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/multimedia | |
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 @@ -335,47 +335,2 @@ 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 ) { 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 @@ -71,6 +71,2 @@ public: signals: - void moreClicked(); - void lessClicked(); - void forwardClicked(); - void backClicked(); void sliderMoved(long); @@ -82,3 +78,2 @@ protected: void resizeEvent( QResizeEvent *re ); - void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *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 @@ -71,2 +71,46 @@ 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 @@ -79,2 +79,6 @@ signals: void backReleased(); + void forwardClicked(); + void backClicked(); + void moreClicked(); + void lessClicked(); @@ -85,2 +89,4 @@ protected: + virtual void mouseMoveEvent( QMouseEvent *event ); + virtual void makeVisible(); 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 @@ -245,42 +245,2 @@ 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 ) { 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 @@ -78,3 +78,2 @@ protected: void showEvent( QShowEvent *se ); - void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); |