-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 @@ -52,3 +52,2 @@ -extern MediaPlayerState *mediaPlayerState; extern PlayListWidget *playList; @@ -92,5 +91,5 @@ 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 ) { @@ -161,4 +160,4 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : - 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 ) ) ); @@ -170,7 +169,7 @@ 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() ); @@ -248,4 +247,4 @@ void AudioWidget::sliderReleased() { 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 ); } @@ -254,3 +253,3 @@ void AudioWidget::setPosition( long i ) { // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); - updateSlider( i, mediaPlayerState->length() ); + updateSlider( i, mediaPlayerState.length() ); } @@ -259,3 +258,3 @@ void AudioWidget::setPosition( long i ) { void AudioWidget::setLength( long max ) { - updateSlider( mediaPlayerState->position(), max ); + updateSlider( mediaPlayerState.position(), max ); } @@ -282,4 +281,4 @@ void AudioWidget::setSeekable( bool isSeekable ) { } - 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() ) ); @@ -291,4 +290,4 @@ void AudioWidget::setSeekable( bool isSeekable ) { 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() ) ); @@ -356,3 +355,3 @@ void AudioWidget::skipFor() { startTimer( 50 ); - mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); + mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } @@ -362,3 +361,3 @@ void AudioWidget::skipBack() { startTimer( 50 ); - mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); + mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } @@ -374,5 +373,5 @@ 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 ); } @@ -422,16 +421,16 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 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; @@ -462,3 +461,3 @@ void AudioWidget::showEvent( QShowEvent* ) { void AudioWidget::closeEvent( QCloseEvent* ) { - mediaPlayerState->setList(); + mediaPlayerState.setList(); } @@ -496,3 +495,3 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { case Key_F11: //menu - mediaPlayerState->toggleBlank(); + mediaPlayerState.toggleBlank(); break; @@ -501,8 +500,8 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 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); @@ -510,3 +509,3 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { // toggleButton(0); - mediaPlayerState->setPlaying(TRUE); + mediaPlayerState.setPlaying(TRUE); // toggleButton(0); @@ -529,3 +528,3 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { // toggleButton(3); - mediaPlayerState->setNext(); + mediaPlayerState.setNext(); // toggleButton(3); @@ -534,3 +533,3 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { // toggleButton(4); - mediaPlayerState->setPrev(); + mediaPlayerState.setPrev(); // toggleButton(4); 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 @@ -70,3 +70,3 @@ class AudioWidget : public MediaWidget { public: - AudioWidget( QWidget* parent=0, const char* name=0 ); + AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~AudioWidget(); 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 @@ -21,5 +21,5 @@ int main(int argc, char **argv) { pl.showMaximized(); - AudioWidget aw( 0, "audioUI" ); + AudioWidget aw( st, 0, "audioUI" ); audioUI = &aw; - VideoWidget vw( 0, "videoUI" ); + VideoWidget vw( st, 0, "videoUI" ); videoUI = &vw; 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 @@ -24,10 +24,10 @@ extern MediaPlayerState *mediaPlayerState; -MediaWidget::MediaWidget( QWidget *parent, const char *name ) - : QWidget( parent, name ) +MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) + : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ) { - connect( mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), + connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); - connect( mediaPlayerState, SIGNAL( lengthChanged( long ) ), + connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), this, SLOT( setLength( long ) ) ); - connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), + connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 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 @@ -30,3 +30,3 @@ class MediaWidget : public QWidget public: - MediaWidget( QWidget *parent = 0, const char *name = 0 ); + MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); virtual ~MediaWidget(); @@ -37,2 +37,5 @@ public slots: virtual void setPlaying( bool playing ) = 0; + +protected: + MediaPlayerState &mediaPlayerState; }; 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 @@ -55,3 +55,2 @@ -extern MediaPlayerState *mediaPlayerState; extern PlayListWidget *playList; @@ -84,4 +83,4 @@ static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); -VideoWidget::VideoWidget(QWidget* parent, const char* name) : -MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { +VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : +MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { @@ -139,6 +138,6 @@ MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { - setLength( mediaPlayerState->length() ); - setPosition( mediaPlayerState->position() ); - setFullscreen( mediaPlayerState->isFullscreen() ); - setPlaying( mediaPlayerState->isPlaying() ); + setLength( mediaPlayerState.length() ); + setPosition( mediaPlayerState.position() ); + setFullscreen( mediaPlayerState.isFullscreen() ); + setPlaying( mediaPlayerState.isPlaying() ); } @@ -223,4 +222,4 @@ void VideoWidget::sliderReleased() { } - 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 ); } @@ -228,3 +227,3 @@ void VideoWidget::sliderReleased() { void VideoWidget::setPosition( long i ) { - updateSlider( i, mediaPlayerState->length() ); + updateSlider( i, mediaPlayerState.length() ); } @@ -233,3 +232,3 @@ void VideoWidget::setPosition( long i ) { void VideoWidget::setLength( long max ) { - updateSlider( mediaPlayerState->position(), max ); + updateSlider( mediaPlayerState.position(), max ); } @@ -256,3 +255,3 @@ void VideoWidget::updateSlider( long i, long max ) { int val = int((double)i * width / max); - if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { + if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { if ( slider->value() != val ) { @@ -325,9 +324,9 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoPlay: { - if( mediaPlayerState->isPaused() ) { + if( mediaPlayerState.isPaused() ) { setToggleButton( i, FALSE ); - mediaPlayerState->setPaused( FALSE ); + mediaPlayerState.setPaused( FALSE ); return; - } else if( !mediaPlayerState->isPaused() ) { + } else if( !mediaPlayerState.isPaused() ) { setToggleButton( i, TRUE ); - mediaPlayerState->setPaused( TRUE ); + mediaPlayerState.setPaused( TRUE ); return; @@ -338,8 +337,8 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { - case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; - case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; - case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; + case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; + case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; + case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; case VideoVolUp: emit moreReleased(); return; case VideoVolDown: emit lessReleased(); return; - case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; + case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; } @@ -355,4 +354,4 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { - if ( mediaPlayerState->isFullscreen() ) { - mediaPlayerState->setFullscreen( FALSE ); + if ( mediaPlayerState.isFullscreen() ) { + mediaPlayerState.setFullscreen( FALSE ); makeVisible(); @@ -369,3 +368,3 @@ void VideoWidget::showEvent( QShowEvent* ) { void VideoWidget::backToNormal() { - mediaPlayerState->setFullscreen( FALSE ); + mediaPlayerState.setFullscreen( FALSE ); makeVisible(); @@ -374,3 +373,3 @@ void VideoWidget::showEvent( QShowEvent* ) { void VideoWidget::makeVisible() { - if ( mediaPlayerState->isFullscreen() ) { + if ( mediaPlayerState.isFullscreen() ) { setBackgroundMode( QWidget::NoBackground ); @@ -381,4 +380,4 @@ void VideoWidget::makeVisible() { 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() ) ); @@ -401,3 +400,3 @@ void VideoWidget::makeVisible() { - if ( !mediaPlayerState->isSeekable() ) { + if ( !mediaPlayerState.isSeekable() ) { if( !slider->isHidden()) { @@ -405,4 +404,4 @@ void VideoWidget::makeVisible() { } - 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() ) ); @@ -411,4 +410,4 @@ void VideoWidget::makeVisible() { slider->show(); - 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() ) ); @@ -425,3 +424,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { - if ( mediaPlayerState->isFullscreen() ) { + if ( mediaPlayerState.isFullscreen() ) { // Clear the background @@ -451,3 +450,3 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { void VideoWidget::closeEvent( QCloseEvent* ) { - mediaPlayerState->setList(); + mediaPlayerState.setList(); } @@ -472,6 +471,6 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { case Key_Space: { - if(mediaPlayerState->isPlaying()) { - mediaPlayerState->setPlaying(FALSE); + if(mediaPlayerState.isPlaying()) { + mediaPlayerState.setPlaying(FALSE); } else { - mediaPlayerState->setPlaying(TRUE); + mediaPlayerState.setPlaying(TRUE); } @@ -492,6 +491,6 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) { case Key_Right: - mediaPlayerState->setNext(); + mediaPlayerState.setNext(); break; case Key_Left: - mediaPlayerState->setPrev(); + mediaPlayerState.setPrev(); 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 @@ -58,3 +58,3 @@ class VideoWidget : public MediaWidget { public: - VideoWidget( QWidget* parent=0, const char* name=0 ); + VideoWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~VideoWidget(); |