author | llornkcor <llornkcor> | 2002-08-15 21:18:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-15 21:18:17 (UTC) |
commit | 78fead876601c4218eda97ec1da95b01a70155cd (patch) (unidiff) | |
tree | edf21f7d3df75c88470fa511db1a3065a6adb9bc | |
parent | 8b6d28983e62dd26acfeb9cf7408e21f68558a16 (diff) | |
download | opie-78fead876601c4218eda97ec1da95b01a70155cd.zip opie-78fead876601c4218eda97ec1da95b01a70155cd.tar.gz opie-78fead876601c4218eda97ec1da95b01a70155cd.tar.bz2 |
fix cruft
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 26 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 3 |
2 files changed, 14 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index cc6187c..132a911 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -181,39 +181,39 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
181 | time.setAlignment( Qt::AlignCenter ); | 181 | time.setAlignment( Qt::AlignCenter ); |
182 | time.setFrame(FALSE); | 182 | time.setFrame(FALSE); |
183 | changeTextColor( &time ); | 183 | changeTextColor( &time ); |
184 | 184 | ||
185 | resizeEvent( NULL ); | 185 | resizeEvent( NULL ); |
186 | 186 | ||
187 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 187 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
188 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 188 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
189 | 189 | ||
190 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 190 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
191 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 191 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
192 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 192 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
193 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 193 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
194 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 194 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
195 | 195 | ||
196 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 196 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
197 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 197 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
198 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 198 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
199 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 199 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
200 | 200 | ||
201 | 201 | ||
202 | 202 | ||
203 | // Intialise state | 203 | // Intialise state |
204 | setLength( mediaPlayerState->length() ); | 204 | setLength( mediaPlayerState->length() ); |
205 | setPosition( mediaPlayerState->position() ); | 205 | setPosition( mediaPlayerState->position() ); |
206 | setLooping( mediaPlayerState->fullscreen() ); | 206 | setLooping( mediaPlayerState->fullscreen() ); |
207 | setPaused( mediaPlayerState->paused() ); | 207 | // setPaused( mediaPlayerState->paused() ); |
208 | setPlaying( mediaPlayerState->playing() ); | 208 | setPlaying( mediaPlayerState->playing() ); |
209 | 209 | ||
210 | } | 210 | } |
211 | 211 | ||
212 | AudioWidget::~AudioWidget() { | 212 | AudioWidget::~AudioWidget() { |
213 | 213 | ||
214 | for ( int i = 0; i < 10; i++ ) { | 214 | for ( int i = 0; i < 10; i++ ) { |
215 | delete buttonPixUp[i]; | 215 | delete buttonPixUp[i]; |
216 | delete buttonPixDown[i]; | 216 | delete buttonPixDown[i]; |
217 | } | 217 | } |
218 | delete pixBg; | 218 | delete pixBg; |
219 | delete imgUp; | 219 | delete imgUp; |
@@ -350,24 +350,25 @@ void AudioWidget::updateSlider( long i, long max ) { | |||
350 | if ( slider.value() != val ) { | 350 | if ( slider.value() != val ) { |
351 | slider.setValue( val ); | 351 | slider.setValue( val ); |
352 | } | 352 | } |
353 | 353 | ||
354 | if ( slider.maxValue() != width ) { | 354 | if ( slider.maxValue() != width ) { |
355 | slider.setMaxValue( width ); | 355 | slider.setMaxValue( width ); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | 360 | ||
361 | void AudioWidget::setToggleButton( int i, bool down ) { | 361 | void AudioWidget::setToggleButton( int i, bool down ) { |
362 | qDebug("setToggleButton %d", i); | ||
362 | if ( down != audioButtons[i].isDown ) { | 363 | if ( down != audioButtons[i].isDown ) { |
363 | toggleButton( i ); | 364 | toggleButton( i ); |
364 | } | 365 | } |
365 | } | 366 | } |
366 | 367 | ||
367 | 368 | ||
368 | void AudioWidget::toggleButton( int i ) { | 369 | void AudioWidget::toggleButton( int i ) { |
369 | audioButtons[i].isDown = !audioButtons[i].isDown; | 370 | audioButtons[i].isDown = !audioButtons[i].isDown; |
370 | QPainter p(this); | 371 | QPainter p(this); |
371 | paintButton ( &p, i ); | 372 | paintButton ( &p, i ); |
372 | } | 373 | } |
373 | 374 | ||
@@ -414,58 +415,57 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
414 | if ( event->state() == QMouseEvent::LeftButton ) { | 415 | if ( event->state() == QMouseEvent::LeftButton ) { |
415 | // The test to see if the mouse click is inside the button or not | 416 | // The test to see if the mouse click is inside the button or not |
416 | int x = event->pos().x() - xoff; | 417 | int x = event->pos().x() - xoff; |
417 | int y = event->pos().y() - yoff; | 418 | int y = event->pos().y() - yoff; |
418 | 419 | ||
419 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 420 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
420 | && y < imgButtonMask->height() | 421 | && y < imgButtonMask->height() |
421 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 422 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
422 | 423 | ||
423 | if ( isOnButton && !audioButtons[i].isHeld ) { | 424 | if ( isOnButton && !audioButtons[i].isHeld ) { |
424 | audioButtons[i].isHeld = TRUE; | 425 | audioButtons[i].isHeld = TRUE; |
425 | toggleButton(i); | 426 | toggleButton(i); |
426 | |||
427 | switch (i) { | 427 | switch (i) { |
428 | case AudioVolumeUp: | 428 | case AudioVolumeUp: |
429 | emit moreClicked(); | 429 | emit moreClicked(); |
430 | return; | 430 | return; |
431 | case AudioVolumeDown: | 431 | case AudioVolumeDown: |
432 | emit lessClicked(); | 432 | emit lessClicked(); |
433 | return; | 433 | return; |
434 | case AudioForward: | 434 | case AudioForward: |
435 | emit forwardClicked(); | 435 | emit forwardClicked(); |
436 | return; | 436 | return; |
437 | case AudioBack: | 437 | case AudioBack: |
438 | emit backClicked(); | 438 | emit backClicked(); |
439 | return; | 439 | return; |
440 | } | 440 | } |
441 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | ||
442 | audioButtons[i].isHeld = FALSE; | ||
443 | toggleButton(i); | ||
444 | } | 441 | } |
442 | else if ( !isOnButton && audioButtons[i].isHeld ) { | ||
443 | audioButtons[i].isHeld = FALSE; | ||
444 | toggleButton(i); | ||
445 | } | ||
445 | } else { | 446 | } else { |
446 | if ( audioButtons[i].isHeld ) { | 447 | if ( audioButtons[i].isHeld ) { |
447 | audioButtons[i].isHeld = FALSE; | 448 | audioButtons[i].isHeld = FALSE; |
448 | if ( !audioButtons[i].isToggle ) { | 449 | if ( !audioButtons[i].isToggle ) { |
449 | setToggleButton( i, FALSE ); | 450 | setToggleButton( i, FALSE ); |
450 | qDebug("button toggled3 %d",i); | ||
451 | } | 451 | } |
452 | switch (i) { | 452 | switch (i) { |
453 | case AudioPlay: | 453 | case AudioPlay: |
454 | if( mediaPlayerState->isPaused ) { | 454 | if( mediaPlayerState->isPaused ) { |
455 | setToggleButton( i, FALSE ); | 455 | // setToggleButton( i, FALSE ); |
456 | mediaPlayerState->setPaused( FALSE ); | 456 | mediaPlayerState->setPaused( FALSE ); |
457 | return; | 457 | return; |
458 | } else if( !mediaPlayerState->isPaused ) { | 458 | } else if( !mediaPlayerState->isPaused ) { |
459 | setToggleButton( i, TRUE ); | 459 | // setToggleButton( i, TRUE ); |
460 | mediaPlayerState->setPaused( TRUE ); | 460 | mediaPlayerState->setPaused( TRUE ); |
461 | return; | 461 | return; |
462 | } else { | 462 | } else { |
463 | // setToggleButton( i, TRUE ); | 463 | // setToggleButton( i, TRUE ); |
464 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); | 464 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); |
465 | } | 465 | } |
466 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 466 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
467 | case AudioNext: mediaPlayerState->setNext(); return; | 467 | case AudioNext: mediaPlayerState->setNext(); return; |
468 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 468 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
469 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 469 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
470 | case AudioVolumeUp: emit moreReleased(); return; | 470 | case AudioVolumeUp: emit moreReleased(); return; |
471 | case AudioVolumeDown: emit lessReleased(); return; | 471 | case AudioVolumeDown: emit lessReleased(); return; |
@@ -540,34 +540,34 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) | |||
540 | if(mediaPlayerState->playing()) { | 540 | if(mediaPlayerState->playing()) { |
541 | // toggleButton(1); | 541 | // toggleButton(1); |
542 | mediaPlayerState->setPlaying(FALSE); | 542 | mediaPlayerState->setPlaying(FALSE); |
543 | // toggleButton(1); | 543 | // toggleButton(1); |
544 | } else { | 544 | } else { |
545 | // toggleButton(0); | 545 | // toggleButton(0); |
546 | mediaPlayerState->setPlaying(TRUE); | 546 | mediaPlayerState->setPlaying(TRUE); |
547 | // toggleButton(0); | 547 | // toggleButton(0); |
548 | } | 548 | } |
549 | } | 549 | } |
550 | break; | 550 | break; |
551 | case Key_Down: | 551 | case Key_Down: |
552 | toggleButton(6); | 552 | // toggleButton(6); |
553 | emit lessClicked(); | 553 | emit lessClicked(); |
554 | emit lessReleased(); | 554 | emit lessReleased(); |
555 | toggleButton(6); | 555 | // toggleButton(6); |
556 | break; | 556 | break; |
557 | case Key_Up: | 557 | case Key_Up: |
558 | toggleButton(5); | 558 | // toggleButton(5); |
559 | emit moreClicked(); | 559 | emit moreClicked(); |
560 | emit moreReleased(); | 560 | emit moreReleased(); |
561 | toggleButton(5); | 561 | // toggleButton(5); |
562 | break; | 562 | break; |
563 | case Key_Right: | 563 | case Key_Right: |
564 | // toggleButton(3); | 564 | // toggleButton(3); |
565 | mediaPlayerState->setNext(); | 565 | mediaPlayerState->setNext(); |
566 | // toggleButton(3); | 566 | // toggleButton(3); |
567 | break; | 567 | break; |
568 | case Key_Left: | 568 | case Key_Left: |
569 | // toggleButton(4); | 569 | // toggleButton(4); |
570 | mediaPlayerState->setPrev(); | 570 | mediaPlayerState->setPrev(); |
571 | // toggleButton(4); | 571 | // toggleButton(4); |
572 | break; | 572 | break; |
573 | case Key_Escape: | 573 | case Key_Escape: |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 772d1d1..e7da6c5 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -40,25 +40,24 @@ | |||
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qslider.h> | 42 | #include <qslider.h> |
43 | #include <qframe.h> | 43 | #include <qframe.h> |
44 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
45 | 45 | ||
46 | 46 | ||
47 | class QPixmap; | 47 | class QPixmap; |
48 | 48 | ||
49 | enum AudioButtons { | 49 | enum AudioButtons { |
50 | AudioPlay=0, | 50 | AudioPlay=0, |
51 | AudioStop, | 51 | AudioStop, |
52 | AudioPause, | ||
53 | AudioNext, | 52 | AudioNext, |
54 | AudioPrevious, | 53 | AudioPrevious, |
55 | AudioVolumeUp, | 54 | AudioVolumeUp, |
56 | AudioVolumeDown, | 55 | AudioVolumeDown, |
57 | AudioLoop, | 56 | AudioLoop, |
58 | AudioPlayList, | 57 | AudioPlayList, |
59 | AudioForward, | 58 | AudioForward, |
60 | AudioBack | 59 | AudioBack |
61 | }; | 60 | }; |
62 | 61 | ||
63 | 62 | ||
64 | class Ticker : public QFrame { | 63 | class Ticker : public QFrame { |
@@ -80,25 +79,25 @@ private: | |||
80 | 79 | ||
81 | class AudioWidget : public QWidget { | 80 | class AudioWidget : public QWidget { |
82 | Q_OBJECT | 81 | Q_OBJECT |
83 | public: | 82 | public: |
84 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 83 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
85 | ~AudioWidget(); | 84 | ~AudioWidget(); |
86 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 85 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
87 | bool isStreaming; | 86 | bool isStreaming; |
88 | public slots: | 87 | public slots: |
89 | void updateSlider( long, long ); | 88 | void updateSlider( long, long ); |
90 | void sliderPressed( ); | 89 | void sliderPressed( ); |
91 | void sliderReleased( ); | 90 | void sliderReleased( ); |
92 | void setPaused( bool b) { setToggleButton( AudioPause, b ); } | 91 | // void setPaused( bool b) { setToggleButton( AudioPause, b ); } |
93 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 92 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
94 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 93 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
95 | void setPosition( long ); | 94 | void setPosition( long ); |
96 | void setLength( long ); | 95 | void setLength( long ); |
97 | void setView( char ); | 96 | void setView( char ); |
98 | 97 | ||
99 | signals: | 98 | signals: |
100 | void moreClicked(); | 99 | void moreClicked(); |
101 | void lessClicked(); | 100 | void lessClicked(); |
102 | void moreReleased(); | 101 | void moreReleased(); |
103 | void lessReleased(); | 102 | void lessReleased(); |
104 | void forwardClicked(); | 103 | void forwardClicked(); |