From 91c84dbb657fb7d7a39e466d92881b25fe097407 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Tue, 29 Apr 2014 16:16:07 +0200 Subject: [PATCH] Color slider for backlight SF in companion --- companion/src/modeledit/customfunctions.cpp | 16 ++++++++++++++++ companion/src/modeledit/customfunctions.h | 1 + 2 files changed, 17 insertions(+) diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 51de7cc69..652b50a24 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -161,6 +161,15 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); + + fswtchBLcolor[i] = new QSlider(this); + fswtchBLcolor[i]->setProperty("index", i); + fswtchBLcolor[i]->setMinimum(0); + fswtchBLcolor[i]->setMaximum(100); + fswtchBLcolor[i]->setSingleStep(1); + fswtchBLcolor[i]->setOrientation(Qt::Horizontal); + paramLayout->addWidget(fswtchBLcolor[i]); + connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); #ifdef PHONON playBT[i] = new QPushButton(this); @@ -271,6 +280,7 @@ void CustomFunctionsPanel::playMusic() #define CUSTOM_FUNCTION_ENABLE (1<<5) #define CUSTOM_FUNCTION_REPEAT (1<<6) #define CUSTOM_FUNCTION_PLAY (1<<7) +#define CUSTOM_FUNCTION_BL_COLOR (1<<8) void CustomFunctionsPanel::customFunctionEdited() { @@ -447,6 +457,11 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM; } } + else if (index==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) { + if (modified) model.funcSw[i].param = (uint8_t)fswtchBLcolor[i]->value(); + fswtchBLcolor[i]->setValue(model.funcSw[i].param); + widgetsMask |= CUSTOM_FUNCTION_BL_COLOR; + } else { if (modified) model.funcSw[i].param = fswtchParam[i]->value(); fswtchParam[i]->setDecimals(0); @@ -468,6 +483,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) fswtchEnable[i]->setChecked(false); fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT); fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE); + fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR); #ifdef PHONON playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY); #endif diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index fecab42a3..40d69cede 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -74,6 +74,7 @@ class CustomFunctionsPanel : public ModelPanel QCheckBox * fswtchEnable[C9X_MAX_CUSTOM_FUNCTIONS]; RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS]; + QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS]; #ifdef PHONON Phonon::MediaObject *clickObject; Phonon::AudioOutput *clickOutput;