summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 15:46:08 (UTC)
committer simon <simon>2002-12-09 15:46:08 (UTC)
commitaa766a6a0818ed0b756f8cd67fc4a1c85906f224 (patch) (unidiff)
treefe6af32c30e0355f839a8a574d1ec7d8a7561fd5
parent21738c78103c42605625f85abf7bfd0d6beaad3f (diff)
downloadopie-aa766a6a0818ed0b756f8cd67fc4a1c85906f224.zip
opie-aa766a6a0818ed0b756f8cd67fc4a1c85906f224.tar.gz
opie-aa766a6a0818ed0b756f8cd67fc4a1c85906f224.tar.bz2
- toggleButton and setToggleButton now operate on a Button object instead
of an index
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp14
5 files changed, 17 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 8c7e614..ef606ab 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -342,5 +342,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
342 if ( isOnButton && !buttons[i].isHeld ) { 342 if ( isOnButton && !buttons[i].isHeld ) {
343 buttons[i].isHeld = TRUE; 343 buttons[i].isHeld = TRUE;
344 toggleButton(i); 344 toggleButton( buttons[ i ] );
345 switch (i) { 345 switch (i) {
346 case VolumeUp: 346 case VolumeUp:
@@ -359,5 +359,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
359 } else if ( !isOnButton && buttons[i].isHeld ) { 359 } else if ( !isOnButton && buttons[i].isHeld ) {
360 buttons[i].isHeld = FALSE; 360 buttons[i].isHeld = FALSE;
361 toggleButton(i); 361 toggleButton( buttons[ i ] );
362 } 362 }
363 } else { 363 } else {
@@ -365,5 +365,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
365 buttons[i].isHeld = FALSE; 365 buttons[i].isHeld = FALSE;
366 if ( buttons[i].type != ToggleButton ) { 366 if ( buttons[i].type != ToggleButton ) {
367 setToggleButton( i, FALSE ); 367 setToggleButton( buttons[ i ], FALSE );
368 } 368 }
369 qDebug("mouseEvent %d", i); 369 qDebug("mouseEvent %d", i);
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 9b276b5..092e5ce 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -60,5 +60,5 @@ public slots:
60 void sliderPressed( ); 60 void sliderPressed( );
61 void sliderReleased( ); 61 void sliderReleased( );
62 void setLooping( bool b) { setToggleButton( Loop, b ); } 62 void setLooping( bool b) { setToggleButton( buttons[ Loop ], b ); }
63 void setPosition( long ); 63 void setPosition( long );
64 void setSeekable( bool ); 64 void setSeekable( bool );
@@ -66,5 +66,5 @@ public slots:
66public: 66public:
67 virtual void setLength( long ); 67 virtual void setLength( long );
68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 68 virtual void setPlaying( bool b) { setToggleButton( buttons[ Play ], b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 70
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 9c5291b..66129c9 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -115,18 +115,12 @@ void MediaWidget::paintButton( QPainter &p, const Button &button )
115} 115}
116 116
117void MediaWidget::setToggleButton( int buttonId, bool down ) 117void MediaWidget::setToggleButton( Button &button, bool down )
118{ 118{
119 qDebug("setToggleButton %d", buttonId );
120
121 Button &button = buttons[ buttonId ];
122
123 if ( down != button.isDown ) 119 if ( down != button.isDown )
124 toggleButton( buttonId ); 120 toggleButton( button );
125} 121}
126 122
127void MediaWidget::toggleButton( int buttonId ) 123void MediaWidget::toggleButton( Button &button )
128{ 124{
129 Button &button = buttons[ buttonId ];
130
131 button.isDown = !button.isDown; 125 button.isDown = !button.isDown;
132 126
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index b7860dc..05b7b71 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -92,6 +92,6 @@ protected:
92 void paintButton( QPainter &p, const Button &button ); 92 void paintButton( QPainter &p, const Button &button );
93 93
94 void setToggleButton( int buttonId, bool down ); 94 void setToggleButton( Button &button, bool down );
95 void toggleButton( int buttonId ); 95 void toggleButton( Button &button );
96 96
97 MediaPlayerState &mediaPlayerState; 97 MediaPlayerState &mediaPlayerState;
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index db4a396..673c9e8 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -251,5 +251,5 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
251 if ( isOnButton && !buttons[i].isHeld ) { 251 if ( isOnButton && !buttons[i].isHeld ) {
252 buttons[i].isHeld = TRUE; 252 buttons[i].isHeld = TRUE;
253 toggleButton(i); 253 toggleButton( buttons[ i ] );
254 254
255 switch (i) { 255 switch (i) {
@@ -263,5 +263,5 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
263 } else if ( !isOnButton && buttons[i].isHeld ) { 263 } else if ( !isOnButton && buttons[i].isHeld ) {
264 buttons[i].isHeld = FALSE; 264 buttons[i].isHeld = FALSE;
265 toggleButton(i); 265 toggleButton( buttons[ i ] );
266 } 266 }
267 } else { 267 } else {
@@ -270,5 +270,5 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
270 buttons[i].isHeld = FALSE; 270 buttons[i].isHeld = FALSE;
271 if ( buttons[i].type != ToggleButton ) { 271 if ( buttons[i].type != ToggleButton ) {
272 setToggleButton( i, FALSE ); 272 setToggleButton( buttons[ i ], FALSE );
273 } 273 }
274 274
@@ -277,9 +277,9 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
277 case VideoPlay: { 277 case VideoPlay: {
278 if( mediaPlayerState.isPaused() ) { 278 if( mediaPlayerState.isPaused() ) {
279 setToggleButton( i, FALSE ); 279 setToggleButton( buttons[ i ], FALSE );
280 mediaPlayerState.setPaused( FALSE ); 280 mediaPlayerState.setPaused( FALSE );
281 return; 281 return;
282 } else if( !mediaPlayerState.isPaused() ) { 282 } else if( !mediaPlayerState.isPaused() ) {
283 setToggleButton( i, TRUE ); 283 setToggleButton( buttons[ i ], TRUE );
284 mediaPlayerState.setPaused( TRUE ); 284 mediaPlayerState.setPaused( TRUE );
285 return; 285 return;
@@ -424,10 +424,10 @@ XineVideoWidget* VideoWidget::vidWidget() {
424 424
425void VideoWidget::setFullscreen ( bool b ) { 425void VideoWidget::setFullscreen ( bool b ) {
426 setToggleButton( VideoFullscreen, b ); 426 setToggleButton( buttons[ VideoFullscreen ], b );
427} 427}
428 428
429 429
430void VideoWidget::setPlaying( bool b) { 430void VideoWidget::setPlaying( bool b) {
431 setToggleButton( VideoPlay, b ); 431 setToggleButton( buttons[ VideoPlay ], b );
432} 432}
433 433