summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-08 22:58:45 (UTC)
committer simon <simon>2002-12-08 22:58:45 (UTC)
commit7b38c0424eca2f49a0c9a931766c816e21f1d86b (patch) (unidiff)
treee310c27ad3592e46fc1a46d963ae24b2f299c949
parentdf6b6a0222e99736284ed8ebb9a7d8068751339b (diff)
downloadopie-7b38c0424eca2f49a0c9a931766c816e21f1d86b.zip
opie-7b38c0424eca2f49a0c9a931766c816e21f1d86b.tar.gz
opie-7b38c0424eca2f49a0c9a931766c816e21f1d86b.tar.bz2
- merged the two duplicated toggleButton methods into a shared one
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
6 files changed, 9 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 10b1e58..2a158a8 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -329,20 +329,12 @@ void AudioWidget::setToggleButton( int i, bool down ) {
329 qDebug("setToggleButton %d", i); 329 qDebug("setToggleButton %d", i);
330 if ( down != buttons[i].isDown ) { 330 if ( down != buttons[i].isDown ) {
331 toggleButton( i ); 331 toggleButton( i );
332 } 332 }
333} 333}
334 334
335
336void AudioWidget::toggleButton( int i ) {
337 buttons[i].isDown = !buttons[i].isDown;
338 QPainter p(this);
339 paintButton ( p, i );
340}
341
342
343void AudioWidget::paintButton( QPainter &p, int i ) { 335void AudioWidget::paintButton( QPainter &p, int i ) {
344 if ( buttons[i].isDown ) { 336 if ( buttons[i].isDown ) {
345 p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); 337 p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
346 } else { 338 } else {
347 p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); 339 p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
348 } 340 }
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index a1a839c..4598d51 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -88,13 +88,12 @@ protected:
88 void keyReleaseEvent( QKeyEvent *e); 88 void keyReleaseEvent( QKeyEvent *e);
89private slots: 89private slots:
90 void skipFor(); 90 void skipFor();
91 void skipBack(); 91 void skipBack();
92 void stopSkip(); 92 void stopSkip();
93private: 93private:
94 void toggleButton( int );
95 void setToggleButton( int, bool ); 94 void setToggleButton( int, bool );
96 virtual void paintButton( QPainter &p, int i ); 95 virtual void paintButton( QPainter &p, int i );
97 int skipDirection; 96 int skipDirection;
98 QString skin; 97 QString skin;
99 QPixmap pixBg; 98 QPixmap pixBg;
100 QImage imgUp; 99 QImage imgUp;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index ca84019..62266ad 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -65,14 +65,20 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
65 return ( position.x() > 0 && position.y() > 0 && 65 return ( position.x() > 0 && position.y() > 0 &&
66 position.x() < buttonMask.width() && 66 position.x() < buttonMask.width() &&
67 position.y() < buttonMask.height() && 67 position.y() < buttonMask.height() &&
68 buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); 68 buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
69} 69}
70 70
71void MediaWidget::repaintButton( int buttonId ) 71void MediaWidget::paintButton( int buttonId )
72{ 72{
73 QPainter p( this ); 73 QPainter p( this );
74 paintButton( p, buttonId ); 74 paintButton( p, buttonId );
75} 75}
76 76
77void MediaWidget::toggleButton( int buttonId )
78{
79 buttons[ buttonId ].isDown = !buttons[ buttonId ].isDown;
80 paintButton( buttonId );
81}
82
77/* vim: et sw=4 ts=4 83/* vim: et sw=4 ts=4
78 */ 84 */
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 066d2ac..46c304d 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -67,12 +67,14 @@ protected:
67 67
68 bool isOverButton( const QPoint &position, int buttonId ) const; 68 bool isOverButton( const QPoint &position, int buttonId ) const;
69 69
70 void paintButton( int buttonId ); 70 void paintButton( int buttonId );
71 virtual void paintButton( QPainter &p, int i ) = 0; 71 virtual void paintButton( QPainter &p, int i ) = 0;
72 72
73 void toggleButton( int buttonId );
74
73 MediaPlayerState &mediaPlayerState; 75 MediaPlayerState &mediaPlayerState;
74 PlayListWidget &playList; 76 PlayListWidget &playList;
75 77
76 ButtonVector buttons; 78 ButtonVector buttons;
77 79
78 QImage buttonMask; 80 QImage buttonMask;
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 3e677c6..77eab71 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -260,18 +260,12 @@ void VideoWidget::updateSlider( long i, long max ) {
260void VideoWidget::setToggleButton( int i, bool down ) { 260void VideoWidget::setToggleButton( int i, bool down ) {
261 if ( down != buttons[i].isDown ) { 261 if ( down != buttons[i].isDown ) {
262 toggleButton( i ); 262 toggleButton( i );
263 } 263 }
264} 264}
265 265
266void VideoWidget::toggleButton( int i ) {
267 buttons[i].isDown = !buttons[i].isDown;
268 QPainter p(this);
269 paintButton ( p, i );
270}
271
272void VideoWidget::paintButton( QPainter &p, int i ) { 266void VideoWidget::paintButton( QPainter &p, int i ) {
273 267
274 if ( buttons[i].isDown ) { 268 if ( buttons[i].isDown ) {
275 p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); 269 p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
276 } else { 270 } else {
277 p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); 271 p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 28f720b..24e8741 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -105,13 +105,12 @@ private:
105 QPixmap *buttonPixDown[7]; 105 QPixmap *buttonPixDown[7];
106 QString skin; 106 QString skin;
107// QPixmap *pixmaps[4]; 107// QPixmap *pixmaps[4];
108 108
109 109
110 virtual void paintButton( QPainter &p, int i ); 110 virtual void paintButton( QPainter &p, int i );
111 void toggleButton( int );
112 void setToggleButton( int, bool ); 111 void setToggleButton( int, bool );
113 112
114 QString backgroundPix; 113 QString backgroundPix;
115 QSlider *slider; 114 QSlider *slider;
116 QPixmap *pixmaps[3]; 115 QPixmap *pixmaps[3];
117 QImage *currentFrame; 116 QImage *currentFrame;