diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 6288305ae..0cbc60b2d 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -349,36 +349,6 @@ 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, fakeSettings); - } - else { - RawSwitch item; - - b->clear(); - - item = RawSwitch(SWITCH_TYPE_NONE); - b->addItem(item.toString(), item.toValue()); - if (item == value) b->setCurrentIndex(b->count()-1); - - for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) { - item = RawSwitch(SWITCH_TYPE_SWITCH, i); - b->addItem(item.toString(), item.toValue()); - if (item == value) b->setCurrentIndex(b->count()-1); - } - - for (int i=1; i<=6; i++) { - item = RawSwitch(SWITCH_TYPE_VIRTUAL, i); - b->addItem(item.toString(), item.toValue()); - if (item == value) b->setCurrentIndex(b->count()-1); - } - } -} - void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr) { RawSwitch item; diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 154ff74ea..dd2a5d7ec 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -82,7 +82,6 @@ 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, const GeneralSettings & generalSettings, unsigned long attr=0); void populatePhasesCB(QComboBox *b, int value); diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index ee432f837..dc2f3af65 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -422,6 +422,34 @@ void LogicalSwitchesPanel::populateCSWCB(QComboBox *b, int value) b->setMaxVisibleItems(10); } +void LogicalSwitchesPanel::populateAndSwitchCB(QComboBox *b, const RawSwitch & value) +{ + if (IS_ARM(firmware->getBoard())) { + populateSwitchCB(b, value, generalSettings, POPULATE_ONOFF); + } + else { + RawSwitch item; + + b->clear(); + + item = RawSwitch(SWITCH_TYPE_NONE); + b->addItem(item.toString(), item.toValue()); + if (item == value) b->setCurrentIndex(b->count()-1); + + for (int i=1; i<=firmware->getCapability(SwitchesPositions); i++) { + item = RawSwitch(SWITCH_TYPE_SWITCH, i); + b->addItem(item.toString(), item.toValue()); + if (item == value) b->setCurrentIndex(b->count()-1); + } + + for (int i=1; i<=6; i++) { + item = RawSwitch(SWITCH_TYPE_VIRTUAL, i); + b->addItem(item.toString(), item.toValue()); + if (item == value) b->setCurrentIndex(b->count()-1); + } + } +} + void LogicalSwitchesPanel::updateLine(int i) { lock = true; diff --git a/companion/src/modeledit/logicalswitches.h b/companion/src/modeledit/logicalswitches.h index 768b00f15..af9e3e2f5 100644 --- a/companion/src/modeledit/logicalswitches.h +++ b/companion/src/modeledit/logicalswitches.h @@ -44,6 +44,7 @@ class LogicalSwitchesPanel : public ModelPanel int selectedSwitch; void populateCSWCB(QComboBox *b, int value); + void populateAndSwitchCB(QComboBox *b, const RawSwitch & value); void updateLine(int index); void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0);