diff options
-rw-r--r-- | utils/themeeditor/gui/devicestate.cpp | 56 | ||||
-rw-r--r-- | utils/themeeditor/gui/devicestate.h | 3 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.cpp | 6 | ||||
-rw-r--r-- | utils/themeeditor/resources/deviceoptions | 23 |
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() | |||
198 | QVariant DeviceState::data(QString tag, int paramCount, | 198 | QVariant 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 | |||
313 | QString 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 | |||
330 | QString 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 | ||
61 | private: | 61 | private: |
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 | |||
74 | fc ; Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG | 74 | fc ; Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG |
75 | ff ; Frequency (Hz) ; spin(1,100000) ; 42000 | 75 | ff ; Frequency (Hz) ; spin(1,100000) ; 42000 |
76 | fk ; Frequency (KHz) ; fspin(1, 100) ; 42 | 76 | fk ; Frequency (KHz) ; fspin(1, 100) ; 42 |
77 | fm ; Name ; text ; Current File Name.a | 77 | file ; File Path ; text ; /.rockbox/music/artist/album/01 - file.ogg |
78 | fn ; Name (w/o extension) ; text ; Current File Name | ||
79 | fp ; Path ; text ; /current/file/path/ | ||
80 | fs ; Size (KB) ; spin(1,100000) ; 3000 | 78 | fs ; Size (KB) ; spin(1,100000) ; 3000 |
81 | fv ; Variable Bit Rate ; check ; true | 79 | fv ; Variable Bit Rate ; check ; true |
82 | d1 ; cd up ; text ; /current/file/ | ||
83 | d2 ; cd up x2 ; text ; /current/ | ||
84 | d3 ; cd up x3 ; text ; / | ||
85 | 80 | ||
86 | [Next File Info] | 81 | [Next File Info] |
87 | Fb ; Next File Bitrate (kbps) ; spin(1,2048) ; 256 | 82 | Fb ; Next File Bitrate (kbps) ; spin(1,2048) ; 256 |
88 | Fc ; 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 | 83 | Fc ; 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 |
89 | Ff ; Next File Frequency (Hz) ; spin(1,100000) ; 42000 | 84 | Ff ; Next File Frequency (Hz) ; spin(1,100000) ; 42000 |
90 | Fk ; Next File Frequency (KHz) ; fspin(1, 100) ; 42 | 85 | Fk ; Next File Frequency (KHz) ; fspin(1, 100) ; 42 |
91 | Fm ; Next File Name ; text ; Next File Name.a | 86 | nextfile ; Next File Path ; text ; /.rockbox/music/artist/album/02 - nextfile.ogg |
92 | Fn ; Next File Name (w/o extension) ; text ; Next File Name | ||
93 | Fp ; Next File Path ; text ; /next/file/path/ | ||
94 | Fs ; Next File Size (KB) ; spin(1,100000) ; 3000 | 87 | Fs ; Next File Size (KB) ; spin(1,100000) ; 3000 |
95 | Fv ; Next File Variable Bit Rate ; check ; true | 88 | Fv ; Next File Variable Bit Rate ; check ; true |
96 | D1 ; Next File cd up ; text ; /next/file/ | ||
97 | D2 ; Next File cd up x2 ; text ; /next/ | ||
98 | D3 ; Next File cd up x3 ; text ; / | ||
99 | 89 | ||
100 | [Playlist/Song Info] | 90 | [Playlist/Song Info] |
101 | px ; Percent Played ; spin(0,100) ; 50 | 91 | ?pc ; Time In Song (Seconds) ; fspin(0,5000) ; 60 |
102 | pc ; Current Time In Song ; text ; 1:00 | ||
103 | ?pc ; Time In Song (Conditional) ; fspin(0,5000) ; 60 | ||
104 | pe ; Playlist Entries ; spin(0,1000) ; 20 | 92 | pe ; Playlist Entries ; spin(0,1000) ; 20 |
105 | pn ; Playlist Name ; text ; Current Playlist | 93 | pn ; Playlist Name ; text ; Current Playlist |
106 | pp ; Playlist Position ; spin(0,1000) ; 10 | 94 | pp ; Playlist Position ; spin(0,1000) ; 10 |
107 | pr ; Time Remaining ; text ; 2:00 | ||
108 | ps ; Shuffle ; check ; true | 95 | ps ; Shuffle ; check ; true |
109 | pt ; Total Track Time ; text ; 3:00 | 96 | pt ; Total Track Time ; spin(0,1000) ; 180 |
110 | pS ; Track Starting ; check ; true | ||
111 | pE ; Track Ending ; check ; false | ||
112 | Sp ; Playback Pitch ; fspin(50,200) ; 100 | 97 | Sp ; Playback Pitch ; fspin(50,200) ; 100 |
113 | rp ; Song Playcount ; spin(0,10000) ; 20 | 98 | rp ; Song Playcount ; spin(0,10000) ; 20 |
114 | rr ; Song Rating ; spin(0,10) ; 5 | 99 | rr ; Song Rating ; spin(0,10) ; 5 |