summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbtoucharea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/graphics/rbtoucharea.cpp')
-rw-r--r--utils/themeeditor/graphics/rbtoucharea.cpp55
1 files changed, 54 insertions, 1 deletions
diff --git a/utils/themeeditor/graphics/rbtoucharea.cpp b/utils/themeeditor/graphics/rbtoucharea.cpp
index 20d30d813f..e41129a213 100644
--- a/utils/themeeditor/graphics/rbtoucharea.cpp
+++ b/utils/themeeditor/graphics/rbtoucharea.cpp
@@ -24,14 +24,18 @@
24#include "devicestate.h" 24#include "devicestate.h"
25 25
26#include <QPainter> 26#include <QPainter>
27#include <QDebug>
28#include <QGraphicsSceneMouseEvent>
27 29
28RBTouchArea::RBTouchArea(int width, int height, QString action, 30RBTouchArea::RBTouchArea(int width, int height, QString action,
29 const RBRenderInfo& info) 31 const RBRenderInfo& info)
30 : QGraphicsItem(info.screen()), 32 : QGraphicsItem(info.screen()),
31 size(QRectF(0, 0, width, height)), action(action) 33 size(QRectF(0, 0, width, height)), action(action),
34 device(info.device())
32{ 35{
33 debug = info.device()->data("showtouch").toBool(); 36 debug = info.device()->data("showtouch").toBool();
34 setZValue(5); 37 setZValue(5);
38 setCursor(Qt::PointingHandCursor);
35} 39}
36 40
37RBTouchArea::~RBTouchArea() 41RBTouchArea::~RBTouchArea()
@@ -56,3 +60,52 @@ void RBTouchArea::paint(QPainter *painter,
56 painter->drawRect(size); 60 painter->drawRect(size);
57 } 61 }
58} 62}
63
64void RBTouchArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
65{
66 if(action[0] == '&')
67 action = action.right(action.count() - 1);
68
69 action = action.toLower();
70
71 if(action == "play")
72 {
73 if(device->data("?mp").toInt() == 2)
74 device->setData("mp", "Play");
75 else
76 device->setData("mp", "Pause");
77 }
78 else if(action == "ffwd")
79 {
80 device->setData("mp", "Fast Forward");
81 }
82 else if(action == "rwd")
83 {
84 device->setData("mp", "Rewind");
85 }
86 else if(action == "repmode")
87 {
88 int index = device->data("?mm").toInt();
89 index = (index + 1) % 5;
90 device->setData("mm", index);
91 }
92 else if(action == "shuffle")
93 {
94 device->setData("ps", !device->data("ps").toBool());
95 }
96 else if(action == "volup")
97 {
98 device->setData("pv", device->data("pv").toInt() + 1);
99 }
100 else if(action == "voldown")
101 {
102 device->setData("pv", device->data("pv").toInt() - 1);
103 }
104 else
105 {
106 event->ignore();
107 return;
108 }
109
110 event->accept();
111}