mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-31 16:52:10 +01:00
LP-179 Highlight stabilized mode used
This commit is contained in:
parent
0fe3b971b8
commit
990e7eb3c9
@ -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 = "border-radius: 4px; border:3px solid #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("QLabel {" + customStyleSheet + "}");
|
||||
comboRoll->setStyleSheet("QComboBox {" + customStyleSheet + "}");
|
||||
comboPitch->setStyleSheet("QComboBox {" + customStyleSheet + "}");
|
||||
comboYaw->setStyleSheet("QComboBox {" + customStyleSheet + "}");
|
||||
comboThrust->setStyleSheet("QComboBox {" + 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("QComboBox {" + 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…
x
Reference in New Issue
Block a user