-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 21 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 99 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 11 |
6 files changed, 105 insertions, 50 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8d8e4e5..a3238f0 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -33,3 +33,5 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); + connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); + connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); @@ -52,6 +54,5 @@ MediaPlayer::~MediaPlayer() { void MediaPlayer::pauseCheck( bool b ) { - // Only pause if playing - if ( b && !mediaPlayerState->playing() ) { - mediaPlayerState->setPaused( FALSE ); - } + if ( b && !mediaPlayerState->playing() ) { + mediaPlayerState->setPaused( FALSE ); + } } @@ -59,4 +60,4 @@ void MediaPlayer::pauseCheck( bool b ) { void MediaPlayer::play() { - mediaPlayerState->setPlaying( FALSE ); - mediaPlayerState->setPlaying( TRUE ); + mediaPlayerState->setPlaying( FALSE ); + mediaPlayerState->setPlaying( TRUE ); } @@ -69,6 +70,6 @@ void MediaPlayer::setPlaying( bool play ) { - if ( mediaPlayerState->paused() ) { - mediaPlayerState->setPaused( FALSE ); - return; - } + if ( mediaPlayerState->paused() ) { + mediaPlayerState->setPaused( FALSE ); + return; + } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 57b1c81..bb8d905 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -55,4 +55,2 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { - - // public stuff @@ -161,10 +159,9 @@ void MediaPlayerState::setPlaylist( bool b ) { void MediaPlayerState::setPaused( bool b ) { -if(b) qDebug("setPaused true"); - else qDebug("setPaused false"); - - if ( isPaused == b ) { - return; - } - isPaused = b; - emit pausedToggled(b); + if ( isPaused == b ) { + isPaused = FALSE; + emit pausedToggled(FALSE); + return; + } + isPaused = b; + emit pausedToggled(b); } @@ -262,3 +259,3 @@ void MediaPlayerState::togglePlaylist() { void MediaPlayerState::togglePaused() { - setPaused( !isPaused); + setPaused( !isPaused); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 65458e7..27db464 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -166,3 +166,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) - pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), this, SLOT( toggleFull() ) ); + pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); @@ -173,3 +173,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) - pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), this, SLOT(toggleScaled() ) ); + pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index fdfa666..dd49892 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -64,3 +64,2 @@ private: - void initializeStates(); 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 ) { @@ -299,3 +302,3 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() - && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); + && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); if ( isOnButton != videoButtons[i].isHeld ) { @@ -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: { + 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 VideoNext: mediaPlayerState->setNext(); return; + case VideoPrevious: mediaPlayerState->setPrev(); return; + case VideoVolUp: return; + case VideoVolDown: return; + case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; + } } } - switch (i) { - case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; - case VideoStop: mediaPlayerState->setPlaying(FALSE); 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 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 ); +} + diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 830696e..92193a4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -43,8 +43,9 @@ class QSlider; enum VideoButtons { - VideoPrevious, VideoStop, VideoPlay, - VideoPause, +// VideoPause, + VideoPrevious, VideoNext, - VideoPlayList, + VideoVolUp, + VideoVolDown, VideoFullscreen @@ -64,4 +65,4 @@ public slots: void sliderReleased( ); - void setPaused( bool b) { setToggleButton( VideoPause, b ); } - void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } + void setPaused( bool b); + void setPlaying( bool b); void setFullscreen( bool b ); |