feat: simple global control for backlight/brightness and volume (#6684)

This commit is contained in:
philmoz
2026-01-04 17:56:50 +10:00
committed by GitHub
parent 586a567b0b
commit e80406b274
71 changed files with 812 additions and 374 deletions
+22 -3
View File
@@ -365,6 +365,10 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
addParams();
}
connect(this, &HardwarePanel::inputFlexTypeChanged, [=](AutoComboBox *cb, int index)
{ setFlexTypeModel(cb, index); }
);
connect(this, &HardwarePanel::refreshItemModels, [=]() { updateItemModels(); });
addVSpring(grid, 0, grid->rowCount());
addHSpring(grid, grid->columnCount(), 0);
disableMouseScrolling();
@@ -446,6 +450,7 @@ void HardwarePanel::addFlex(int index)
name->setValidator(new NameValidator(board, this));
name->setField(config.name, HARDWARE_NAME_LEN, this);
params->append(name);
connect(name, &AutoLineEdit::editingFinished, [=] () { emit refreshItemModels(); });
AutoComboBox *type = new AutoComboBox(this);
setFlexTypeModel(type, index);
@@ -465,11 +470,10 @@ void HardwarePanel::addFlex(int index)
} else {
invertToggles[index - Boards::getCapability(board, Board::Sticks)]->show();
}
emit InputFlexTypeChanged();
emit inputFlexTypeChanged(type, index);
emit refreshItemModels();
});
connect(this, &HardwarePanel::InputFlexTypeChanged, [=]() { setFlexTypeModel(type, index); });
params->append(type);
AutoCheckBox *inverted = new AutoCheckBox(this);
@@ -508,6 +512,7 @@ void HardwarePanel::addSwitch(int index)
name->setValidator(new NameValidator(board, this));
name->setField(config.name, HARDWARE_NAME_LEN, this);
params->append(name);
connect(name, &AutoLineEdit::editingFinished, [=] () { emit refreshItemModels(); });
AutoComboBox *input = nullptr;
@@ -538,6 +543,12 @@ void HardwarePanel::addSwitch(int index)
type->setField(config.type, this);
params->append(type);
if (!generalSettings.isSwitchFunc(index)) {
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
emit refreshItemModels();
});
}
if (generalSettings.isSwitchFlex(index)) {
connect(input, &AutoComboBox::currentDataChanged, [=] (int val) {
if (val < 0) {
@@ -547,6 +558,8 @@ void HardwarePanel::addSwitch(int index)
}
else
type->setModel(tabFilteredModels->getItemModel(FIM_SWITCHTYPE3POS));
emit refreshItemModels();
});
}
@@ -562,6 +575,7 @@ void HardwarePanel::addSwitch(int index)
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
start->setEnabled(val == Board::SWITCH_2POS);
emit refreshItemModels();
});
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
@@ -677,3 +691,8 @@ void HardwarePanel::updateSerialPortUSBVCP()
view->setRowHidden(i, false);
}
}
void HardwarePanel::updateItemModels()
{
editorItemModels->update(AbstractItemModel::IMUE_Hardware);
}