author | simon <simon> | 2002-12-08 22:20:24 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 22:20:24 (UTC) |
commit | 00252c667bf6c6af3f2a1d2519bf23e448e8f174 (patch) (unidiff) | |
tree | 4ecb004aa67d993561178b33cad2a6f0a9e85049 | |
parent | 695398075ec5e4d01f29c40c00538ee8c60404d2 (diff) | |
download | opie-00252c667bf6c6af3f2a1d2519bf23e448e8f174.zip opie-00252c667bf6c6af3f2a1d2519bf23e448e8f174.tar.gz opie-00252c667bf6c6af3f2a1d2519bf23e448e8f174.tar.bz2 |
- share the buttons data in a buttons member variable in the base class
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 50 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 42 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
5 files changed, 48 insertions, 50 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 7fb3781..a9d5a88 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -82,13 +82,13 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
82 | 82 | ||
83 | audioButtons.reserve( 10 ); | 83 | buttons.reserve( 10 ); |
84 | audioButtons.push_back( toggleButton ); // play | 84 | buttons.push_back( toggleButton ); // play |
85 | audioButtons.push_back( defaultButton ); // stop | 85 | buttons.push_back( defaultButton ); // stop |
86 | audioButtons.push_back( defaultButton ); // next | 86 | buttons.push_back( defaultButton ); // next |
87 | audioButtons.push_back( defaultButton ); // previous | 87 | buttons.push_back( defaultButton ); // previous |
88 | audioButtons.push_back( defaultButton ); // volume up | 88 | buttons.push_back( defaultButton ); // volume up |
89 | audioButtons.push_back( defaultButton ); // volume down | 89 | buttons.push_back( defaultButton ); // volume down |
90 | audioButtons.push_back( toggleButton ); // repeat/loop | 90 | buttons.push_back( toggleButton ); // repeat/loop |
91 | audioButtons.push_back( defaultButton ); // playlist | 91 | buttons.push_back( defaultButton ); // playlist |
92 | audioButtons.push_back( defaultButton ); // forward | 92 | buttons.push_back( defaultButton ); // forward |
93 | audioButtons.push_back( defaultButton ); // back | 93 | buttons.push_back( defaultButton ); // back |
94 | 94 | ||
@@ -329,3 +329,3 @@ void AudioWidget::setToggleButton( int i, bool down ) { | |||
329 | qDebug("setToggleButton %d", i); | 329 | qDebug("setToggleButton %d", i); |
330 | if ( down != audioButtons[i].isDown ) { | 330 | if ( down != buttons[i].isDown ) { |
331 | toggleButton( i ); | 331 | toggleButton( i ); |
@@ -336,3 +336,3 @@ void AudioWidget::setToggleButton( int i, bool down ) { | |||
336 | void AudioWidget::toggleButton( int i ) { | 336 | void AudioWidget::toggleButton( int i ) { |
337 | audioButtons[i].isDown = !audioButtons[i].isDown; | 337 | buttons[i].isDown = !buttons[i].isDown; |
338 | QPainter p(this); | 338 | QPainter p(this); |
@@ -343,3 +343,3 @@ void AudioWidget::toggleButton( int i ) { | |||
343 | void AudioWidget::paintButton( QPainter *p, int i ) { | 343 | void AudioWidget::paintButton( QPainter *p, int i ) { |
344 | if ( audioButtons[i].isDown ) { | 344 | if ( buttons[i].isDown ) { |
345 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 345 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
@@ -380,3 +380,3 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
380 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 380 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
381 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) { | 381 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
382 | if ( event->state() == QMouseEvent::LeftButton ) { | 382 | if ( event->state() == QMouseEvent::LeftButton ) { |
@@ -390,4 +390,4 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
390 | 390 | ||
391 | if ( isOnButton && !audioButtons[i].isHeld ) { | 391 | if ( isOnButton && !buttons[i].isHeld ) { |
392 | audioButtons[i].isHeld = TRUE; | 392 | buttons[i].isHeld = TRUE; |
393 | toggleButton(i); | 393 | toggleButton(i); |
@@ -407,4 +407,4 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
407 | } | 407 | } |
408 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 408 | } else if ( !isOnButton && buttons[i].isHeld ) { |
409 | audioButtons[i].isHeld = FALSE; | 409 | buttons[i].isHeld = FALSE; |
410 | toggleButton(i); | 410 | toggleButton(i); |
@@ -412,5 +412,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
412 | } else { | 412 | } else { |
413 | if ( audioButtons[i].isHeld ) { | 413 | if ( buttons[i].isHeld ) { |
414 | audioButtons[i].isHeld = FALSE; | 414 | buttons[i].isHeld = FALSE; |
415 | if ( !audioButtons[i].isToggle ) { | 415 | if ( !buttons[i].isToggle ) { |
416 | setToggleButton( i, FALSE ); | 416 | setToggleButton( i, FALSE ); |
@@ -418,3 +418,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
418 | qDebug("mouseEvent %d", i); | 418 | qDebug("mouseEvent %d", i); |
419 | handleCommand( static_cast<Command>( i ), audioButtons[ i ].isDown ); | 419 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
420 | } | 420 | } |
@@ -448,3 +448,3 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { | |||
448 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 448 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
449 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) | 449 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
450 | paintButton( &p, i ); | 450 | paintButton( &p, i ); |
@@ -454,3 +454,3 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { | |||
454 | QPainter p( this ); | 454 | QPainter p( this ); |
455 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) | 455 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
456 | paintButton( &p, i ); | 456 | paintButton( &p, i ); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index e09c5f8..52a358c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -112,4 +112,2 @@ private: | |||
112 | bool isStreaming : 1; | 112 | bool isStreaming : 1; |
113 | |||
114 | ButtonVector audioButtons; | ||
115 | }; | 113 | }; |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index c81768c..b88d7e2 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -69,2 +69,4 @@ protected: | |||
69 | PlayListWidget &playList; | 69 | PlayListWidget &playList; |
70 | |||
71 | ButtonVector buttons; | ||
70 | }; | 72 | }; |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 6e2e03e..7838229 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -78,10 +78,10 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
78 | 78 | ||
79 | videoButtons.reserve( 7 ); | 79 | buttons.reserve( 7 ); |
80 | videoButtons.push_back( defaultButton ); // stop | 80 | buttons.push_back( defaultButton ); // stop |
81 | videoButtons.push_back( toggleButton ); // play | 81 | buttons.push_back( toggleButton ); // play |
82 | videoButtons.push_back( defaultButton ); // previous | 82 | buttons.push_back( defaultButton ); // previous |
83 | videoButtons.push_back( defaultButton ); // next | 83 | buttons.push_back( defaultButton ); // next |
84 | videoButtons.push_back( defaultButton ); // volUp | 84 | buttons.push_back( defaultButton ); // volUp |
85 | videoButtons.push_back( defaultButton ); // volDown | 85 | buttons.push_back( defaultButton ); // volDown |
86 | videoButtons.push_back( toggleButton ); //fullscreen | 86 | buttons.push_back( toggleButton ); //fullscreen |
87 | 87 | ||
@@ -260,3 +260,3 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
260 | void VideoWidget::setToggleButton( int i, bool down ) { | 260 | void VideoWidget::setToggleButton( int i, bool down ) { |
261 | if ( down != videoButtons[i].isDown ) { | 261 | if ( down != buttons[i].isDown ) { |
262 | toggleButton( i ); | 262 | toggleButton( i ); |
@@ -266,3 +266,3 @@ void VideoWidget::setToggleButton( int i, bool down ) { | |||
266 | void VideoWidget::toggleButton( int i ) { | 266 | void VideoWidget::toggleButton( int i ) { |
267 | videoButtons[i].isDown = !videoButtons[i].isDown; | 267 | buttons[i].isDown = !buttons[i].isDown; |
268 | QPainter p(this); | 268 | QPainter p(this); |
@@ -273,3 +273,3 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
273 | 273 | ||
274 | if ( videoButtons[i].isDown ) { | 274 | if ( buttons[i].isDown ) { |
275 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 275 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
@@ -281,3 +281,3 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
281 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 281 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
282 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { | 282 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
283 | if ( event->state() == QMouseEvent::LeftButton ) { | 283 | if ( event->state() == QMouseEvent::LeftButton ) { |
@@ -291,4 +291,4 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
291 | 291 | ||
292 | if ( isOnButton && !videoButtons[i].isHeld ) { | 292 | if ( isOnButton && !buttons[i].isHeld ) { |
293 | videoButtons[i].isHeld = TRUE; | 293 | buttons[i].isHeld = TRUE; |
294 | toggleButton(i); | 294 | toggleButton(i); |
@@ -303,4 +303,4 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
303 | } | 303 | } |
304 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 304 | } else if ( !isOnButton && buttons[i].isHeld ) { |
305 | videoButtons[i].isHeld = FALSE; | 305 | buttons[i].isHeld = FALSE; |
306 | toggleButton(i); | 306 | toggleButton(i); |
@@ -309,5 +309,5 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
309 | 309 | ||
310 | if ( videoButtons[i].isHeld ) { | 310 | if ( buttons[i].isHeld ) { |
311 | videoButtons[i].isHeld = FALSE; | 311 | buttons[i].isHeld = FALSE; |
312 | if ( !videoButtons[i].isToggle ) { | 312 | if ( !buttons[i].isToggle ) { |
313 | setToggleButton( i, FALSE ); | 313 | setToggleButton( i, FALSE ); |
@@ -428,3 +428,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
428 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 428 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
429 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { | 429 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
430 | paintButton( &p, i ); | 430 | paintButton( &p, i ); |
@@ -435,3 +435,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
435 | QPainter p( this ); | 435 | QPainter p( this ); |
436 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) | 436 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
437 | paintButton( &p, i ); | 437 | paintButton( &p, i ); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 34558f8..f996803 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -122,4 +122,2 @@ private: | |||
122 | XineVideoWidget* videoFrame; | 122 | XineVideoWidget* videoFrame; |
123 | |||
124 | ButtonVector videoButtons; | ||
125 | }; | 123 | }; |