author | llornkcor <llornkcor> | 2002-08-13 23:42:50 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-13 23:42:50 (UTC) |
commit | 6baf582094b418ec1defa2415210a7d7583628ff (patch) (side-by-side diff) | |
tree | e7ee4a196eeb23a1b9276ab09f01aaf39ced83e3 /noncore/multimedia/opieplayer2/videowidget.cpp | |
parent | 8abcf5a17d4ec31ad01557b69b8b0e7d97dc0c8f (diff) | |
download | opie-6baf582094b418ec1defa2415210a7d7583628ff.zip opie-6baf582094b418ec1defa2415210a7d7583628ff.tar.gz opie-6baf582094b418ec1defa2415210a7d7583628ff.tar.bz2 |
fix video button actions.. still needs work
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 87 |
1 files changed, 72 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 9b88299..33153d4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -65,8 +65,8 @@ struct MediaButton { MediaButton videoButtons[] = { - { FALSE, FALSE, FALSE }, // previous { FALSE, FALSE, FALSE }, // stop { TRUE, FALSE, FALSE }, // play - { TRUE, FALSE, FALSE }, // pause + { FALSE, FALSE, FALSE }, // previous { FALSE, FALSE, FALSE }, // next - { FALSE, FALSE, FALSE }, // playlist + { FALSE, FALSE, FALSE }, // volUp + { FALSE, FALSE, FALSE }, // volDown { TRUE, FALSE, FALSE } // fullscreen @@ -78,3 +78,3 @@ const char *skinV_mask_file_names[7] = { -static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); +static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); @@ -139,2 +139,3 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); + connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); @@ -154,2 +155,3 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { VideoWidget::~VideoWidget() { + mediaPlayerState->setPlaying( FALSE ); for ( int i = 0; i < 7; i++ ) { @@ -166,2 +168,3 @@ VideoWidget::~VideoWidget() { } + } @@ -292,3 +295,3 @@ void VideoWidget::paintButton( QPainter *p, int i ) { void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( int i = 0; i < numButtons; i++ ) { + for ( int i = 0; i < numVButtons; i++ ) { if ( event->state() == QMouseEvent::LeftButton ) { @@ -304,2 +307,38 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { } + +// qDebug("mouseMove event switch1 %d", i); + if( isOnButton) + switch (i) { + case VideoStop:{ + setToggleButton( i, FALSE ); + mediaPlayerState->setStop(TRUE); + mediaPlayerState->setPlaying(FALSE); + return; + } + case VideoPlay: { + + if( mediaPlayerState->isPaused) { + setToggleButton( i, FALSE ); + mediaPlayerState->setPaused( FALSE); + return; + } + else if( mediaPlayerState->isPlaying) { + setToggleButton( i, TRUE ); + mediaPlayerState->setPaused( TRUE); + return; + } + else { + setToggleButton( i, FALSE ); + mediaPlayerState->setPlaying( videoButtons[i].isDown ); + return; + } + } + case VideoNext: qDebug("next"); mediaPlayerState->setNext(); return; + case VideoPrevious: qDebug("previous"); mediaPlayerState->setPrev(); return; + case VideoVolUp: return; + case VideoVolDown: return; + case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; + + }; + } else { @@ -307,16 +346,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { videoButtons[i].isHeld = FALSE; - if ( !videoButtons[i].isToggle ) + if ( !videoButtons[i].isToggle ) { setToggleButton( i, FALSE ); } - } +// qDebug("mouseMove event switch2 %d %d", i, VideoPlay); switch (i) { - case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; + case VideoPlay: { + if( mediaPlayerState->isPaused) { + mediaPlayerState->setPaused( FALSE); return; } + else if( mediaPlayerState->isPlaying) { + mediaPlayerState->setPaused( TRUE); return; } + else + mediaPlayerState->setPlaying( TRUE /*videoButtons[i].isDown*/ ); return; + } case VideoStop: mediaPlayerState->setPlaying(FALSE); return; - case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; +// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; case VideoNext: mediaPlayerState->setNext(); return; case VideoPrevious: mediaPlayerState->setPrev(); return; - case VideoPlayList: mediaPlayerState->setList(); return; + case VideoVolUp: return; + case VideoVolDown: return; case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; } - + } + } } @@ -373,3 +421,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); - for ( int i = 0; i < numButtons; i++ ) + for ( int i = 0; i < numVButtons; i++ ) paintButton( &p, i ); @@ -379,3 +427,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); - for ( int i = 0; i < numButtons; i++ ) + for ( int i = 0; i < numVButtons; i++ ) paintButton( &p, i ); @@ -385,4 +433,4 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { // } -// // draw the slider -// slider->repaint( TRUE ); + // draw the slider + slider->repaint( TRUE ); } @@ -466 +514,10 @@ void VideoWidget::setFullscreen ( bool b ) { } + +void VideoWidget::setPaused( bool b) { +// setToggleButton( VideoPause, b ); +} + +void VideoWidget::setPlaying( bool b) { + setToggleButton( VideoPlay, b ); +} + |