Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 582660c..3901446 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -1,110 +1,114 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | ||
21 | #include <qpe/resource.h> | ||
22 | |||
20 | #include <qwidget.h> | 23 | #include <qwidget.h> |
21 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
22 | #include <qbutton.h> | 25 | #include <qbutton.h> |
23 | #include <qpainter.h> | 26 | #include <qpainter.h> |
24 | #include <qframe.h> | 27 | #include <qframe.h> |
25 | #include <qpe/resource.h> | 28 | |
26 | #include "audiowidget.h" | 29 | #include "audiowidget.h" |
27 | #include "mediaplayerstate.h" | 30 | #include "mediaplayerstate.h" |
28 | 31 | ||
29 | extern MediaPlayerState *mediaPlayerState; | 32 | extern MediaPlayerState *mediaPlayerState; |
30 | 33 | ||
31 | 34 | ||
32 | static const int xo = -2; // movable x offset | 35 | static const int xo = -2; // movable x offset |
33 | static const int yo = 22; // movable y offset | 36 | static const int yo = 22; // movable y offset |
34 | 37 | ||
35 | 38 | ||
36 | struct MediaButton { | 39 | struct MediaButton { |
37 | int xPos, yPos; | 40 | int xPos, yPos; |
38 | int color; | 41 | int color; |
39 | bool isToggle, isBig, isHeld, isDown; | 42 | bool isToggle, isBig, isHeld, isDown; |
40 | }; | 43 | }; |
41 | 44 | ||
42 | 45 | ||
43 | // Layout information for the audioButtons (and if it is a toggle button or not) | 46 | // Layout information for the audioButtons (and if it is a toggle button or not) |
44 | MediaButton audioButtons[] = { | 47 | MediaButton audioButtons[] = { |
45 | { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play | 48 | { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play |
46 | { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop | 49 | { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop |
47 | { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause | 50 | { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause |
48 | { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next | 51 | { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next |
49 | { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous | 52 | { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous |
50 | { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up | 53 | { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up |
51 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down | 54 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down |
52 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop | 55 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop |
53 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist | 56 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist |
54 | }; | 57 | }; |
55 | 58 | ||
56 | 59 | ||
57 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 60 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
58 | 61 | ||
59 | 62 | ||
60 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 63 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
61 | QWidget( parent, name, f ) | 64 | QWidget( parent, name, f ) |
62 | { | 65 | { |
66 | // QPEApplication::grabKeyboard(); | ||
63 | setCaption( tr("OpiePlayer") ); | 67 | setCaption( tr("OpiePlayer") ); |
64 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 68 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
65 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); | 69 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); |
66 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); | 70 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); |
67 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls" ) ); | 71 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls" ) ); |
68 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "mpegplayer/animatedButton" ) ); | 72 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "mpegplayer/animatedButton" ) ); |
69 | 73 | ||
70 | songInfo = new Ticker( this ); | 74 | songInfo = new Ticker( this ); |
71 | songInfo->setFocusPolicy( QWidget::NoFocus ); | 75 | songInfo->setFocusPolicy( QWidget::NoFocus ); |
72 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); | 76 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); |
73 | 77 | ||
74 | slider = new QSlider( Qt::Horizontal, this ); | 78 | slider = new QSlider( Qt::Horizontal, this ); |
75 | slider->setFixedWidth( 220 ); | 79 | slider->setFixedWidth( 220 ); |
76 | slider->setFixedHeight( 20 ); | 80 | slider->setFixedHeight( 20 ); |
77 | slider->setMinValue( 0 ); | 81 | slider->setMinValue( 0 ); |
78 | slider->setMaxValue( 1 ); | 82 | slider->setMaxValue( 1 ); |
79 | slider->setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 83 | slider->setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
80 | slider->setFocusPolicy( QWidget::NoFocus ); | 84 | slider->setFocusPolicy( QWidget::NoFocus ); |
81 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); | 85 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); |
82 | 86 | ||
83 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 87 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
84 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 88 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
85 | 89 | ||
86 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 90 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
87 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 91 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
88 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 92 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
89 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 93 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
90 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 94 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
91 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 95 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
92 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 96 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
93 | 97 | ||
94 | // Intialise state | 98 | // Intialise state |
95 | setLength( mediaPlayerState->length() ); | 99 | setLength( mediaPlayerState->length() ); |
96 | setPosition( mediaPlayerState->position() ); | 100 | setPosition( mediaPlayerState->position() ); |
97 | setLooping( mediaPlayerState->fullscreen() ); | 101 | setLooping( mediaPlayerState->fullscreen() ); |
98 | setPaused( mediaPlayerState->paused() ); | 102 | setPaused( mediaPlayerState->paused() ); |
99 | setPlaying( mediaPlayerState->playing() ); | 103 | setPlaying( mediaPlayerState->playing() ); |
100 | 104 | ||
101 | } | 105 | } |
102 | 106 | ||
103 | 107 | ||
104 | AudioWidget::~AudioWidget() { | 108 | AudioWidget::~AudioWidget() { |
105 | for ( int i = 0; i < 4; i++ ) | 109 | for ( int i = 0; i < 4; i++ ) |
106 | delete pixmaps[i]; | 110 | delete pixmaps[i]; |
107 | } | 111 | } |
108 | 112 | ||
109 | 113 | ||
110 | static bool audioSliderBeingMoved = FALSE; | 114 | static bool audioSliderBeingMoved = FALSE; |
@@ -171,106 +175,162 @@ void AudioWidget::toggleButton( int i ) { | |||
171 | audioButtons[i].isDown = !audioButtons[i].isDown; | 175 | audioButtons[i].isDown = !audioButtons[i].isDown; |
172 | QPainter p(this); | 176 | QPainter p(this); |
173 | paintButton ( &p, i ); | 177 | paintButton ( &p, i ); |
174 | } | 178 | } |
175 | 179 | ||
176 | 180 | ||
177 | void AudioWidget::paintButton( QPainter *p, int i ) { | 181 | void AudioWidget::paintButton( QPainter *p, int i ) { |
178 | int x = audioButtons[i].xPos; | 182 | int x = audioButtons[i].xPos; |
179 | int y = audioButtons[i].yPos; | 183 | int y = audioButtons[i].yPos; |
180 | int offset = 22 + 14 * audioButtons[i].isBig + audioButtons[i].isDown; | 184 | int offset = 22 + 14 * audioButtons[i].isBig + audioButtons[i].isDown; |
181 | int buttonSize = 64 + audioButtons[i].isBig * (90 - 64); | 185 | int buttonSize = 64 + audioButtons[i].isBig * (90 - 64); |
182 | p->drawPixmap( x, y, *pixmaps[audioButtons[i].isBig], buttonSize * (audioButtons[i].isDown + 2 * audioButtons[i].color), 0, buttonSize, buttonSize ); | 186 | p->drawPixmap( x, y, *pixmaps[audioButtons[i].isBig], buttonSize * (audioButtons[i].isDown + 2 * audioButtons[i].color), 0, buttonSize, buttonSize ); |
183 | p->drawPixmap( x + offset, y + offset, *pixmaps[2], 18 * i, 0, 18, 18 ); | 187 | p->drawPixmap( x + offset, y + offset, *pixmaps[2], 18 * i, 0, 18, 18 ); |
184 | } | 188 | } |
185 | 189 | ||
186 | 190 | ||
187 | void AudioWidget::timerEvent( QTimerEvent * ) { | 191 | void AudioWidget::timerEvent( QTimerEvent * ) { |
188 | static int frame = 0; | 192 | static int frame = 0; |
189 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { | 193 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { |
190 | frame = frame >= 7 ? 0 : frame + 1; | 194 | frame = frame >= 7 ? 0 : frame + 1; |
191 | int x = audioButtons[AudioPlay].xPos; | 195 | int x = audioButtons[AudioPlay].xPos; |
192 | int y = audioButtons[AudioPlay].yPos; | 196 | int y = audioButtons[AudioPlay].yPos; |
193 | QPainter p( this ); | 197 | QPainter p( this ); |
194 | // Optimize to only draw the little bit of the changing images which is different | 198 | // Optimize to only draw the little bit of the changing images which is different |
195 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); | 199 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); |
196 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); | 200 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); |
197 | } | 201 | } |
198 | } | 202 | } |
199 | 203 | ||
200 | 204 | ||
201 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 205 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
202 | for ( int i = 0; i < numButtons; i++ ) { | 206 | for ( int i = 0; i < numButtons; i++ ) { |
203 | int size = audioButtons[i].isBig; | 207 | int size = audioButtons[i].isBig; |
204 | int x = audioButtons[i].xPos; | 208 | int x = audioButtons[i].xPos; |
205 | int y = audioButtons[i].yPos; | 209 | int y = audioButtons[i].yPos; |
206 | if ( event->state() == QMouseEvent::LeftButton ) { | 210 | if ( event->state() == QMouseEvent::LeftButton ) { |
207 | // The test to see if the mouse click is inside the circular button or not | 211 | // The test to see if the mouse click is inside the circular button or not |
208 | // (compared with the radius squared to avoid a square-root of our distance) | 212 | // (compared with the radius squared to avoid a square-root of our distance) |
209 | int radius = 32 + 13 * size; | 213 | int radius = 32 + 13 * size; |
210 | QPoint center = QPoint( x + radius, y + radius ); | 214 | QPoint center = QPoint( x + radius, y + radius ); |
211 | QPoint dXY = center - event->pos(); | 215 | QPoint dXY = center - event->pos(); |
212 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 216 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
213 | bool isOnButton = dist <= (radius * radius); | 217 | bool isOnButton = dist <= (radius * radius); |
214 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); | 218 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); |
215 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code | 219 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code |
216 | if ( isOnButton && !audioButtons[i].isHeld ) { | 220 | if ( isOnButton && !audioButtons[i].isHeld ) { |
217 | audioButtons[i].isHeld = TRUE; | 221 | audioButtons[i].isHeld = TRUE; |
218 | toggleButton(i); | 222 | toggleButton(i); |
223 | qDebug("button toggled %d",i); | ||
219 | switch (i) { | 224 | switch (i) { |
220 | case AudioVolumeUp: emit moreClicked(); return; | 225 | case AudioVolumeUp: emit moreClicked(); return; |
221 | case AudioVolumeDown: emit lessClicked(); return; | 226 | case AudioVolumeDown: emit lessClicked(); return; |
222 | } | 227 | } |
223 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 228 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
224 | audioButtons[i].isHeld = FALSE; | 229 | audioButtons[i].isHeld = FALSE; |
225 | toggleButton(i); | 230 | toggleButton(i); |
226 | } | 231 | } |
227 | } else { | 232 | } else { |
228 | if ( audioButtons[i].isHeld ) { | 233 | if ( audioButtons[i].isHeld ) { |
229 | audioButtons[i].isHeld = FALSE; | 234 | audioButtons[i].isHeld = FALSE; |
230 | if ( !audioButtons[i].isToggle ) | 235 | if ( !audioButtons[i].isToggle ) |
231 | setToggleButton( i, FALSE ); | 236 | setToggleButton( i, FALSE ); |
232 | switch (i) { | 237 | switch (i) { |
233 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 238 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
234 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 239 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
235 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 240 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; |
236 | case AudioNext: mediaPlayerState->setNext(); return; | 241 | case AudioNext: mediaPlayerState->setNext(); return; |
237 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 242 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
238 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 243 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
239 | case AudioVolumeUp: emit moreReleased(); return; | 244 | case AudioVolumeUp: emit moreReleased(); return; |
240 | case AudioVolumeDown: emit lessReleased(); return; | 245 | case AudioVolumeDown: emit lessReleased(); return; |
241 | case AudioPlayList: mediaPlayerState->setList(); return; | 246 | case AudioPlayList: mediaPlayerState->setList(); return; |
242 | } | 247 | } |
243 | } | 248 | } |
244 | } | 249 | } |
245 | } | 250 | } |
246 | } | 251 | } |
247 | 252 | ||
248 | 253 | ||
249 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 254 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
250 | mouseMoveEvent( event ); | 255 | mouseMoveEvent( event ); |
251 | } | 256 | } |
252 | 257 | ||
253 | 258 | ||
254 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 259 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
255 | mouseMoveEvent( event ); | 260 | mouseMoveEvent( event ); |
256 | } | 261 | } |
257 | 262 | ||
258 | 263 | ||
259 | void AudioWidget::showEvent( QShowEvent* ) { | 264 | void AudioWidget::showEvent( QShowEvent* ) { |
260 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 265 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
261 | mouseMoveEvent( &event ); | 266 | mouseMoveEvent( &event ); |
262 | } | 267 | } |
263 | 268 | ||
264 | 269 | ||
265 | void AudioWidget::closeEvent( QCloseEvent* ) { | 270 | void AudioWidget::closeEvent( QCloseEvent* ) { |
266 | mediaPlayerState->setList(); | 271 | mediaPlayerState->setList(); |
267 | } | 272 | } |
268 | 273 | ||
269 | 274 | ||
270 | void AudioWidget::paintEvent( QPaintEvent * ) { | 275 | void AudioWidget::paintEvent( QPaintEvent * ) { |
271 | QPainter p( this ); | 276 | QPainter p( this ); |
272 | for ( int i = 0; i < numButtons; i++ ) | 277 | for ( int i = 0; i < numButtons; i++ ) |
273 | paintButton( &p, i ); | 278 | paintButton( &p, i ); |
274 | } | 279 | } |
275 | 280 | ||
276 | 281 | ||
282 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | ||
283 | { | ||
284 | switch ( e->key() ) { | ||
285 | ////////////////////////////// Zaurus keys | ||
286 | case Key_Home: | ||
287 | break; | ||
288 | case Key_F9: //activity | ||
289 | break; | ||
290 | case Key_F10: //contacts | ||
291 | break; | ||
292 | case Key_F11: //menu | ||
293 | break; | ||
294 | case Key_F12: //home | ||
295 | break; | ||
296 | case Key_F13: //mail | ||
297 | break; | ||
298 | case Key_Space: { | ||
299 | if(mediaPlayerState->playing()) { | ||
300 | // toggleButton(1); | ||
301 | mediaPlayerState->setPlaying(FALSE); | ||
302 | // toggleButton(1); | ||
303 | } else { | ||
304 | // toggleButton(0); | ||
305 | mediaPlayerState->setPlaying(TRUE); | ||
306 | // toggleButton(0); | ||
307 | } | ||
308 | } | ||
309 | break; | ||
310 | case Key_Down: | ||
311 | toggleButton(6); | ||
312 | emit lessClicked(); | ||
313 | emit lessReleased(); | ||
314 | toggleButton(6); | ||
315 | break; | ||
316 | case Key_Up: | ||
317 | toggleButton(5); | ||
318 | emit moreClicked(); | ||
319 | emit moreReleased(); | ||
320 | toggleButton(5); | ||
321 | break; | ||
322 | case Key_Right: | ||
323 | // toggleButton(3); | ||
324 | mediaPlayerState->setNext(); | ||
325 | // toggleButton(3); | ||
326 | break; | ||
327 | case Key_Left: | ||
328 | // toggleButton(4); | ||
329 | mediaPlayerState->setPrev(); | ||
330 | // toggleButton(4); | ||
331 | break; | ||
332 | case Key_Escape: | ||
333 | break; | ||
334 | |||
335 | }; | ||
336 | } | ||