author | simon <simon> | 2002-12-02 19:20:59 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 19:20:59 (UTC) |
commit | 24081d2efe5860c9656716b04af00e5ab85d1cd3 (patch) (unidiff) | |
tree | af0a952e87220242aab54bfae4010c667b60aca9 | |
parent | 54665278a9b7d703deb73ede0d74d3948c265b39 (diff) | |
download | opie-24081d2efe5860c9656716b04af00e5ab85d1cd3.zip opie-24081d2efe5860c9656716b04af00e5ab85d1cd3.tar.gz opie-24081d2efe5860c9656716b04af00e5ab85d1cd3.tar.bz2 |
- another step to switch to from char view to DisplayType
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 39 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 |
2 files changed, 29 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 6806adc..901b43f 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,272 +1,285 @@ | |||
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 | #include <assert.h> | 44 | #include <assert.h> |
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 | videoGamma = cfg.readNumEntry( "VideoGamma" ); | 69 | videoGamma = cfg.readNumEntry( "VideoGamma" ); |
70 | playing = FALSE; | 70 | playing = FALSE; |
71 | streaming = FALSE; | 71 | streaming = FALSE; |
72 | paused = FALSE; | 72 | paused = FALSE; |
73 | curPosition = 0; | 73 | curPosition = 0; |
74 | curLength = 0; | 74 | curLength = 0; |
75 | curView = 'l'; | 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 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | 88 | char MediaPlayerState::view() const |
89 | { | 89 | { |
90 | char v = view(); | 90 | switch ( m_displayType ) { |
91 | switch ( v ) { | 91 | case Audio: return 'a'; |
92 | case 'a': return MediaPlayerState::Audio; | 92 | case Video: return 'v'; |
93 | case 'v': return MediaPlayerState::Video; | 93 | case MediaSelection: return 'l'; |
94 | case 'l': return MediaPlayerState::MediaSelection; | ||
95 | default: assert( false ); | 94 | default: assert( false ); |
96 | } | 95 | } |
97 | // never reached | 96 | // never reached |
98 | return MediaPlayerState::MediaSelection; | 97 | return 42; |
98 | } | ||
99 | |||
100 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | ||
101 | { | ||
102 | return m_displayType; | ||
99 | } | 103 | } |
100 | 104 | ||
101 | // slots | 105 | // slots |
102 | void MediaPlayerState::setIsStreaming( bool b ) { | 106 | void MediaPlayerState::setIsStreaming( bool b ) { |
103 | streaming = b; | 107 | streaming = b; |
104 | } | 108 | } |
105 | 109 | ||
106 | void MediaPlayerState::setIsSeekable( bool b ) { | 110 | void MediaPlayerState::setIsSeekable( bool b ) { |
107 | seekable = b; | 111 | seekable = b; |
108 | emit isSeekableToggled(b); | 112 | emit isSeekableToggled(b); |
109 | } | 113 | } |
110 | 114 | ||
111 | 115 | ||
112 | void MediaPlayerState::setFullscreen( bool b ) { | 116 | void MediaPlayerState::setFullscreen( bool b ) { |
113 | if ( fullscreen == b ) { | 117 | if ( fullscreen == b ) { |
114 | return; | 118 | return; |
115 | } | 119 | } |
116 | fullscreen = b; | 120 | fullscreen = b; |
117 | emit fullscreenToggled(b); | 121 | emit fullscreenToggled(b); |
118 | } | 122 | } |
119 | 123 | ||
120 | 124 | ||
121 | void MediaPlayerState::setBlanked( bool b ) { | 125 | void MediaPlayerState::setBlanked( bool b ) { |
122 | if ( blanked == b ) { | 126 | if ( blanked == b ) { |
123 | return; | 127 | return; |
124 | } | 128 | } |
125 | blanked = b; | 129 | blanked = b; |
126 | emit blankToggled(b); | 130 | emit blankToggled(b); |
127 | } | 131 | } |
128 | 132 | ||
129 | 133 | ||
130 | void MediaPlayerState::setScaled( bool b ) { | 134 | void MediaPlayerState::setScaled( bool b ) { |
131 | if ( scaled == b ) { | 135 | if ( scaled == b ) { |
132 | return; | 136 | return; |
133 | } | 137 | } |
134 | scaled = b; | 138 | scaled = b; |
135 | emit scaledToggled(b); | 139 | emit scaledToggled(b); |
136 | } | 140 | } |
137 | 141 | ||
138 | void MediaPlayerState::setLooping( bool b ) { | 142 | void MediaPlayerState::setLooping( bool b ) { |
139 | if ( looping == b ) { | 143 | if ( looping == b ) { |
140 | return; | 144 | return; |
141 | } | 145 | } |
142 | looping = b; | 146 | looping = b; |
143 | emit loopingToggled(b); | 147 | emit loopingToggled(b); |
144 | } | 148 | } |
145 | 149 | ||
146 | void MediaPlayerState::setShuffled( bool b ) { | 150 | void MediaPlayerState::setShuffled( bool b ) { |
147 | if ( shuffled == b ) { | 151 | if ( shuffled == b ) { |
148 | return; | 152 | return; |
149 | } | 153 | } |
150 | shuffled = b; | 154 | shuffled = b; |
151 | emit shuffledToggled(b); | 155 | emit shuffledToggled(b); |
152 | } | 156 | } |
153 | 157 | ||
154 | void MediaPlayerState::setPaused( bool b ) { | 158 | void MediaPlayerState::setPaused( bool b ) { |
155 | if ( paused == b ) { | 159 | if ( paused == b ) { |
156 | paused = FALSE; | 160 | paused = FALSE; |
157 | emit pausedToggled(FALSE); | 161 | emit pausedToggled(FALSE); |
158 | return; | 162 | return; |
159 | } | 163 | } |
160 | paused = b; | 164 | paused = b; |
161 | emit pausedToggled(b); | 165 | emit pausedToggled(b); |
162 | } | 166 | } |
163 | 167 | ||
164 | void MediaPlayerState::setPlaying( bool b ) { | 168 | void MediaPlayerState::setPlaying( bool b ) { |
165 | if ( playing == b ) { | 169 | if ( playing == b ) { |
166 | return; | 170 | return; |
167 | } | 171 | } |
168 | playing = b; | 172 | playing = b; |
169 | stopped = !b; | 173 | stopped = !b; |
170 | emit playingToggled(b); | 174 | emit playingToggled(b); |
171 | } | 175 | } |
172 | 176 | ||
173 | void MediaPlayerState::setStopped( bool b ) { | 177 | void MediaPlayerState::setStopped( bool b ) { |
174 | if ( stopped == b ) { | 178 | if ( stopped == b ) { |
175 | return; | 179 | return; |
176 | } | 180 | } |
177 | stopped = b; | 181 | stopped = b; |
178 | emit stopToggled(b); | 182 | emit stopToggled(b); |
179 | } | 183 | } |
180 | 184 | ||
181 | void MediaPlayerState::setPosition( long p ) { | 185 | void MediaPlayerState::setPosition( long p ) { |
182 | if ( curPosition == p ) { | 186 | if ( curPosition == p ) { |
183 | return; | 187 | return; |
184 | } | 188 | } |
185 | curPosition = p; | 189 | curPosition = p; |
186 | emit positionChanged(p); | 190 | emit positionChanged(p); |
187 | } | 191 | } |
188 | 192 | ||
189 | void MediaPlayerState::updatePosition( long p ){ | 193 | void MediaPlayerState::updatePosition( long p ){ |
190 | if ( curPosition == p ) { | 194 | if ( curPosition == p ) { |
191 | return; | 195 | return; |
192 | } | 196 | } |
193 | curPosition = p; | 197 | curPosition = p; |
194 | emit positionUpdated(p); | 198 | emit positionUpdated(p); |
195 | } | 199 | } |
196 | 200 | ||
197 | void MediaPlayerState::setVideoGamma( int v ){ | 201 | void MediaPlayerState::setVideoGamma( int v ){ |
198 | if ( videoGamma == v ) { | 202 | if ( videoGamma == v ) { |
199 | return; | 203 | return; |
200 | } | 204 | } |
201 | videoGamma = v; | 205 | videoGamma = v; |
202 | emit videoGammaChanged( v ); | 206 | emit videoGammaChanged( v ); |
203 | } | 207 | } |
204 | 208 | ||
205 | void MediaPlayerState::setLength( long l ) { | 209 | void MediaPlayerState::setLength( long l ) { |
206 | if ( curLength == l ) { | 210 | if ( curLength == l ) { |
207 | return; | 211 | return; |
208 | } | 212 | } |
209 | curLength = l; | 213 | curLength = l; |
210 | emit lengthChanged(l); | 214 | emit lengthChanged(l); |
211 | } | 215 | } |
212 | 216 | ||
213 | void MediaPlayerState::setView( char v ) { | 217 | void MediaPlayerState::setView( char v ) { |
214 | if ( curView == v ) { | 218 | switch ( v ) { |
215 | return; | 219 | case 'a': setDisplayType( Audio ); return; |
220 | case 'v': setDisplayType( Video ); return; | ||
221 | case 'l': setDisplayType( MediaSelection ); return; | ||
222 | default: assert( false ); | ||
216 | } | 223 | } |
217 | curView = v; | 224 | } |
218 | emit viewChanged(v); | 225 | |
219 | emit displayTypeChanged( displayType() ); | 226 | void MediaPlayerState::setDisplayType( DisplayType displayType ) |
227 | { | ||
228 | if ( m_displayType == displayType ) | ||
229 | return; | ||
230 | |||
231 | m_displayType = displayType; | ||
232 | emit displayTypeChanged( m_displayType ); | ||
220 | } | 233 | } |
221 | 234 | ||
222 | void MediaPlayerState::setPrev(){ | 235 | void MediaPlayerState::setPrev(){ |
223 | emit prev(); | 236 | emit prev(); |
224 | } | 237 | } |
225 | 238 | ||
226 | void MediaPlayerState::setNext() { | 239 | void MediaPlayerState::setNext() { |
227 | emit next(); | 240 | emit next(); |
228 | } | 241 | } |
229 | 242 | ||
230 | void MediaPlayerState::setList() { | 243 | void MediaPlayerState::setList() { |
231 | setPlaying( FALSE ); | 244 | setPlaying( FALSE ); |
232 | setView('l'); | 245 | setView('l'); |
233 | } | 246 | } |
234 | 247 | ||
235 | void MediaPlayerState::setVideo() { | 248 | void MediaPlayerState::setVideo() { |
236 | setView('v'); | 249 | setView('v'); |
237 | } | 250 | } |
238 | 251 | ||
239 | void MediaPlayerState::setAudio() { | 252 | void MediaPlayerState::setAudio() { |
240 | setView('a'); | 253 | setView('a'); |
241 | } | 254 | } |
242 | 255 | ||
243 | void MediaPlayerState::toggleFullscreen() { | 256 | void MediaPlayerState::toggleFullscreen() { |
244 | setFullscreen( !fullscreen ); | 257 | setFullscreen( !fullscreen ); |
245 | } | 258 | } |
246 | 259 | ||
247 | void MediaPlayerState::toggleScaled() { | 260 | void MediaPlayerState::toggleScaled() { |
248 | setScaled( !scaled); | 261 | setScaled( !scaled); |
249 | } | 262 | } |
250 | 263 | ||
251 | void MediaPlayerState::toggleLooping() { | 264 | void MediaPlayerState::toggleLooping() { |
252 | setLooping( !looping); | 265 | setLooping( !looping); |
253 | } | 266 | } |
254 | 267 | ||
255 | void MediaPlayerState::toggleShuffled() { | 268 | void MediaPlayerState::toggleShuffled() { |
256 | setShuffled( !shuffled); | 269 | setShuffled( !shuffled); |
257 | } | 270 | } |
258 | 271 | ||
259 | void MediaPlayerState::togglePaused() { | 272 | void MediaPlayerState::togglePaused() { |
260 | setPaused( !paused); | 273 | setPaused( !paused); |
261 | } | 274 | } |
262 | 275 | ||
263 | void MediaPlayerState::togglePlaying() { | 276 | void MediaPlayerState::togglePlaying() { |
264 | setPlaying( !playing); | 277 | setPlaying( !playing); |
265 | } | 278 | } |
266 | 279 | ||
267 | void MediaPlayerState::toggleBlank() { | 280 | void MediaPlayerState::toggleBlank() { |
268 | setBlanked( !blanked); | 281 | setBlanked( !blanked); |
269 | } | 282 | } |
270 | 283 | ||
271 | 284 | ||
272 | 285 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index ca531c5..b18780b 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 | 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 { return curView; } | 66 | char view() const; |
67 | DisplayType displayType() const; | 67 | DisplayType displayType() const; |
68 | 68 | ||
69 | public slots: | 69 | public slots: |
70 | void setIsStreaming( bool b ); | 70 | void setIsStreaming( bool b ); |
71 | void setIsSeekable( bool b ); | 71 | void setIsSeekable( bool b ); |
72 | void setFullscreen( bool b ); | 72 | void setFullscreen( bool b ); |
73 | void setScaled( bool b ); | 73 | void setScaled( bool b ); |
74 | void setLooping( bool b ); | 74 | void setLooping( bool b ); |
75 | void setShuffled( bool b ); | 75 | void setShuffled( bool b ); |
76 | void setPaused( bool b ); | 76 | void setPaused( bool b ); |
77 | void setPlaying( bool b ); | 77 | void setPlaying( bool b ); |
78 | void setStopped( bool b ); | 78 | void setStopped( bool b ); |
79 | void setPosition( long p ); | 79 | void setPosition( long p ); |
80 | void updatePosition( long p ); | 80 | void updatePosition( long p ); |
81 | void setLength( long l ); | 81 | void setLength( long l ); |
82 | void setView( char v ); | 82 | void setView( char v ); |
83 | void setDisplayType( MediaPlayerState::DisplayType displayType ); | ||
83 | void setBlanked( bool b ); | 84 | void setBlanked( bool b ); |
84 | void setVideoGamma( int v ); | 85 | void setVideoGamma( int v ); |
85 | 86 | ||
86 | void setPrev(); | 87 | void setPrev(); |
87 | void setNext(); | 88 | void setNext(); |
88 | void setList(); | 89 | void setList(); |
89 | void setVideo(); | 90 | void setVideo(); |
90 | void setAudio(); | 91 | void setAudio(); |
91 | 92 | ||
92 | void toggleFullscreen(); | 93 | void toggleFullscreen(); |
93 | void toggleScaled(); | 94 | void toggleScaled(); |
94 | void toggleLooping(); | 95 | void toggleLooping(); |
95 | void toggleShuffled(); | 96 | void toggleShuffled(); |
96 | void togglePaused(); | 97 | void togglePaused(); |
97 | void togglePlaying(); | 98 | void togglePlaying(); |
98 | void toggleBlank(); | 99 | void toggleBlank(); |
99 | void writeConfig( Config& cfg ) const; | 100 | void writeConfig( Config& cfg ) const; |
100 | 101 | ||
101 | 102 | ||
102 | signals: | 103 | signals: |
103 | void fullscreenToggled( bool ); | 104 | void fullscreenToggled( bool ); |
104 | void scaledToggled( bool ); | 105 | void scaledToggled( bool ); |
105 | void loopingToggled( bool ); | 106 | void loopingToggled( bool ); |
106 | void shuffledToggled( bool ); | 107 | void shuffledToggled( bool ); |
107 | void pausedToggled( bool ); | 108 | void pausedToggled( bool ); |
108 | void playingToggled( bool ); | 109 | void playingToggled( bool ); |
109 | void stopToggled( bool ); | 110 | void stopToggled( bool ); |
110 | void positionChanged( long ); // When the slider is moved | 111 | void positionChanged( long ); // When the slider is moved |
111 | void positionUpdated( long ); // When the media file progresses | 112 | void positionUpdated( long ); // When the media file progresses |
112 | void lengthChanged( long ); | 113 | void lengthChanged( long ); |
113 | void viewChanged( char ); | ||
114 | void displayTypeChanged( MediaPlayerState::DisplayType type ); | 114 | void displayTypeChanged( MediaPlayerState::DisplayType type ); |
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 : 1; | 122 | bool streaming : 1; |
123 | bool seekable : 1; | 123 | bool seekable : 1; |
124 | bool fullscreen: 1; | 124 | bool fullscreen: 1; |
125 | bool scaled : 1; | 125 | bool scaled : 1; |
126 | bool blanked : 1; | 126 | bool blanked : 1; |
127 | bool looping : 1; | 127 | bool looping : 1; |
128 | bool shuffled : 1; | 128 | bool shuffled : 1; |
129 | bool usePlaylist : 1; | 129 | bool usePlaylist : 1; |
130 | bool paused : 1; | 130 | bool paused : 1; |
131 | bool playing : 1; | 131 | bool playing : 1; |
132 | bool stopped : 1; | 132 | bool stopped : 1; |
133 | long curPosition; | 133 | long curPosition; |
134 | long curLength; | 134 | long curLength; |
135 | char curView; | 135 | DisplayType m_displayType; |
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 | ||