summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/themeeditor/gui/devicestate.cpp56
-rw-r--r--utils/themeeditor/gui/devicestate.h3
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp6
-rw-r--r--utils/themeeditor/resources/deviceoptions23
4 files changed, 67 insertions, 21 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp
index d87cd70f2c..12198f5138 100644
--- a/utils/themeeditor/gui/devicestate.cpp
+++ b/utils/themeeditor/gui/devicestate.cpp
@@ -198,6 +198,36 @@ DeviceState::~DeviceState()
198QVariant DeviceState::data(QString tag, int paramCount, 198QVariant DeviceState::data(QString tag, int paramCount,
199 skin_tag_parameter *params) 199 skin_tag_parameter *params)
200{ 200{
201 /* Handling special cases */
202 if(tag.toLower() == "fm")
203 {
204 QString path = tag[0].isLower()
205 ? data("file").toString() : data("nextfile").toString();
206 return fileName(path, true);
207 }
208 else if(tag.toLower() == "fn")
209 {
210 QString path = tag[0].isLower()
211 ? data("file").toString() : data("nextfile").toString();
212 return fileName(path, false);
213 }
214 else if(tag.toLower() == "fp")
215 {
216 if(tag[0].isLower())
217 return data("file").toString();
218 else
219 return data("nextfile").toString();
220 }
221 else if(tag.toLower() == "d")
222 {
223 QString path = tag[0].isLower()
224 ? data("file").toString() : data("nextfile").toString();
225 if(paramCount > 0)
226 return directory(path, params[0].data.numeric);
227 else
228 return QVariant();
229 }
230
201 QPair<InputType, QWidget*> found = 231 QPair<InputType, QWidget*> found =
202 inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); 232 inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0));
203 233
@@ -279,3 +309,29 @@ void DeviceState::input()
279{ 309{
280 emit settingsChanged(); 310 emit settingsChanged();
281} 311}
312
313QString DeviceState::fileName(QString path, bool extension)
314{
315 path = path.split("/").last();
316 if(!extension)
317 {
318 QString sum;
319 QStringList name = path.split(".");
320 for(int i = 0; i < name.count() - 1; i++)
321 sum.append(name[i]);
322 return sum;
323 }
324 else
325 {
326 return path;
327 }
328}
329
330QString DeviceState::directory(QString path, int level)
331{
332 QStringList dirs = path.split("/");
333 int index = dirs.count() - 1 - level;
334 if(index < 0)
335 index = 0;
336 return dirs[index];
337}
diff --git a/utils/themeeditor/gui/devicestate.h b/utils/themeeditor/gui/devicestate.h
index d3a6c4650f..ebd4afec8c 100644
--- a/utils/themeeditor/gui/devicestate.h
+++ b/utils/themeeditor/gui/devicestate.h
@@ -59,6 +59,9 @@ private slots:
59 void input(); 59 void input();
60 60
61private: 61private:
62 static QString fileName(QString path, bool extension);
63 static QString directory(QString path, int level);
64
62 QMap<QString, QPair<InputType, QWidget*> > inputs; 65 QMap<QString, QPair<InputType, QWidget*> > inputs;
63 QTabWidget tabs; 66 QTabWidget tabs;
64}; 67};
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index e5eb9df9b3..3ccf6c0063 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -873,7 +873,8 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional,
873{ 873{
874 if(!conditional) 874 if(!conditional)
875 { 875 {
876 return info.device()->data(QString(element->tag->name)); 876 return info.device()->data(QString(element->tag->name),
877 element->params_count, element->params);
877 } 878 }
878 else 879 else
879 { 880 {
@@ -886,7 +887,8 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional,
886 int child; 887 int child;
887 QVariant val = info.device()->data("?" + QString(element->tag->name)); 888 QVariant val = info.device()->data("?" + QString(element->tag->name));
888 if(val.isNull()) 889 if(val.isNull())
889 val = info.device()->data(QString(element->tag->name)); 890 val = info.device()->data(QString(element->tag->name),
891 element->params_count, element->params);
890 892
891 if(val.isNull()) 893 if(val.isNull())
892 { 894 {
diff --git a/utils/themeeditor/resources/deviceoptions b/utils/themeeditor/resources/deviceoptions
index d76baf1861..689704577f 100644
--- a/utils/themeeditor/resources/deviceoptions
+++ b/utils/themeeditor/resources/deviceoptions
@@ -74,41 +74,26 @@ fb ; Bitrate (kbps) ; spin(1,2048) ; 256
74fc ; Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG 74fc ; Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG
75ff ; Frequency (Hz) ; spin(1,100000) ; 42000 75ff ; Frequency (Hz) ; spin(1,100000) ; 42000
76fk ; Frequency (KHz) ; fspin(1, 100) ; 42 76fk ; Frequency (KHz) ; fspin(1, 100) ; 42
77fm ; Name ; text ; Current File Name.a 77file ; File Path ; text ; /.rockbox/music/artist/album/01 - file.ogg
78fn ; Name (w/o extension) ; text ; Current File Name
79fp ; Path ; text ; /current/file/path/
80fs ; Size (KB) ; spin(1,100000) ; 3000 78fs ; Size (KB) ; spin(1,100000) ; 3000
81fv ; Variable Bit Rate ; check ; true 79fv ; Variable Bit Rate ; check ; true
82d1 ; cd up ; text ; /current/file/
83d2 ; cd up x2 ; text ; /current/
84d3 ; cd up x3 ; text ; /
85 80
86[Next File Info] 81[Next File Info]
87Fb ; Next File Bitrate (kbps) ; spin(1,2048) ; 256 82Fb ; Next File Bitrate (kbps) ; spin(1,2048) ; 256
88Fc ; Next File Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG 83Fc ; Next File Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG
89Ff ; Next File Frequency (Hz) ; spin(1,100000) ; 42000 84Ff ; Next File Frequency (Hz) ; spin(1,100000) ; 42000
90Fk ; Next File Frequency (KHz) ; fspin(1, 100) ; 42 85Fk ; Next File Frequency (KHz) ; fspin(1, 100) ; 42
91Fm ; Next File Name ; text ; Next File Name.a 86nextfile ; Next File Path ; text ; /.rockbox/music/artist/album/02 - nextfile.ogg
92Fn ; Next File Name (w/o extension) ; text ; Next File Name
93Fp ; Next File Path ; text ; /next/file/path/
94Fs ; Next File Size (KB) ; spin(1,100000) ; 3000 87Fs ; Next File Size (KB) ; spin(1,100000) ; 3000
95Fv ; Next File Variable Bit Rate ; check ; true 88Fv ; Next File Variable Bit Rate ; check ; true
96D1 ; Next File cd up ; text ; /next/file/
97D2 ; Next File cd up x2 ; text ; /next/
98D3 ; Next File cd up x3 ; text ; /
99 89
100[Playlist/Song Info] 90[Playlist/Song Info]
101px ; Percent Played ; spin(0,100) ; 50 91?pc ; Time In Song (Seconds) ; fspin(0,5000) ; 60
102pc ; Current Time In Song ; text ; 1:00
103?pc ; Time In Song (Conditional) ; fspin(0,5000) ; 60
104pe ; Playlist Entries ; spin(0,1000) ; 20 92pe ; Playlist Entries ; spin(0,1000) ; 20
105pn ; Playlist Name ; text ; Current Playlist 93pn ; Playlist Name ; text ; Current Playlist
106pp ; Playlist Position ; spin(0,1000) ; 10 94pp ; Playlist Position ; spin(0,1000) ; 10
107pr ; Time Remaining ; text ; 2:00
108ps ; Shuffle ; check ; true 95ps ; Shuffle ; check ; true
109pt ; Total Track Time ; text ; 3:00 96pt ; Total Track Time ; spin(0,1000) ; 180
110pS ; Track Starting ; check ; true
111pE ; Track Ending ; check ; false
112Sp ; Playback Pitch ; fspin(50,200) ; 100 97Sp ; Playback Pitch ; fspin(50,200) ; 100
113rp ; Song Playcount ; spin(0,10000) ; 20 98rp ; Song Playcount ; spin(0,10000) ; 20
114rr ; Song Rating ; spin(0,10) ; 5 99rr ; Song Rating ; spin(0,10) ; 5