feat(color): Quick Model Select, keep active model in view when changing labels (#2895)
* Fix rebase merge issue. * Incorporate solution from @ParkerEde in PR #2626 * Fix selection logic for models. * Select model on first press. * Fix quick model selection when using scroll wheel & enter button. Add setting to enable quick model selection. * German translation. * Fix behaviour when 'model quick select' is off to work like existing 2.8 logic. * Add translations. * Prioritise active model as selected model when the set of visible models changes. * Fix selection ordering when using scroll wheel. Minor code cleanup.
This commit is contained in:
@@ -213,6 +213,9 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
|
||||
node["varioRange"] = rhs.varioRange * 15;
|
||||
node["varioRepeat"] = rhs.varioRepeat;
|
||||
node["backgroundVolume"] = rhs.backgroundVolume + 2;
|
||||
if (Boards::getCapability(getCurrentFirmware()->getBoard(), Board::HasColorLcd)) {
|
||||
node["modelQuickSelect"] = (int)rhs.modelQuickSelect;
|
||||
}
|
||||
|
||||
Node serialPort;
|
||||
for (int i = 0; i < GeneralSettings::SP_COUNT; i++) {
|
||||
@@ -408,6 +411,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
||||
node["varioRange"] >> ifactor<int>(rhs.varioRange, 15);
|
||||
node["varioRepeat"] >> rhs.varioRepeat;
|
||||
node["backgroundVolume"] >> ioffset_int(rhs.backgroundVolume, 2);
|
||||
node["modelQuickSelect"] >> rhs.modelQuickSelect;
|
||||
|
||||
// depreciated v2.7 replaced by serialPort
|
||||
if (node["auxSerialMode"]) {
|
||||
|
||||
@@ -255,6 +255,7 @@ class GeneralSettings {
|
||||
bool serialPower[SP_COUNT];
|
||||
int antennaMode;
|
||||
unsigned int backlightColor;
|
||||
bool modelQuickSelect;
|
||||
CustomFunctionData customFn[CPN_MAX_SPECIAL_FUNCTIONS];
|
||||
char switchName[CPN_MAX_SWITCHES][HARDWARE_NAME_LEN + 1];
|
||||
unsigned int switchConfig[CPN_MAX_SWITCHES];
|
||||
|
||||
@@ -471,6 +471,13 @@ void GeneralSetupPanel::setValues()
|
||||
ui->pwrOffDelay->setValue(2 - generalSettings.pwrOffSpeed);
|
||||
|
||||
ui->registrationId->setText(generalSettings.registrationId);
|
||||
|
||||
if (Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) {
|
||||
ui->modelQuickSelect_CB->setChecked(generalSettings.modelQuickSelect);
|
||||
} else {
|
||||
ui->label_modelQuickSelect->hide();
|
||||
ui->modelQuickSelect_CB->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_faimode_CB_stateChanged(int)
|
||||
@@ -799,3 +806,9 @@ void GeneralSetupPanel::stickReverseEdited()
|
||||
generalSettings.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_modelQuickSelect_CB_stateChanged(int)
|
||||
{
|
||||
generalSettings.modelQuickSelect = ui->modelQuickSelect_CB->isChecked();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
void on_pwrOnDelay_valueChanged(int);
|
||||
void on_pwrOffDelay_valueChanged(int);
|
||||
|
||||
void on_modelQuickSelect_CB_stateChanged(int);
|
||||
|
||||
private:
|
||||
Ui::GeneralSetup *ui;
|
||||
|
||||
|
||||
@@ -807,7 +807,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<item row="23" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -1152,6 +1152,23 @@ p, li { white-space: pre-wrap; }
|
||||
<item row="21" column="1">
|
||||
<widget class="QComboBox" name="rotEncMode_CB"/>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<widget class="QLabel" name="label_modelQuickSelect">
|
||||
<property name="text">
|
||||
<string>Model quick select</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="1">
|
||||
<widget class="QCheckBox" name="modelQuickSelect_CB">
|
||||
<property name="toolTip">
|
||||
<string>Enable this to quickly change model on the model select page (a long press can then be used to open the model edit menu).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
|
||||
Reference in New Issue
Block a user