author | simon <simon> | 2002-12-02 20:32:42 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 20:32:42 (UTC) |
commit | 6cd1494f86f2f60614c9b9a7b959666dec2500ee (patch) (unidiff) | |
tree | 5f5cdbae8be03210fae087eecec2f6b2d070569c | |
parent | abeed050bedee6e2697ea417ed74ab621361da48 (diff) | |
download | opie-6cd1494f86f2f60614c9b9a7b959666dec2500ee.zip opie-6cd1494f86f2f60614c9b9a7b959666dec2500ee.tar.gz opie-6cd1494f86f2f60614c9b9a7b959666dec2500ee.tar.bz2 |
- the audiowidget and the videowidget don't rely on the mediaplayerstate
singleton anymore
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 75 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 75 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
7 files changed, 87 insertions, 86 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index f4edb79..d9beb90 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -51,5 +51,4 @@ | |||
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | 52 | ||
53 | extern MediaPlayerState *mediaPlayerState; | ||
54 | extern PlayListWidget *playList; | 53 | extern PlayListWidget *playList; |
55 | 54 | ||
@@ -91,7 +90,7 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | |||
91 | 90 | ||
92 | 91 | ||
93 | AudioWidget::AudioWidget(QWidget* parent, const char* name) : | 92 | AudioWidget::AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
94 | 93 | ||
95 | MediaWidget( parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 94 | MediaWidget( mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
96 | 95 | ||
97 | setCaption( tr("OpiePlayer") ); | 96 | setCaption( tr("OpiePlayer") ); |
@@ -160,6 +159,6 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : | |||
160 | resizeEvent( NULL ); | 159 | resizeEvent( NULL ); |
161 | 160 | ||
162 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 161 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
163 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 162 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
164 | 163 | ||
165 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 164 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
@@ -169,9 +168,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : | |||
169 | 168 | ||
170 | // Intialise state | 169 | // Intialise state |
171 | setLength( mediaPlayerState->length() ); | 170 | setLength( mediaPlayerState.length() ); |
172 | setPosition( mediaPlayerState->position() ); | 171 | setPosition( mediaPlayerState.position() ); |
173 | setLooping( mediaPlayerState->isFullscreen() ); | 172 | setLooping( mediaPlayerState.isFullscreen() ); |
174 | // setPaused( mediaPlayerState->paused() ); | 173 | // setPaused( mediaPlayerState->paused() ); |
175 | setPlaying( mediaPlayerState->isPlaying() ); | 174 | setPlaying( mediaPlayerState.isPlaying() ); |
176 | 175 | ||
177 | } | 176 | } |
@@ -247,16 +246,16 @@ void AudioWidget::sliderReleased() { | |||
247 | if ( slider.width() == 0 ) | 246 | if ( slider.width() == 0 ) |
248 | return; | 247 | return; |
249 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 248 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
250 | mediaPlayerState->setPosition( val ); | 249 | mediaPlayerState.setPosition( val ); |
251 | } | 250 | } |
252 | 251 | ||
253 | void AudioWidget::setPosition( long i ) { | 252 | void AudioWidget::setPosition( long i ) { |
254 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 253 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
255 | updateSlider( i, mediaPlayerState->length() ); | 254 | updateSlider( i, mediaPlayerState.length() ); |
256 | } | 255 | } |
257 | 256 | ||
258 | 257 | ||
259 | void AudioWidget::setLength( long max ) { | 258 | void AudioWidget::setLength( long max ) { |
260 | updateSlider( mediaPlayerState->position(), max ); | 259 | updateSlider( mediaPlayerState.position(), max ); |
261 | } | 260 | } |
262 | 261 | ||
@@ -281,6 +280,6 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
281 | slider.hide(); | 280 | slider.hide(); |
282 | } | 281 | } |
283 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 282 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
284 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 283 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
285 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 284 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
286 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 285 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
@@ -290,6 +289,6 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
290 | slider.show(); | 289 | slider.show(); |
291 | qDebug( " CONNECT SET POSTION " ); | 290 | qDebug( " CONNECT SET POSTION " ); |
292 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 291 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
293 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 292 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
294 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 293 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
295 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 294 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
@@ -355,5 +354,5 @@ void AudioWidget::skipFor() { | |||
355 | skipDirection = +1; | 354 | skipDirection = +1; |
356 | startTimer( 50 ); | 355 | startTimer( 50 ); |
357 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 356 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
358 | } | 357 | } |
359 | 358 | ||
@@ -361,5 +360,5 @@ void AudioWidget::skipBack() { | |||
361 | skipDirection = -1; | 360 | skipDirection = -1; |
362 | startTimer( 50 ); | 361 | startTimer( 50 ); |
363 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 362 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
364 | } | 363 | } |
365 | 364 | ||
@@ -373,7 +372,7 @@ void AudioWidget::stopSkip() { | |||
373 | void AudioWidget::timerEvent( QTimerEvent * ) { | 372 | void AudioWidget::timerEvent( QTimerEvent * ) { |
374 | if ( skipDirection == +1 ) { | 373 | if ( skipDirection == +1 ) { |
375 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 374 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
376 | } else if ( skipDirection == -1 ) { | 375 | } else if ( skipDirection == -1 ) { |
377 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 376 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
378 | } | 377 | } |
379 | } | 378 | } |
@@ -421,18 +420,18 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
421 | switch (i) { | 420 | switch (i) { |
422 | case AudioPlay: | 421 | case AudioPlay: |
423 | if( mediaPlayerState->isPaused() ) { | 422 | if( mediaPlayerState.isPaused() ) { |
424 | mediaPlayerState->setPaused( FALSE ); | 423 | mediaPlayerState.setPaused( FALSE ); |
425 | return; | 424 | return; |
426 | } else if( !mediaPlayerState->isPaused() ) { | 425 | } else if( !mediaPlayerState.isPaused() ) { |
427 | mediaPlayerState->setPaused( TRUE ); | 426 | mediaPlayerState.setPaused( TRUE ); |
428 | return; | 427 | return; |
429 | } | 428 | } |
430 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 429 | case AudioStop: mediaPlayerState.setPlaying(FALSE); return; |
431 | case AudioNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; | 430 | case AudioNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
432 | case AudioPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; | 431 | case AudioPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
433 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 432 | case AudioLoop: mediaPlayerState.setLooping(audioButtons[i].isDown); return; |
434 | case AudioVolumeUp: emit moreReleased(); return; | 433 | case AudioVolumeUp: emit moreReleased(); return; |
435 | case AudioVolumeDown: emit lessReleased(); return; | 434 | case AudioVolumeDown: emit lessReleased(); return; |
436 | case AudioPlayList: mediaPlayerState->setList(); return; | 435 | case AudioPlayList: mediaPlayerState.setList(); return; |
437 | case AudioForward: emit forwardReleased(); return; | 436 | case AudioForward: emit forwardReleased(); return; |
438 | case AudioBack: emit backReleased(); return; | 437 | case AudioBack: emit backReleased(); return; |
@@ -461,5 +460,5 @@ void AudioWidget::showEvent( QShowEvent* ) { | |||
461 | 460 | ||
462 | void AudioWidget::closeEvent( QCloseEvent* ) { | 461 | void AudioWidget::closeEvent( QCloseEvent* ) { |
463 | mediaPlayerState->setList(); | 462 | mediaPlayerState.setList(); |
464 | } | 463 | } |
465 | 464 | ||
@@ -495,19 +494,19 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | |||
495 | break; | 494 | break; |
496 | case Key_F11: //menu | 495 | case Key_F11: //menu |
497 | mediaPlayerState->toggleBlank(); | 496 | mediaPlayerState.toggleBlank(); |
498 | break; | 497 | break; |
499 | case Key_F12: //home | 498 | case Key_F12: //home |
500 | break; | 499 | break; |
501 | case Key_F13: //mail | 500 | case Key_F13: //mail |
502 | mediaPlayerState->toggleBlank(); | 501 | mediaPlayerState.toggleBlank(); |
503 | break; | 502 | break; |
504 | case Key_Space: { | 503 | case Key_Space: { |
505 | if(mediaPlayerState->isPlaying()) { | 504 | if(mediaPlayerState.isPlaying()) { |
506 | // toggleButton(1); | 505 | // toggleButton(1); |
507 | mediaPlayerState->setPlaying(FALSE); | 506 | mediaPlayerState.setPlaying(FALSE); |
508 | // toggleButton(1); | 507 | // toggleButton(1); |
509 | } else { | 508 | } else { |
510 | // toggleButton(0); | 509 | // toggleButton(0); |
511 | mediaPlayerState->setPlaying(TRUE); | 510 | mediaPlayerState.setPlaying(TRUE); |
512 | // toggleButton(0); | 511 | // toggleButton(0); |
513 | } | 512 | } |
@@ -528,10 +527,10 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | |||
528 | case Key_Right: | 527 | case Key_Right: |
529 | // toggleButton(3); | 528 | // toggleButton(3); |
530 | mediaPlayerState->setNext(); | 529 | mediaPlayerState.setNext(); |
531 | // toggleButton(3); | 530 | // toggleButton(3); |
532 | break; | 531 | break; |
533 | case Key_Left: | 532 | case Key_Left: |
534 | // toggleButton(4); | 533 | // toggleButton(4); |
535 | mediaPlayerState->setPrev(); | 534 | mediaPlayerState.setPrev(); |
536 | // toggleButton(4); | 535 | // toggleButton(4); |
537 | break; | 536 | break; |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 83927f1..087d711 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -69,5 +69,5 @@ class AudioWidget : public MediaWidget { | |||
69 | Q_OBJECT | 69 | Q_OBJECT |
70 | public: | 70 | public: |
71 | AudioWidget( QWidget* parent=0, const char* name=0 ); | 71 | AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
72 | ~AudioWidget(); | 72 | ~AudioWidget(); |
73 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 73 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index 02fdbf3..fd47ea5 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp | |||
@@ -20,7 +20,7 @@ int main(int argc, char **argv) { | |||
20 | playList = &pl; | 20 | playList = &pl; |
21 | pl.showMaximized(); | 21 | pl.showMaximized(); |
22 | AudioWidget aw( 0, "audioUI" ); | 22 | AudioWidget aw( st, 0, "audioUI" ); |
23 | audioUI = &aw; | 23 | audioUI = &aw; |
24 | VideoWidget vw( 0, "videoUI" ); | 24 | VideoWidget vw( st, 0, "videoUI" ); |
25 | videoUI = &vw; | 25 | videoUI = &vw; |
26 | a.processEvents(); | 26 | a.processEvents(); |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 83456a0..d58e87e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -23,12 +23,12 @@ | |||
23 | extern MediaPlayerState *mediaPlayerState; | 23 | extern MediaPlayerState *mediaPlayerState; |
24 | 24 | ||
25 | MediaWidget::MediaWidget( QWidget *parent, const char *name ) | 25 | MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
26 | : QWidget( parent, name ) | 26 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ) |
27 | { | 27 | { |
28 | connect( mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 28 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
29 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 29 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
30 | connect( mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 30 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
31 | this, SLOT( setLength( long ) ) ); | 31 | this, SLOT( setLength( long ) ) ); |
32 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 32 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
33 | this, SLOT( setPlaying( bool ) ) ); | 33 | this, SLOT( setPlaying( bool ) ) ); |
34 | } | 34 | } |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index fc5198e..64adba9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -29,5 +29,5 @@ class MediaWidget : public QWidget | |||
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | MediaWidget( QWidget *parent = 0, const char *name = 0 ); | 31 | MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
32 | virtual ~MediaWidget(); | 32 | virtual ~MediaWidget(); |
33 | 33 | ||
@@ -36,4 +36,7 @@ public slots: | |||
36 | virtual void setLength( long length ) = 0; | 36 | virtual void setLength( long length ) = 0; |
37 | virtual void setPlaying( bool playing ) = 0; | 37 | virtual void setPlaying( bool playing ) = 0; |
38 | |||
39 | protected: | ||
40 | MediaPlayerState &mediaPlayerState; | ||
38 | }; | 41 | }; |
39 | 42 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index e0ca243..b4ecb4c 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -54,5 +54,4 @@ | |||
54 | 54 | ||
55 | 55 | ||
56 | extern MediaPlayerState *mediaPlayerState; | ||
57 | extern PlayListWidget *playList; | 56 | extern PlayListWidget *playList; |
58 | 57 | ||
@@ -83,6 +82,6 @@ static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | |||
83 | 82 | ||
84 | 83 | ||
85 | VideoWidget::VideoWidget(QWidget* parent, const char* name) : | 84 | VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
86 | MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { | 85 | MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { |
87 | 86 | ||
88 | 87 | ||
@@ -138,8 +137,8 @@ MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
138 | resizeEvent( NULL ); | 137 | resizeEvent( NULL ); |
139 | 138 | ||
140 | setLength( mediaPlayerState->length() ); | 139 | setLength( mediaPlayerState.length() ); |
141 | setPosition( mediaPlayerState->position() ); | 140 | setPosition( mediaPlayerState.position() ); |
142 | setFullscreen( mediaPlayerState->isFullscreen() ); | 141 | setFullscreen( mediaPlayerState.isFullscreen() ); |
143 | setPlaying( mediaPlayerState->isPlaying() ); | 142 | setPlaying( mediaPlayerState.isPlaying() ); |
144 | } | 143 | } |
145 | 144 | ||
@@ -222,15 +221,15 @@ void VideoWidget::sliderReleased() { | |||
222 | return; | 221 | return; |
223 | } | 222 | } |
224 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 223 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); |
225 | mediaPlayerState->setPosition( val ); | 224 | mediaPlayerState.setPosition( val ); |
226 | } | 225 | } |
227 | 226 | ||
228 | void VideoWidget::setPosition( long i ) { | 227 | void VideoWidget::setPosition( long i ) { |
229 | updateSlider( i, mediaPlayerState->length() ); | 228 | updateSlider( i, mediaPlayerState.length() ); |
230 | } | 229 | } |
231 | 230 | ||
232 | 231 | ||
233 | void VideoWidget::setLength( long max ) { | 232 | void VideoWidget::setLength( long max ) { |
234 | updateSlider( mediaPlayerState->position(), max ); | 233 | updateSlider( mediaPlayerState.position(), max ); |
235 | } | 234 | } |
236 | 235 | ||
@@ -255,5 +254,5 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
255 | int width = slider->width(); | 254 | int width = slider->width(); |
256 | int val = int((double)i * width / max); | 255 | int val = int((double)i * width / max); |
257 | if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { | 256 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
258 | if ( slider->value() != val ) { | 257 | if ( slider->value() != val ) { |
259 | slider->setValue( val ); | 258 | slider->setValue( val ); |
@@ -324,11 +323,11 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
324 | 323 | ||
325 | case VideoPlay: { | 324 | case VideoPlay: { |
326 | if( mediaPlayerState->isPaused() ) { | 325 | if( mediaPlayerState.isPaused() ) { |
327 | setToggleButton( i, FALSE ); | 326 | setToggleButton( i, FALSE ); |
328 | mediaPlayerState->setPaused( FALSE ); | 327 | mediaPlayerState.setPaused( FALSE ); |
329 | return; | 328 | return; |
330 | } else if( !mediaPlayerState->isPaused() ) { | 329 | } else if( !mediaPlayerState.isPaused() ) { |
331 | setToggleButton( i, TRUE ); | 330 | setToggleButton( i, TRUE ); |
332 | mediaPlayerState->setPaused( TRUE ); | 331 | mediaPlayerState.setPaused( TRUE ); |
333 | return; | 332 | return; |
334 | } else { | 333 | } else { |
@@ -337,10 +336,10 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
337 | } | 336 | } |
338 | 337 | ||
339 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 338 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; |
340 | case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; | 339 | case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
341 | case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; | 340 | case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
342 | case VideoVolUp: emit moreReleased(); return; | 341 | case VideoVolUp: emit moreReleased(); return; |
343 | case VideoVolDown: emit lessReleased(); return; | 342 | case VideoVolDown: emit lessReleased(); return; |
344 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 343 | case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; |
345 | } | 344 | } |
346 | } | 345 | } |
@@ -354,6 +353,6 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { | |||
354 | 353 | ||
355 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 354 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
356 | if ( mediaPlayerState->isFullscreen() ) { | 355 | if ( mediaPlayerState.isFullscreen() ) { |
357 | mediaPlayerState->setFullscreen( FALSE ); | 356 | mediaPlayerState.setFullscreen( FALSE ); |
358 | makeVisible(); | 357 | makeVisible(); |
359 | } | 358 | } |
@@ -368,10 +367,10 @@ void VideoWidget::showEvent( QShowEvent* ) { | |||
368 | 367 | ||
369 | void VideoWidget::backToNormal() { | 368 | void VideoWidget::backToNormal() { |
370 | mediaPlayerState->setFullscreen( FALSE ); | 369 | mediaPlayerState.setFullscreen( FALSE ); |
371 | makeVisible(); | 370 | makeVisible(); |
372 | } | 371 | } |
373 | 372 | ||
374 | void VideoWidget::makeVisible() { | 373 | void VideoWidget::makeVisible() { |
375 | if ( mediaPlayerState->isFullscreen() ) { | 374 | if ( mediaPlayerState.isFullscreen() ) { |
376 | setBackgroundMode( QWidget::NoBackground ); | 375 | setBackgroundMode( QWidget::NoBackground ); |
377 | showFullScreen(); | 376 | showFullScreen(); |
@@ -380,6 +379,6 @@ void VideoWidget::makeVisible() { | |||
380 | 379 | ||
381 | slider->hide(); | 380 | slider->hide(); |
382 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 381 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
383 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 382 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
384 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 383 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
385 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 384 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
@@ -400,16 +399,16 @@ void VideoWidget::makeVisible() { | |||
400 | } | 399 | } |
401 | 400 | ||
402 | if ( !mediaPlayerState->isSeekable() ) { | 401 | if ( !mediaPlayerState.isSeekable() ) { |
403 | if( !slider->isHidden()) { | 402 | if( !slider->isHidden()) { |
404 | slider->hide(); | 403 | slider->hide(); |
405 | } | 404 | } |
406 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 405 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
407 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 406 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
408 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 407 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
409 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 408 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
410 | } else { | 409 | } else { |
411 | slider->show(); | 410 | slider->show(); |
412 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 411 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
413 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 412 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
414 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 413 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
415 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 414 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
@@ -424,5 +423,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
424 | QPainter p( this ); | 423 | QPainter p( this ); |
425 | 424 | ||
426 | if ( mediaPlayerState->isFullscreen() ) { | 425 | if ( mediaPlayerState.isFullscreen() ) { |
427 | // Clear the background | 426 | // Clear the background |
428 | p.setBrush( QBrush( Qt::black ) ); | 427 | p.setBrush( QBrush( Qt::black ) ); |
@@ -450,5 +449,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
450 | 449 | ||
451 | void VideoWidget::closeEvent( QCloseEvent* ) { | 450 | void VideoWidget::closeEvent( QCloseEvent* ) { |
452 | mediaPlayerState->setList(); | 451 | mediaPlayerState.setList(); |
453 | } | 452 | } |
454 | 453 | ||
@@ -471,8 +470,8 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
471 | break; | 470 | break; |
472 | case Key_Space: { | 471 | case Key_Space: { |
473 | if(mediaPlayerState->isPlaying()) { | 472 | if(mediaPlayerState.isPlaying()) { |
474 | mediaPlayerState->setPlaying(FALSE); | 473 | mediaPlayerState.setPlaying(FALSE); |
475 | } else { | 474 | } else { |
476 | mediaPlayerState->setPlaying(TRUE); | 475 | mediaPlayerState.setPlaying(TRUE); |
477 | } | 476 | } |
478 | } | 477 | } |
@@ -491,8 +490,8 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
491 | break; | 490 | break; |
492 | case Key_Right: | 491 | case Key_Right: |
493 | mediaPlayerState->setNext(); | 492 | mediaPlayerState.setNext(); |
494 | break; | 493 | break; |
495 | case Key_Left: | 494 | case Key_Left: |
496 | mediaPlayerState->setPrev(); | 495 | mediaPlayerState.setPrev(); |
497 | break; | 496 | break; |
498 | case Key_Escape: | 497 | case Key_Escape: |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 816ce2e..38eb726 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -57,5 +57,5 @@ class VideoWidget : public MediaWidget { | |||
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | VideoWidget( QWidget* parent=0, const char* name=0 ); | 59 | VideoWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
60 | ~VideoWidget(); | 60 | ~VideoWidget(); |
61 | 61 | ||