-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 57 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 26 |
2 files changed, 13 insertions, 70 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 85d9bac..0d21027 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,338 +1,281 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | // this file is based on work by trolltech | 34 | // this file is based on work by trolltech |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/qlibrary.h> | 37 | #include <qpe/qlibrary.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qobject.h> | 40 | #include <qobject.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include "mediaplayerstate.h" | 42 | #include "mediaplayerstate.h" |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | //#define MediaPlayerDebug(x) qDebug x | 46 | //#define MediaPlayerDebug(x) qDebug x |
47 | #define MediaPlayerDebug(x) | 47 | #define MediaPlayerDebug(x) |
48 | 48 | ||
49 | 49 | ||
50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
51 | : QObject( parent, name ) { | 51 | : QObject( parent, name ) { |
52 | Config cfg( "OpiePlayer" ); | 52 | Config cfg( "OpiePlayer" ); |
53 | readConfig( cfg ); | 53 | readConfig( cfg ); |
54 | streaming = false; | 54 | streaming = false; |
55 | seekable = true; | 55 | seekable = true; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | MediaPlayerState::~MediaPlayerState() { | 59 | MediaPlayerState::~MediaPlayerState() { |
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | void MediaPlayerState::readConfig( Config& cfg ) { | 63 | void MediaPlayerState::readConfig( Config& cfg ) { |
64 | cfg.setGroup("Options"); | 64 | cfg.setGroup("Options"); |
65 | fullscreen = cfg.readBoolEntry( "FullScreen" ); | 65 | fullscreen = cfg.readBoolEntry( "FullScreen" ); |
66 | scaled = cfg.readBoolEntry( "Scaling" ); | 66 | scaled = cfg.readBoolEntry( "Scaling" ); |
67 | looping = cfg.readBoolEntry( "Looping" ); | 67 | looping = cfg.readBoolEntry( "Looping" ); |
68 | shuffled = cfg.readBoolEntry( "Shuffle" ); | 68 | shuffled = cfg.readBoolEntry( "Shuffle" ); |
69 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 69 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
70 | videoGamma = cfg.readNumEntry( "VideoGamma" ); | 70 | videoGamma = cfg.readNumEntry( "VideoGamma" ); |
71 | usePlaylist = TRUE; | 71 | usePlaylist = TRUE; |
72 | playing = FALSE; | 72 | playing = FALSE; |
73 | streaming = FALSE; | 73 | streaming = FALSE; |
74 | paused = FALSE; | 74 | paused = FALSE; |
75 | curPosition = 0; | 75 | curPosition = 0; |
76 | curLength = 0; | 76 | curLength = 0; |
77 | curView = 'l'; | 77 | curView = 'l'; |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 81 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
82 | cfg.setGroup( "Options" ); | 82 | cfg.setGroup( "Options" ); |
83 | cfg.writeEntry( "FullScreen", fullscreen ); | 83 | cfg.writeEntry( "FullScreen", fullscreen ); |
84 | cfg.writeEntry( "Scaling", scaled ); | 84 | cfg.writeEntry( "Scaling", scaled ); |
85 | cfg.writeEntry( "Looping", looping ); | 85 | cfg.writeEntry( "Looping", looping ); |
86 | cfg.writeEntry( "Shuffle", shuffled ); | 86 | cfg.writeEntry( "Shuffle", shuffled ); |
87 | cfg.writeEntry( "UsePlayList", usePlaylist ); | 87 | cfg.writeEntry( "UsePlayList", usePlaylist ); |
88 | cfg.writeEntry( "VideoGamma", videoGamma ); | 88 | cfg.writeEntry( "VideoGamma", videoGamma ); |
89 | } | 89 | } |
90 | 90 | ||
91 | |||
92 | // public stuff | ||
93 | |||
94 | |||
95 | bool MediaPlayerState::isStreaming() const { | ||
96 | return streaming; | ||
97 | } | ||
98 | |||
99 | bool MediaPlayerState::isSeekable() const { | ||
100 | return seekable; | ||
101 | } | ||
102 | |||
103 | bool MediaPlayerState::isFullscreen() const { | ||
104 | return fullscreen; | ||
105 | } | ||
106 | |||
107 | bool MediaPlayerState::isScaled() const { | ||
108 | return scaled; | ||
109 | } | ||
110 | |||
111 | bool MediaPlayerState::isLooping() const { | ||
112 | return looping; | ||
113 | } | ||
114 | |||
115 | bool MediaPlayerState::isShuffled() const { | ||
116 | return shuffled; | ||
117 | } | ||
118 | |||
119 | |||
120 | bool MediaPlayerState::isUsingPlaylist() const { | ||
121 | return usePlaylist; | ||
122 | } | ||
123 | |||
124 | bool MediaPlayerState::isPaused() const { | ||
125 | return paused; | ||
126 | } | ||
127 | |||
128 | bool MediaPlayerState::isPlaying() const { | ||
129 | return playing; | ||
130 | } | ||
131 | |||
132 | bool MediaPlayerState::isStop() const { | ||
133 | return stoped; | ||
134 | } | ||
135 | |||
136 | long MediaPlayerState::position() const { | ||
137 | return curPosition; | ||
138 | } | ||
139 | |||
140 | long MediaPlayerState::length() const { | ||
141 | return curLength; | ||
142 | } | ||
143 | |||
144 | char MediaPlayerState::view() const { | ||
145 | return curView; | ||
146 | } | ||
147 | |||
148 | // slots | 91 | // slots |
149 | void MediaPlayerState::setIsStreaming( bool b ) { | 92 | void MediaPlayerState::setIsStreaming( bool b ) { |
150 | 93 | ||
151 | if ( streaming == b ) { | 94 | if ( streaming == b ) { |
152 | return; | 95 | return; |
153 | } | 96 | } |
154 | streaming = b; | 97 | streaming = b; |
155 | } | 98 | } |
156 | 99 | ||
157 | void MediaPlayerState::setIsSeekable( bool b ) { | 100 | void MediaPlayerState::setIsSeekable( bool b ) { |
158 | 101 | ||
159 | //if ( isSeekable == b ) { | 102 | //if ( isSeekable == b ) { |
160 | // return; | 103 | // return; |
161 | // } | 104 | // } |
162 | seekable = b; | 105 | seekable = b; |
163 | emit isSeekableToggled(b); | 106 | emit isSeekableToggled(b); |
164 | } | 107 | } |
165 | 108 | ||
166 | 109 | ||
167 | void MediaPlayerState::setFullscreen( bool b ) { | 110 | void MediaPlayerState::setFullscreen( bool b ) { |
168 | if ( fullscreen == b ) { | 111 | if ( fullscreen == b ) { |
169 | return; | 112 | return; |
170 | } | 113 | } |
171 | fullscreen = b; | 114 | fullscreen = b; |
172 | emit fullscreenToggled(b); | 115 | emit fullscreenToggled(b); |
173 | } | 116 | } |
174 | 117 | ||
175 | 118 | ||
176 | void MediaPlayerState::setBlanked( bool b ) { | 119 | void MediaPlayerState::setBlanked( bool b ) { |
177 | if ( blanked == b ) { | 120 | if ( blanked == b ) { |
178 | return; | 121 | return; |
179 | } | 122 | } |
180 | blanked = b; | 123 | blanked = b; |
181 | emit blankToggled(b); | 124 | emit blankToggled(b); |
182 | } | 125 | } |
183 | 126 | ||
184 | 127 | ||
185 | void MediaPlayerState::setScaled( bool b ) { | 128 | void MediaPlayerState::setScaled( bool b ) { |
186 | if ( scaled == b ) { | 129 | if ( scaled == b ) { |
187 | return; | 130 | return; |
188 | } | 131 | } |
189 | scaled = b; | 132 | scaled = b; |
190 | emit scaledToggled(b); | 133 | emit scaledToggled(b); |
191 | } | 134 | } |
192 | 135 | ||
193 | void MediaPlayerState::setLooping( bool b ) { | 136 | void MediaPlayerState::setLooping( bool b ) { |
194 | if ( looping == b ) { | 137 | if ( looping == b ) { |
195 | return; | 138 | return; |
196 | } | 139 | } |
197 | looping = b; | 140 | looping = b; |
198 | emit loopingToggled(b); | 141 | emit loopingToggled(b); |
199 | } | 142 | } |
200 | 143 | ||
201 | void MediaPlayerState::setShuffled( bool b ) { | 144 | void MediaPlayerState::setShuffled( bool b ) { |
202 | if ( shuffled == b ) { | 145 | if ( shuffled == b ) { |
203 | return; | 146 | return; |
204 | } | 147 | } |
205 | shuffled = b; | 148 | shuffled = b; |
206 | emit shuffledToggled(b); | 149 | emit shuffledToggled(b); |
207 | } | 150 | } |
208 | 151 | ||
209 | void MediaPlayerState::setPlaylist( bool b ) { | 152 | void MediaPlayerState::setPlaylist( bool b ) { |
210 | if ( usePlaylist == b ) { | 153 | if ( usePlaylist == b ) { |
211 | return; | 154 | return; |
212 | } | 155 | } |
213 | usePlaylist = b; | 156 | usePlaylist = b; |
214 | emit playlistToggled(b); | 157 | emit playlistToggled(b); |
215 | } | 158 | } |
216 | 159 | ||
217 | void MediaPlayerState::setPaused( bool b ) { | 160 | void MediaPlayerState::setPaused( bool b ) { |
218 | if ( paused == b ) { | 161 | if ( paused == b ) { |
219 | paused = FALSE; | 162 | paused = FALSE; |
220 | emit pausedToggled(FALSE); | 163 | emit pausedToggled(FALSE); |
221 | return; | 164 | return; |
222 | } | 165 | } |
223 | paused = b; | 166 | paused = b; |
224 | emit pausedToggled(b); | 167 | emit pausedToggled(b); |
225 | } | 168 | } |
226 | 169 | ||
227 | void MediaPlayerState::setPlaying( bool b ) { | 170 | void MediaPlayerState::setPlaying( bool b ) { |
228 | if ( playing == b ) { | 171 | if ( playing == b ) { |
229 | return; | 172 | return; |
230 | } | 173 | } |
231 | playing = b; | 174 | playing = b; |
232 | stoped = !b; | 175 | stoped = !b; |
233 | emit playingToggled(b); | 176 | emit playingToggled(b); |
234 | } | 177 | } |
235 | 178 | ||
236 | void MediaPlayerState::setStop( bool b ) { | 179 | void MediaPlayerState::setStop( bool b ) { |
237 | if ( stoped == b ) { | 180 | if ( stoped == b ) { |
238 | return; | 181 | return; |
239 | } | 182 | } |
240 | stoped = b; | 183 | stoped = b; |
241 | emit stopToggled(b); | 184 | emit stopToggled(b); |
242 | } | 185 | } |
243 | 186 | ||
244 | void MediaPlayerState::setPosition( long p ) { | 187 | void MediaPlayerState::setPosition( long p ) { |
245 | if ( curPosition == p ) { | 188 | if ( curPosition == p ) { |
246 | return; | 189 | return; |
247 | } | 190 | } |
248 | curPosition = p; | 191 | curPosition = p; |
249 | emit positionChanged(p); | 192 | emit positionChanged(p); |
250 | } | 193 | } |
251 | 194 | ||
252 | void MediaPlayerState::updatePosition( long p ){ | 195 | void MediaPlayerState::updatePosition( long p ){ |
253 | if ( curPosition == p ) { | 196 | if ( curPosition == p ) { |
254 | return; | 197 | return; |
255 | } | 198 | } |
256 | curPosition = p; | 199 | curPosition = p; |
257 | emit positionUpdated(p); | 200 | emit positionUpdated(p); |
258 | } | 201 | } |
259 | 202 | ||
260 | void MediaPlayerState::setVideoGamma( int v ){ | 203 | void MediaPlayerState::setVideoGamma( int v ){ |
261 | if ( videoGamma == v ) { | 204 | if ( videoGamma == v ) { |
262 | return; | 205 | return; |
263 | } | 206 | } |
264 | videoGamma = v; | 207 | videoGamma = v; |
265 | emit videoGammaChanged( v ); | 208 | emit videoGammaChanged( v ); |
266 | } | 209 | } |
267 | 210 | ||
268 | void MediaPlayerState::setLength( long l ) { | 211 | void MediaPlayerState::setLength( long l ) { |
269 | if ( curLength == l ) { | 212 | if ( curLength == l ) { |
270 | return; | 213 | return; |
271 | } | 214 | } |
272 | curLength = l; | 215 | curLength = l; |
273 | emit lengthChanged(l); | 216 | emit lengthChanged(l); |
274 | } | 217 | } |
275 | 218 | ||
276 | void MediaPlayerState::setView( char v ) { | 219 | void MediaPlayerState::setView( char v ) { |
277 | if ( curView == v ) { | 220 | if ( curView == v ) { |
278 | return; | 221 | return; |
279 | } | 222 | } |
280 | curView = v; | 223 | curView = v; |
281 | emit viewChanged(v); | 224 | emit viewChanged(v); |
282 | } | 225 | } |
283 | 226 | ||
284 | void MediaPlayerState::setPrev(){ | 227 | void MediaPlayerState::setPrev(){ |
285 | emit prev(); | 228 | emit prev(); |
286 | } | 229 | } |
287 | 230 | ||
288 | void MediaPlayerState::setNext() { | 231 | void MediaPlayerState::setNext() { |
289 | emit next(); | 232 | emit next(); |
290 | } | 233 | } |
291 | 234 | ||
292 | void MediaPlayerState::setList() { | 235 | void MediaPlayerState::setList() { |
293 | setPlaying( FALSE ); | 236 | setPlaying( FALSE ); |
294 | setView('l'); | 237 | setView('l'); |
295 | } | 238 | } |
296 | 239 | ||
297 | void MediaPlayerState::setVideo() { | 240 | void MediaPlayerState::setVideo() { |
298 | setView('v'); | 241 | setView('v'); |
299 | } | 242 | } |
300 | 243 | ||
301 | void MediaPlayerState::setAudio() { | 244 | void MediaPlayerState::setAudio() { |
302 | setView('a'); | 245 | setView('a'); |
303 | } | 246 | } |
304 | 247 | ||
305 | void MediaPlayerState::toggleFullscreen() { | 248 | void MediaPlayerState::toggleFullscreen() { |
306 | setFullscreen( !fullscreen ); | 249 | setFullscreen( !fullscreen ); |
307 | } | 250 | } |
308 | 251 | ||
309 | void MediaPlayerState::toggleScaled() { | 252 | void MediaPlayerState::toggleScaled() { |
310 | setScaled( !scaled); | 253 | setScaled( !scaled); |
311 | } | 254 | } |
312 | 255 | ||
313 | void MediaPlayerState::toggleLooping() { | 256 | void MediaPlayerState::toggleLooping() { |
314 | setLooping( !looping); | 257 | setLooping( !looping); |
315 | } | 258 | } |
316 | 259 | ||
317 | void MediaPlayerState::toggleShuffled() { | 260 | void MediaPlayerState::toggleShuffled() { |
318 | setShuffled( !shuffled); | 261 | setShuffled( !shuffled); |
319 | } | 262 | } |
320 | 263 | ||
321 | void MediaPlayerState::togglePlaylist() { | 264 | void MediaPlayerState::togglePlaylist() { |
322 | setPlaylist( !usePlaylist); | 265 | setPlaylist( !usePlaylist); |
323 | } | 266 | } |
324 | 267 | ||
325 | void MediaPlayerState::togglePaused() { | 268 | void MediaPlayerState::togglePaused() { |
326 | setPaused( !paused); | 269 | setPaused( !paused); |
327 | } | 270 | } |
328 | 271 | ||
329 | void MediaPlayerState::togglePlaying() { | 272 | void MediaPlayerState::togglePlaying() { |
330 | setPlaying( !playing); | 273 | setPlaying( !playing); |
331 | } | 274 | } |
332 | 275 | ||
333 | void MediaPlayerState::toggleBlank() { | 276 | void MediaPlayerState::toggleBlank() { |
334 | setBlanked( !blanked); | 277 | setBlanked( !blanked); |
335 | } | 278 | } |
336 | 279 | ||
337 | 280 | ||
338 | 281 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 4e837e3..57189dd 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -1,143 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | // this file is based on work by trolltech | 34 | // this file is based on work by trolltech |
35 | 35 | ||
36 | #ifndef MEDIA_PLAYER_STATE_H | 36 | #ifndef MEDIA_PLAYER_STATE_H |
37 | #define MEDIA_PLAYER_STATE_H | 37 | #define MEDIA_PLAYER_STATE_H |
38 | 38 | ||
39 | 39 | ||
40 | #include <qobject.h> | 40 | #include <qobject.h> |
41 | 41 | ||
42 | 42 | ||
43 | class MediaPlayerDecoder; | 43 | class MediaPlayerDecoder; |
44 | class Config; | 44 | class Config; |
45 | 45 | ||
46 | 46 | ||
47 | class MediaPlayerState : public QObject { | 47 | class MediaPlayerState : public QObject { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | MediaPlayerState( QObject *parent, const char *name ); | 50 | MediaPlayerState( QObject *parent, const char *name ); |
51 | ~MediaPlayerState(); | 51 | ~MediaPlayerState(); |
52 | 52 | ||
53 | bool isStreaming() const; | 53 | bool isStreaming() const { return streaming; } |
54 | bool isSeekable() const; | 54 | bool isSeekable() const { return seekable; } |
55 | bool isFullscreen() const; | 55 | bool isFullscreen() const { return fullscreen; } |
56 | bool isScaled() const; | 56 | bool isScaled() const { return scaled; } |
57 | bool isLooping() const; | 57 | bool isLooping() const { return looping; } |
58 | bool isShuffled() const; | 58 | bool isShuffled() const { return shuffled; } |
59 | bool isUsingPlaylist() const; | 59 | bool isUsingPlaylist() const { return usePlaylist; } |
60 | bool isPaused() const; | 60 | bool isPaused() const { return paused; } |
61 | bool isPlaying() const; | 61 | bool isPlaying() const { return playing; } |
62 | bool isStop() const; | 62 | bool isStop() const { return stoped; } |
63 | long position() const; | 63 | long position() const { return curPosition; } |
64 | long length() const; | 64 | long length() const { return curLength; } |
65 | char view() const; | 65 | char view() const { return curView; } |
66 | 66 | ||
67 | public slots: | 67 | public slots: |
68 | void setIsStreaming( bool b ); | 68 | void setIsStreaming( bool b ); |
69 | void setIsSeekable( bool b ); | 69 | void setIsSeekable( bool b ); |
70 | void setFullscreen( bool b ); | 70 | void setFullscreen( bool b ); |
71 | void setScaled( bool b ); | 71 | void setScaled( bool b ); |
72 | void setLooping( bool b ); | 72 | void setLooping( bool b ); |
73 | void setShuffled( bool b ); | 73 | void setShuffled( bool b ); |
74 | void setPlaylist( bool b ); | 74 | void setPlaylist( bool b ); |
75 | void setPaused( bool b ); | 75 | void setPaused( bool b ); |
76 | void setPlaying( bool b ); | 76 | void setPlaying( bool b ); |
77 | void setStop( bool b ); | 77 | void setStop( bool b ); |
78 | void setPosition( long p ); | 78 | void setPosition( long p ); |
79 | void updatePosition( long p ); | 79 | void updatePosition( long p ); |
80 | void setLength( long l ); | 80 | void setLength( long l ); |
81 | void setView( char v ); | 81 | void setView( char v ); |
82 | void setBlanked( bool b ); | 82 | void setBlanked( bool b ); |
83 | void setVideoGamma( int v ); | 83 | void setVideoGamma( int v ); |
84 | 84 | ||
85 | void setPrev(); | 85 | void setPrev(); |
86 | void setNext(); | 86 | void setNext(); |
87 | void setList(); | 87 | void setList(); |
88 | void setVideo(); | 88 | void setVideo(); |
89 | void setAudio(); | 89 | void setAudio(); |
90 | 90 | ||
91 | void toggleFullscreen(); | 91 | void toggleFullscreen(); |
92 | void toggleScaled(); | 92 | void toggleScaled(); |
93 | void toggleLooping(); | 93 | void toggleLooping(); |
94 | void toggleShuffled(); | 94 | void toggleShuffled(); |
95 | void togglePlaylist(); | 95 | void togglePlaylist(); |
96 | void togglePaused(); | 96 | void togglePaused(); |
97 | void togglePlaying(); | 97 | void togglePlaying(); |
98 | void toggleBlank(); | 98 | void toggleBlank(); |
99 | void writeConfig( Config& cfg ) const; | 99 | void writeConfig( Config& cfg ) const; |
100 | 100 | ||
101 | 101 | ||
102 | signals: | 102 | signals: |
103 | void fullscreenToggled( bool ); | 103 | void fullscreenToggled( bool ); |
104 | void scaledToggled( bool ); | 104 | void scaledToggled( bool ); |
105 | void loopingToggled( bool ); | 105 | void loopingToggled( bool ); |
106 | void shuffledToggled( bool ); | 106 | void shuffledToggled( bool ); |
107 | void playlistToggled( bool ); | 107 | void playlistToggled( bool ); |
108 | void pausedToggled( bool ); | 108 | void pausedToggled( bool ); |
109 | void playingToggled( bool ); | 109 | void playingToggled( bool ); |
110 | void stopToggled( bool ); | 110 | void stopToggled( bool ); |
111 | void positionChanged( long ); // When the slider is moved | 111 | void positionChanged( long ); // When the slider is moved |
112 | void positionUpdated( long ); // When the media file progresses | 112 | void positionUpdated( long ); // When the media file progresses |
113 | void lengthChanged( long ); | 113 | void lengthChanged( long ); |
114 | void viewChanged( char ); | 114 | void viewChanged( char ); |
115 | void isSeekableToggled( bool ); | 115 | void isSeekableToggled( bool ); |
116 | void blankToggled( bool ); | 116 | void blankToggled( bool ); |
117 | void videoGammaChanged( int ); | 117 | void videoGammaChanged( int ); |
118 | void prev(); | 118 | void prev(); |
119 | void next(); | 119 | void next(); |
120 | 120 | ||
121 | private: | 121 | private: |
122 | bool streaming; | 122 | bool streaming; |
123 | bool seekable; | 123 | bool seekable; |
124 | bool fullscreen; | 124 | bool fullscreen; |
125 | bool scaled; | 125 | bool scaled; |
126 | bool blanked; | 126 | bool blanked; |
127 | bool looping; | 127 | bool looping; |
128 | bool shuffled; | 128 | bool shuffled; |
129 | bool usePlaylist; | 129 | bool usePlaylist; |
130 | bool paused; | 130 | bool paused; |
131 | bool playing; | 131 | bool playing; |
132 | bool stoped; | 132 | bool stoped; |
133 | long curPosition; | 133 | long curPosition; |
134 | long curLength; | 134 | long curLength; |
135 | char curView; | 135 | char curView; |
136 | int videoGamma; | 136 | int videoGamma; |
137 | void readConfig( Config& cfg ); | 137 | void readConfig( Config& cfg ); |
138 | 138 | ||
139 | }; | 139 | }; |
140 | 140 | ||
141 | 141 | ||
142 | #endif // MEDIA_PLAYER_STATE_H | 142 | #endif // MEDIA_PLAYER_STATE_H |
143 | 143 | ||