summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 16:45:41 (UTC)
committer simon <simon>2002-12-09 16:45:41 (UTC)
commitdbe0046eb82c8ee61ce7fc704d3b376730abc17f (patch) (side-by-side diff)
treed8729a7844dc889024090afe1ffac1c6f3a3ab1b
parent1bb6aa52f2db85f65f75278310c328218caeae65 (diff)
downloadopie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.zip
opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.gz
opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.bz2
- yay, mouseMoveEvent is no more duplicated code :)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp45
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp44
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp40
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
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
@@ -334,49 +334,4 @@ 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
@@ -70,8 +70,4 @@ public:
signals:
- void moreClicked();
- void lessClicked();
- void forwardClicked();
- void backClicked();
void sliderMoved(long);
@@ -81,5 +77,4 @@ protected:
void showEvent( QShowEvent *se );
void resizeEvent( QResizeEvent *re );
- void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( 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
@@ -70,4 +70,48 @@ 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
@@ -78,4 +78,8 @@ signals:
void forwardReleased();
void backReleased();
+ void forwardClicked();
+ void backClicked();
+ void moreClicked();
+ void lessClicked();
protected:
@@ -84,4 +88,6 @@ protected:
virtual void paintEvent( QPaintEvent *pe );
+ 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
@@ -244,44 +244,4 @@ 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
@@ -77,5 +77,4 @@ protected:
void resizeEvent( QResizeEvent * );
void showEvent( QShowEvent *se );
- void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );