summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp7
4 files changed, 12 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 4301a67..d083273 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -383,8 +383,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
// The test to see if the mouse click is inside the button or not
- int x = event->pos().x() - upperLeftOfButtonMask.x();
- int y = event->pos().y() - upperLeftOfButtonMask.y();
-
- bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
- && y < buttonMask.height()
- && buttonMask.pixelIndex( x, y ) == i + 1 );
+ bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index a1b292e..1d18d6f 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -62,2 +62,10 @@ void MediaWidget::handleCommand( Command command, bool buttonDown )
+bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
+{
+ return ( position.x() > 0 && position.y() > 0 &&
+ position.x() < buttonMask.width() &&
+ position.y() < buttonMask.height() &&
+ buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
+}
+
/* vim: et sw=4 ts=4
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 7e6cb3b..6e12a3b 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -67,2 +67,4 @@ protected:
+ bool isOverButton( const QPoint &position, int buttonId ) const;
+
MediaPlayerState &mediaPlayerState;
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 6ab6d7b..6451ac4 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -284,8 +284,3 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
// The test to see if the mouse click is inside the button or not
- int x = event->pos().x() - upperLeftOfButtonMask.x();
- int y = event->pos().y() - upperLeftOfButtonMask.y();
-
- bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
- && y < buttonMask.height()
- && buttonMask.pixelIndex( x, y ) == i + 1 );
+ bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );