author | simon <simon> | 2002-12-02 20:09:10 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 20:09:10 (UTC) |
commit | e1ef407b16b652755f9c8eefce0f617ec3996998 (patch) (side-by-side diff) | |
tree | 6db64108908f1eee41955caa0e9d7f1d7878e5a8 /noncore/multimedia | |
parent | acfbc79f2acf59fa5e4494dde4ea1c4ea5e429b7 (diff) | |
download | opie-e1ef407b16b652755f9c8eefce0f617ec3996998.zip opie-e1ef407b16b652755f9c8eefce0f617ec3996998.tar.gz opie-e1ef407b16b652755f9c8eefce0f617ec3996998.tar.bz2 |
- MediaPlayer no more uses the MediaPlayerState instance as singleton
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 55 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 4 |
3 files changed, 31 insertions, 30 deletions
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index e951554..24aba6c 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp @@ -26,3 +26,3 @@ int main(int argc, char **argv) { a.processEvents(); - MediaPlayer mp( 0, "mediaPlayer" ); + MediaPlayer mp( st, 0, "mediaPlayer" ); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 68bbae9..424259b 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -29,3 +29,2 @@ extern VideoWidget *videoUI; extern PlayListWidget *playList; -extern MediaPlayerState *mediaPlayerState; @@ -34,4 +33,4 @@ extern MediaPlayerState *mediaPlayerState; -MediaPlayer::MediaPlayer( QObject *parent, const char *name ) - : QObject( parent, name ), volumeDirection( 0 ) { +MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) + : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { @@ -44,9 +43,9 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) - connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); - connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); - connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); - connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); - connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); + connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); + connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); @@ -76,4 +75,4 @@ MediaPlayer::~MediaPlayer() { void MediaPlayer::pauseCheck( bool b ) { - if ( b && !mediaPlayerState->isPlaying() ) { - mediaPlayerState->setPaused( FALSE ); + if ( b && !mediaPlayerState.isPlaying() ) { + mediaPlayerState.setPaused( FALSE ); } @@ -82,4 +81,4 @@ void MediaPlayer::pauseCheck( bool b ) { void MediaPlayer::play() { - mediaPlayerState->setPlaying( FALSE ); - mediaPlayerState->setPlaying( TRUE ); + mediaPlayerState.setPlaying( FALSE ); + mediaPlayerState.setPlaying( TRUE ); } @@ -91,4 +90,4 @@ void MediaPlayer::setPlaying( bool play ) { - if ( mediaPlayerState->isPaused() ) { - mediaPlayerState->setPaused( FALSE ); + if ( mediaPlayerState.isPaused() ) { + mediaPlayerState.setPaused( FALSE ); return; @@ -102,8 +101,8 @@ void MediaPlayer::setPlaying( bool play ) { // so we remember and shutoff - l = mediaPlayerState->isLooping(); + l = mediaPlayerState.isLooping(); if(l) { - mediaPlayerState->setLooping( false ); + mediaPlayerState.setLooping( false ); } - r = mediaPlayerState->isShuffled(); - mediaPlayerState->setShuffled( false ); + r = mediaPlayerState.isShuffled(); + mediaPlayerState.setShuffled( false ); } @@ -114,3 +113,3 @@ void MediaPlayer::setPlaying( bool play ) { - long seconds = mediaPlayerState->length(); + long seconds = mediaPlayerState.length(); time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); @@ -139,3 +138,3 @@ void MediaPlayer::prev() { play(); - } else if ( mediaPlayerState->isLooping() ) { + } else if ( mediaPlayerState.isLooping() ) { if ( playList->last() ) { @@ -144,3 +143,3 @@ void MediaPlayer::prev() { } else { - mediaPlayerState->setList(); + mediaPlayerState.setList(); } @@ -155,3 +154,3 @@ void MediaPlayer::next() { play(); - } else if ( mediaPlayerState->isLooping() ) { + } else if ( mediaPlayerState.isLooping() ) { if ( playList->first() ) { @@ -160,3 +159,3 @@ void MediaPlayer::next() { } else { - mediaPlayerState->setList(); + mediaPlayerState.setList(); } @@ -164,6 +163,6 @@ void MediaPlayer::next() { qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); - mediaPlayerState->setPlaying(false); - mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); - if(l) mediaPlayerState->setLooping(l); - if(r) mediaPlayerState->setShuffled(r); + mediaPlayerState.setPlaying(false); + mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); + if(l) mediaPlayerState.setLooping(l); + if(r) mediaPlayerState.setShuffled(r); } @@ -348,3 +347,3 @@ void MediaPlayer::cleanUp() {// this happens on closing Config cfg( "OpiePlayer" ); - mediaPlayerState->writeConfig( cfg ); + mediaPlayerState.writeConfig( cfg ); playList->writeDefaultPlaylist( ); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index de3886e..6aeac7c 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -43,2 +43,3 @@ class DocLnk; class VolumeControl; +class MediaPlayerState; @@ -47,3 +48,3 @@ class MediaPlayer : public QObject { public: - MediaPlayer( QObject *parent, const char *name ); + MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); ~MediaPlayer(); @@ -70,2 +71,3 @@ private: VolumeControl *volControl; + MediaPlayerState &mediaPlayerState; }; |