[Companion] Show custom control names throughout the UI (& internal refactoring) (#4693)
* [Companion] Introduce new Boards class to further consolidate hardware metadata and remove some globals.
* [Companion] * RawSource::toString() and RawSwitch::toString() can now return custom hardware names (if given a GeneralSettings object) for the following types (respectively):
SOURCE_TYPE_STICK, SOURCE_TYPE_SWITCH, SWITCH_TYPE_SWITCH, & SWITCH_TYPE_MULTIPOS_POT;
* RawSource::isPot() and isSlider() can now return their own index position in potConfig[]/sliderConfig[];
* Switch indicator strings can be localized if necessary.
* [Companion] Refactor model printers to use new RawSource/RawSwitch capabilities; Simplify model-to-printer mapping scheme in multimodelprinter; Use const ModelData pointer.
* [Companion] Refactor how RawSource and RawSwitch selection combo boxes are populated, using cache-able data models instead of direct manipulation; Refactor some other Helpers function into their own namespace.
* Cosmetics & forgotten qualifier.
This commit is contained in:
committed by
Bertrand Songis
parent
627347a48c
commit
f5ab145d2f
@@ -50,7 +50,8 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
|
||||
// Phase switch
|
||||
if (phaseIdx > 0) {
|
||||
populateSwitchCB(ui->swtch, phase.swtch, generalSettings, MixesContext);
|
||||
ui->swtch->setModel(Helpers::getRawSwitchItemModel(&generalSettings, Helpers::MixesContext));
|
||||
ui->swtch->setCurrentIndex(ui->swtch->findData(phase.swtch.toValue()));
|
||||
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
|
||||
}
|
||||
else {
|
||||
@@ -74,7 +75,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
ui->fadeIn->setDisabled(true);
|
||||
ui->fadeOut->setDisabled(true);
|
||||
}
|
||||
|
||||
|
||||
// The trims
|
||||
QString labels[CPN_MAX_STICKS];
|
||||
for(int i=0; i < CPN_MAX_STICKS; i++) {
|
||||
@@ -129,7 +130,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
// RE link to another RE
|
||||
reUse[i] = new QComboBox(ui->reGB);
|
||||
reUse[i]->setProperty("index", i);
|
||||
populateGvarUseCB(reUse[i], phaseIdx);
|
||||
Helpers::populateGvarUseCB(reUse[i], phaseIdx);
|
||||
if (phase.rotaryEncoders[i] > 1024) {
|
||||
reUse[i]->setCurrentIndex(phase.rotaryEncoders[i] - 1024);
|
||||
}
|
||||
@@ -171,7 +172,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
// GVar link to another GVar
|
||||
gvUse[i] = new QComboBox(ui->gvGB);
|
||||
gvUse[i]->setProperty("index", i);
|
||||
populateGvarUseCB(gvUse[i], phaseIdx);
|
||||
Helpers::populateGvarUseCB(gvUse[i], phaseIdx);
|
||||
if (phase.gvars[i] > 1024) {
|
||||
gvUse[i]->setCurrentIndex(phase.gvars[i] - 1024);
|
||||
}
|
||||
@@ -185,7 +186,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
gvValues[i]->setMinimum(-1024);
|
||||
gvValues[i]->setMaximum(1024);
|
||||
gvLayout->addWidget(gvValues[i], i, col++, 1, 1);
|
||||
|
||||
|
||||
// Popups
|
||||
if (IS_TARANIS(board) && phaseIdx == 0) {
|
||||
gvPopups[i] = new QCheckBox(ui->gvGB);
|
||||
@@ -219,9 +220,9 @@ void FlightModePanel::update()
|
||||
ui->fadeOut->setValue(float(phase.fadeOut)/scale);
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
int trimsMax = firmware->getCapability(ExtendedTrims);
|
||||
int trimsMax = firmware->getCapability(ExtendedTrimsRange);
|
||||
if (trimsMax == 0 || !model->extendedTrims) {
|
||||
trimsMax = 125;
|
||||
trimsMax = firmware->getCapability(TrimsRange);
|
||||
}
|
||||
trimsSlider[i]->setRange(-trimsMax, +trimsMax);
|
||||
trimsValue[i]->setRange(-trimsMax, +trimsMax);
|
||||
@@ -244,7 +245,7 @@ void FlightModePanel::update()
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<reCount; i++) {
|
||||
for (int i=0; i<reCount; i++) {
|
||||
reValues[i]->setDisabled(false);
|
||||
int idx = phase.rotaryEncoders[i];
|
||||
FlightModeData *phasere = &phase;
|
||||
|
||||
Reference in New Issue
Block a user