Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayerstate.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index d984022..4ec5989 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,65 +1,99 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
34 | // this file is based on work by trolltech | ||
35 | |||
1 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 37 | #include <qpe/qlibrary.h> |
3 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
4 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
5 | #include <qobject.h> | 40 | #include <qobject.h> |
6 | #include <qdir.h> | 41 | #include <qdir.h> |
7 | #include "mediaplayerstate.h" | 42 | #include "mediaplayerstate.h" |
8 | 43 | ||
9 | 44 | ||
10 | 45 | ||
11 | //#define MediaPlayerDebug(x) qDebug x | 46 | //#define MediaPlayerDebug(x) qDebug x |
12 | #define MediaPlayerDebug(x) | 47 | #define MediaPlayerDebug(x) |
13 | 48 | ||
14 | 49 | ||
15 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
16 | : QObject( parent, name ) { | 51 | : QObject( parent, name ) { |
17 | Config cfg( "OpiePlayer" ); | 52 | Config cfg( "OpiePlayer" ); |
18 | readConfig( cfg ); | 53 | readConfig( cfg ); |
19 | isStreaming = false; | 54 | isStreaming = false; |
20 | } | 55 | } |
21 | 56 | ||
22 | 57 | ||
23 | MediaPlayerState::~MediaPlayerState() { | 58 | MediaPlayerState::~MediaPlayerState() { |
24 | // Config cfg( "OpiePlayer" ); | ||
25 | // writeConfig( cfg ); | ||
26 | |||
27 | } | 59 | } |
28 | 60 | ||
29 | 61 | ||
30 | void MediaPlayerState::readConfig( Config& cfg ) { | 62 | void MediaPlayerState::readConfig( Config& cfg ) { |
31 | cfg.setGroup("Options"); | 63 | cfg.setGroup("Options"); |
32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | 64 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); |
33 | isScaled = cfg.readBoolEntry( "Scaling" ); | 65 | isScaled = cfg.readBoolEntry( "Scaling" ); |
34 | isLooping = cfg.readBoolEntry( "Looping" ); | 66 | isLooping = cfg.readBoolEntry( "Looping" ); |
35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | 67 | isShuffled = cfg.readBoolEntry( "Shuffle" ); |
36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 68 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
69 | videoGamma = cfg.readNumEntry( "VideoGamma" ); | ||
37 | usePlaylist = TRUE; | 70 | usePlaylist = TRUE; |
38 | isPlaying = FALSE; | 71 | isPlaying = FALSE; |
39 | isStreaming = FALSE; | 72 | isStreaming = FALSE; |
40 | isPaused = FALSE; | 73 | isPaused = FALSE; |
41 | curPosition = 0; | 74 | curPosition = 0; |
42 | curLength = 0; | 75 | curLength = 0; |
43 | curView = 'l'; | 76 | curView = 'l'; |
44 | } | 77 | } |
45 | 78 | ||
46 | 79 | ||
47 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 80 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
48 | cfg.setGroup("Options"); | 81 | cfg.setGroup("Options"); |
49 | cfg.writeEntry("FullScreen", isFullscreen ); | 82 | cfg.writeEntry("FullScreen", isFullscreen ); |
50 | cfg.writeEntry("Scaling", isScaled ); | 83 | cfg.writeEntry("Scaling", isScaled ); |
51 | cfg.writeEntry("Looping", isLooping ); | 84 | cfg.writeEntry("Looping", isLooping ); |
52 | cfg.writeEntry("Shuffle", isShuffled ); | 85 | cfg.writeEntry("Shuffle", isShuffled ); |
53 | cfg.writeEntry("UsePlayList", usePlaylist ); | 86 | cfg.writeEntry("UsePlayList", usePlaylist ); |
87 | cfg.writeEntry( "VideoGamma", videoGamma ); | ||
54 | } | 88 | } |
55 | 89 | ||
56 | 90 | ||
57 | // public stuff | 91 | // public stuff |
58 | 92 | ||
59 | 93 | ||
60 | bool MediaPlayerState::streaming() { | 94 | bool MediaPlayerState::streaming() { |
61 | return isStreaming; | 95 | return isStreaming; |
62 | } | 96 | } |
63 | 97 | ||
64 | bool MediaPlayerState::fullscreen() { | 98 | bool MediaPlayerState::fullscreen() { |
65 | return isFullscreen; | 99 | return isFullscreen; |
@@ -200,24 +234,32 @@ void MediaPlayerState::setPosition( long p ) { | |||
200 | curPosition = p; | 234 | curPosition = p; |
201 | emit positionChanged(p); | 235 | emit positionChanged(p); |
202 | } | 236 | } |
203 | 237 | ||
204 | void MediaPlayerState::updatePosition( long p ){ | 238 | void MediaPlayerState::updatePosition( long p ){ |
205 | if ( curPosition == p ) { | 239 | if ( curPosition == p ) { |
206 | return; | 240 | return; |
207 | } | 241 | } |
208 | curPosition = p; | 242 | curPosition = p; |
209 | emit positionUpdated(p); | 243 | emit positionUpdated(p); |
210 | } | 244 | } |
211 | 245 | ||
246 | void MediaPlayerState::setVideoGamma( int v ){ | ||
247 | if ( videoGamma == v ) { | ||
248 | return; | ||
249 | } | ||
250 | videoGamma = v; | ||
251 | emit videoGammaChanged( v ); | ||
252 | } | ||
253 | |||
212 | void MediaPlayerState::setLength( long l ) { | 254 | void MediaPlayerState::setLength( long l ) { |
213 | if ( curLength == l ) { | 255 | if ( curLength == l ) { |
214 | return; | 256 | return; |
215 | } | 257 | } |
216 | curLength = l; | 258 | curLength = l; |
217 | emit lengthChanged(l); | 259 | emit lengthChanged(l); |
218 | } | 260 | } |
219 | 261 | ||
220 | void MediaPlayerState::setView( char v ) { | 262 | void MediaPlayerState::setView( char v ) { |
221 | if ( curView == v ) { | 263 | if ( curView == v ) { |
222 | return; | 264 | return; |
223 | } | 265 | } |