-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 27 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 10 |
5 files changed, 12 insertions, 35 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 74ab2e3..68bbae9 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -150,33 +150,33 @@ void MediaPlayer::prev() { | |||
150 | 150 | ||
151 | void MediaPlayer::next() { | 151 | void MediaPlayer::next() { |
152 | 152 | ||
153 | if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist | 153 | if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist |
154 | if ( playList->next() ) { | 154 | if ( playList->next() ) { |
155 | play(); | 155 | play(); |
156 | } else if ( mediaPlayerState->isLooping() ) { | 156 | } else if ( mediaPlayerState->isLooping() ) { |
157 | if ( playList->first() ) { | 157 | if ( playList->first() ) { |
158 | play(); | 158 | play(); |
159 | } | 159 | } |
160 | } else { | 160 | } else { |
161 | mediaPlayerState->setList(); | 161 | mediaPlayerState->setList(); |
162 | } | 162 | } |
163 | } else { //if playing from file list, let's just stop | 163 | } else { //if playing from file list, let's just stop |
164 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); | 164 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); |
165 | mediaPlayerState->setPlaying(false); | 165 | mediaPlayerState->setPlaying(false); |
166 | mediaPlayerState->setView('l'); | 166 | mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); |
167 | if(l) mediaPlayerState->setLooping(l); | 167 | if(l) mediaPlayerState->setLooping(l); |
168 | if(r) mediaPlayerState->setShuffled(r); | 168 | if(r) mediaPlayerState->setShuffled(r); |
169 | } | 169 | } |
170 | qApp->processEvents(); | 170 | qApp->processEvents(); |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | void MediaPlayer::startDecreasingVolume() { | 174 | void MediaPlayer::startDecreasingVolume() { |
175 | volumeDirection = -1; | 175 | volumeDirection = -1; |
176 | startTimer( 100 ); | 176 | startTimer( 100 ); |
177 | volControl->decVol(2); | 177 | volControl->decVol(2); |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | void MediaPlayer::startIncreasingVolume() { | 181 | void MediaPlayer::startIncreasingVolume() { |
182 | volumeDirection = +1; | 182 | volumeDirection = +1; |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 901b43f..40fa1a4 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -72,44 +72,32 @@ void MediaPlayerState::readConfig( Config& cfg ) { | |||
72 | paused = FALSE; | 72 | paused = FALSE; |
73 | curPosition = 0; | 73 | curPosition = 0; |
74 | curLength = 0; | 74 | curLength = 0; |
75 | m_displayType = MediaSelection; | 75 | m_displayType = MediaSelection; |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 79 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
80 | cfg.setGroup( "Options" ); | 80 | cfg.setGroup( "Options" ); |
81 | cfg.writeEntry( "FullScreen", fullscreen ); | 81 | cfg.writeEntry( "FullScreen", fullscreen ); |
82 | cfg.writeEntry( "Scaling", scaled ); | 82 | cfg.writeEntry( "Scaling", scaled ); |
83 | cfg.writeEntry( "Looping", looping ); | 83 | cfg.writeEntry( "Looping", looping ); |
84 | cfg.writeEntry( "Shuffle", shuffled ); | 84 | cfg.writeEntry( "Shuffle", shuffled ); |
85 | cfg.writeEntry( "VideoGamma", videoGamma ); | 85 | cfg.writeEntry( "VideoGamma", videoGamma ); |
86 | } | 86 | } |
87 | 87 | ||
88 | char MediaPlayerState::view() const | ||
89 | { | ||
90 | switch ( m_displayType ) { | ||
91 | case Audio: return 'a'; | ||
92 | case Video: return 'v'; | ||
93 | case MediaSelection: return 'l'; | ||
94 | default: assert( false ); | ||
95 | } | ||
96 | // never reached | ||
97 | return 42; | ||
98 | } | ||
99 | |||
100 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | 88 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const |
101 | { | 89 | { |
102 | return m_displayType; | 90 | return m_displayType; |
103 | } | 91 | } |
104 | 92 | ||
105 | // slots | 93 | // slots |
106 | void MediaPlayerState::setIsStreaming( bool b ) { | 94 | void MediaPlayerState::setIsStreaming( bool b ) { |
107 | streaming = b; | 95 | streaming = b; |
108 | } | 96 | } |
109 | 97 | ||
110 | void MediaPlayerState::setIsSeekable( bool b ) { | 98 | void MediaPlayerState::setIsSeekable( bool b ) { |
111 | seekable = b; | 99 | seekable = b; |
112 | emit isSeekableToggled(b); | 100 | emit isSeekableToggled(b); |
113 | } | 101 | } |
114 | 102 | ||
115 | 103 | ||
@@ -201,69 +189,60 @@ void MediaPlayerState::updatePosition( long p ){ | |||
201 | void MediaPlayerState::setVideoGamma( int v ){ | 189 | void MediaPlayerState::setVideoGamma( int v ){ |
202 | if ( videoGamma == v ) { | 190 | if ( videoGamma == v ) { |
203 | return; | 191 | return; |
204 | } | 192 | } |
205 | videoGamma = v; | 193 | videoGamma = v; |
206 | emit videoGammaChanged( v ); | 194 | emit videoGammaChanged( v ); |
207 | } | 195 | } |
208 | 196 | ||
209 | void MediaPlayerState::setLength( long l ) { | 197 | void MediaPlayerState::setLength( long l ) { |
210 | if ( curLength == l ) { | 198 | if ( curLength == l ) { |
211 | return; | 199 | return; |
212 | } | 200 | } |
213 | curLength = l; | 201 | curLength = l; |
214 | emit lengthChanged(l); | 202 | emit lengthChanged(l); |
215 | } | 203 | } |
216 | 204 | ||
217 | void MediaPlayerState::setView( char v ) { | ||
218 | switch ( v ) { | ||
219 | case 'a': setDisplayType( Audio ); return; | ||
220 | case 'v': setDisplayType( Video ); return; | ||
221 | case 'l': setDisplayType( MediaSelection ); return; | ||
222 | default: assert( false ); | ||
223 | } | ||
224 | } | ||
225 | |||
226 | void MediaPlayerState::setDisplayType( DisplayType displayType ) | 205 | void MediaPlayerState::setDisplayType( DisplayType displayType ) |
227 | { | 206 | { |
228 | if ( m_displayType == displayType ) | 207 | if ( m_displayType == displayType ) |
229 | return; | 208 | return; |
230 | 209 | ||
231 | m_displayType = displayType; | 210 | m_displayType = displayType; |
232 | emit displayTypeChanged( m_displayType ); | 211 | emit displayTypeChanged( m_displayType ); |
233 | } | 212 | } |
234 | 213 | ||
235 | void MediaPlayerState::setPrev(){ | 214 | void MediaPlayerState::setPrev(){ |
236 | emit prev(); | 215 | emit prev(); |
237 | } | 216 | } |
238 | 217 | ||
239 | void MediaPlayerState::setNext() { | 218 | void MediaPlayerState::setNext() { |
240 | emit next(); | 219 | emit next(); |
241 | } | 220 | } |
242 | 221 | ||
243 | void MediaPlayerState::setList() { | 222 | void MediaPlayerState::setList() { |
244 | setPlaying( FALSE ); | 223 | setPlaying( FALSE ); |
245 | setView('l'); | 224 | setDisplayType( MediaSelection ); |
246 | } | 225 | } |
247 | 226 | ||
248 | void MediaPlayerState::setVideo() { | 227 | void MediaPlayerState::setVideo() { |
249 | setView('v'); | 228 | setDisplayType( Video ); |
250 | } | 229 | } |
251 | 230 | ||
252 | void MediaPlayerState::setAudio() { | 231 | void MediaPlayerState::setAudio() { |
253 | setView('a'); | 232 | setDisplayType( Audio ); |
254 | } | 233 | } |
255 | 234 | ||
256 | void MediaPlayerState::toggleFullscreen() { | 235 | void MediaPlayerState::toggleFullscreen() { |
257 | setFullscreen( !fullscreen ); | 236 | setFullscreen( !fullscreen ); |
258 | } | 237 | } |
259 | 238 | ||
260 | void MediaPlayerState::toggleScaled() { | 239 | void MediaPlayerState::toggleScaled() { |
261 | setScaled( !scaled); | 240 | setScaled( !scaled); |
262 | } | 241 | } |
263 | 242 | ||
264 | void MediaPlayerState::toggleLooping() { | 243 | void MediaPlayerState::toggleLooping() { |
265 | setLooping( !looping); | 244 | setLooping( !looping); |
266 | } | 245 | } |
267 | 246 | ||
268 | void MediaPlayerState::toggleShuffled() { | 247 | void MediaPlayerState::toggleShuffled() { |
269 | setShuffled( !shuffled); | 248 | setShuffled( !shuffled); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index b18780b..c887bb8 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -50,49 +50,47 @@ public: | |||
50 | enum DisplayType { Audio, Video, MediaSelection }; | 50 | enum DisplayType { Audio, Video, MediaSelection }; |
51 | 51 | ||
52 | MediaPlayerState( QObject *parent, const char *name ); | 52 | MediaPlayerState( QObject *parent, const char *name ); |
53 | ~MediaPlayerState(); | 53 | ~MediaPlayerState(); |
54 | 54 | ||
55 | bool isStreaming() const { return streaming; } | 55 | bool isStreaming() const { return streaming; } |
56 | bool isSeekable() const { return seekable; } | 56 | bool isSeekable() const { return seekable; } |
57 | bool isFullscreen() const { return fullscreen; } | 57 | bool isFullscreen() const { return fullscreen; } |
58 | bool isScaled() const { return scaled; } | 58 | bool isScaled() const { return scaled; } |
59 | bool isLooping() const { return looping; } | 59 | bool isLooping() const { return looping; } |
60 | bool isShuffled() const { return shuffled; } | 60 | bool isShuffled() const { return shuffled; } |
61 | bool isPaused() const { return paused; } | 61 | bool isPaused() const { return paused; } |
62 | bool isPlaying() const { return playing; } | 62 | bool isPlaying() const { return playing; } |
63 | bool isStopped() const { return stopped; } | 63 | bool isStopped() const { return stopped; } |
64 | long position() const { return curPosition; } | 64 | long position() const { return curPosition; } |
65 | long length() const { return curLength; } | 65 | long length() const { return curLength; } |
66 | char view() const; | ||
67 | DisplayType displayType() const; | 66 | DisplayType displayType() const; |
68 | 67 | ||
69 | public slots: | 68 | public slots: |
70 | void setIsStreaming( bool b ); | 69 | void setIsStreaming( bool b ); |
71 | void setIsSeekable( bool b ); | 70 | void setIsSeekable( bool b ); |
72 | void setFullscreen( bool b ); | 71 | void setFullscreen( bool b ); |
73 | void setScaled( bool b ); | 72 | void setScaled( bool b ); |
74 | void setLooping( bool b ); | 73 | void setLooping( bool b ); |
75 | void setShuffled( bool b ); | 74 | void setShuffled( bool b ); |
76 | void setPaused( bool b ); | 75 | void setPaused( bool b ); |
77 | void setPlaying( bool b ); | 76 | void setPlaying( bool b ); |
78 | void setStopped( bool b ); | 77 | void setStopped( bool b ); |
79 | void setPosition( long p ); | 78 | void setPosition( long p ); |
80 | void updatePosition( long p ); | 79 | void updatePosition( long p ); |
81 | void setLength( long l ); | 80 | void setLength( long l ); |
82 | void setView( char v ); | ||
83 | void setDisplayType( MediaPlayerState::DisplayType displayType ); | 81 | void setDisplayType( MediaPlayerState::DisplayType displayType ); |
84 | void setBlanked( bool b ); | 82 | void setBlanked( bool b ); |
85 | void setVideoGamma( int v ); | 83 | void setVideoGamma( int v ); |
86 | 84 | ||
87 | void setPrev(); | 85 | void setPrev(); |
88 | void setNext(); | 86 | void setNext(); |
89 | void setList(); | 87 | void setList(); |
90 | void setVideo(); | 88 | void setVideo(); |
91 | void setAudio(); | 89 | void setAudio(); |
92 | 90 | ||
93 | void toggleFullscreen(); | 91 | void toggleFullscreen(); |
94 | void toggleScaled(); | 92 | void toggleScaled(); |
95 | void toggleLooping(); | 93 | void toggleLooping(); |
96 | void toggleShuffled(); | 94 | void toggleShuffled(); |
97 | void togglePaused(); | 95 | void togglePaused(); |
98 | void togglePlaying(); | 96 | void togglePlaying(); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index db7c979..8be7a2f 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | |||
@@ -208,21 +208,21 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags | |||
208 | 208 | ||
209 | 209 | ||
210 | PlayListWidgetGui::~PlayListWidgetGui() { | 210 | PlayListWidgetGui::~PlayListWidgetGui() { |
211 | } | 211 | } |
212 | 212 | ||
213 | void PlayListWidgetGui::setView( char view ) { | 213 | void PlayListWidgetGui::setView( char view ) { |
214 | if ( view == 'l' ) | 214 | if ( view == 'l' ) |
215 | showMaximized(); | 215 | showMaximized(); |
216 | else | 216 | else |
217 | hide(); | 217 | hide(); |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | void PlayListWidgetGui::setActiveWindow() { | 221 | void PlayListWidgetGui::setActiveWindow() { |
222 | // qDebug("SETTING active window"); | 222 | // qDebug("SETTING active window"); |
223 | // When we get raised we need to ensure that it switches views | 223 | // When we get raised we need to ensure that it switches views |
224 | char origView = mediaPlayerState->view(); | 224 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); |
225 | mediaPlayerState->setView( 'l' ); // invalidate | 225 | mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate |
226 | mediaPlayerState->setView( origView ); // now switch back | 226 | mediaPlayerState->setDisplayType( origDisplayType ); // now switch back |
227 | } | 227 | } |
228 | 228 | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 71e08a6..e7d5a7b 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -72,57 +72,57 @@ XineControl::~XineControl() { | |||
72 | 72 | ||
73 | void XineControl::play( const QString& fileName ) { | 73 | void XineControl::play( const QString& fileName ) { |
74 | hasVideoChannel = FALSE; | 74 | hasVideoChannel = FALSE; |
75 | hasAudioChannel = FALSE; | 75 | hasAudioChannel = FALSE; |
76 | m_fileName = fileName; | 76 | m_fileName = fileName; |
77 | 77 | ||
78 | qDebug("<<FILENAME: " + fileName + ">>>>"); | 78 | qDebug("<<FILENAME: " + fileName + ">>>>"); |
79 | 79 | ||
80 | if ( !libXine->play( fileName, 0, 0 ) ) { | 80 | if ( !libXine->play( fileName, 0, 0 ) ) { |
81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
82 | // toggle stop so the the play button is reset | 82 | // toggle stop so the the play button is reset |
83 | mediaPlayerState->setPlaying( false ); | 83 | mediaPlayerState->setPlaying( false ); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | mediaPlayerState->setPlaying( true ); | 86 | mediaPlayerState->setPlaying( true ); |
87 | 87 | ||
88 | char whichGui; | 88 | MediaPlayerState::DisplayType displayType; |
89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); | 89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); |
90 | if ( !libXine->hasVideo() ) { | 90 | if ( !libXine->hasVideo() ) { |
91 | whichGui = 'a'; | 91 | displayType = MediaPlayerState::Audio; |
92 | qDebug("HAS AUDIO"); | 92 | qDebug("HAS AUDIO"); |
93 | libXine->setShowVideo( false ); | 93 | libXine->setShowVideo( false ); |
94 | hasAudioChannel = TRUE; | 94 | hasAudioChannel = TRUE; |
95 | } else { | 95 | } else { |
96 | whichGui = 'v'; | 96 | displayType = MediaPlayerState::Video; |
97 | qDebug("HAS VIDEO"); | 97 | qDebug("HAS VIDEO"); |
98 | libXine->setShowVideo( true ); | 98 | libXine->setShowVideo( true ); |
99 | hasVideoChannel = TRUE; | 99 | hasVideoChannel = TRUE; |
100 | } | 100 | } |
101 | // determine if slider is shown | 101 | // determine if slider is shown |
102 | mediaPlayerState->setIsSeekable( libXine->isSeekable() ); | 102 | mediaPlayerState->setIsSeekable( libXine->isSeekable() ); |
103 | 103 | ||
104 | // which gui (video / audio) | 104 | // which gui (video / audio) |
105 | mediaPlayerState->setView( whichGui ); | 105 | mediaPlayerState->setDisplayType( displayType ); |
106 | 106 | ||
107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
108 | if ( !disabledSuspendScreenSaver ) { | 108 | if ( !disabledSuspendScreenSaver ) { |
109 | disabledSuspendScreenSaver = TRUE; | 109 | disabledSuspendScreenSaver = TRUE; |
110 | // Stop the screen from blanking and power saving state | 110 | // Stop the screen from blanking and power saving state |
111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
112 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 112 | << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | length(); | 116 | length(); |
117 | position(); | 117 | position(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void XineControl::nextMedia() { | 120 | void XineControl::nextMedia() { |
121 | mediaPlayerState->setNext(); | 121 | mediaPlayerState->setNext(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void XineControl::setGamma( int value ) { | 124 | void XineControl::setGamma( int value ) { |
125 | libXine->setGamma( value ); | 125 | libXine->setGamma( value ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void XineControl::stop( bool isSet ) { | 128 | void XineControl::stop( bool isSet ) { |