summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-24 18:43:06 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-24 18:43:06 +0000
commit9079cddd832366fce51d853926cba3bad14837d4 (patch)
tree39ebef773b40647c99f961cba64edf7132058ee2 /utils/themeeditor
parent4146882277cdc2145c67b3340d9b3c83b9469148 (diff)
downloadrockbox-9079cddd832366fce51d853926cba3bad14837d4.tar.gz
rockbox-9079cddd832366fce51d853926cba3bad14837d4.zip
Theme Editor: Added settingsChanged() signal to DeviceState class
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27110 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/gui/devicestate.cpp66
-rw-r--r--utils/themeeditor/gui/devicestate.h6
2 files changed, 51 insertions, 21 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp
index fb35e77b36..b17dcafa57 100644
--- a/utils/themeeditor/gui/devicestate.cpp
+++ b/utils/themeeditor/gui/devicestate.cpp
@@ -44,7 +44,6 @@ DeviceState::DeviceState(QWidget *parent) :
QScrollArea* currentArea;
QHBoxLayout* subLayout;
QWidget* panel;
- QWidget* temp;
QFile fin(":/resources/deviceoptions");
fin.open(QFile::Text | QFile::ReadOnly);
@@ -91,19 +90,25 @@ DeviceState::DeviceState(QWidget *parent) :
elements = type.split("(");
if(elements[0].trimmed() == "text")
{
- temp = new QLineEdit(defVal, currentArea);
+ QLineEdit* temp = new QLineEdit(defVal, currentArea);
subLayout->addWidget(temp);
inputs.insert(tag, QPair<InputType, QWidget*>(Text, temp));
+
+ QObject::connect(temp, SIGNAL(textChanged(QString)),
+ this, SLOT(input()));
}
else if(elements[0].trimmed() == "check")
{
- temp = new QCheckBox(title, currentArea);
+ QCheckBox* temp = new QCheckBox(title, currentArea);
subLayout->addWidget(temp);
if(defVal.toLower() == "true")
- dynamic_cast<QCheckBox*>(temp)->setChecked(true);
+ temp->setChecked(true);
else
- dynamic_cast<QCheckBox*>(temp)->setChecked(false);
+ temp->setChecked(false);
inputs.insert(tag, QPair<InputType, QWidget*>(Check, temp));
+
+ QObject::connect(temp, SIGNAL(toggled(bool)),
+ this, SLOT(input()));
}
else if(elements[0].trimmed() == "slider")
{
@@ -113,12 +118,15 @@ DeviceState::DeviceState(QWidget *parent) :
maxS.chop(1);
int max = maxS.toInt();
- temp = new QSlider(Qt::Horizontal, currentArea);
- dynamic_cast<QSlider*>(temp)->setMinimum(min);
- dynamic_cast<QSlider*>(temp)->setMaximum(max);
- dynamic_cast<QSlider*>(temp)->setValue(defVal.toInt());
+ QSlider* temp = new QSlider(Qt::Horizontal, currentArea);
+ temp->setMinimum(min);
+ temp->setMaximum(max);
+ temp->setValue(defVal.toInt());
subLayout->addWidget(temp);
inputs.insert(tag, QPair<InputType, QWidget*>(Slide, temp));
+
+ QObject::connect(temp, SIGNAL(valueChanged(int)),
+ this, SLOT(input()));
}
else if(elements[0].trimmed() == "spin")
{
@@ -128,12 +136,15 @@ DeviceState::DeviceState(QWidget *parent) :
maxS.chop(1);
int max = maxS.toInt();
- temp = new QSpinBox(currentArea);
- dynamic_cast<QSpinBox*>(temp)->setMinimum(min);
- dynamic_cast<QSpinBox*>(temp)->setMaximum(max);
- dynamic_cast<QSpinBox*>(temp)->setValue(defVal.toInt());
+ QSpinBox* temp = new QSpinBox(currentArea);
+ temp->setMinimum(min);
+ temp->setMaximum(max);
+ temp->setValue(defVal.toInt());
subLayout->addWidget(temp);
inputs.insert(tag, QPair<InputType, QWidget*>(Spin, temp));
+
+ QObject::connect(temp, SIGNAL(valueChanged(int)),
+ this, SLOT(input()));
}
else if(elements[0].trimmed() == "fspin")
{
@@ -143,32 +154,38 @@ DeviceState::DeviceState(QWidget *parent) :
maxS.chop(1);
int max = maxS.toDouble();
- temp = new QDoubleSpinBox(currentArea);
- dynamic_cast<QDoubleSpinBox*>(temp)->setMinimum(min);
- dynamic_cast<QDoubleSpinBox*>(temp)->setMaximum(max);
- dynamic_cast<QDoubleSpinBox*>(temp)->setValue(defVal.toDouble());
- dynamic_cast<QDoubleSpinBox*>(temp)->setSingleStep(0.1);
+ QDoubleSpinBox* temp = new QDoubleSpinBox(currentArea);
+ temp->setMinimum(min);
+ temp->setMaximum(max);
+ temp->setValue(defVal.toDouble());
+ temp->setSingleStep(0.1);
subLayout->addWidget(temp);
inputs.insert(tag, QPair<InputType, QWidget*>(DSpin, temp));
+
+ QObject::connect(temp, SIGNAL(valueChanged(double)),
+ this, SLOT(input()));
}
else if(elements[0].trimmed() == "combo")
{
elements = elements[1].trimmed().split(",");
int defIndex;
- temp = new QComboBox(currentArea);
+ QComboBox* temp = new QComboBox(currentArea);
for(int i = 0; i < elements.count(); i++)
{
QString current = elements[i].trimmed();
if(i == elements.count() - 1)
current.chop(1);
- dynamic_cast<QComboBox*>(temp)->addItem(current, i);
+ temp->addItem(current, i);
if(current == defVal)
defIndex = i;
}
- dynamic_cast<QComboBox*>(temp)->setCurrentIndex(defIndex);
+ temp->setCurrentIndex(defIndex);
subLayout->addWidget(temp);
inputs.insert(tag, QPair<InputType, QWidget*>(Combo, temp));
+
+ QObject::connect(temp, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(input()));
}
}
@@ -206,4 +223,11 @@ QVariant DeviceState::data(QString tag)
case Check:
return dynamic_cast<QCheckBox*>(found.second)->isChecked();
}
+
+ return QVariant();
+}
+
+void DeviceState::input()
+{
+ emit settingsChanged();
}
diff --git a/utils/themeeditor/gui/devicestate.h b/utils/themeeditor/gui/devicestate.h
index 8938e01f29..c680e2c1ea 100644
--- a/utils/themeeditor/gui/devicestate.h
+++ b/utils/themeeditor/gui/devicestate.h
@@ -48,6 +48,12 @@ public:
QVariant data(QString tag);
+signals:
+ void settingsChanged();
+
+private slots:
+ void input();
+
private:
QMap<QString, QPair<InputType, QWidget*> > inputs;
QTabWidget tabs;