author | simon <simon> | 2002-12-09 16:45:41 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:45:41 (UTC) |
commit | dbe0046eb82c8ee61ce7fc704d3b376730abc17f (patch) (side-by-side diff) | |
tree | d8729a7844dc889024090afe1ffac1c6f3a3ab1b /noncore | |
parent | 1bb6aa52f2db85f65f75278310c328218caeae65 (diff) | |
download | opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.zip opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.gz opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.bz2 |
- yay, mouseMoveEvent is no more duplicated code :)
-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 @@ -333,51 +333,6 @@ void AudioWidget::timerEvent( QTimerEvent * ) { } } - -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 @@ -69,10 +69,6 @@ public: virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); signals: - void moreClicked(); - void lessClicked(); - void forwardClicked(); - void backClicked(); void sliderMoved(long); protected: @@ -80,7 +76,6 @@ protected: 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 ); 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 @@ -69,6 +69,50 @@ void MediaWidget::paintEvent( QPaintEvent *pe ) } } +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 @@ -77,12 +77,18 @@ signals: 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 @@ -243,46 +243,6 @@ 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 @@ -76,7 +76,6 @@ protected: void resizeEvent( QResizeEvent * ); void showEvent( QShowEvent *se ); - void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void keyReleaseEvent( QKeyEvent *e); |