summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp225
-rw-r--r--core/multimedia/opieplayer/videowidget.h14
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
@@ -56,7 +56,7 @@ struct MediaButton {
56// Layout information for the videoButtons (and if it is a toggle button or not) 56// Layout information for the videoButtons (and if it is a toggle button or not)
57MediaButton videoButtons[] = { 57MediaButton 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
61 { FALSE, FALSE, FALSE }, // next 61 { FALSE, FALSE, FALSE }, // next
62 { FALSE, FALSE, FALSE }, // volUp 62 { FALSE, FALSE, FALSE }, // volUp
@@ -144,14 +144,14 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
144 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 144 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
145 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 145 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
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) ) );
149 149
150 // Intialise state 150 // Intialise state
151 setLength( mediaPlayerState->length() ); 151 setLength( mediaPlayerState->length() );
152 setPosition( mediaPlayerState->position() ); 152 setPosition( mediaPlayerState->position() );
153 setFullscreen( mediaPlayerState->fullscreen() ); 153 setFullscreen( mediaPlayerState->fullscreen() );
154 setPaused( mediaPlayerState->paused() ); 154// setPaused( mediaPlayerState->paused() );
155 setPlaying( mediaPlayerState->playing() ); 155 setPlaying( mediaPlayerState->playing() );
156} 156}
157 157
@@ -319,24 +319,94 @@ void VideoWidget::paintButton( QPainter *p, int i ) {
319 319
320 320
321void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 321void 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) {
341// case VideoVolUp: 411// case VideoVolUp:
342// emit moreClicked(); 412// emit moreClicked();
@@ -345,65 +415,51 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
345// emit lessClicked(); 415// emit lessClicked();
346// return; 416// return;
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
408 464
409 465
@@ -432,17 +488,8 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
432// } 488// }
433// } 489// }
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}
447 494
448 495
@@ -456,9 +503,9 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
456 { 503 {
457 mediaPlayerState->setFullscreen( FALSE ); 504 mediaPlayerState->setFullscreen( FALSE );
458 makeVisible(); 505 makeVisible();
459
460 mouseMoveEvent( event );
461 } 506 }
507 mouseMoveEvent( event );
508// }
462} 509}
463 510
464 511
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
@@ -28,12 +28,14 @@ class QSlider;
28 28
29 29
30enum VideoButtons { 30enum 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
38}; 40};
39 41
@@ -49,7 +51,7 @@ public slots:
49 void updateSlider( long, long ); 51 void updateSlider( long, long );
50 void sliderPressed( ); 52 void sliderPressed( );
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 ); }
54 void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); } 56 void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); }
55 void makeVisible(); 57 void makeVisible();
@@ -58,6 +60,10 @@ public slots:
58 void setView( char ); 60 void setView( char );
59 61
60signals: 62signals:
63 void moreClicked();
64 void lessClicked();
65 void moreReleased();
66 void lessReleased();
61 void sliderMoved( long ); 67 void sliderMoved( long );
62 68
63protected: 69protected: