diff options
Diffstat (limited to 'utils/themeeditor/graphics')
-rw-r--r-- | utils/themeeditor/graphics/rbtoucharea.cpp | 55 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbtoucharea.h | 4 |
2 files changed, 57 insertions, 2 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 | ||
28 | RBTouchArea::RBTouchArea(int width, int height, QString action, | 30 | RBTouchArea::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 | ||
37 | RBTouchArea::~RBTouchArea() | 41 | RBTouchArea::~RBTouchArea() |
@@ -56,3 +60,52 @@ void RBTouchArea::paint(QPainter *painter, | |||
56 | painter->drawRect(size); | 60 | painter->drawRect(size); |
57 | } | 61 | } |
58 | } | 62 | } |
63 | |||
64 | void 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 | } | ||
diff --git a/utils/themeeditor/graphics/rbtoucharea.h b/utils/themeeditor/graphics/rbtoucharea.h index eb25d83261..ccc3edb272 100644 --- a/utils/themeeditor/graphics/rbtoucharea.h +++ b/utils/themeeditor/graphics/rbtoucharea.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <QGraphicsItem> | 25 | #include <QGraphicsItem> |
26 | 26 | ||
27 | #include "rbrenderinfo.h" | 27 | #include "rbrenderinfo.h" |
28 | #include "devicestate.h" | ||
28 | 29 | ||
29 | class RBTouchArea : public QGraphicsItem | 30 | class RBTouchArea : public QGraphicsItem |
30 | { | 31 | { |
@@ -37,11 +38,12 @@ public: | |||
37 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, | 38 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
38 | QWidget *widget); | 39 | QWidget *widget); |
39 | 40 | ||
41 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
40 | 42 | ||
41 | private: | 43 | private: |
42 | QRectF size; | 44 | QRectF size; |
43 | QString action; | 45 | QString action; |
44 | RBScreen* screen; | 46 | DeviceState* device; |
45 | bool debug; | 47 | bool debug; |
46 | }; | 48 | }; |
47 | 49 | ||