Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 75 |
1 files changed, 37 insertions, 38 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 @@ #include "playlistwidget.h" -extern MediaPlayerState *mediaPlayerState; extern PlayListWidget *playList; @@ -91,7 +90,7 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); -AudioWidget::AudioWidget(QWidget* parent, const char* name) : +AudioWidget::AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : - MediaWidget( parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { + MediaWidget( mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { setCaption( tr("OpiePlayer") ); @@ -160,6 +159,6 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : resizeEvent( NULL ); - connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); - connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); + connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); @@ -169,9 +168,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : // Intialise state - setLength( mediaPlayerState->length() ); - setPosition( mediaPlayerState->position() ); - setLooping( mediaPlayerState->isFullscreen() ); + setLength( mediaPlayerState.length() ); + setPosition( mediaPlayerState.position() ); + setLooping( mediaPlayerState.isFullscreen() ); // setPaused( mediaPlayerState->paused() ); - setPlaying( mediaPlayerState->isPlaying() ); + setPlaying( mediaPlayerState.isPlaying() ); } @@ -247,16 +246,16 @@ void AudioWidget::sliderReleased() { if ( slider.width() == 0 ) return; - long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); - mediaPlayerState->setPosition( val ); + long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); + mediaPlayerState.setPosition( val ); } void AudioWidget::setPosition( long i ) { // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); - updateSlider( i, mediaPlayerState->length() ); + updateSlider( i, mediaPlayerState.length() ); } void AudioWidget::setLength( long max ) { - updateSlider( mediaPlayerState->position(), max ); + updateSlider( mediaPlayerState.position(), max ); } @@ -281,6 +280,6 @@ void AudioWidget::setSeekable( bool isSeekable ) { slider.hide(); } - disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); @@ -290,6 +289,6 @@ void AudioWidget::setSeekable( bool isSeekable ) { slider.show(); qDebug( " CONNECT SET POSTION " ); - connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); - connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); + connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); + connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); @@ -355,5 +354,5 @@ void AudioWidget::skipFor() { skipDirection = +1; startTimer( 50 ); - mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); + mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } @@ -361,5 +360,5 @@ void AudioWidget::skipBack() { skipDirection = -1; startTimer( 50 ); - mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); + mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } @@ -373,7 +372,7 @@ void AudioWidget::stopSkip() { void AudioWidget::timerEvent( QTimerEvent * ) { if ( skipDirection == +1 ) { - mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); + mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } else if ( skipDirection == -1 ) { - mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); + mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } } @@ -421,18 +420,18 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { switch (i) { case AudioPlay: - if( mediaPlayerState->isPaused() ) { - mediaPlayerState->setPaused( FALSE ); + if( mediaPlayerState.isPaused() ) { + mediaPlayerState.setPaused( FALSE ); return; - } else if( !mediaPlayerState->isPaused() ) { - mediaPlayerState->setPaused( TRUE ); + } else if( !mediaPlayerState.isPaused() ) { + mediaPlayerState.setPaused( TRUE ); return; } - case AudioStop: mediaPlayerState->setPlaying(FALSE); return; - case AudioNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; - case AudioPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; - case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; + case AudioStop: mediaPlayerState.setPlaying(FALSE); return; + case AudioNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; + case AudioPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; + case AudioLoop: mediaPlayerState.setLooping(audioButtons[i].isDown); return; case AudioVolumeUp: emit moreReleased(); return; case AudioVolumeDown: emit lessReleased(); return; - case AudioPlayList: mediaPlayerState->setList(); return; + case AudioPlayList: mediaPlayerState.setList(); return; case AudioForward: emit forwardReleased(); return; case AudioBack: emit backReleased(); return; @@ -461,5 +460,5 @@ void AudioWidget::showEvent( QShowEvent* ) { void AudioWidget::closeEvent( QCloseEvent* ) { - mediaPlayerState->setList(); + mediaPlayerState.setList(); } @@ -495,19 +494,19 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { break; case Key_F11: //menu - mediaPlayerState->toggleBlank(); + mediaPlayerState.toggleBlank(); break; case Key_F12: //home break; case Key_F13: //mail - mediaPlayerState->toggleBlank(); + mediaPlayerState.toggleBlank(); break; case Key_Space: { - if(mediaPlayerState->isPlaying()) { + if(mediaPlayerState.isPlaying()) { // toggleButton(1); - mediaPlayerState->setPlaying(FALSE); + mediaPlayerState.setPlaying(FALSE); // toggleButton(1); } else { // toggleButton(0); - mediaPlayerState->setPlaying(TRUE); + mediaPlayerState.setPlaying(TRUE); // toggleButton(0); } @@ -528,10 +527,10 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { case Key_Right: // toggleButton(3); - mediaPlayerState->setNext(); + mediaPlayerState.setNext(); // toggleButton(3); break; case Key_Left: // toggleButton(4); - mediaPlayerState->setPrev(); + mediaPlayerState.setPrev(); // toggleButton(4); break; |