This commit is contained in:
bsongis
2014-11-21 00:01:03 +01:00
parent b492d43f73
commit 59d72f93ce
16 changed files with 161 additions and 141 deletions
+15 -11
View File
@@ -370,7 +370,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
b->clear();
if (context != MixesContext) {
if (context != MixesContext && context != GlobalFunctionsContext) {
// !FMx
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
@@ -381,10 +381,12 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
}
}
for (int i=-GetCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
if (context != GlobalFunctionsContext) {
for (int i=-GetCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
for (int i=-GetCurrentFirmware()->getCapability(RotaryEncoders); i<0; i++) {
@@ -460,13 +462,15 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=1; i<=GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
if (context != GlobalFunctionsContext) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
if (context == CustomFunctionsContext) {
if (context == SpecialFunctionsContext || context == GlobalFunctionsContext) {
// ON
item = RawSwitch(SWITCH_TYPE_ON);
b->addItem(item.toString(), item.toValue());
@@ -478,7 +482,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
}
// FMx
if (context != MixesContext) {
if (context != MixesContext && context != GlobalFunctionsContext) {
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
+2 -1
View File
@@ -88,7 +88,8 @@ class CurveGroup : public QObject {
enum SwitchContext
{
LogicalSwitchesContext,
CustomFunctionsContext,
SpecialFunctionsContext,
GlobalFunctionsContext,
TimersContext,
MixesContext
};
+7 -4
View File
@@ -110,7 +110,10 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
label->setProperty("index", i);
label->setText(tr("SF%1").arg(i+1));
if (model)
label->setText(tr("SF%1").arg(i+1));
else
label->setText(tr("GF%1").arg(i+1));
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0);
@@ -524,7 +527,7 @@ void CustomFunctionsPanel::update()
lock = true;
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
if (!initialized) {
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, CustomFunctionsContext);
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
populateFuncCB(fswtchFunc[i], functions[i].func);
populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
@@ -545,7 +548,7 @@ void CustomFunctionsPanel::fswPaste()
CustomFunctionData *fsw = &functions[selectedFunction];
memcpy(fsw, fswData.mid(0, sizeof(CustomFunctionData)).constData(), sizeof(CustomFunctionData));
lock = true;
populateSwitchCB(fswtchSwtch[selectedFunction], functions[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
populateSwitchCB(fswtchSwtch[selectedFunction], functions[selectedFunction].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
populateFuncCB(fswtchFunc[selectedFunction], functions[selectedFunction].func);
populateGVmodeCB(fswtchGVmode[selectedFunction], functions[selectedFunction].adjustMode);
populateFuncParamCB(fswtchParamT[selectedFunction], functions[selectedFunction].func, functions[selectedFunction].param, functions[selectedFunction].adjustMode);
@@ -561,7 +564,7 @@ void CustomFunctionsPanel::fswDelete()
functions[selectedFunction].clear();
// TODO update switch and func
lock = true;
populateSwitchCB(fswtchSwtch[selectedFunction], functions[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
populateSwitchCB(fswtchSwtch[selectedFunction], functions[selectedFunction].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
populateFuncCB(fswtchFunc[selectedFunction], functions[selectedFunction].func);
refreshCustomFunction(selectedFunction);
lock = false;