author | simon <simon> | 2002-12-08 22:53:07 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 22:53:07 (UTC) |
commit | cb1b7bf6f4dd465cc4f5b268893def8b11ce0bde (patch) (unidiff) | |
tree | 9e6497f79f24c690b5fdb737be5d38a3d5efcee5 | |
parent | 786bc677f61983414df8a4613cc525c4bcd2a054 (diff) | |
download | opie-cb1b7bf6f4dd465cc4f5b268893def8b11ce0bde.zip opie-cb1b7bf6f4dd465cc4f5b268893def8b11ce0bde.tar.gz opie-cb1b7bf6f4dd465cc4f5b268893def8b11ce0bde.tar.bz2 |
- some preparations for further code cleanups for paintButton calls
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
5 files changed, 17 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index d083273..10b1e58 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -331,25 +331,25 @@ void AudioWidget::setToggleButton( int i, bool down ) { | |||
331 | toggleButton( i ); | 331 | toggleButton( i ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void AudioWidget::toggleButton( int i ) { | 336 | void AudioWidget::toggleButton( int i ) { |
337 | buttons[i].isDown = !buttons[i].isDown; | 337 | buttons[i].isDown = !buttons[i].isDown; |
338 | QPainter p(this); | 338 | QPainter p(this); |
339 | paintButton ( &p, i ); | 339 | paintButton ( p, i ); |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | void AudioWidget::paintButton( QPainter *p, int i ) { | 343 | void AudioWidget::paintButton( QPainter &p, int i ) { |
344 | if ( buttons[i].isDown ) { | 344 | if ( buttons[i].isDown ) { |
345 | p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); | 345 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); |
346 | } else { | 346 | } else { |
347 | p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); | 347 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | 351 | ||
352 | void AudioWidget::skipFor() { | 352 | void AudioWidget::skipFor() { |
353 | skipDirection = +1; | 353 | skipDirection = +1; |
354 | startTimer( 50 ); | 354 | startTimer( 50 ); |
355 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 355 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
@@ -437,23 +437,23 @@ void AudioWidget::showEvent( QShowEvent* ) { | |||
437 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 437 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
438 | if ( !pe->erased() ) { | 438 | if ( !pe->erased() ) { |
439 | // Combine with background and double buffer | 439 | // Combine with background and double buffer |
440 | QPixmap pix( pe->rect().size() ); | 440 | QPixmap pix( pe->rect().size() ); |
441 | QPainter p( &pix ); | 441 | QPainter p( &pix ); |
442 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 442 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
443 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 443 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
444 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 444 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
445 | paintButton( &p, i ); | 445 | paintButton( p, i ); |
446 | QPainter p2( this ); | 446 | QPainter p2( this ); |
447 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 447 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
448 | } else { | 448 | } else { |
449 | QPainter p( this ); | 449 | QPainter p( this ); |
450 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 450 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
451 | paintButton( &p, i ); | 451 | paintButton( p, i ); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 455 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
456 | switch ( e->key() ) { | 456 | switch ( e->key() ) { |
457 | ////////////////////////////// Zaurus keys | 457 | ////////////////////////////// Zaurus keys |
458 | case Key_Home: | 458 | case Key_Home: |
459 | break; | 459 | break; |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index acf2dda..a1a839c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -88,17 +88,17 @@ protected: | |||
88 | void keyReleaseEvent( QKeyEvent *e); | 88 | void keyReleaseEvent( QKeyEvent *e); |
89 | private slots: | 89 | private slots: |
90 | void skipFor(); | 90 | void skipFor(); |
91 | void skipBack(); | 91 | void skipBack(); |
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | void toggleButton( int ); | 94 | void toggleButton( int ); |
95 | void setToggleButton( int, bool ); | 95 | void setToggleButton( int, bool ); |
96 | void paintButton( QPainter *p, int i ); | 96 | virtual void paintButton( QPainter &p, int i ); |
97 | int skipDirection; | 97 | int skipDirection; |
98 | QString skin; | 98 | QString skin; |
99 | QPixmap pixBg; | 99 | QPixmap pixBg; |
100 | QImage imgUp; | 100 | QImage imgUp; |
101 | QImage imgDn; | 101 | QImage imgDn; |
102 | QBitmap *masks[10]; | 102 | QBitmap *masks[10]; |
103 | QPixmap *buttonPixUp[10]; | 103 | QPixmap *buttonPixUp[10]; |
104 | QPixmap *buttonPixDown[10]; | 104 | QPixmap *buttonPixDown[10]; |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 6e12a3b..066d2ac 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -62,16 +62,19 @@ signals: | |||
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | virtual void closeEvent( QCloseEvent * ); | 64 | virtual void closeEvent( QCloseEvent * ); |
65 | 65 | ||
66 | void handleCommand( Command command, bool buttonDown ); | 66 | void handleCommand( Command command, bool buttonDown ); |
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 ); | ||
71 | virtual void paintButton( QPainter &p, int i ) = 0; | ||
72 | |||
70 | MediaPlayerState &mediaPlayerState; | 73 | MediaPlayerState &mediaPlayerState; |
71 | PlayListWidget &playList; | 74 | PlayListWidget &playList; |
72 | 75 | ||
73 | ButtonVector buttons; | 76 | ButtonVector buttons; |
74 | 77 | ||
75 | QImage buttonMask; | 78 | QImage buttonMask; |
76 | 79 | ||
77 | QPoint upperLeftOfButtonMask; | 80 | QPoint upperLeftOfButtonMask; |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 6451ac4..3e677c6 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -261,25 +261,25 @@ void 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 | ||
266 | void VideoWidget::toggleButton( int i ) { | 266 | void VideoWidget::toggleButton( int i ) { |
267 | buttons[i].isDown = !buttons[i].isDown; | 267 | buttons[i].isDown = !buttons[i].isDown; |
268 | QPainter p(this); | 268 | QPainter p(this); |
269 | paintButton ( &p, i ); | 269 | paintButton ( p, i ); |
270 | } | 270 | } |
271 | 271 | ||
272 | void VideoWidget::paintButton( QPainter *p, int i ) { | 272 | void VideoWidget::paintButton( QPainter &p, int i ) { |
273 | 273 | ||
274 | if ( buttons[i].isDown ) { | 274 | if ( buttons[i].isDown ) { |
275 | p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); | 275 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); |
276 | } else { | 276 | } else { |
277 | p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); | 277 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 281 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
282 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 282 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
283 | if ( event->state() == QMouseEvent::LeftButton ) { | 283 | if ( event->state() == QMouseEvent::LeftButton ) { |
284 | // The test to see if the mouse click is inside the button or not | 284 | // The test to see if the mouse click is inside the button or not |
285 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 285 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
@@ -417,24 +417,24 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
417 | } else { | 417 | } else { |
418 | if ( !pe->erased() ) { | 418 | if ( !pe->erased() ) { |
419 | // Combine with background and double buffer | 419 | // Combine with background and double buffer |
420 | QPixmap pix( pe->rect().size() ); | 420 | QPixmap pix( pe->rect().size() ); |
421 | QPainter p( &pix ); | 421 | QPainter p( &pix ); |
422 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 422 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
423 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 423 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
424 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 424 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
425 | paintButton( &p, i ); | 425 | paintButton( p, i ); |
426 | } | 426 | } |
427 | QPainter p2( this ); | 427 | QPainter p2( this ); |
428 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 428 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
429 | } else { | 429 | } else { |
430 | QPainter p( this ); | 430 | QPainter p( this ); |
431 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 431 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
432 | paintButton( &p, i ); | 432 | paintButton( p, i ); |
433 | } | 433 | } |
434 | //slider->repaint( TRUE ); | 434 | //slider->repaint( TRUE ); |
435 | } | 435 | } |
436 | } | 436 | } |
437 | 437 | ||
438 | 438 | ||
439 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 439 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
440 | switch ( e->key() ) { | 440 | switch ( e->key() ) { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 2a9f1e0..28f720b 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -102,17 +102,17 @@ private: | |||
102 | QImage imgDn; | 102 | QImage imgDn; |
103 | QBitmap *masks[7]; | 103 | QBitmap *masks[7]; |
104 | QPixmap *buttonPixUp[7]; | 104 | QPixmap *buttonPixUp[7]; |
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 | void paintButton( QPainter *p, int i ); | 110 | virtual void paintButton( QPainter &p, int i ); |
111 | void toggleButton( int ); | 111 | void toggleButton( int ); |
112 | void setToggleButton( int, bool ); | 112 | void setToggleButton( int, bool ); |
113 | 113 | ||
114 | QString backgroundPix; | 114 | QString backgroundPix; |
115 | QSlider *slider; | 115 | QSlider *slider; |
116 | QPixmap *pixmaps[3]; | 116 | QPixmap *pixmaps[3]; |
117 | QImage *currentFrame; | 117 | QImage *currentFrame; |
118 | int scaledWidth; | 118 | int scaledWidth; |