-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 45 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 44 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 40 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
6 files changed, 50 insertions, 91 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 37c565b..dda039c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -332,53 +332,8 @@ void AudioWidget::timerEvent( QTimerEvent * ) { mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } } - -void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { - Button &button = *it; - Command command = button.command; - - 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, command ); - - if ( isOnButton && !button.isHeld ) { - button.isHeld = TRUE; - toggleButton( button ); - switch ( command ) { - case VolumeUp: - emit moreClicked(); - return; - case VolumeDown: - emit lessClicked(); - return; - case Forward: - emit forwardClicked(); - return; - case Back: - emit backClicked(); - return; - default: break; - } - } else if ( !isOnButton && button.isHeld ) { - button.isHeld = FALSE; - toggleButton( button ); - } - } else { - if ( button.isHeld ) { - button.isHeld = FALSE; - if ( button.type != ToggleButton ) { - setToggleButton( button, FALSE ); - } - handleCommand( command, button.isDown ); - } - } - } -} - - void AudioWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 9b276b5..690d1b3 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -68,20 +68,15 @@ public: virtual void setPlaying( bool b) { setToggleButton( Play, b ); } virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); signals: - void moreClicked(); - void lessClicked(); - void forwardClicked(); - void backClicked(); void sliderMoved(long); protected: void doBlank(); void doUnblank(); void showEvent( QShowEvent *se ); void resizeEvent( QResizeEvent *re ); - void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void timerEvent( QTimerEvent *event ); void keyReleaseEvent( QKeyEvent *e); diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 7eb75e6..3533d74 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -68,8 +68,52 @@ void MediaWidget::paintEvent( QPaintEvent *pe ) paintAllButtons( p ); } } +void MediaWidget::mouseMoveEvent( QMouseEvent *event ) +{ + for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { + Button &button = *it; + Command command = button.command; + + 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, command ); + + if ( isOnButton && !button.isHeld ) { + button.isHeld = TRUE; + toggleButton( button ); + switch ( command ) { + case VolumeUp: + emit moreClicked(); + return; + case VolumeDown: + emit lessClicked(); + return; + case Forward: + emit forwardClicked(); + return; + case Back: + emit backClicked(); + return; + default: break; + } + } else if ( !isOnButton && button.isHeld ) { + button.isHeld = FALSE; + toggleButton( button ); + } + } else { + if ( button.isHeld ) { + button.isHeld = FALSE; + if ( button.type != ToggleButton ) { + setToggleButton( button, FALSE ); + } + handleCommand( command, button.isDown ); + } + } + } +} + void MediaWidget::makeVisible() { } diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 3f4c45d..c19fdbb 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -76,14 +76,20 @@ signals: void moreReleased(); void lessReleased(); void forwardReleased(); void backReleased(); + void forwardClicked(); + void backClicked(); + void moreClicked(); + void lessClicked(); protected: virtual void closeEvent( QCloseEvent * ); virtual void paintEvent( QPaintEvent *pe ); + virtual void mouseMoveEvent( QMouseEvent *event ); + virtual void makeVisible(); void handleCommand( Command command, bool buttonDown ); diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index cc586cc..41844e1 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -242,48 +242,8 @@ void VideoWidget::updateSlider( long i, long max ) { } } } -void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { - Button &button = *it; - Command command = button.command; - - 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, command ); - - if ( isOnButton && !button.isHeld ) { - button.isHeld = TRUE; - toggleButton( button ); - - switch ( command ) { - case VolumeUp: - emit moreClicked(); - return; - case VolumeDown: - emit lessClicked(); - return; - default: break; - } - } else if ( !isOnButton && button.isHeld ) { - button.isHeld = FALSE; - toggleButton( button ); - } - } else { - - if ( button.isHeld ) { - button.isHeld = FALSE; - if ( button.type != ToggleButton ) { - setToggleButton( button, FALSE ); - } - - handleCommand( command, button.isDown ); - } - } - } -} - void VideoWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index ef88186..7d50ea0 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -75,9 +75,8 @@ signals: protected: void resizeEvent( QResizeEvent * ); void showEvent( QShowEvent *se ); - void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void keyReleaseEvent( QKeyEvent *e); |