From 1bf95c9438c86db097f2ff97945b081288887381 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 2 Apr 2014 10:25:07 +0200 Subject: [PATCH] 36 switches hidden in Companion when no Multipos switches ... --- companion/src/helpers.cpp | 30 ++++++++++++++------- companion/src/helpers.h | 2 +- companion/src/modeledit/channels.cpp | 4 +-- companion/src/modeledit/channels.h | 2 +- companion/src/modeledit/curves.cpp | 4 +-- companion/src/modeledit/curves.h | 2 +- companion/src/modeledit/customfunctions.cpp | 9 +++---- companion/src/modeledit/customfunctions.h | 1 - companion/src/modeledit/expodialog.cpp | 15 ++++++----- companion/src/modeledit/expodialog.h | 3 ++- companion/src/modeledit/flightmodes.cpp | 7 +++-- companion/src/modeledit/flightmodes.h | 1 - companion/src/modeledit/heli.cpp | 4 +-- companion/src/modeledit/heli.h | 2 +- companion/src/modeledit/inputs.cpp | 5 ++-- companion/src/modeledit/inputs.h | 1 - companion/src/modeledit/logicalswitches.cpp | 10 +++---- companion/src/modeledit/logicalswitches.h | 2 +- companion/src/modeledit/mixerdialog.cpp | 15 ++++++----- companion/src/modeledit/mixerdialog.h | 3 ++- companion/src/modeledit/mixes.cpp | 5 ++-- companion/src/modeledit/mixes.h | 1 - companion/src/modeledit/modeledit.cpp | 20 +++++++------- companion/src/modeledit/modelpanel.cpp | 3 ++- companion/src/modeledit/modelpanel.h | 3 ++- companion/src/modeledit/setup.cpp | 20 +++++++------- companion/src/modeledit/setup.h | 6 ++--- companion/src/modeledit/telemetry.cpp | 10 +++---- companion/src/modeledit/telemetry.h | 4 +-- 29 files changed, 101 insertions(+), 93 deletions(-) diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index f5a9af42a..73beefce1 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -361,8 +361,10 @@ void populateBacklightCB(QComboBox *b, const uint8_t value) void populateAndSwitchCB(QComboBox *b, const RawSwitch & value) { + GeneralSettings fakeSettings; + if (IS_ARM(GetEepromInterface()->getBoard())) { - populateSwitchCB(b, value); + populateSwitchCB(b, value, fakeSettings); } else { RawSwitch item; @@ -387,7 +389,7 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value) } } -void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr) +void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr) { RawSwitch item; @@ -417,10 +419,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr) if (item == value) b->setCurrentIndex(b->count()-1); } - for (int i=-GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i<0; i++) { - item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i); - b->addItem(item.toString(), item.toValue()); - if (item == value) b->setCurrentIndex(b->count()-1); + for (int i=GetEepromInterface()->getCapability(MultiposPots)-1; i>=0; i--) { + if (generalSettings.potsType[i] == 2/* TODO constant*/) { + for (int j=-GetEepromInterface()->getCapability(MultiposPotsPositions); j<0; j++) { + item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetEepromInterface()->getCapability(MultiposPotsPositions)+j); + b->addItem(item.toString(), item.toValue()); + if (item == value) b->setCurrentIndex(b->count()-1); + } + } } for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) { @@ -448,10 +454,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr) if (item == value) b->setCurrentIndex(b->count()-1); } - for (int i=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) { - item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i); - b->addItem(item.toString(), item.toValue()); - if (item == value) b->setCurrentIndex(b->count()-1); + for (int i=0; igetCapability(MultiposPots); i++) { + if (generalSettings.potsType[i] == 2/* TODO constant*/) { + for (int j=1; j<=GetEepromInterface()->getCapability(MultiposPotsPositions); j++) { + item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetEepromInterface()->getCapability(MultiposPotsPositions)+j); + b->addItem(item.toString(), item.toValue()); + if (item == value) b->setCurrentIndex(b->count()-1); + } + } } for (int i=1; i<=8; i++) { diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 6d8e61000..d4f655089 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -85,7 +85,7 @@ class CurveGroup : public QObject { #define POPULATE_ONOFF 0x01 #define POPULATE_TIMER_MODES 0x02 void populateAndSwitchCB(QComboBox *b, const RawSwitch & value); -void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0); +void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0); void populatePhasesCB(QComboBox *b, int value); void populateGvarUseCB(QComboBox *b, unsigned int phase); diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index 119c320ae..debdfae4a 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -6,8 +6,8 @@ #include #include -Channels::Channels(QWidget * parent, ModelData & model): - ModelPanel(parent, model) +Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings) { QGridLayout * gridLayout = new QGridLayout(this); bool minimize = false; diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h index 1d44db8bd..9fa8a01d9 100644 --- a/companion/src/modeledit/channels.h +++ b/companion/src/modeledit/channels.h @@ -8,7 +8,7 @@ class Channels : public ModelPanel Q_OBJECT public: - Channels(QWidget *parent, ModelData & model); + Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); ~Channels(); private slots: diff --git a/companion/src/modeledit/curves.cpp b/companion/src/modeledit/curves.cpp index 34d1d5d93..a24e30fa8 100644 --- a/companion/src/modeledit/curves.cpp +++ b/companion/src/modeledit/curves.cpp @@ -130,8 +130,8 @@ float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax #endif #endif -Curves::Curves(QWidget * parent, ModelData & model): - ModelPanel(parent, model), +Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), ui(new Ui::Curves), currentCurve(0) { diff --git a/companion/src/modeledit/curves.h b/companion/src/modeledit/curves.h index 69e0bd0f8..9cabed576 100644 --- a/companion/src/modeledit/curves.h +++ b/companion/src/modeledit/curves.h @@ -21,7 +21,7 @@ class Curves : public ModelPanel Q_OBJECT public: - Curves(QWidget *parent, ModelData & model); + Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); virtual ~Curves(); virtual void update(); diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 444006b92..833582f0e 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -48,8 +48,7 @@ void RepeatComboBox::update() } CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): - ModelPanel(parent, model), - generalSettings(generalSettings), + ModelPanel(parent, model, generalSettings), initialized(false), phononCurrent(-1), clickObject(NULL), @@ -476,7 +475,7 @@ void CustomFunctionsPanel::update() lock = true; for (int i=0; igetCapability(CustomFunctions); i++) { if (!initialized) { - populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF); + populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF); populateFuncCB(fswtchFunc[i], model.funcSw[i].func); populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode); populateFuncParamCB(fswtchParamT[i], model, model.funcSw[i].func, model.funcSw[i].param, model.funcSw[i].adjustMode); @@ -497,7 +496,7 @@ void CustomFunctionsPanel::fswPaste() FuncSwData *fsw = &model.funcSw[selectedFunction]; memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData)); lock = true; - populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF); + populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF); populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func); refreshCustomFunction(selectedFunction); lock = false; @@ -510,7 +509,7 @@ void CustomFunctionsPanel::fswDelete() model.funcSw[selectedFunction].clear(); // TODO update switch and func lock = true; - populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF); + populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF); populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func); refreshCustomFunction(selectedFunction); lock = false; diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index 7d71526a0..6b908a2a7 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -61,7 +61,6 @@ class CustomFunctionsPanel : public ModelPanel void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0); void populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList); - GeneralSettings & generalSettings; bool initialized; QStringList paramarmList; int phononCurrent; diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp index 0bf6e7965..ba54c7997 100644 --- a/companion/src/modeledit/expodialog.cpp +++ b/companion/src/modeledit/expodialog.cpp @@ -2,12 +2,13 @@ #include "ui_expodialog.h" #include "helpers.h" -ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode, char * inputName) : - QDialog(parent), - ui(new Ui::ExpoDialog), - model(model), - ed(expoData), - inputName(inputName) +ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings, char * inputName) : + QDialog(parent), + ui(new Ui::ExpoDialog), + model(model), + generalSettings(generalSettings), + ed(expoData), + inputName(inputName) { ui->setupUi(this); QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 }; @@ -23,7 +24,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve); - populateSwitchCB(ui->switchesCB,ed->swtch); + populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings); ui->sideCB->setCurrentIndex(ed->mode-1); diff --git a/companion/src/modeledit/expodialog.h b/companion/src/modeledit/expodialog.h index ddb3d750c..c052afe00 100644 --- a/companion/src/modeledit/expodialog.h +++ b/companion/src/modeledit/expodialog.h @@ -14,7 +14,7 @@ namespace Ui { class ExpoDialog : public QDialog { Q_OBJECT public: - ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode, char * inputName); + ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings, char * inputName); ~ExpoDialog(); protected: @@ -27,6 +27,7 @@ class ExpoDialog : public QDialog { private: Ui::ExpoDialog * ui; ModelData & model; + GeneralSettings & generalSettings; ExpoData * ed; char * inputName; GVarGroup * gvGroup; diff --git a/companion/src/modeledit/flightmodes.cpp b/companion/src/modeledit/flightmodes.cpp index dffb391aa..116755403 100644 --- a/companion/src/modeledit/flightmodes.cpp +++ b/companion/src/modeledit/flightmodes.cpp @@ -6,9 +6,8 @@ #include FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings): - ModelPanel(parent, model), + ModelPanel(parent, model, generalSettings), ui(new Ui::FlightMode), - generalSettings(generalSettings), phaseIdx(phaseIdx), phase(model.phaseData[phaseIdx]), reCount(GetEepromInterface()->getCapability(RotaryEncoders)), @@ -32,7 +31,7 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera // Phase switch if (phaseIdx > 0) { - populateSwitchCB(ui->swtch, phase.swtch); + populateSwitchCB(ui->swtch, phase.swtch, generalSettings); connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int))); } else { @@ -401,7 +400,7 @@ void FlightMode::phaseTrimSlider_valueChanged() /**********************************************************/ FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): - ModelPanel(parent, model), + ModelPanel(parent, model, generalSettings), modesCount(GetEepromInterface()->getCapability(FlightPhases)) { QGridLayout * gridLayout = new QGridLayout(this); diff --git a/companion/src/modeledit/flightmodes.h b/companion/src/modeledit/flightmodes.h index 0a09f279b..dddcc26c1 100644 --- a/companion/src/modeledit/flightmodes.h +++ b/companion/src/modeledit/flightmodes.h @@ -42,7 +42,6 @@ class FlightMode : public ModelPanel private: Ui::FlightMode *ui; - GeneralSettings & generalSettings; int phaseIdx; PhaseData & phase; int reCount; diff --git a/companion/src/modeledit/heli.cpp b/companion/src/modeledit/heli.cpp index a6a97a1b9..05a39e28b 100644 --- a/companion/src/modeledit/heli.cpp +++ b/companion/src/modeledit/heli.cpp @@ -2,8 +2,8 @@ #include "ui_heli.h" #include "helpers.h" -HeliPanel::HeliPanel(QWidget *parent, ModelData & model): - ModelPanel(parent, model), +HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), ui(new Ui::Heli) { ui->setupUi(this); diff --git a/companion/src/modeledit/heli.h b/companion/src/modeledit/heli.h index 7b5e3a73d..52a855797 100644 --- a/companion/src/modeledit/heli.h +++ b/companion/src/modeledit/heli.h @@ -12,7 +12,7 @@ class HeliPanel : public ModelPanel Q_OBJECT public: - HeliPanel(QWidget *parent, ModelData & model); + HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); ~HeliPanel(); void update(); diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index e828c52cc..3ecb63e9f 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -4,8 +4,7 @@ #include "helpers.h" InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings): - ModelPanel(parent, model), - generalSettings(generalSettings), + ModelPanel(parent, model, generalSettings), expoInserted(false) { QGridLayout * exposLayout = new QGridLayout(this); @@ -175,7 +174,7 @@ void InputsPanel::gm_openExpo(int index) if (GetEepromInterface()->getCapability(VirtualInputs)) strcpy(inputName, model.inputNames[mixd.chn]); - ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode, inputName); + ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, inputName); if (g->exec()) { model.expoData[index] = mixd; if (GetEepromInterface()->getCapability(VirtualInputs)) diff --git a/companion/src/modeledit/inputs.h b/companion/src/modeledit/inputs.h index 4164caac9..44b99dd71 100644 --- a/companion/src/modeledit/inputs.h +++ b/companion/src/modeledit/inputs.h @@ -31,7 +31,6 @@ class InputsPanel : public ModelPanel void expoAdd(); private: - GeneralSettings & generalSettings; bool expoInserted; MixersList *ExposlistWidget; diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index 5ccb5ba21..b338183f5 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -7,8 +7,8 @@ #include #include "helpers.h" -LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model): - ModelPanel(parent, model), +LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), selectedSwitch(0) { QGridLayout * gridLayout = new QGridLayout(this); @@ -303,12 +303,12 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i) case LS_FAMILY_VBOOL: case LS_FAMILY_STICKY: mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE; - populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1)); - populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2)); + populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings); + populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings); break; case LS_FAMILY_STAY: mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE; - populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1)); + populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings); updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true); updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true); break; diff --git a/companion/src/modeledit/logicalswitches.h b/companion/src/modeledit/logicalswitches.h index d563f1308..0055af8e3 100644 --- a/companion/src/modeledit/logicalswitches.h +++ b/companion/src/modeledit/logicalswitches.h @@ -10,7 +10,7 @@ class LogicalSwitchesPanel : public ModelPanel Q_OBJECT public: - LogicalSwitchesPanel(QWidget *parent, ModelData & model); + LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); virtual ~LogicalSwitchesPanel(); virtual void update(); diff --git a/companion/src/modeledit/mixerdialog.cpp b/companion/src/modeledit/mixerdialog.cpp index a2e2757af..e9301c876 100644 --- a/companion/src/modeledit/mixerdialog.cpp +++ b/companion/src/modeledit/mixerdialog.cpp @@ -3,12 +3,13 @@ #include "eeprominterface.h" #include "helpers.h" -MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode) : - QDialog(parent), - ui(new Ui::MixerDialog), - model(model), - md(mixdata), - lock(false) +MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings) : + QDialog(parent), + ui(new Ui::MixerDialog), + model(model), + generalSettings(generalSettings), + md(mixdata), + lock(false) { ui->setupUi(this); QRegExp rx(CHAR_FOR_NAMES_REGEX); @@ -76,7 +77,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i } } - populateSwitchCB(ui->switchesCB,md->swtch); + populateSwitchCB(ui->switchesCB, md->swtch, generalSettings); ui->warningCB->setCurrentIndex(md->mixWarn); ui->mltpxCB->setCurrentIndex(md->mltpx); int scale=GetEepromInterface()->getCapability(SlowScale); diff --git a/companion/src/modeledit/mixerdialog.h b/companion/src/modeledit/mixerdialog.h index 437d9ca21..a97081352 100644 --- a/companion/src/modeledit/mixerdialog.h +++ b/companion/src/modeledit/mixerdialog.h @@ -14,7 +14,7 @@ namespace Ui { class MixerDialog : public QDialog { Q_OBJECT public: - MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode); + MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings); ~MixerDialog(); protected: @@ -27,6 +27,7 @@ class MixerDialog : public QDialog { private: Ui::MixerDialog *ui; ModelData & model; + GeneralSettings & generalSettings; MixData *md; bool lock; GVarGroup * gvWeightGroup; diff --git a/companion/src/modeledit/mixes.cpp b/companion/src/modeledit/mixes.cpp index 2f1e48ab5..2979ee72a 100644 --- a/companion/src/modeledit/mixes.cpp +++ b/companion/src/modeledit/mixes.cpp @@ -4,8 +4,7 @@ // #include "expodialog.h" MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings): - ModelPanel(parent, model), - generalSettings(generalSettings), + ModelPanel(parent, model, generalSettings), mixInserted(false) { QGridLayout * mixesLayout = new QGridLayout(this); @@ -193,7 +192,7 @@ void MixesPanel::gm_openMix(int index) emit modified(); update(); - MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings.stickMode); + MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings); if(g->exec()) { model.mixData[index] = mixd; emit modified(); diff --git a/companion/src/modeledit/mixes.h b/companion/src/modeledit/mixes.h index 1fbbe9da7..72bb0e0d5 100644 --- a/companion/src/modeledit/mixes.h +++ b/companion/src/modeledit/mixes.h @@ -38,7 +38,6 @@ class MixesPanel : public ModelPanel void mixesEdited(); private: - GeneralSettings & generalSettings; MixersList *MixerlistWidget; bool mixInserted; diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index bb035c4f9..ef7911c41 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -25,18 +25,18 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i setWindowIcon(CompanionIcon("edit.png")); restoreGeometry(g.modelEditGeo()); ui->pushButton->setIcon(CompanionIcon("simulate.png")); - addTab(new Setup(this, model), tr("Setup")); - addTab(new HeliPanel(this, model), tr("Heli")); - addTab(new FlightModes(this, model, radioData.generalSettings), tr("Flight Modes")); - addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs")); - addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes")); - addTab(new Channels(this, model), tr("Channels")); - addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches")); + addTab(new Setup(this, model, generalSettings), tr("Setup")); + addTab(new HeliPanel(this, model, generalSettings), tr("Heli")); + addTab(new FlightModes(this, model, generalSettings), tr("Flight Modes")); + addTab(new InputsPanel(this, model, generalSettings), tr("Inputs")); + addTab(new MixesPanel(this, model, generalSettings), tr("Mixes")); + addTab(new Channels(this, model, generalSettings), tr("Channels")); + addTab(new LogicalSwitchesPanel(this, model, generalSettings), tr("Logical Switches")); if (GetEepromInterface()->getCapability(CustomFunctions)) - addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Special Functions")); - addTab(new Curves(this, model), tr("Curves")); + addTab(new CustomFunctionsPanel(this, model, generalSettings), tr("Special Functions")); + addTab(new Curves(this, model, generalSettings), tr("Curves")); if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY) - addTab(new TelemetryPanel(this, model), tr("Telemetry")); + addTab(new TelemetryPanel(this, model, generalSettings), tr("Telemetry")); } ModelEdit::~ModelEdit() diff --git a/companion/src/modeledit/modelpanel.cpp b/companion/src/modeledit/modelpanel.cpp index ed4424773..ea3aafde4 100644 --- a/companion/src/modeledit/modelpanel.cpp +++ b/companion/src/modeledit/modelpanel.cpp @@ -1,9 +1,10 @@ #include "modelpanel.h" #include -ModelPanel::ModelPanel(QWidget * parent, ModelData & model): +ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings): QWidget(parent), model(model), + generalSettings(generalSettings), lock(false) { } diff --git a/companion/src/modeledit/modelpanel.h b/companion/src/modeledit/modelpanel.h index ebe4f73a0..81d2113cd 100644 --- a/companion/src/modeledit/modelpanel.h +++ b/companion/src/modeledit/modelpanel.h @@ -10,7 +10,7 @@ class ModelPanel : public QWidget Q_OBJECT public: - ModelPanel(QWidget *parent, ModelData & model); + ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); virtual ~ModelPanel(); signals: @@ -21,6 +21,7 @@ class ModelPanel : public QWidget protected: ModelData & model; + GeneralSettings & generalSettings; bool lock; void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false); void addEmptyLabel(QGridLayout * gridLayout, int col); diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 8c1f6b671..dbde9a22c 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -5,8 +5,8 @@ #include "helpers.h" #include "appdata.h" -TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer): - ModelPanel(parent, model), +TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), timer(timer), ui(new Ui::Timer) { @@ -15,7 +15,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer): lock = true; // Mode - populateSwitchCB(ui->mode, timer.mode, POPULATE_TIMER_MODES); + populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES); if (!GetEepromInterface()->getCapability(PermTimers)) { ui->persistent->hide(); @@ -94,8 +94,8 @@ void TimerPanel::on_minuteBeep_toggled(bool checked) /******************************************************************************/ -ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, int moduleIdx): - ModelPanel(parent, model), +ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, int moduleIdx): + ModelPanel(parent, model, generalSettings), module(module), moduleIdx(moduleIdx), ui(new Ui::Module) @@ -320,8 +320,8 @@ void ModulePanel::onFailsafeSpinChanged(double value) /******************************************************************************/ -Setup::Setup(QWidget *parent, ModelData & model): - ModelPanel(parent, model), +Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), ui(new Ui::Setup) { lock = true; @@ -333,19 +333,19 @@ Setup::Setup(QWidget *parent, ModelData & model): ui->name->setMaxLength(IS_TARANIS(GetEepromInterface()->getBoard()) ? 12 : 10); for (int i=0; igridLayout->addWidget(timers[i], 1+i, 1); connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified())); } for (int i=0; igetCapability(NumModules); i++) { - modules[i] = new ModulePanel(this, model, model.moduleData[i], i); + modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, i); ui->modulesLayout->addWidget(modules[i]); connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified())); } if (GetEepromInterface()->getCapability(ModelTrainerEnable)) { - modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], -1); + modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, -1); ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]); } diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 6880c363f..7ab38999f 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -20,7 +20,7 @@ class TimerPanel : public ModelPanel Q_OBJECT public: - TimerPanel(QWidget *parent, ModelData & model, TimerData & timer); + TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings); virtual ~TimerPanel(); virtual void update(); @@ -42,7 +42,7 @@ class ModulePanel : public ModelPanel Q_OBJECT public: - ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, int moduleIdx); + ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, int moduleIdx); virtual ~ModulePanel(); virtual void update(); @@ -71,7 +71,7 @@ class Setup : public ModelPanel Q_OBJECT public: - Setup(QWidget *parent, ModelData & model); + Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); virtual ~Setup(); virtual void update(); diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index e768ae64c..cde96a6b3 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -280,8 +280,8 @@ TelemetryAnalog::~TelemetryAnalog() /******************************************************/ -TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen): - ModelPanel(parent, model), +TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), ui(new Ui::TelemetryCustomScreen), screen(screen) { @@ -465,8 +465,8 @@ void TelemetryCustomScreen::barMaxChanged(double value) /******************************************************/ -TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model): - ModelPanel(parent, model), +TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings): + ModelPanel(parent, model, generalSettings), ui(new Ui::Telemetry) { ui->setupUi(this); @@ -484,7 +484,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model): connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified())); for (int i=0; igetCapability(TelemetryCustomScreens); i++) { - TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i]); + TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings); ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1)); } diff --git a/companion/src/modeledit/telemetry.h b/companion/src/modeledit/telemetry.h index 3f44f3261..c0d29997d 100644 --- a/companion/src/modeledit/telemetry.h +++ b/companion/src/modeledit/telemetry.h @@ -50,7 +50,7 @@ class TelemetryCustomScreen : public ModelPanel Q_OBJECT public: - TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen); + TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings); ~TelemetryCustomScreen(); void update(); @@ -79,7 +79,7 @@ class TelemetryPanel : public ModelPanel Q_OBJECT public: - TelemetryPanel(QWidget *parent, ModelData & model); + TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings); virtual ~TelemetryPanel(); signals: