summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 3a44185..b73a5c0 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -93,28 +93,31 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
93 return ( position.x() > 0 && position.y() > 0 && 93 return ( position.x() > 0 && position.y() > 0 &&
94 position.x() < buttonMask.width() && 94 position.x() < buttonMask.width() &&
95 position.y() < buttonMask.height() && 95 position.y() < buttonMask.height() &&
96 buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); 96 buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
97} 97}
98 98
99void MediaWidget::paintButton( int buttonId ) 99void MediaWidget::paintButton( const Button &button )
100{ 100{
101 QPainter p( this ); 101 QPainter p( this );
102 paintButton( p, buttons[ buttonId ] ); 102 paintButton( p, button );
103} 103}
104 104
105void MediaWidget::paintButton( QPainter &p, const Button &button ) 105void MediaWidget::paintButton( QPainter &p, const Button &button )
106{ 106{
107 if ( button.isDown ) 107 if ( button.isDown )
108 p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); 108 p.drawPixmap( upperLeftOfButtonMask, button.pixDown );
109 else 109 else
110 p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); 110 p.drawPixmap( upperLeftOfButtonMask, button.pixUp );
111} 111}
112 112
113void MediaWidget::toggleButton( int buttonId ) 113void MediaWidget::toggleButton( int buttonId )
114{ 114{
115 buttons[ buttonId ].isDown = !buttons[ buttonId ].isDown; 115 Button &button = buttons[ buttonId ];
116 paintButton( buttonId ); 116
117 button.isDown = !button.isDown;
118
119 paintButton( button );
117} 120}
118 121
119/* vim: et sw=4 ts=4 122/* vim: et sw=4 ts=4
120 */ 123 */
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 8cdaad1..dcf7fb8 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -84,13 +84,13 @@ protected:
84 virtual void paintEvent( QPaintEvent *pe ); 84 virtual void paintEvent( QPaintEvent *pe );
85 85
86 void handleCommand( Command command, bool buttonDown ); 86 void handleCommand( Command command, bool buttonDown );
87 87
88 bool isOverButton( const QPoint &position, int buttonId ) const; 88 bool isOverButton( const QPoint &position, int buttonId ) const;
89 89
90 void paintButton( int buttonId ); 90 void paintButton( const Button &button );
91 void paintButton( QPainter &p, const Button &button ); 91 void paintButton( QPainter &p, const Button &button );
92 92
93 void toggleButton( int buttonId ); 93 void toggleButton( int buttonId );
94 94
95 MediaPlayerState &mediaPlayerState; 95 MediaPlayerState &mediaPlayerState;
96 PlayListWidget &playList; 96 PlayListWidget &playList;