1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-22 15:55:26 +03:00
This commit is contained in:
bsongis 2014-06-20 14:35:03 +02:00
parent 9e1afe8cb0
commit 8d42380abb
4 changed files with 29 additions and 31 deletions

View file

@ -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) void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
{ {
RawSwitch item; RawSwitch item;

View file

@ -82,7 +82,6 @@ class CurveGroup : public QObject {
#define POPULATE_ONOFF 0x01 #define POPULATE_ONOFF 0x01
#define POPULATE_TIMER_MODES 0x02 #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 populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
void populatePhasesCB(QComboBox *b, int value); void populatePhasesCB(QComboBox *b, int value);

View file

@ -422,6 +422,34 @@ void LogicalSwitchesPanel::populateCSWCB(QComboBox *b, int value)
b->setMaxVisibleItems(10); 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) void LogicalSwitchesPanel::updateLine(int i)
{ {
lock = true; lock = true;

View file

@ -44,6 +44,7 @@ class LogicalSwitchesPanel : public ModelPanel
int selectedSwitch; int selectedSwitch;
void populateCSWCB(QComboBox *b, int value); void populateCSWCB(QComboBox *b, int value);
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
void updateLine(int index); void updateLine(int index);
void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0); void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0);