Merge pull request #2018 from davxlw/davxlw_SF_SetTimer_Format_next

Companion: Time format for Special Functions Set Timers
This commit is contained in:
Bertrand Songis
2015-01-17 09:38:05 +01:00
2 changed files with 25 additions and 21 deletions
+23 -21
View File
@@ -1,10 +1,4 @@
#include "customfunctions.h"
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
#include <QDoubleSpinBox>
#include "helpers.h"
#include "appdata.h"
@@ -125,6 +119,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
gridLayout->addWidget(fswtchFunc[i], i+1, 2);
// The parameters
QHBoxLayout *paramLayout = new QHBoxLayout();
gridLayout->addLayout(paramLayout, i+1, 3);
@@ -147,6 +142,13 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
paramLayout->addWidget(fswtchParam[i]);
fswtchParamTime[i] = new QTimeEdit(this);
fswtchParamTime[i]->setProperty("index", i);
fswtchParamTime[i]->setAccelerated(true);
fswtchParamTime[i]->setDisplayFormat("hh:mm:ss");
connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
paramLayout->addWidget(fswtchParamTime[i]);
fswtchParamT[i] = new QComboBox(this);
fswtchParamT[i]->setProperty("index", i);
paramLayout->addWidget(fswtchParamT[i]);
@@ -159,7 +161,7 @@ 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);
@@ -195,7 +197,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
addDoubleSpring(gridLayout, 5, num_fsw+1);
disableMouseScrolling();
lock = false;
}
@@ -279,12 +281,13 @@ void CustomFunctionsPanel::playMusic()
#define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0)
#define CUSTOM_FUNCTION_SOURCE_PARAM (1<<1)
#define CUSTOM_FUNCTION_FILE_PARAM (1<<2)
#define CUSTOM_FUNCTION_GV_MODE (1<<3)
#define CUSTOM_FUNCTION_GV_TOOGLE (1<<4)
#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)
#define CUSTOM_FUNCTION_TIME_PARAM (1<<3)
#define CUSTOM_FUNCTION_GV_MODE (1<<4)
#define CUSTOM_FUNCTION_GV_TOOGLE (1<<5)
#define CUSTOM_FUNCTION_ENABLE (1<<6)
#define CUSTOM_FUNCTION_REPEAT (1<<7)
#define CUSTOM_FUNCTION_PLAY (1<<8)
#define CUSTOM_FUNCTION_BL_COLOR (1<<9)
void CustomFunctionsPanel::customFunctionEdited()
{
@@ -380,13 +383,11 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
}
else if (func>=FuncSetTimer1 && func<=FuncSetTimer2) {
if (modified) cfn.param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
fswtchParam[i]->setMinimum(0);
fswtchParam[i]->setMaximum(59*60+59);
fswtchParam[i]->setValue(cfn.param);
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
if (modified) cfn.param = QTimeS(fswtchParamTime[i]->time()).seconds();
fswtchParamTime[i]->setMinimumTime(QTime(0, 0, 0));
fswtchParamTime[i]->setMaximumTime(QTime(0, 59, 59));
fswtchParamTime[i]->setTime(QTimeS(cfn.param));
widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM + CUSTOM_FUNCTION_ENABLE;
}
else if (func==FuncVolume) {
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
@@ -521,6 +522,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
}
fswtchParam[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_NUMERIC_PARAM);
fswtchParamTime[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_TIME_PARAM);
fswtchParamGV[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_TOOGLE);
fswtchParamT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_SOURCE_PARAM);
fswtchParamArmT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_FILE_PARAM);
@@ -8,6 +8,7 @@
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QTimeEdit>
#ifdef PHONON
#include <phonon/audiooutput.h>
#include <phonon/mediaobject.h>
@@ -74,6 +75,7 @@ class CustomFunctionsPanel : public GenericPanel
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS];
QDoubleSpinBox * fswtchParam[C9X_MAX_CUSTOM_FUNCTIONS];
QTimeEdit * fswtchParamTime[C9X_MAX_CUSTOM_FUNCTIONS];
QPushButton * playBT[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamT[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamArmT[C9X_MAX_CUSTOM_FUNCTIONS];