summaryrefslogtreecommitdiff
path: root/utils/themeeditor
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-16 07:47:03 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-16 07:47:03 +0000
commit0d48448500129669c35f3316d86a98a41c0c8452 (patch)
tree2d254187e96b2152f9017a87ea8029a9cee0ec56 /utils/themeeditor
parentda4089d8362cedb4f7297635c436273746923b8a (diff)
downloadrockbox-0d48448500129669c35f3316d86a98a41c0c8452.tar.gz
rockbox-0d48448500129669c35f3316d86a98a41c0c8452.zip
Theme Editor: Replaced line edits for key names with combo boxes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26868 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/configdocument.cpp40
-rw-r--r--utils/themeeditor/configdocument.h25
-rw-r--r--utils/themeeditor/resources.qrc1
-rw-r--r--utils/themeeditor/resources/configkeys173
4 files changed, 226 insertions, 13 deletions
diff --git a/utils/themeeditor/configdocument.cpp b/utils/themeeditor/configdocument.cpp
index 5bc4b77504..a897d3b9e3 100644
--- a/utils/themeeditor/configdocument.cpp
+++ b/utils/themeeditor/configdocument.cpp
@@ -36,9 +36,24 @@ ConfigDocument::ConfigDocument(QMap<QString, QString>& settings, QString file,
36{ 36{
37 ui->setupUi(this); 37 ui->setupUi(this);
38 38
39 /* Populating the known keys list */
40 QFile fin(":/resources/configkeys");
41 fin.open(QFile::ReadOnly);
42
43 QStringList* container = &primaryKeys;
44 while(!fin.atEnd())
45 {
46 QString current = QString(fin.readLine());
47 if(current == "-\n")
48 container = &secondaryKeys;
49 else if(current != "\n")
50 container->append(current.trimmed());
51 }
52
39 QMap<QString, QString>::iterator i; 53 QMap<QString, QString>::iterator i;
40 for(i = settings.begin(); i != settings.end(); i++) 54 for(i = settings.begin(); i != settings.end(); i++)
41 addRow(i.key(), i.value()); 55 if(i.key() != "themebase")
56 addRow(i.key(), i.value());
42 57
43 saved = toPlainText(); 58 saved = toPlainText();
44 59
@@ -160,7 +175,7 @@ QString ConfigDocument::toPlainText() const
160 175
161 for(int i = 0; i < keys.count(); i++) 176 for(int i = 0; i < keys.count(); i++)
162 { 177 {
163 buffer += keys[i]->text(); 178 buffer += keys[i]->currentText();
164 buffer += ":"; 179 buffer += ":";
165 buffer += values[i]->text(); 180 buffer += values[i]->text();
166 buffer += "\n"; 181 buffer += "\n";
@@ -172,11 +187,24 @@ QString ConfigDocument::toPlainText() const
172void ConfigDocument::addRow(QString key, QString value) 187void ConfigDocument::addRow(QString key, QString value)
173{ 188{
174 QHBoxLayout* layout = new QHBoxLayout(); 189 QHBoxLayout* layout = new QHBoxLayout();
175 QLineEdit* keyEdit = new QLineEdit(key, this); 190 QComboBox* keyEdit = new QComboBox(this);
176 QLineEdit* valueEdit = new QLineEdit(value, this); 191 QLineEdit* valueEdit = new QLineEdit(value, this);
177 QPushButton* delButton = new QPushButton(tr("-"), this); 192 QPushButton* delButton = new QPushButton(tr("-"), this);
193 QLabel* label = new QLabel(":");
194
195 /* Loading the combo box options */
196 keyEdit->setInsertPolicy(QComboBox::InsertAlphabetically);
197 keyEdit->setEditable(true);
198 keyEdit->addItems(primaryKeys);
199 keyEdit->insertSeparator(keyEdit->count());
200 keyEdit->addItems(secondaryKeys);
201 if(keyEdit->findText(key) != -1)
202 keyEdit->setCurrentIndex(keyEdit->findText(key));
203 else
204 keyEdit->setEditText(key);
178 205
179 layout->addWidget(keyEdit); 206 layout->addWidget(keyEdit);
207 layout->addWidget(label);
180 layout->addWidget(valueEdit); 208 layout->addWidget(valueEdit);
181 layout->addWidget(delButton); 209 layout->addWidget(delButton);
182 210
@@ -185,7 +213,8 @@ void ConfigDocument::addRow(QString key, QString value)
185 213
186 QObject::connect(delButton, SIGNAL(clicked()), 214 QObject::connect(delButton, SIGNAL(clicked()),
187 this, SLOT(deleteClicked())); 215 this, SLOT(deleteClicked()));
188 216 QObject::connect(keyEdit, SIGNAL(currentIndexChanged(QString)),
217 this, SLOT(textChanged()));
189 QObject::connect(keyEdit, SIGNAL(textChanged(QString)), 218 QObject::connect(keyEdit, SIGNAL(textChanged(QString)),
190 this, SLOT(textChanged())); 219 this, SLOT(textChanged()));
191 QObject::connect(valueEdit, SIGNAL(textChanged(QString)), 220 QObject::connect(valueEdit, SIGNAL(textChanged(QString)),
@@ -197,6 +226,7 @@ void ConfigDocument::addRow(QString key, QString value)
197 keys.append(keyEdit); 226 keys.append(keyEdit);
198 values.append(valueEdit); 227 values.append(valueEdit);
199 deleteButtons.append(delButton); 228 deleteButtons.append(delButton);
229 labels.append(label);
200 230
201} 231}
202 232
@@ -209,11 +239,13 @@ void ConfigDocument::deleteClicked()
209 keys[row]->deleteLater(); 239 keys[row]->deleteLater();
210 values[row]->deleteLater(); 240 values[row]->deleteLater();
211 containers[row]->deleteLater(); 241 containers[row]->deleteLater();
242 labels[row]->deleteLater();
212 243
213 deleteButtons.removeAt(row); 244 deleteButtons.removeAt(row);
214 keys.removeAt(row); 245 keys.removeAt(row);
215 values.removeAt(row); 246 values.removeAt(row);
216 containers.removeAt(row); 247 containers.removeAt(row);
248 labels.removeAt(row);
217 249
218 if(saved != toPlainText()) 250 if(saved != toPlainText())
219 emit titleChanged(title() + "*"); 251 emit titleChanged(title() + "*");
diff --git a/utils/themeeditor/configdocument.h b/utils/themeeditor/configdocument.h
index 114cb5bbfc..8493c7a138 100644
--- a/utils/themeeditor/configdocument.h
+++ b/utils/themeeditor/configdocument.h
@@ -24,8 +24,10 @@
24 24
25#include <QHBoxLayout> 25#include <QHBoxLayout>
26#include <QLineEdit> 26#include <QLineEdit>
27#include <QComboBox>
27#include <QPushButton> 28#include <QPushButton>
28#include <QWidget> 29#include <QWidget>
30#include <QLabel>
29#include <QMap> 31#include <QMap>
30 32
31#include "tabcontent.h" 33#include "tabcontent.h"
@@ -55,25 +57,30 @@ public:
55protected: 57protected:
56 void changeEvent(QEvent *e); 58 void changeEvent(QEvent *e);
57 59
60signals:
61 void configFileChanged(QString);
62
63private slots:
64 void deleteClicked();
65 void addClicked();
66 void textChanged();
67
68
58private: 69private:
59 Ui::ConfigDocument *ui; 70 Ui::ConfigDocument *ui;
60 QList<QHBoxLayout*> containers; 71 QList<QHBoxLayout*> containers;
61 QList<QLineEdit*> keys; 72 QList<QComboBox*> keys;
62 QList<QLineEdit*> values; 73 QList<QLineEdit*> values;
63 QList<QPushButton*> deleteButtons; 74 QList<QPushButton*> deleteButtons;
75 QList<QLabel*> labels;
76
77 QStringList primaryKeys;
78 QStringList secondaryKeys;
64 79
65 QString filePath; 80 QString filePath;
66 QString saved; 81 QString saved;
67 82
68 void addRow(QString key, QString value); 83 void addRow(QString key, QString value);
69
70signals:
71 void configFileChanged(QString);
72
73private slots:
74 void deleteClicked();
75 void addClicked();
76 void textChanged();
77}; 84};
78 85
79#endif // CONFIGDOCUMENT_H 86#endif // CONFIGDOCUMENT_H
diff --git a/utils/themeeditor/resources.qrc b/utils/themeeditor/resources.qrc
index b882e23a1d..bba483f210 100644
--- a/utils/themeeditor/resources.qrc
+++ b/utils/themeeditor/resources.qrc
@@ -4,5 +4,6 @@
4 <file>resources/document-new.png</file> 4 <file>resources/document-new.png</file>
5 <file>resources/document-open.png</file> 5 <file>resources/document-open.png</file>
6 <file>resources/document-save.png</file> 6 <file>resources/document-save.png</file>
7 <file alias="configkeys">resources/configkeys</file>
7 </qresource> 8 </qresource>
8</RCC> 9</RCC>
diff --git a/utils/themeeditor/resources/configkeys b/utils/themeeditor/resources/configkeys
new file mode 100644
index 0000000000..67b84b8e68
--- /dev/null
+++ b/utils/themeeditor/resources/configkeys
@@ -0,0 +1,173 @@
1wps
2rwps
3sbs
4rsbs
5fms
6rfms
7volume
8backdrop
9foreground colour
10background colour
11foreground color
12background color
13font
14iconset
15-
16bass
17treble
18balance
19ui viewport
20channels
21stereo_width
22shuffle
23repeat
24play selected
25party mode
26scan min step
27seek acceleration
28antiskip
29volume fade
30sort case
31show files
32show filename exts
33follow playlist
34playlist viewer icons
35playlist viewer indices
36playlist viewer track display
37recursive directory insert
38scroll speed
39scroll delay
40scroll step
41screen scroll step
42Screen Scrolls Out Of View
43bidir limit
44scroll paginated
45hold_lr_for_scroll_in_list
46show path in browser
47contrast
48backlight timeout
49backlight timeout plugged
50backlight filters first keypress
51backlight on button hold
52caption backlight
53brightness
54disk spindown
55battery capacity
56usb hid
57usb keypad mode
58idle poweroff
59max files in playlist
60max files in dir
61lang
62autocreate bookmarks
63autoload bookmarks
64use most-recent-bookmarks
65pause on headphone unplug
66rewind duration on pause
67disable autoresume if phones not present
68Last.fm Logging
69talk dir
70talk dir clip
71talk file
72talk file clip
73talk filetype
74talk menu
75Announce Battery Level
76hotkey wps
77hotkey tree
78sort files
79sort dirs
80sort interpret number
81tagcache_autoupdate
82warn when erasing dynamic playlist
83cuesheet support
84folder navigation
85gather runtime data
86skip length
87prevent track skip
88start in screen
89playlist catalog directory
90list_accel_start_delay
91list_accel_wait
92replaygain type
93replaygain noclip
94replaygain preamp
95crossfade
96crossfade fade in delay
97crossfade fade out delay
98crossfade fade in duration
99crossfade fade out duration
100crossfade fade out mode
101crossfeed
102crossfeed direct gain
103crossfeed cross gain
104crossfeed hf attenuation
105crossfeed hf cutoff
106eq enabled
107eq precut
108eq band 0 cutoff
109eq band 1 cutoff
110eq band 2 cutoff
111eq band 3 cutoff
112eq band 4 cutoff
113eq band 0 q
114eq band 1 q
115eq band 2 q
116eq band 3 q
117eq band 4 q
118eq band 0 gain
119eq band 1 gain
120eq band 2 gain
121eq band 3 gain
122eq band 4 gain
123dithering enabled
124timestretch enabled
125compressor threshold
126compressor makeup gain
127compressor ratio
128compressor knee
129compressor release time
130beep
131keyclick
132keyclick repeats
133dircache
134tagcache_ram
135peak meter release
136peak meter hold
137peak meter clip hold
138peak meter busy
139peak meter dbfs
140peak meter min
141peak meter max
142statusbar
143scrollbar
144scrollbar width
145volume display
146battery display
147kbd
148invert
149flip display
150selector type
151show icons
152viewers iconset
153line selector start colour
154line selector start color
155line selector end colour
156line selector end color
157line selector text colour
158line selector text color
159filetype colours
160filetype colors
161time format
162rec quality
163rec frequency
164rec source
165rec channels
166rec mic gain
167rec left gain
168rec right gain
169editable recordings
170rec timesplit
171pre-recording time
172rec directory
173