mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Merged in f5soh/librepilot/laurent/LP-179_Highlight_stabilization_modes (pull request #116)
LP-179 Highlight stabilized mode used
This commit is contained in:
commit
39d7f932d7
@ -1645,6 +1645,46 @@ void ConfigInputWidget::moveFMSlider()
|
||||
pos = manualSettingsDataPriv.FlightModeNumber - 1;
|
||||
}
|
||||
ui->fmsSlider->setValue(pos);
|
||||
highlightStabilizationMode(pos);
|
||||
}
|
||||
|
||||
void ConfigInputWidget::highlightStabilizationMode(int pos)
|
||||
{
|
||||
QComboBox *comboboxFm = this->findChild<QComboBox *>("fmsModePos" + QString::number(pos + 1));
|
||||
QString customStyleSheet = "QComboBox:editable:!on{background: #feb103;}";
|
||||
|
||||
if (comboboxFm) {
|
||||
QString flightModeText = comboboxFm->currentText();
|
||||
comboboxFm->setStyleSheet("");
|
||||
for (uint8_t i = 0; i < FlightModeSettings::FLIGHTMODEPOSITION_NUMELEM; i++) {
|
||||
QLabel *label = this->findChild<QLabel *>("stab" + QString::number(i + 1) + "_label");
|
||||
QComboBox *comboRoll = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Roll");
|
||||
QComboBox *comboPitch = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Pitch");
|
||||
QComboBox *comboYaw = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Yaw");
|
||||
QComboBox *comboThrust = this->findChild<QComboBox *>("fmsSsPos" + QString::number(i + 1) + "Thrust");
|
||||
QComboBox *comboboxFm2 = this->findChild<QComboBox *>("fmsModePos" + QString::number(i + 1));
|
||||
comboboxFm2->setStyleSheet("");
|
||||
|
||||
// Highlight current stabilization mode if any.
|
||||
if ((flightModeText.contains("Stabilized", Qt::CaseInsensitive)) && (flightModeText.contains(QString::number(i + 1), Qt::CaseInsensitive))) {
|
||||
label->setStyleSheet("border-radius: 4px; border:3px solid #feb103;");
|
||||
comboRoll->setStyleSheet(customStyleSheet);
|
||||
comboPitch->setStyleSheet(customStyleSheet);
|
||||
comboYaw->setStyleSheet(customStyleSheet);
|
||||
comboThrust->setStyleSheet(customStyleSheet);
|
||||
} else {
|
||||
label->setStyleSheet("");
|
||||
comboRoll->setStyleSheet("");
|
||||
comboPitch->setStyleSheet("");
|
||||
comboYaw->setStyleSheet("");
|
||||
comboThrust->setStyleSheet("");
|
||||
if (!flightModeText.contains("Stabilized", Qt::CaseInsensitive)) {
|
||||
// Highlight PosHold, Return to Base, ... flightmodes
|
||||
comboboxFm->setStyleSheet(customStyleSheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigInputWidget::updatePositionSlider()
|
||||
|
@ -202,6 +202,8 @@ private:
|
||||
AccessoryDesired *getAccessoryDesiredInstance(int instance);
|
||||
float getAccessoryDesiredValue(int instance);
|
||||
|
||||
void highlightStabilizationMode(int pos);
|
||||
|
||||
private slots:
|
||||
void wzNext();
|
||||
void wzNextDelayed();
|
||||
|
@ -752,62 +752,62 @@ font:bold;</string>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<widget class="QLabel" name="stab1_label">
|
||||
<property name="text">
|
||||
<string>Stabilized 1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<widget class="QLabel" name="stab2_label">
|
||||
<property name="text">
|
||||
<string>Stabilized 2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<widget class="QLabel" name="stab3_label">
|
||||
<property name="text">
|
||||
<string>Stabilized 3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_114">
|
||||
<widget class="QLabel" name="stab4_label">
|
||||
<property name="text">
|
||||
<string>Stabilized 4</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_121">
|
||||
<widget class="QLabel" name="stab5_label">
|
||||
<property name="text">
|
||||
<string>Stabilized 5</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_122">
|
||||
<widget class="QLabel" name="stab6_label">
|
||||
<property name="text">
|
||||
<string>Stabilized 6</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user