Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 0e9e7ea..955169c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -59,25 +59,25 @@ void Ticker::drawContents( QPainter *p ) { | |||
59 | } | 59 | } |
60 | p->drawPixmap( 0, 0, pm ); | 60 | p->drawPixmap( 0, 0, pm ); |
61 | } | 61 | } |
62 | 62 | ||
63 | struct MediaButton { | 63 | struct MediaButton { |
64 | bool isToggle, isHeld, isDown; | 64 | bool isToggle, isHeld, isDown; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | //Layout information for the audioButtons (and if it is a toggle button or not) | 67 | //Layout information for the audioButtons (and if it is a toggle button or not) |
68 | MediaButton audioButtons[] = { | 68 | MediaButton audioButtons[] = { |
69 | { TRUE, FALSE, FALSE }, // play | 69 | { TRUE, FALSE, FALSE }, // play |
70 | { FALSE, FALSE, FALSE }, // stop | 70 | { FALSE, FALSE, FALSE }, // stop |
71 | { TRUE, FALSE, FALSE }, // pause | 71 | { FALSE, FALSE, FALSE }, // pause |
72 | { FALSE, FALSE, FALSE }, // next | 72 | { FALSE, FALSE, FALSE }, // next |
73 | { FALSE, FALSE, FALSE }, // previous | 73 | { FALSE, FALSE, FALSE }, // previous |
74 | { FALSE, FALSE, FALSE }, // volume up | 74 | { FALSE, FALSE, FALSE }, // volume up |
75 | { FALSE, FALSE, FALSE }, // volume down | 75 | { FALSE, FALSE, FALSE }, // volume down |
76 | { TRUE, FALSE, FALSE }, // repeat/loop | 76 | { TRUE, FALSE, FALSE }, // repeat/loop |
77 | { FALSE, FALSE, FALSE }, // playlist | 77 | { FALSE, FALSE, FALSE }, // playlist |
78 | { FALSE, FALSE, FALSE }, // forward | 78 | { FALSE, FALSE, FALSE }, // forward |
79 | { FALSE, FALSE, FALSE } // back | 79 | { FALSE, FALSE, FALSE } // back |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *skin_mask_file_names[11] = { | 82 | const char *skin_mask_file_names[11] = { |
83 | "play", "stop", "pause", "next", "prev", "up", | 83 | "play", "stop", "pause", "next", "prev", "up", |
@@ -333,28 +333,24 @@ void AudioWidget::toggleButton( int i ) { | |||
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void AudioWidget::paintButton( QPainter *p, int i ) { | 336 | void AudioWidget::paintButton( QPainter *p, int i ) { |
337 | if ( audioButtons[i].isDown ) | 337 | if ( audioButtons[i].isDown ) |
338 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 338 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
339 | else | 339 | else |
340 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 340 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | void AudioWidget::timerEvent( QTimerEvent * ) { | 344 | void AudioWidget::timerEvent( QTimerEvent * ) { |
345 | // static int frame = 0; | ||
346 | // if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { | ||
347 | // frame = frame >= 7 ? 0 : frame + 1; | ||
348 | // } | ||
349 | } | 345 | } |
350 | 346 | ||
351 | 347 | ||
352 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 348 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
353 | for ( int i = 0; i < numButtons; i++ ) { | 349 | for ( int i = 0; i < numButtons; i++ ) { |
354 | if ( event->state() == QMouseEvent::LeftButton ) { | 350 | if ( event->state() == QMouseEvent::LeftButton ) { |
355 | 351 | ||
356 | // The test to see if the mouse click is inside the button or not | 352 | // The test to see if the mouse click is inside the button or not |
357 | int x = event->pos().x() - xoff; | 353 | int x = event->pos().x() - xoff; |
358 | int y = event->pos().y() - yoff; | 354 | int y = event->pos().y() - yoff; |
359 | 355 | ||
360 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 356 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
@@ -362,35 +358,39 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
362 | 358 | ||
363 | if ( isOnButton && i == AudioVolumeUp ) | 359 | if ( isOnButton && i == AudioVolumeUp ) |
364 | qDebug("on up"); | 360 | qDebug("on up"); |
365 | 361 | ||
366 | if ( isOnButton && !audioButtons[i].isHeld ) { | 362 | if ( isOnButton && !audioButtons[i].isHeld ) { |
367 | audioButtons[i].isHeld = TRUE; | 363 | audioButtons[i].isHeld = TRUE; |
368 | toggleButton(i); | 364 | toggleButton(i); |
369 | switch (i) { | 365 | switch (i) { |
370 | case AudioVolumeUp: | 366 | case AudioVolumeUp: |
371 | qDebug("more clicked"); | 367 | qDebug("more clicked"); |
372 | emit moreClicked(); | 368 | emit moreClicked(); |
373 | return; | 369 | return; |
374 | case AudioVolumeDown: emit lessClicked(); return; | 370 | case AudioVolumeDown: |
371 | emit lessClicked(); | ||
372 | return; | ||
375 | } | 373 | } |
376 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 374 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
377 | audioButtons[i].isHeld = FALSE; | 375 | audioButtons[i].isHeld = FALSE; |
378 | toggleButton(i); | 376 | toggleButton(i); |
379 | } | 377 | } |
380 | } else { | 378 | } else { |
381 | if ( audioButtons[i].isHeld ) { | 379 | if ( audioButtons[i].isHeld ) { |
382 | audioButtons[i].isHeld = FALSE; | 380 | audioButtons[i].isHeld = FALSE; |
383 | if ( !audioButtons[i].isToggle ) | 381 | if ( !audioButtons[i].isToggle ) { |
384 | setToggleButton( i, FALSE ); | 382 | setToggleButton( i, FALSE ); |
383 | qDebug("button toggled3 %d",i); | ||
384 | } | ||
385 | switch (i) { | 385 | switch (i) { |
386 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 386 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
387 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 387 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
388 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 388 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; |
389 | case AudioNext: mediaPlayerState->setNext(); return; | 389 | case AudioNext: mediaPlayerState->setNext(); return; |
390 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 390 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
391 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 391 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
392 | case AudioVolumeUp: emit moreReleased(); return; | 392 | case AudioVolumeUp: emit moreReleased(); return; |
393 | case AudioVolumeDown: emit lessReleased(); return; | 393 | case AudioVolumeDown: emit lessReleased(); return; |
394 | case AudioPlayList: mediaPlayerState->setList(); return; | 394 | case AudioPlayList: mediaPlayerState->setList(); return; |
395 | } | 395 | } |
396 | } | 396 | } |