Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 14 |
5 files changed, 17 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 8c7e614..ef606ab 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -338,13 +338,13 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); if ( isOnButton && !buttons[i].isHeld ) { buttons[i].isHeld = TRUE; - toggleButton(i); + toggleButton( buttons[ i ] ); switch (i) { case VolumeUp: emit moreClicked(); return; case VolumeDown: emit lessClicked(); @@ -355,19 +355,19 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { case Back: emit backClicked(); return; } } else if ( !isOnButton && buttons[i].isHeld ) { buttons[i].isHeld = FALSE; - toggleButton(i); + toggleButton( buttons[ i ] ); } } else { if ( buttons[i].isHeld ) { buttons[i].isHeld = FALSE; if ( buttons[i].type != ToggleButton ) { - setToggleButton( i, FALSE ); + setToggleButton( buttons[ i ], FALSE ); } qDebug("mouseEvent %d", i); handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); } } } diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 9b276b5..092e5ce 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -56,19 +56,19 @@ public: ~AudioWidget(); void setTickerText( const QString &text ) { songInfo.setText( text ); } public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); - void setLooping( bool b) { setToggleButton( Loop, b ); } + void setLooping( bool b) { setToggleButton( buttons[ Loop ], b ); } void setPosition( long ); void setSeekable( bool ); public: virtual void setLength( long ); - virtual void setPlaying( bool b) { setToggleButton( Play, b ); } + virtual void setPlaying( bool b) { setToggleButton( buttons[ Play ], b ); } virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); signals: void moreClicked(); void lessClicked(); void forwardClicked(); diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 9c5291b..66129c9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -111,26 +111,20 @@ void MediaWidget::paintButton( QPainter &p, const Button &button ) if ( button.isDown ) p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); else p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); } -void MediaWidget::setToggleButton( int buttonId, bool down ) +void MediaWidget::setToggleButton( Button &button, bool down ) { - qDebug("setToggleButton %d", buttonId ); - - Button &button = buttons[ buttonId ]; - if ( down != button.isDown ) - toggleButton( buttonId ); + toggleButton( button ); } -void MediaWidget::toggleButton( int buttonId ) +void MediaWidget::toggleButton( Button &button ) { - Button &button = buttons[ buttonId ]; - button.isDown = !button.isDown; paintButton( button ); } /* vim: et sw=4 ts=4 diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index b7860dc..05b7b71 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -88,14 +88,14 @@ protected: bool isOverButton( const QPoint &position, int buttonId ) const; void paintAllButtons( QPainter &p ); void paintButton( const Button &button ); void paintButton( QPainter &p, const Button &button ); - void setToggleButton( int buttonId, bool down ); - void toggleButton( int buttonId ); + void setToggleButton( Button &button, bool down ); + void toggleButton( Button &button ); MediaPlayerState &mediaPlayerState; PlayListWidget &playList; ButtonMap buttons; diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index db4a396..673c9e8 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -247,43 +247,43 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); if ( isOnButton && !buttons[i].isHeld ) { buttons[i].isHeld = TRUE; - toggleButton(i); + toggleButton( buttons[ i ] ); switch (i) { case VideoVolUp: emit moreClicked(); return; case VideoVolDown: emit lessClicked(); return; } } else if ( !isOnButton && buttons[i].isHeld ) { buttons[i].isHeld = FALSE; - toggleButton(i); + toggleButton( buttons[ i ] ); } } else { if ( buttons[i].isHeld ) { buttons[i].isHeld = FALSE; if ( buttons[i].type != ToggleButton ) { - setToggleButton( i, FALSE ); + setToggleButton( buttons[ i ], FALSE ); } switch(i) { case VideoPlay: { if( mediaPlayerState.isPaused() ) { - setToggleButton( i, FALSE ); + setToggleButton( buttons[ i ], FALSE ); mediaPlayerState.setPaused( FALSE ); return; } else if( !mediaPlayerState.isPaused() ) { - setToggleButton( i, TRUE ); + setToggleButton( buttons[ i ], TRUE ); mediaPlayerState.setPaused( TRUE ); return; } else { return; } } @@ -420,14 +420,14 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { XineVideoWidget* VideoWidget::vidWidget() { return videoFrame; } void VideoWidget::setFullscreen ( bool b ) { - setToggleButton( VideoFullscreen, b ); + setToggleButton( buttons[ VideoFullscreen ], b ); } void VideoWidget::setPlaying( bool b) { - setToggleButton( VideoPlay, b ); + setToggleButton( buttons[ VideoPlay ], b ); } |