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() QVariant DeviceState::data(QString tag, int paramCount, skin_tag_parameter *params) { + /* Handling special cases */ + if(tag.toLower() == "fm") + { + QString path = tag[0].isLower() + ? data("file").toString() : data("nextfile").toString(); + return fileName(path, true); + } + else if(tag.toLower() == "fn") + { + QString path = tag[0].isLower() + ? data("file").toString() : data("nextfile").toString(); + return fileName(path, false); + } + else if(tag.toLower() == "fp") + { + if(tag[0].isLower()) + return data("file").toString(); + else + return data("nextfile").toString(); + } + else if(tag.toLower() == "d") + { + QString path = tag[0].isLower() + ? data("file").toString() : data("nextfile").toString(); + if(paramCount > 0) + return directory(path, params[0].data.numeric); + else + return QVariant(); + } + QPair<InputType, QWidget*> found = inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); @@ -279,3 +309,29 @@ void DeviceState::input() { emit settingsChanged(); } + +QString DeviceState::fileName(QString path, bool extension) +{ + path = path.split("/").last(); + if(!extension) + { + QString sum; + QStringList name = path.split("."); + for(int i = 0; i < name.count() - 1; i++) + sum.append(name[i]); + return sum; + } + else + { + return path; + } +} + +QString DeviceState::directory(QString path, int level) +{ + QStringList dirs = path.split("/"); + int index = dirs.count() - 1 - level; + if(index < 0) + index = 0; + return dirs[index]; +} 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: void input(); private: + static QString fileName(QString path, bool extension); + static QString directory(QString path, int level); + QMap<QString, QPair<InputType, QWidget*> > inputs; QTabWidget tabs; }; 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, { if(!conditional) { - return info.device()->data(QString(element->tag->name)); + return info.device()->data(QString(element->tag->name), + element->params_count, element->params); } else { @@ -886,7 +887,8 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional, int child; QVariant val = info.device()->data("?" + QString(element->tag->name)); if(val.isNull()) - val = info.device()->data(QString(element->tag->name)); + val = info.device()->data(QString(element->tag->name), + element->params_count, element->params); if(val.isNull()) { 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 fc ; Codec ; combo(MP1, MP2, MP3, AIFF, WAV, OGG, FLAC, MPC, AC3, WV, ALAC, AAC, SHN, SID, ADX, NSF, Speex, SPC, APE, WMA) ; OGG ff ; Frequency (Hz) ; spin(1,100000) ; 42000 fk ; Frequency (KHz) ; fspin(1, 100) ; 42 -fm ; Name ; text ; Current File Name.a -fn ; Name (w/o extension) ; text ; Current File Name -fp ; Path ; text ; /current/file/path/ +file ; File Path ; text ; /.rockbox/music/artist/album/01 - file.ogg fs ; Size (KB) ; spin(1,100000) ; 3000 fv ; Variable Bit Rate ; check ; true -d1 ; cd up ; text ; /current/file/ -d2 ; cd up x2 ; text ; /current/ -d3 ; cd up x3 ; text ; / [Next File Info] Fb ; Next File Bitrate (kbps) ; spin(1,2048) ; 256 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 Ff ; Next File Frequency (Hz) ; spin(1,100000) ; 42000 Fk ; Next File Frequency (KHz) ; fspin(1, 100) ; 42 -Fm ; Next File Name ; text ; Next File Name.a -Fn ; Next File Name (w/o extension) ; text ; Next File Name -Fp ; Next File Path ; text ; /next/file/path/ +nextfile ; Next File Path ; text ; /.rockbox/music/artist/album/02 - nextfile.ogg Fs ; Next File Size (KB) ; spin(1,100000) ; 3000 Fv ; Next File Variable Bit Rate ; check ; true -D1 ; Next File cd up ; text ; /next/file/ -D2 ; Next File cd up x2 ; text ; /next/ -D3 ; Next File cd up x3 ; text ; / [Playlist/Song Info] -px ; Percent Played ; spin(0,100) ; 50 -pc ; Current Time In Song ; text ; 1:00 -?pc ; Time In Song (Conditional) ; fspin(0,5000) ; 60 +?pc ; Time In Song (Seconds) ; fspin(0,5000) ; 60 pe ; Playlist Entries ; spin(0,1000) ; 20 pn ; Playlist Name ; text ; Current Playlist pp ; Playlist Position ; spin(0,1000) ; 10 -pr ; Time Remaining ; text ; 2:00 ps ; Shuffle ; check ; true -pt ; Total Track Time ; text ; 3:00 -pS ; Track Starting ; check ; true -pE ; Track Ending ; check ; false +pt ; Total Track Time ; spin(0,1000) ; 180 Sp ; Playback Pitch ; fspin(50,200) ; 100 rp ; Song Playcount ; spin(0,10000) ; 20 rr ; Song Rating ; spin(0,10) ; 5 |