summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
authorsimon <simon>2002-12-02 20:09:10 (UTC)
committer simon <simon>2002-12-02 20:09:10 (UTC)
commite1ef407b16b652755f9c8eefce0f617ec3996998 (patch) (unidiff)
tree6db64108908f1eee41955caa0e9d7f1d7878e5a8 /noncore/multimedia/opieplayer2
parentacfbc79f2acf59fa5e4494dde4ea1c4ea5e429b7 (diff)
downloadopie-e1ef407b16b652755f9c8eefce0f617ec3996998.zip
opie-e1ef407b16b652755f9c8eefce0f617ec3996998.tar.gz
opie-e1ef407b16b652755f9c8eefce0f617ec3996998.tar.bz2
- MediaPlayer no more uses the MediaPlayerState instance as singleton
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp55
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h4
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) {
26 a.processEvents(); 26 a.processEvents();
27 MediaPlayer mp( 0, "mediaPlayer" ); 27 MediaPlayer mp( st, 0, "mediaPlayer" );
28 28
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;
29extern PlayListWidget *playList; 29extern PlayListWidget *playList;
30extern MediaPlayerState *mediaPlayerState;
31 30
@@ -34,4 +33,4 @@ extern MediaPlayerState *mediaPlayerState;
34 33
35MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 34MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
36 : QObject( parent, name ), volumeDirection( 0 ) { 35 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) {
37 36
@@ -44,9 +43,9 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
44 43
45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 44 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
46 45
47 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 46 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
48 47
49 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 48 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
50 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 49 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
51 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 50 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
52 51
@@ -76,4 +75,4 @@ MediaPlayer::~MediaPlayer() {
76void MediaPlayer::pauseCheck( bool b ) { 75void MediaPlayer::pauseCheck( bool b ) {
77 if ( b && !mediaPlayerState->isPlaying() ) { 76 if ( b && !mediaPlayerState.isPlaying() ) {
78 mediaPlayerState->setPaused( FALSE ); 77 mediaPlayerState.setPaused( FALSE );
79 } 78 }
@@ -82,4 +81,4 @@ void MediaPlayer::pauseCheck( bool b ) {
82void MediaPlayer::play() { 81void MediaPlayer::play() {
83 mediaPlayerState->setPlaying( FALSE ); 82 mediaPlayerState.setPlaying( FALSE );
84 mediaPlayerState->setPlaying( TRUE ); 83 mediaPlayerState.setPlaying( TRUE );
85} 84}
@@ -91,4 +90,4 @@ void MediaPlayer::setPlaying( bool play ) {
91 90
92 if ( mediaPlayerState->isPaused() ) { 91 if ( mediaPlayerState.isPaused() ) {
93 mediaPlayerState->setPaused( FALSE ); 92 mediaPlayerState.setPaused( FALSE );
94 return; 93 return;
@@ -102,8 +101,8 @@ void MediaPlayer::setPlaying( bool play ) {
102 // so we remember and shutoff 101 // so we remember and shutoff
103 l = mediaPlayerState->isLooping(); 102 l = mediaPlayerState.isLooping();
104 if(l) { 103 if(l) {
105 mediaPlayerState->setLooping( false ); 104 mediaPlayerState.setLooping( false );
106 } 105 }
107 r = mediaPlayerState->isShuffled(); 106 r = mediaPlayerState.isShuffled();
108 mediaPlayerState->setShuffled( false ); 107 mediaPlayerState.setShuffled( false );
109 } 108 }
@@ -114,3 +113,3 @@ void MediaPlayer::setPlaying( bool play ) {
114 113
115 long seconds = mediaPlayerState->length(); 114 long seconds = mediaPlayerState.length();
116 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 115 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
@@ -139,3 +138,3 @@ void MediaPlayer::prev() {
139 play(); 138 play();
140 } else if ( mediaPlayerState->isLooping() ) { 139 } else if ( mediaPlayerState.isLooping() ) {
141 if ( playList->last() ) { 140 if ( playList->last() ) {
@@ -144,3 +143,3 @@ void MediaPlayer::prev() {
144 } else { 143 } else {
145 mediaPlayerState->setList(); 144 mediaPlayerState.setList();
146 } 145 }
@@ -155,3 +154,3 @@ void MediaPlayer::next() {
155 play(); 154 play();
156 } else if ( mediaPlayerState->isLooping() ) { 155 } else if ( mediaPlayerState.isLooping() ) {
157 if ( playList->first() ) { 156 if ( playList->first() ) {
@@ -160,3 +159,3 @@ void MediaPlayer::next() {
160 } else { 159 } else {
161 mediaPlayerState->setList(); 160 mediaPlayerState.setList();
162 } 161 }
@@ -164,6 +163,6 @@ void MediaPlayer::next() {
164 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 163 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
165 mediaPlayerState->setPlaying(false); 164 mediaPlayerState.setPlaying(false);
166 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); 165 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
167 if(l) mediaPlayerState->setLooping(l); 166 if(l) mediaPlayerState.setLooping(l);
168 if(r) mediaPlayerState->setShuffled(r); 167 if(r) mediaPlayerState.setShuffled(r);
169 } 168 }
@@ -348,3 +347,3 @@ void MediaPlayer::cleanUp() {// this happens on closing
348 Config cfg( "OpiePlayer" ); 347 Config cfg( "OpiePlayer" );
349 mediaPlayerState->writeConfig( cfg ); 348 mediaPlayerState.writeConfig( cfg );
350 playList->writeDefaultPlaylist( ); 349 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;
43class VolumeControl; 43class VolumeControl;
44class MediaPlayerState;
44 45
@@ -47,3 +48,3 @@ class MediaPlayer : public QObject {
47public: 48public:
48 MediaPlayer( QObject *parent, const char *name ); 49 MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
49 ~MediaPlayer(); 50 ~MediaPlayer();
@@ -70,2 +71,3 @@ private:
70 VolumeControl *volControl; 71 VolumeControl *volControl;
72 MediaPlayerState &mediaPlayerState;
71}; 73};