-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 | |||
@@ -50,7 +50,6 @@ | |||
50 | #include "mediaplayerstate.h" | 50 | #include "mediaplayerstate.h" |
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | 52 | ||
53 | extern MediaPlayerState *mediaPlayerState; | ||
54 | extern PlayListWidget *playList; | 53 | extern PlayListWidget *playList; |
55 | 54 | ||
56 | static const int xo = -2; // movable x offset | 55 | static const int xo = -2; // movable x offset |
@@ -90,9 +89,9 @@ static void changeTextColor( QWidget *w ) { | |||
90 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 89 | 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") ); |
98 | 97 | ||
@@ -159,8 +158,8 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : | |||
159 | 158 | ||
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() ) ); |
166 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 165 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
@@ -168,11 +167,11 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : | |||
168 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 167 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
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 | } |
178 | 177 | ||
@@ -246,18 +245,18 @@ void AudioWidget::sliderReleased() { | |||
246 | audioSliderBeingMoved = FALSE; | 245 | audioSliderBeingMoved = FALSE; |
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 | ||
263 | 262 | ||
@@ -280,8 +279,8 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
280 | if( !slider.isHidden()) { | 279 | if( !slider.isHidden()) { |
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() ) ); |
287 | } else { | 286 | } else { |
@@ -289,8 +288,8 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
289 | // does not stop stream when it reaches the end | 288 | // does not stop stream when it reaches the end |
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() ) ); |
296 | } | 295 | } |
@@ -354,13 +353,13 @@ void AudioWidget::paintButton( QPainter *p, int i ) { | |||
354 | void AudioWidget::skipFor() { | 353 | 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 | ||
360 | void AudioWidget::skipBack() { | 359 | 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 | ||
366 | 365 | ||
@@ -372,9 +371,9 @@ void AudioWidget::stopSkip() { | |||
372 | 371 | ||
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 | } |
380 | 379 | ||
@@ -420,20 +419,20 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
420 | qDebug("mouseEvent %d", i); | 419 | qDebug("mouseEvent %d", i); |
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; |
439 | } | 438 | } |
@@ -460,7 +459,7 @@ void AudioWidget::showEvent( QShowEvent* ) { | |||
460 | 459 | ||
461 | 460 | ||
462 | void AudioWidget::closeEvent( QCloseEvent* ) { | 461 | void AudioWidget::closeEvent( QCloseEvent* ) { |
463 | mediaPlayerState->setList(); | 462 | mediaPlayerState.setList(); |
464 | } | 463 | } |
465 | 464 | ||
466 | 465 | ||
@@ -494,21 +493,21 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | |||
494 | case Key_F10: //contacts | 493 | case Key_F10: //contacts |
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 | } |
514 | } | 513 | } |
@@ -527,12 +526,12 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | |||
527 | break; | 526 | break; |
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; |
538 | case Key_Escape: { | 537 | case Key_Escape: { |
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 | |||
@@ -68,7 +68,7 @@ enum AudioButtons { | |||
68 | class AudioWidget : public MediaWidget { | 68 | 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 ); } |
74 | public slots: | 74 | public slots: |
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 | |||
@@ -19,9 +19,9 @@ int main(int argc, char **argv) { | |||
19 | PlayListWidget pl( st, 0, "playList" ); | 19 | PlayListWidget pl( st, 0, "playList" ); |
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(); |
27 | MediaPlayer mp( st, 0, "mediaPlayer" ); | 27 | MediaPlayer mp( st, 0, "mediaPlayer" ); |
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 | |||
@@ -22,14 +22,14 @@ | |||
22 | 22 | ||
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 | } |
35 | 35 | ||
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 | |||
@@ -28,13 +28,16 @@ class MediaWidget : public QWidget | |||
28 | { | 28 | { |
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 | ||
34 | public slots: | 34 | public slots: |
35 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 35 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
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 | ||
40 | #endif // MEDIAWIDGET_H | 43 | #endif // MEDIAWIDGET_H |
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 | |||
@@ -53,7 +53,6 @@ | |||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | 55 | ||
56 | extern MediaPlayerState *mediaPlayerState; | ||
57 | extern PlayListWidget *playList; | 56 | extern PlayListWidget *playList; |
58 | 57 | ||
59 | 58 | ||
@@ -82,8 +81,8 @@ const char *skinV_mask_file_names[7] = { | |||
82 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 81 | 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 | ||
89 | setCaption( tr("OpiePlayer - Video") ); | 88 | setCaption( tr("OpiePlayer - Video") ); |
@@ -137,10 +136,10 @@ MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
137 | 136 | ||
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 | ||
146 | 145 | ||
@@ -221,17 +220,17 @@ void VideoWidget::sliderReleased() { | |||
221 | if ( slider->width() == 0 ) { | 220 | if ( slider->width() == 0 ) { |
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 | ||
237 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 236 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
@@ -254,7 +253,7 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
254 | } | 253 | } |
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 ); |
260 | } | 259 | } |
@@ -323,25 +322,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
323 | switch(i) { | 322 | switch(i) { |
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 { |
335 | return; | 334 | return; |
336 | } | 335 | } |
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 | } |
347 | } | 346 | } |
@@ -353,8 +352,8 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { | |||
353 | } | 352 | } |
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 | } |
360 | mouseMoveEvent( event ); | 359 | mouseMoveEvent( event ); |
@@ -367,20 +366,20 @@ void VideoWidget::showEvent( QShowEvent* ) { | |||
367 | 366 | ||
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(); |
378 | resize( qApp->desktop()->size() ); | 377 | resize( qApp->desktop()->size() ); |
379 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 378 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
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() ) ); |
386 | 385 | ||
@@ -399,18 +398,18 @@ void VideoWidget::makeVisible() { | |||
399 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 398 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
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() ) ); |
416 | } | 415 | } |
@@ -423,7 +422,7 @@ void VideoWidget::makeVisible() { | |||
423 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 422 | 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 ) ); |
429 | } else { | 428 | } else { |
@@ -449,7 +448,7 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
449 | 448 | ||
450 | 449 | ||
451 | void VideoWidget::closeEvent( QCloseEvent* ) { | 450 | void VideoWidget::closeEvent( QCloseEvent* ) { |
452 | mediaPlayerState->setList(); | 451 | mediaPlayerState.setList(); |
453 | } | 452 | } |
454 | 453 | ||
455 | 454 | ||
@@ -470,10 +469,10 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
470 | case Key_F13: //mail | 469 | case Key_F13: //mail |
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 | } |
479 | break; | 478 | break; |
@@ -490,10 +489,10 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | |||
490 | // toggleButton(5); | 489 | // toggleButton(5); |
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: |
499 | break; | 498 | break; |
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 | |||
@@ -56,7 +56,7 @@ enum VideoButtons { | |||
56 | class VideoWidget : public MediaWidget { | 56 | 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 | ||
62 | 62 | ||