author | simon <simon> | 2002-12-02 13:48:06 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 13:48:06 (UTC) |
commit | 4a942c5d074cef8a04870cee1ab053f72321fd20 (patch) (unidiff) | |
tree | 135459fe1bd5ada39b9028e70bfc09f6fa6555e5 | |
parent | 58ae980e181b89143760b3893b0f8267cb4489d9 (diff) | |
download | opie-4a942c5d074cef8a04870cee1ab053f72321fd20.zip opie-4a942c5d074cef8a04870cee1ab053f72321fd20.tar.gz opie-4a942c5d074cef8a04870cee1ab053f72321fd20.tar.bz2 |
- two unnecessary if statements removed
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 4f43465..5e5dfb2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,281 +1,273 @@ | |||
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 | // slots | 91 | // slots |
92 | void MediaPlayerState::setIsStreaming( bool b ) { | 92 | void MediaPlayerState::setIsStreaming( bool b ) { |
93 | |||
94 | if ( streaming == b ) { | ||
95 | return; | ||
96 | } | ||
97 | streaming = b; | 93 | streaming = b; |
98 | } | 94 | } |
99 | 95 | ||
100 | void MediaPlayerState::setIsSeekable( bool b ) { | 96 | void MediaPlayerState::setIsSeekable( bool b ) { |
101 | |||
102 | //if ( isSeekable == b ) { | ||
103 | // return; | ||
104 | // } | ||
105 | seekable = b; | 97 | seekable = b; |
106 | emit isSeekableToggled(b); | 98 | emit isSeekableToggled(b); |
107 | } | 99 | } |
108 | 100 | ||
109 | 101 | ||
110 | void MediaPlayerState::setFullscreen( bool b ) { | 102 | void MediaPlayerState::setFullscreen( bool b ) { |
111 | if ( fullscreen == b ) { | 103 | if ( fullscreen == b ) { |
112 | return; | 104 | return; |
113 | } | 105 | } |
114 | fullscreen = b; | 106 | fullscreen = b; |
115 | emit fullscreenToggled(b); | 107 | emit fullscreenToggled(b); |
116 | } | 108 | } |
117 | 109 | ||
118 | 110 | ||
119 | void MediaPlayerState::setBlanked( bool b ) { | 111 | void MediaPlayerState::setBlanked( bool b ) { |
120 | if ( blanked == b ) { | 112 | if ( blanked == b ) { |
121 | return; | 113 | return; |
122 | } | 114 | } |
123 | blanked = b; | 115 | blanked = b; |
124 | emit blankToggled(b); | 116 | emit blankToggled(b); |
125 | } | 117 | } |
126 | 118 | ||
127 | 119 | ||
128 | void MediaPlayerState::setScaled( bool b ) { | 120 | void MediaPlayerState::setScaled( bool b ) { |
129 | if ( scaled == b ) { | 121 | if ( scaled == b ) { |
130 | return; | 122 | return; |
131 | } | 123 | } |
132 | scaled = b; | 124 | scaled = b; |
133 | emit scaledToggled(b); | 125 | emit scaledToggled(b); |
134 | } | 126 | } |
135 | 127 | ||
136 | void MediaPlayerState::setLooping( bool b ) { | 128 | void MediaPlayerState::setLooping( bool b ) { |
137 | if ( looping == b ) { | 129 | if ( looping == b ) { |
138 | return; | 130 | return; |
139 | } | 131 | } |
140 | looping = b; | 132 | looping = b; |
141 | emit loopingToggled(b); | 133 | emit loopingToggled(b); |
142 | } | 134 | } |
143 | 135 | ||
144 | void MediaPlayerState::setShuffled( bool b ) { | 136 | void MediaPlayerState::setShuffled( bool b ) { |
145 | if ( shuffled == b ) { | 137 | if ( shuffled == b ) { |
146 | return; | 138 | return; |
147 | } | 139 | } |
148 | shuffled = b; | 140 | shuffled = b; |
149 | emit shuffledToggled(b); | 141 | emit shuffledToggled(b); |
150 | } | 142 | } |
151 | 143 | ||
152 | void MediaPlayerState::setPlaylist( bool b ) { | 144 | void MediaPlayerState::setPlaylist( bool b ) { |
153 | if ( usePlaylist == b ) { | 145 | if ( usePlaylist == b ) { |
154 | return; | 146 | return; |
155 | } | 147 | } |
156 | usePlaylist = b; | 148 | usePlaylist = b; |
157 | emit playlistToggled(b); | 149 | emit playlistToggled(b); |
158 | } | 150 | } |
159 | 151 | ||
160 | void MediaPlayerState::setPaused( bool b ) { | 152 | void MediaPlayerState::setPaused( bool b ) { |
161 | if ( paused == b ) { | 153 | if ( paused == b ) { |
162 | paused = FALSE; | 154 | paused = FALSE; |
163 | emit pausedToggled(FALSE); | 155 | emit pausedToggled(FALSE); |
164 | return; | 156 | return; |
165 | } | 157 | } |
166 | paused = b; | 158 | paused = b; |
167 | emit pausedToggled(b); | 159 | emit pausedToggled(b); |
168 | } | 160 | } |
169 | 161 | ||
170 | void MediaPlayerState::setPlaying( bool b ) { | 162 | void MediaPlayerState::setPlaying( bool b ) { |
171 | if ( playing == b ) { | 163 | if ( playing == b ) { |
172 | return; | 164 | return; |
173 | } | 165 | } |
174 | playing = b; | 166 | playing = b; |
175 | stopped = !b; | 167 | stopped = !b; |
176 | emit playingToggled(b); | 168 | emit playingToggled(b); |
177 | } | 169 | } |
178 | 170 | ||
179 | void MediaPlayerState::setStopped( bool b ) { | 171 | void MediaPlayerState::setStopped( bool b ) { |
180 | if ( stopped == b ) { | 172 | if ( stopped == b ) { |
181 | return; | 173 | return; |
182 | } | 174 | } |
183 | stopped = b; | 175 | stopped = b; |
184 | emit stopToggled(b); | 176 | emit stopToggled(b); |
185 | } | 177 | } |
186 | 178 | ||
187 | void MediaPlayerState::setPosition( long p ) { | 179 | void MediaPlayerState::setPosition( long p ) { |
188 | if ( curPosition == p ) { | 180 | if ( curPosition == p ) { |
189 | return; | 181 | return; |
190 | } | 182 | } |
191 | curPosition = p; | 183 | curPosition = p; |
192 | emit positionChanged(p); | 184 | emit positionChanged(p); |
193 | } | 185 | } |
194 | 186 | ||
195 | void MediaPlayerState::updatePosition( long p ){ | 187 | void MediaPlayerState::updatePosition( long p ){ |
196 | if ( curPosition == p ) { | 188 | if ( curPosition == p ) { |
197 | return; | 189 | return; |
198 | } | 190 | } |
199 | curPosition = p; | 191 | curPosition = p; |
200 | emit positionUpdated(p); | 192 | emit positionUpdated(p); |
201 | } | 193 | } |
202 | 194 | ||
203 | void MediaPlayerState::setVideoGamma( int v ){ | 195 | void MediaPlayerState::setVideoGamma( int v ){ |
204 | if ( videoGamma == v ) { | 196 | if ( videoGamma == v ) { |
205 | return; | 197 | return; |
206 | } | 198 | } |
207 | videoGamma = v; | 199 | videoGamma = v; |
208 | emit videoGammaChanged( v ); | 200 | emit videoGammaChanged( v ); |
209 | } | 201 | } |
210 | 202 | ||
211 | void MediaPlayerState::setLength( long l ) { | 203 | void MediaPlayerState::setLength( long l ) { |
212 | if ( curLength == l ) { | 204 | if ( curLength == l ) { |
213 | return; | 205 | return; |
214 | } | 206 | } |
215 | curLength = l; | 207 | curLength = l; |
216 | emit lengthChanged(l); | 208 | emit lengthChanged(l); |
217 | } | 209 | } |
218 | 210 | ||
219 | void MediaPlayerState::setView( char v ) { | 211 | void MediaPlayerState::setView( char v ) { |
220 | if ( curView == v ) { | 212 | if ( curView == v ) { |
221 | return; | 213 | return; |
222 | } | 214 | } |
223 | curView = v; | 215 | curView = v; |
224 | emit viewChanged(v); | 216 | emit viewChanged(v); |
225 | } | 217 | } |
226 | 218 | ||
227 | void MediaPlayerState::setPrev(){ | 219 | void MediaPlayerState::setPrev(){ |
228 | emit prev(); | 220 | emit prev(); |
229 | } | 221 | } |
230 | 222 | ||
231 | void MediaPlayerState::setNext() { | 223 | void MediaPlayerState::setNext() { |
232 | emit next(); | 224 | emit next(); |
233 | } | 225 | } |
234 | 226 | ||
235 | void MediaPlayerState::setList() { | 227 | void MediaPlayerState::setList() { |
236 | setPlaying( FALSE ); | 228 | setPlaying( FALSE ); |
237 | setView('l'); | 229 | setView('l'); |
238 | } | 230 | } |
239 | 231 | ||
240 | void MediaPlayerState::setVideo() { | 232 | void MediaPlayerState::setVideo() { |
241 | setView('v'); | 233 | setView('v'); |
242 | } | 234 | } |
243 | 235 | ||
244 | void MediaPlayerState::setAudio() { | 236 | void MediaPlayerState::setAudio() { |
245 | setView('a'); | 237 | setView('a'); |
246 | } | 238 | } |
247 | 239 | ||
248 | void MediaPlayerState::toggleFullscreen() { | 240 | void MediaPlayerState::toggleFullscreen() { |
249 | setFullscreen( !fullscreen ); | 241 | setFullscreen( !fullscreen ); |
250 | } | 242 | } |
251 | 243 | ||
252 | void MediaPlayerState::toggleScaled() { | 244 | void MediaPlayerState::toggleScaled() { |
253 | setScaled( !scaled); | 245 | setScaled( !scaled); |
254 | } | 246 | } |
255 | 247 | ||
256 | void MediaPlayerState::toggleLooping() { | 248 | void MediaPlayerState::toggleLooping() { |
257 | setLooping( !looping); | 249 | setLooping( !looping); |
258 | } | 250 | } |
259 | 251 | ||
260 | void MediaPlayerState::toggleShuffled() { | 252 | void MediaPlayerState::toggleShuffled() { |
261 | setShuffled( !shuffled); | 253 | setShuffled( !shuffled); |
262 | } | 254 | } |
263 | 255 | ||
264 | void MediaPlayerState::togglePlaylist() { | 256 | void MediaPlayerState::togglePlaylist() { |
265 | setPlaylist( !usePlaylist); | 257 | setPlaylist( !usePlaylist); |
266 | } | 258 | } |
267 | 259 | ||
268 | void MediaPlayerState::togglePaused() { | 260 | void MediaPlayerState::togglePaused() { |
269 | setPaused( !paused); | 261 | setPaused( !paused); |
270 | } | 262 | } |
271 | 263 | ||
272 | void MediaPlayerState::togglePlaying() { | 264 | void MediaPlayerState::togglePlaying() { |
273 | setPlaying( !playing); | 265 | setPlaying( !playing); |
274 | } | 266 | } |
275 | 267 | ||
276 | void MediaPlayerState::toggleBlank() { | 268 | void MediaPlayerState::toggleBlank() { |
277 | setBlanked( !blanked); | 269 | setBlanked( !blanked); |
278 | } | 270 | } |
279 | 271 | ||
280 | 272 | ||
281 | 273 | ||