diff options
-rw-r--r-- | utils/themeeditor/graphics/rbprogressbar.cpp | 18 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbprogressbar.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.cpp | 31 | ||||
-rw-r--r-- | utils/themeeditor/resources/deviceoptions | 1 |
4 files changed, 48 insertions, 4 deletions
diff --git a/utils/themeeditor/graphics/rbprogressbar.cpp b/utils/themeeditor/graphics/rbprogressbar.cpp index 1c14acfc5a..027520f4da 100644 --- a/utils/themeeditor/graphics/rbprogressbar.cpp +++ b/utils/themeeditor/graphics/rbprogressbar.cpp | |||
@@ -25,7 +25,8 @@ | |||
25 | #include "projectmodel.h" | 25 | #include "projectmodel.h" |
26 | 26 | ||
27 | RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info, | 27 | RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info, |
28 | int paramCount, skin_tag_parameter *params) | 28 | int paramCount, skin_tag_parameter *params, |
29 | bool pv) | ||
29 | :QGraphicsItem(parent) | 30 | :QGraphicsItem(parent) |
30 | { | 31 | { |
31 | /* First we set everything to defaults */ | 32 | /* First we set everything to defaults */ |
@@ -72,7 +73,20 @@ RBProgressBar::RBProgressBar(RBViewport *parent, const RBRenderInfo &info, | |||
72 | 73 | ||
73 | 74 | ||
74 | /* Finally, we scale the width according to the amount played */ | 75 | /* Finally, we scale the width according to the amount played */ |
75 | int percent = info.device()->data("px").toInt(); | 76 | int percent; |
77 | if(pv) | ||
78 | { | ||
79 | percent = (info.device()->data("pv").toInt() + 50) * 100 / 56; | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | percent = info.device()->data("px").toInt(); | ||
84 | } | ||
85 | if(percent > 100) | ||
86 | percent = 100; | ||
87 | if(percent < 0) | ||
88 | percent = 0; | ||
89 | |||
76 | w = w * percent / 100; | 90 | w = w * percent / 100; |
77 | 91 | ||
78 | size = QRectF(0, 0, w, h); | 92 | size = QRectF(0, 0, w, h); |
diff --git a/utils/themeeditor/graphics/rbprogressbar.h b/utils/themeeditor/graphics/rbprogressbar.h index edcdd01d6e..e72479853e 100644 --- a/utils/themeeditor/graphics/rbprogressbar.h +++ b/utils/themeeditor/graphics/rbprogressbar.h | |||
@@ -34,7 +34,7 @@ class RBProgressBar : public QGraphicsItem | |||
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | RBProgressBar(RBViewport* parent, const RBRenderInfo& info, | 36 | RBProgressBar(RBViewport* parent, const RBRenderInfo& info, |
37 | int paramCount, skin_tag_parameter* params); | 37 | int paramCount, skin_tag_parameter* params, bool pv = 0); |
38 | virtual ~RBProgressBar(); | 38 | virtual ~RBProgressBar(); |
39 | 39 | ||
40 | QRectF boundingRect() const; | 40 | QRectF boundingRect() const; |
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp index 973ceb598b..1b894b7c33 100644 --- a/utils/themeeditor/models/parsetreenode.cpp +++ b/utils/themeeditor/models/parsetreenode.cpp | |||
@@ -660,6 +660,17 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport) | |||
660 | new RBProgressBar(viewport, info, element->params_count, | 660 | new RBProgressBar(viewport, info, element->params_count, |
661 | element->params); | 661 | element->params); |
662 | return true; | 662 | return true; |
663 | |||
664 | case 'v': | ||
665 | /* %pv */ | ||
666 | if(element->params_count > 0) | ||
667 | { | ||
668 | new RBProgressBar(viewport, info, element->params_count, | ||
669 | element->params, true); | ||
670 | return true; | ||
671 | } | ||
672 | else | ||
673 | return false; | ||
663 | } | 674 | } |
664 | 675 | ||
665 | return false; | 676 | return false; |
@@ -928,6 +939,26 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional, | |||
928 | child = ((branches - 1) * child / 100) + 1; | 939 | child = ((branches - 1) * child / 100) + 1; |
929 | } | 940 | } |
930 | } | 941 | } |
942 | else if(QString(element->tag->name) == "pv") | ||
943 | { | ||
944 | /* ?pv gets scaled to the number of available children, sandwiched | ||
945 | * in between mute and 0/>0dB. I assume a floor of -50dB for the | ||
946 | * time being | ||
947 | */ | ||
948 | int dB = val.toInt(); | ||
949 | |||
950 | if(dB < -50) | ||
951 | child = 0; | ||
952 | else if(dB == 0) | ||
953 | child = branches - 2; | ||
954 | else if(dB > 0) | ||
955 | child = branches - 1; | ||
956 | else | ||
957 | { | ||
958 | int options = branches - 3; | ||
959 | child = (options * (dB + 50)) / 50; | ||
960 | } | ||
961 | } | ||
931 | else if(QString(element->tag->name) == "px") | 962 | else if(QString(element->tag->name) == "px") |
932 | { | 963 | { |
933 | child = val.toInt(); | 964 | child = val.toInt(); |
diff --git a/utils/themeeditor/resources/deviceoptions b/utils/themeeditor/resources/deviceoptions index 771229a453..cc349c5418 100644 --- a/utils/themeeditor/resources/deviceoptions +++ b/utils/themeeditor/resources/deviceoptions | |||
@@ -105,7 +105,6 @@ artheight; Album Art Height ; spin(0,500) ; 100 | |||
105 | 105 | ||
106 | [Hardware Status] | 106 | [Hardware Status] |
107 | pv ; Current Volume (dB) ; spin(-100,100) ; 0 | 107 | pv ; Current Volume (dB) ; spin(-100,100) ; 0 |
108 | ?pv ; Current Volume (Conditional) ; combo(Mute, Below 0 dB, 0 dB, Above 0 dB) ; 0 dB | ||
109 | bl ; Battery Level (-1 for unknown) ; spin(-1,100) ; 50 | 108 | bl ; Battery Level (-1 for unknown) ; spin(-1,100) ; 50 |
110 | bv ; Battery Volts ; spin(0,20) ; 5 | 109 | bv ; Battery Volts ; spin(0,20) ; 5 |
111 | bt ; Time Left (-1 for unknown) ; spin(-1,500); 100 | 110 | bt ; Time Left (-1 for unknown) ; spin(-1,500); 100 |