diff options
-rw-r--r-- | utils/themeeditor/gui/devicestate.cpp | 80 | ||||
-rw-r--r-- | utils/themeeditor/gui/devicestate.h | 1 | ||||
-rw-r--r-- | utils/themeeditor/resources/deviceoptions | 2 |
3 files changed, 82 insertions, 1 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp index 12198f5138..8802bd5e87 100644 --- a/utils/themeeditor/gui/devicestate.cpp +++ b/utils/themeeditor/gui/devicestate.cpp | |||
@@ -30,7 +30,9 @@ | |||
30 | #include <QLabel> | 30 | #include <QLabel> |
31 | #include <QLineEdit> | 31 | #include <QLineEdit> |
32 | #include <QFormLayout> | 32 | #include <QFormLayout> |
33 | #include <QTime> | ||
33 | 34 | ||
35 | #include <cstdlib> | ||
34 | 36 | ||
35 | DeviceState::DeviceState(QWidget *parent) : | 37 | DeviceState::DeviceState(QWidget *parent) : |
36 | QWidget(parent), tabs(this) | 38 | QWidget(parent), tabs(this) |
@@ -227,6 +229,47 @@ QVariant DeviceState::data(QString tag, int paramCount, | |||
227 | else | 229 | else |
228 | return QVariant(); | 230 | return QVariant(); |
229 | } | 231 | } |
232 | else if(tag == "pc") | ||
233 | { | ||
234 | int secs = data("?pc").toInt(); | ||
235 | return secsToString(secs); | ||
236 | } | ||
237 | else if(tag == "pr") | ||
238 | { | ||
239 | int secs = data("?pt").toInt() - data("?pc").toInt(); | ||
240 | if(secs < 0) | ||
241 | secs = 0; | ||
242 | return secsToString(secs); | ||
243 | } | ||
244 | else if(tag == "pt") | ||
245 | { | ||
246 | int secs = data("?pt").toInt(); | ||
247 | return secsToString(secs); | ||
248 | } | ||
249 | else if(tag == "px") | ||
250 | { | ||
251 | int totalTime = data("?pt").toInt(); | ||
252 | int currentTime = data("?pc").toInt(); | ||
253 | return currentTime * 100 / totalTime; | ||
254 | } | ||
255 | else if(tag == "pS") | ||
256 | { | ||
257 | double threshhold = paramCount > 0 | ||
258 | ? std::atof(params[0].data.text) : 10; | ||
259 | if(data("?pc").toDouble() <= threshhold) | ||
260 | return true; | ||
261 | else | ||
262 | return false; | ||
263 | } | ||
264 | else if(tag == "pE") | ||
265 | { | ||
266 | double threshhold = paramCount > 0 | ||
267 | ? std::atof(params[0].data.text) : 10; | ||
268 | if(data("?pt").toDouble() - data("?pc").toDouble() <= threshhold) | ||
269 | return true; | ||
270 | else | ||
271 | return false; | ||
272 | } | ||
230 | 273 | ||
231 | QPair<InputType, QWidget*> found = | 274 | QPair<InputType, QWidget*> found = |
232 | inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); | 275 | inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); |
@@ -335,3 +378,40 @@ QString DeviceState::directory(QString path, int level) | |||
335 | index = 0; | 378 | index = 0; |
336 | return dirs[index]; | 379 | return dirs[index]; |
337 | } | 380 | } |
381 | |||
382 | QString DeviceState::secsToString(int secs) | ||
383 | { | ||
384 | int hours = 0; | ||
385 | int minutes = 0; | ||
386 | while(secs >= 60) | ||
387 | { | ||
388 | minutes++; | ||
389 | secs -= 60; | ||
390 | } | ||
391 | |||
392 | while(minutes >= 60) | ||
393 | { | ||
394 | hours++; | ||
395 | minutes -= 60; | ||
396 | } | ||
397 | |||
398 | QString retval; | ||
399 | |||
400 | if(hours > 0) | ||
401 | { | ||
402 | retval += QString::number(hours); | ||
403 | if(minutes < 10) | ||
404 | retval += ":0"; | ||
405 | else | ||
406 | retval += ":"; | ||
407 | } | ||
408 | |||
409 | retval += QString::number(minutes); | ||
410 | if(secs < 10) | ||
411 | retval += ":0"; | ||
412 | else | ||
413 | retval += ":"; | ||
414 | |||
415 | retval += QString::number(secs); | ||
416 | return retval; | ||
417 | } | ||
diff --git a/utils/themeeditor/gui/devicestate.h b/utils/themeeditor/gui/devicestate.h index ebd4afec8c..bff27ce678 100644 --- a/utils/themeeditor/gui/devicestate.h +++ b/utils/themeeditor/gui/devicestate.h | |||
@@ -61,6 +61,7 @@ private slots: | |||
61 | private: | 61 | private: |
62 | static QString fileName(QString path, bool extension); | 62 | static QString fileName(QString path, bool extension); |
63 | static QString directory(QString path, int level); | 63 | static QString directory(QString path, int level); |
64 | static QString secsToString(int secs); | ||
64 | 65 | ||
65 | QMap<QString, QPair<InputType, QWidget*> > inputs; | 66 | QMap<QString, QPair<InputType, QWidget*> > inputs; |
66 | QTabWidget tabs; | 67 | QTabWidget tabs; |
diff --git a/utils/themeeditor/resources/deviceoptions b/utils/themeeditor/resources/deviceoptions index 689704577f..56c7927373 100644 --- a/utils/themeeditor/resources/deviceoptions +++ b/utils/themeeditor/resources/deviceoptions | |||
@@ -93,7 +93,7 @@ pe ; Playlist Entries ; spin(0,1000) ; 20 | |||
93 | pn ; Playlist Name ; text ; Current Playlist | 93 | pn ; Playlist Name ; text ; Current Playlist |
94 | pp ; Playlist Position ; spin(0,1000) ; 10 | 94 | pp ; Playlist Position ; spin(0,1000) ; 10 |
95 | ps ; Shuffle ; check ; true | 95 | ps ; Shuffle ; check ; true |
96 | pt ; Total Track Time ; spin(0,1000) ; 180 | 96 | ?pt ; Total Track Time ; spin(0,1000) ; 180 |
97 | Sp ; Playback Pitch ; fspin(50,200) ; 100 | 97 | Sp ; Playback Pitch ; fspin(50,200) ; 100 |
98 | rp ; Song Playcount ; spin(0,10000) ; 20 | 98 | rp ; Song Playcount ; spin(0,10000) ; 20 |
99 | rr ; Song Rating ; spin(0,10) ; 5 | 99 | rr ; Song Rating ; spin(0,10) ; 5 |