author | llornkcor <llornkcor> | 2003-04-20 04:09:51 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-04-20 04:09:51 (UTC) |
commit | 0bc47585aef17477ca5564dde4da4a41cf57a1c0 (patch) (unidiff) | |
tree | b425c7820c64c1673680b86a87932401a6e8f4a1 /core/multimedia/opieplayer | |
parent | f4b192f79649abb3318c2c404da31f067f4ca467 (diff) | |
download | opie-0bc47585aef17477ca5564dde4da4a41cf57a1c0.zip opie-0bc47585aef17477ca5564dde4da4a41cf57a1c0.tar.gz opie-0bc47585aef17477ca5564dde4da4a41cf57a1c0.tar.bz2 |
buttons working
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 225 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.h | 14 |
2 files changed, 146 insertions, 93 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 1b38206..6ed0108 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -58,3 +58,3 @@ MediaButton videoButtons[] = { | |||
58 | { FALSE, FALSE, FALSE }, // stop | 58 | { FALSE, FALSE, FALSE }, // stop |
59 | { TRUE, FALSE, FALSE }, // play | 59 | { FALSE, FALSE, FALSE }, // play |
60 | { FALSE, FALSE, FALSE }, // previous | 60 | { FALSE, FALSE, FALSE }, // previous |
@@ -146,3 +146,3 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
146 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 146 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
147 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 147 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
148 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 148 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
@@ -153,3 +153,3 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
153 | setFullscreen( mediaPlayerState->fullscreen() ); | 153 | setFullscreen( mediaPlayerState->fullscreen() ); |
154 | setPaused( mediaPlayerState->paused() ); | 154 | // setPaused( mediaPlayerState->paused() ); |
155 | setPlaying( mediaPlayerState->playing() ); | 155 | setPlaying( mediaPlayerState->playing() ); |
@@ -321,20 +321,90 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
321 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 321 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
322 | 322 | for ( int i = 0; i < numVButtons; i++ ) { | |
323 | for ( int i = 0; i < numVButtons; i++ ) | 323 | if ( event->state() == QMouseEvent::LeftButton ) { |
324 | { | 324 | // The test to see if the mouse click is inside the button or not |
325 | if ( event->state() == QMouseEvent::LeftButton ) | 325 | int x = event->pos().x() - xoff; |
326 | { | 326 | int y = event->pos().y() - yoff; |
327 | // The test to see if the mouse click is inside the button or not | 327 | |
328 | int x = event->pos().x() - xoff; | 328 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
329 | int y = event->pos().y() - yoff; | 329 | && y < imgButtonMask->height() |
330 | 330 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | |
331 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 331 | |
332 | && y < imgButtonMask->height() | 332 | if ( isOnButton && !videoButtons[i].isHeld ) { |
333 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 333 | videoButtons[i].isHeld = TRUE; |
334 | 334 | toggleButton(i); | |
335 | if ( isOnButton && !videoButtons[i].isHeld ) | 335 | |
336 | { | 336 | switch (i) { |
337 | videoButtons[i].isHeld = TRUE; | 337 | case VideoVolUp: |
338 | toggleButton(i); | 338 | emit moreClicked(); |
339 | 339 | return; | |
340 | case VideoVolDown: | ||
341 | emit lessClicked(); | ||
342 | return; | ||
343 | } | ||
344 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | ||
345 | videoButtons[i].isHeld = FALSE; | ||
346 | toggleButton(i); | ||
347 | } | ||
348 | } else { | ||
349 | |||
350 | if ( videoButtons[i].isHeld ) { | ||
351 | videoButtons[i].isHeld = FALSE; | ||
352 | if ( !videoButtons[i].isToggle ) { | ||
353 | setToggleButton( i, FALSE ); | ||
354 | } | ||
355 | |||
356 | switch(i) { | ||
357 | |||
358 | case VideoPlay: { | ||
359 | qDebug("play"); | ||
360 | if( !mediaPlayerState->playing()) { | ||
361 | mediaPlayerState->setPlaying( true); | ||
362 | setToggleButton( i-1, false ); | ||
363 | setToggleButton( i, false ); | ||
364 | return; | ||
365 | } | ||
366 | if( mediaPlayerState->isPaused ) { | ||
367 | qDebug("isPaused"); | ||
368 | setToggleButton( i, FALSE ); | ||
369 | mediaPlayerState->setPaused( FALSE ); | ||
370 | return; | ||
371 | } else if( !mediaPlayerState->isPaused ) { | ||
372 | qDebug("is not paused"); | ||
373 | setToggleButton( i, TRUE ); | ||
374 | mediaPlayerState->setPaused( TRUE ); | ||
375 | return; | ||
376 | } else { | ||
377 | return; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; | ||
382 | case VideoNext: mediaPlayerState->setNext(); return; | ||
383 | case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
384 | case VideoVolUp: emit moreReleased(); return; | ||
385 | case VideoVolDown: emit lessReleased(); return; | ||
386 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
387 | } | ||
388 | } | ||
389 | } | ||
390 | } | ||
391 | |||
392 | // for ( int i = 0; i < numVButtons; i++ ) | ||
393 | // { | ||
394 | // if ( event->state() == QMouseEvent::LeftButton ) | ||
395 | // { | ||
396 | // // The test to see if the mouse click is inside the button or not | ||
397 | // int x = event->pos().x() - xoff; | ||
398 | // int y = event->pos().y() - yoff; | ||
399 | |||
400 | // bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | ||
401 | // && y < imgButtonMask->height() | ||
402 | // && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | ||
403 | |||
404 | // if ( isOnButton && !videoButtons[i].isHeld ) | ||
405 | // { | ||
406 | // qDebug("key %d", i); | ||
407 | |||
408 | // videoButtons[i].isHeld = TRUE; | ||
409 | // toggleButton(i); | ||
340 | // switch (i) { | 410 | // switch (i) { |
@@ -347,61 +417,47 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
347 | // } | 417 | // } |
348 | } | 418 | // } else if ( !isOnButton && videoButtons[i].isHeld ) { |
349 | else if ( !isOnButton && videoButtons[i].isHeld ) | 419 | // videoButtons[i].isHeld = FALSE; |
350 | { | 420 | // toggleButton(i); |
351 | videoButtons[i].isHeld = FALSE; | 421 | // } |
352 | toggleButton(i); | ||
353 | } | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | 422 | ||
358 | if ( videoButtons[i].isHeld ) | ||
359 | { | ||
360 | videoButtons[i].isHeld = FALSE; | ||
361 | if ( !videoButtons[i].isToggle ) | ||
362 | { | ||
363 | setToggleButton( i, FALSE ); | ||
364 | } | ||
365 | qDebug("key %d", i); | ||
366 | switch(i) | ||
367 | { | ||
368 | // case VideoPlay: | ||
369 | // { | ||
370 | // if( mediaPlayerState->isPaused ) | ||
371 | // { | ||
372 | // setToggleButton( i, FALSE ); | ||
373 | // mediaPlayerState->setPaused( FALSE ); | ||
374 | // return; | ||
375 | // } | ||
376 | // else if( !mediaPlayerState->isPaused ) | ||
377 | // { | ||
378 | // setToggleButton( i, TRUE ); | ||
379 | // mediaPlayerState->setPaused( TRUE ); | ||
380 | // return; | ||
381 | // } | ||
382 | // else | ||
383 | // { | ||
384 | // return; | ||
385 | // } | ||
386 | // } | ||
387 | 423 | ||
388 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 424 | // } else { |
389 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
390 | // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
391 | case VideoNext: mediaPlayerState->setNext(); return; | ||
392 | case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
393 | // case VideoPlayList: mediaPlayerState->setList(); return; | ||
394 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
395 | |||
396 | // case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | ||
397 | // case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; | ||
398 | // case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; | ||
399 | // case VideoVolUp: emit moreReleased(); return; | ||
400 | // case VideoVolDown: emit lessReleased(); return; | ||
401 | // case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
402 | } | ||
403 | } | ||
404 | } | ||
405 | } | ||
406 | 425 | ||
426 | // if ( videoButtons[i].isHeld ) | ||
427 | // { | ||
428 | // videoButtons[i].isHeld = FALSE; | ||
429 | // if ( !videoButtons[i].isToggle ) { | ||
430 | // setToggleButton( i, FALSE ); | ||
431 | // } | ||
432 | // qDebug("key %d", i); | ||
433 | // switch(i) { | ||
434 | // case VideoPlay: | ||
435 | // { | ||
436 | // if( mediaPlayerState->isPaused ) { | ||
437 | // setToggleButton( i, FALSE ); | ||
438 | // mediaPlayerState->setPaused( FALSE ); | ||
439 | // return; | ||
440 | // } | ||
441 | // else if( !mediaPlayerState->isPaused ) { | ||
442 | // setToggleButton( i, TRUE ); | ||
443 | // mediaPlayerState->setPaused( TRUE ); | ||
444 | // return; | ||
445 | // } else { | ||
446 | // return; | ||
447 | // } | ||
448 | // } | ||
449 | |||
450 | // case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
451 | // // case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | ||
452 | // // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
453 | // case VideoNext: mediaPlayerState->setNext(); return; | ||
454 | // case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
455 | // case VideoVolUp: emit moreReleased(); return; | ||
456 | // case VideoVolDown: emit lessReleased(); return; | ||
457 | // // case VideoPlayList: mediaPlayerState->setList(); return; | ||
458 | // case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
459 | // } | ||
460 | // } | ||
461 | // } | ||
462 | // } | ||
407 | 463 | ||
@@ -434,13 +490,4 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
434 | 490 | ||
435 | // switch (i) { | ||
436 | // case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | ||
437 | // case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
438 | // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
439 | // case VideoNext: mediaPlayerState->setNext(); return; | ||
440 | // case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
441 | // case VideoPlayList: mediaPlayerState->setList(); return; | ||
442 | // case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
443 | // } | ||
444 | 491 | ||
445 | // } | 492 | // } |
446 | } | 493 | } |
@@ -458,5 +505,5 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
458 | makeVisible(); | 505 | makeVisible(); |
459 | |||
460 | mouseMoveEvent( event ); | ||
461 | } | 506 | } |
507 | mouseMoveEvent( event ); | ||
508 | // } | ||
462 | } | 509 | } |
diff --git a/core/multimedia/opieplayer/videowidget.h b/core/multimedia/opieplayer/videowidget.h index fd86cd2..e9778f1 100644 --- a/core/multimedia/opieplayer/videowidget.h +++ b/core/multimedia/opieplayer/videowidget.h | |||
@@ -30,8 +30,10 @@ class QSlider; | |||
30 | enum VideoButtons { | 30 | enum VideoButtons { |
31 | VideoPrevious, | ||
32 | VideoStop, | 31 | VideoStop, |
33 | VideoPlay, | 32 | VideoPlay, |
34 | VideoPause, | 33 | // VideoPause, |
34 | VideoPrevious, | ||
35 | VideoNext, | 35 | VideoNext, |
36 | VideoPlayList, | 36 | VideoVolUp, |
37 | VideoVolDown, | ||
38 | // VideoPlayList, | ||
37 | VideoFullscreen | 39 | VideoFullscreen |
@@ -51,3 +53,3 @@ public slots: | |||
51 | void sliderReleased( ); | 53 | void sliderReleased( ); |
52 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } | 54 | // void setPaused( bool b) { setToggleButton( VideoPause, b ); } |
53 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } | 55 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } |
@@ -60,2 +62,6 @@ public slots: | |||
60 | signals: | 62 | signals: |
63 | void moreClicked(); | ||
64 | void lessClicked(); | ||
65 | void moreReleased(); | ||
66 | void lessReleased(); | ||
61 | void sliderMoved( long ); | 67 | void sliderMoved( long ); |