diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-03 23:48:10 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-03 23:48:10 +0000 |
commit | d4e7ab7a93a268a9fbb1255b7ca3a39a09c090e2 (patch) | |
tree | 52cd45438b6394169c4921dbbaacdc1acaaf3952 | |
parent | e472c3975e9bf280b08bc48e6cc0fcfa0ef46ef5 (diff) | |
download | rockbox-d4e7ab7a93a268a9fbb1255b7ca3a39a09c090e2.tar.gz rockbox-d4e7ab7a93a268a9fbb1255b7ca3a39a09c090e2.zip |
Theme Editor: Switched device configuration panel to a QFormLayout
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27267 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/themeeditor/gui/devicestate.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp index 477adf2296..fda2bddbe5 100644 --- a/utils/themeeditor/gui/devicestate.cpp +++ b/utils/themeeditor/gui/devicestate.cpp | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <QVBoxLayout> | 29 | #include <QVBoxLayout> |
30 | #include <QLabel> | 30 | #include <QLabel> |
31 | #include <QLineEdit> | 31 | #include <QLineEdit> |
32 | #include <QFormLayout> | ||
32 | 33 | ||
33 | 34 | ||
34 | DeviceState::DeviceState(QWidget *parent) : | 35 | DeviceState::DeviceState(QWidget *parent) : |
@@ -39,7 +40,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
39 | setWindowIcon(QIcon(":/resources/windowicon.png")); | 40 | setWindowIcon(QIcon(":/resources/windowicon.png")); |
40 | setWindowTitle(tr("Device Settings")); | 41 | setWindowTitle(tr("Device Settings")); |
41 | 42 | ||
42 | QVBoxLayout* layout = new QVBoxLayout(this); | 43 | QFormLayout* layout = new QFormLayout(this); |
43 | layout->addWidget(&tabs); | 44 | layout->addWidget(&tabs); |
44 | this->setLayout(layout); | 45 | this->setLayout(layout); |
45 | 46 | ||
@@ -68,7 +69,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
68 | 69 | ||
69 | panel = new QWidget(); | 70 | panel = new QWidget(); |
70 | currentArea = new QScrollArea(); | 71 | currentArea = new QScrollArea(); |
71 | layout = new QVBoxLayout(panel); | 72 | layout = new QFormLayout(panel); |
72 | currentArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | 73 | currentArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
73 | currentArea->setWidget(panel); | 74 | currentArea->setWidget(panel); |
74 | currentArea->setWidgetResizable(true); | 75 | currentArea->setWidgetResizable(true); |
@@ -84,18 +85,11 @@ DeviceState::DeviceState(QWidget *parent) : | |||
84 | QString type = elements[2].trimmed(); | 85 | QString type = elements[2].trimmed(); |
85 | QString defVal = elements[3].trimmed(); | 86 | QString defVal = elements[3].trimmed(); |
86 | 87 | ||
87 | subLayout = new QHBoxLayout(); | ||
88 | if(type != "check") | ||
89 | subLayout->addWidget(new QLabel(elements[1].trimmed(), | ||
90 | currentArea)); | ||
91 | layout->addLayout(subLayout); | ||
92 | |||
93 | |||
94 | elements = type.split("("); | 88 | elements = type.split("("); |
95 | if(elements[0].trimmed() == "text") | 89 | if(elements[0].trimmed() == "text") |
96 | { | 90 | { |
97 | QLineEdit* temp = new QLineEdit(defVal, currentArea); | 91 | QLineEdit* temp = new QLineEdit(defVal, currentArea); |
98 | subLayout->addWidget(temp); | 92 | layout->addRow(title, temp); |
99 | inputs.insert(tag, QPair<InputType, QWidget*>(Text, temp)); | 93 | inputs.insert(tag, QPair<InputType, QWidget*>(Text, temp)); |
100 | 94 | ||
101 | temp->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, | 95 | temp->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, |
@@ -107,7 +101,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
107 | else if(elements[0].trimmed() == "check") | 101 | else if(elements[0].trimmed() == "check") |
108 | { | 102 | { |
109 | QCheckBox* temp = new QCheckBox(title, currentArea); | 103 | QCheckBox* temp = new QCheckBox(title, currentArea); |
110 | subLayout->addWidget(temp); | 104 | layout->addRow(temp); |
111 | if(defVal.toLower() == "true") | 105 | if(defVal.toLower() == "true") |
112 | temp->setChecked(true); | 106 | temp->setChecked(true); |
113 | else | 107 | else |
@@ -129,7 +123,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
129 | temp->setMinimum(min); | 123 | temp->setMinimum(min); |
130 | temp->setMaximum(max); | 124 | temp->setMaximum(max); |
131 | temp->setValue(defVal.toInt()); | 125 | temp->setValue(defVal.toInt()); |
132 | subLayout->addWidget(temp); | 126 | layout->addRow(title, temp); |
133 | inputs.insert(tag, QPair<InputType, QWidget*>(Slide, temp)); | 127 | inputs.insert(tag, QPair<InputType, QWidget*>(Slide, temp)); |
134 | 128 | ||
135 | QObject::connect(temp, SIGNAL(valueChanged(int)), | 129 | QObject::connect(temp, SIGNAL(valueChanged(int)), |
@@ -147,7 +141,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
147 | temp->setMinimum(min); | 141 | temp->setMinimum(min); |
148 | temp->setMaximum(max); | 142 | temp->setMaximum(max); |
149 | temp->setValue(defVal.toInt()); | 143 | temp->setValue(defVal.toInt()); |
150 | subLayout->addWidget(temp); | 144 | layout->addRow(title, temp); |
151 | inputs.insert(tag, QPair<InputType, QWidget*>(Spin, temp)); | 145 | inputs.insert(tag, QPair<InputType, QWidget*>(Spin, temp)); |
152 | 146 | ||
153 | QObject::connect(temp, SIGNAL(valueChanged(int)), | 147 | QObject::connect(temp, SIGNAL(valueChanged(int)), |
@@ -166,7 +160,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
166 | temp->setMaximum(max); | 160 | temp->setMaximum(max); |
167 | temp->setValue(defVal.toDouble()); | 161 | temp->setValue(defVal.toDouble()); |
168 | temp->setSingleStep(0.1); | 162 | temp->setSingleStep(0.1); |
169 | subLayout->addWidget(temp); | 163 | layout->addRow(title, temp); |
170 | inputs.insert(tag, QPair<InputType, QWidget*>(DSpin, temp)); | 164 | inputs.insert(tag, QPair<InputType, QWidget*>(DSpin, temp)); |
171 | 165 | ||
172 | QObject::connect(temp, SIGNAL(valueChanged(double)), | 166 | QObject::connect(temp, SIGNAL(valueChanged(double)), |
@@ -188,7 +182,7 @@ DeviceState::DeviceState(QWidget *parent) : | |||
188 | defIndex = i; | 182 | defIndex = i; |
189 | } | 183 | } |
190 | temp->setCurrentIndex(defIndex); | 184 | temp->setCurrentIndex(defIndex); |
191 | subLayout->addWidget(temp); | 185 | layout->addRow(title, temp); |
192 | inputs.insert(tag, QPair<InputType, QWidget*>(Combo, temp)); | 186 | inputs.insert(tag, QPair<InputType, QWidget*>(Combo, temp)); |
193 | 187 | ||
194 | QObject::connect(temp, SIGNAL(currentIndexChanged(int)), | 188 | QObject::connect(temp, SIGNAL(currentIndexChanged(int)), |