diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-07-08 06:54:08 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-08 06:54:08 +0000 |
| commit | 6358d41f31edd6487ee76232c55d5b7385426be3 (patch) | |
| tree | c58eb0a6580018cffa9cc727765eeb3d2a3971b9 /utils/themeeditor/gui | |
| parent | eb93e3b3d26ce31407a302f49c70770ad3f98274 (diff) | |
| download | rockbox-6358d41f31edd6487ee76232c55d5b7385426be3.zip rockbox-6358d41f31edd6487ee76232c55d5b7385426be3.tar.gz rockbox-6358d41f31edd6487ee76232c55d5b7385426be3.tar.bz2 rockbox-6358d41f31edd6487ee76232c55d5b7385426be3.tar.xz | |
Theme Editor: Began working on special cases for device option panel. Implemented path info for current and next file
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27346 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui')
| -rw-r--r-- | utils/themeeditor/gui/devicestate.cpp | 56 | ||||
| -rw-r--r-- | utils/themeeditor/gui/devicestate.h | 3 |
2 files changed, 59 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp index d87cd70..12198f5 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 d3a6c46..ebd4afe 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; }; |