summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 44bc46b..31773f2 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,259 +1,264 @@
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/config.h> 36#include <qpe/config.h>
37#include "mediaplayerstate.h" 37#include "mediaplayerstate.h"
38 38
39#include <assert.h> 39#include <assert.h>
40 40
41#define MediaPlayerDebug(x) 41#define MediaPlayerDebug(x)
42 42
43 43
44MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 44MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
45 : QObject( parent, name ) { 45 : QObject( parent, name ) {
46 Config cfg( "OpiePlayer" ); 46 Config cfg( "OpiePlayer" );
47 readConfig( cfg ); 47 readConfig( cfg );
48 streaming = false; 48 streaming = false;
49 seekable = true; 49 seekable = true;
50} 50}
51 51
52 52
53MediaPlayerState::~MediaPlayerState() { 53MediaPlayerState::~MediaPlayerState() {
54 Config cfg( "OpiePlayer" );
55 writeConfig( cfg );
54} 56}
55 57
56 58
57void MediaPlayerState::readConfig( Config& cfg ) { 59void MediaPlayerState::readConfig( Config& cfg ) {
58 cfg.setGroup("Options"); 60 cfg.setGroup("Options");
59 fullscreen = cfg.readBoolEntry( "FullScreen" ); 61 fullscreen = cfg.readBoolEntry( "FullScreen" );
60 scaled = cfg.readBoolEntry( "Scaling" ); 62 scaled = cfg.readBoolEntry( "Scaling" );
61 looping = cfg.readBoolEntry( "Looping" ); 63 looping = cfg.readBoolEntry( "Looping" );
62 shuffled = cfg.readBoolEntry( "Shuffle" ); 64 shuffled = cfg.readBoolEntry( "Shuffle" );
63 videoGamma = cfg.readNumEntry( "VideoGamma" ); 65 videoGamma = cfg.readNumEntry( "VideoGamma" );
64 playing = FALSE; 66 playing = FALSE;
65 streaming = FALSE; 67 streaming = FALSE;
66 paused = FALSE; 68 paused = FALSE;
67 curPosition = 0; 69 curPosition = 0;
68 curLength = 0; 70 curLength = 0;
69 m_displayType = MediaSelection; 71 m_displayType = MediaSelection;
70} 72}
71 73
72 74
73void MediaPlayerState::writeConfig( Config& cfg ) const { 75void MediaPlayerState::writeConfig( Config& cfg ) const {
74 cfg.setGroup( "Options" ); 76 cfg.setGroup( "Options" );
75 cfg.writeEntry( "FullScreen", fullscreen ); 77 cfg.writeEntry( "FullScreen", fullscreen );
76 cfg.writeEntry( "Scaling", scaled ); 78 cfg.writeEntry( "Scaling", scaled );
77 cfg.writeEntry( "Looping", looping ); 79 cfg.writeEntry( "Looping", looping );
78 cfg.writeEntry( "Shuffle", shuffled ); 80 cfg.writeEntry( "Shuffle", shuffled );
79 cfg.writeEntry( "VideoGamma", videoGamma ); 81 cfg.writeEntry( "VideoGamma", videoGamma );
80} 82}
81 83
82MediaPlayerState::DisplayType MediaPlayerState::displayType() const 84MediaPlayerState::DisplayType MediaPlayerState::displayType() const
83{ 85{
84 return m_displayType; 86 return m_displayType;
85} 87}
86 88
87// slots 89// slots
88void MediaPlayerState::setIsStreaming( bool b ) { 90void MediaPlayerState::setIsStreaming( bool b ) {
89 streaming = b; 91 streaming = b;
90} 92}
91 93
92void MediaPlayerState::setIsSeekable( bool b ) { 94void MediaPlayerState::setIsSeekable( bool b ) {
93 seekable = b; 95 seekable = b;
94 emit isSeekableToggled(b); 96 emit isSeekableToggled(b);
95} 97}
96 98
97 99
98void MediaPlayerState::setFullscreen( bool b ) { 100void MediaPlayerState::setFullscreen( bool b ) {
99 if ( fullscreen == b ) { 101 if ( fullscreen == b ) {
100 return; 102 return;
101 } 103 }
102 fullscreen = b; 104 fullscreen = b;
103 emit fullscreenToggled(b); 105 emit fullscreenToggled(b);
104} 106}
105 107
106 108
107void MediaPlayerState::setBlanked( bool b ) { 109void MediaPlayerState::setBlanked( bool b ) {
108 if ( blanked == b ) { 110 if ( blanked == b ) {
109 return; 111 return;
110 } 112 }
111 blanked = b; 113 blanked = b;
112 emit blankToggled(b); 114 emit blankToggled(b);
113} 115}
114 116
115 117
116void MediaPlayerState::setScaled( bool b ) { 118void MediaPlayerState::setScaled( bool b ) {
117 if ( scaled == b ) { 119 if ( scaled == b ) {
118 return; 120 return;
119 } 121 }
120 scaled = b; 122 scaled = b;
121 emit scaledToggled(b); 123 emit scaledToggled(b);
122} 124}
123 125
124void MediaPlayerState::setLooping( bool b ) { 126void MediaPlayerState::setLooping( bool b ) {
125 if ( looping == b ) { 127 if ( looping == b ) {
126 return; 128 return;
127 } 129 }
128 looping = b; 130 looping = b;
129 emit loopingToggled(b); 131 emit loopingToggled(b);
130} 132}
131 133
132void MediaPlayerState::setShuffled( bool b ) { 134void MediaPlayerState::setShuffled( bool b ) {
133 if ( shuffled == b ) { 135 if ( shuffled == b ) {
134 return; 136 return;
135 } 137 }
136 shuffled = b; 138 shuffled = b;
137 emit shuffledToggled(b); 139 emit shuffledToggled(b);
138} 140}
139 141
140void MediaPlayerState::setPaused( bool b ) { 142void MediaPlayerState::setPaused( bool b ) {
141 if ( paused == b ) { 143 if ( paused == b ) {
142 paused = FALSE; 144 paused = FALSE;
143 emit pausedToggled(FALSE); 145 emit pausedToggled(FALSE);
144 return; 146 return;
145 } 147 }
146 paused = b; 148 paused = b;
147 emit pausedToggled(b); 149 emit pausedToggled(b);
148} 150}
149 151
150void MediaPlayerState::setPlaying( bool b ) { 152void MediaPlayerState::setPlaying( bool b ) {
151 if ( playing == b ) { 153 if ( playing == b ) {
152 return; 154 return;
153 } 155 }
154 playing = b; 156 playing = b;
155 stopped = !b; 157 stopped = !b;
156 emit playingToggled(b); 158 emit playingToggled(b);
157} 159}
158 160
159void MediaPlayerState::setStopped( bool b ) { 161void MediaPlayerState::setStopped( bool b ) {
160 if ( stopped == b ) { 162 if ( stopped == b ) {
161 return; 163 return;
162 } 164 }
163 stopped = b; 165 stopped = b;
164 emit stopToggled(b); 166 emit stopToggled(b);
165} 167}
166 168
167void MediaPlayerState::setPosition( long p ) { 169void MediaPlayerState::setPosition( long p ) {
168 if ( curPosition == p ) { 170 if ( curPosition == p ) {
169 return; 171 return;
170 } 172 }
171 curPosition = p; 173 curPosition = p;
172 emit positionChanged(p); 174 emit positionChanged(p);
173} 175}
174 176
175void MediaPlayerState::updatePosition( long p ){ 177void MediaPlayerState::updatePosition( long p ){
176 if ( curPosition == p ) { 178 if ( curPosition == p ) {
177 return; 179 return;
178 } 180 }
179 curPosition = p; 181 curPosition = p;
180 emit positionUpdated(p); 182 emit positionUpdated(p);
181} 183}
182 184
183void MediaPlayerState::setVideoGamma( int v ){ 185void MediaPlayerState::setVideoGamma( int v ){
184 if ( videoGamma == v ) { 186 if ( videoGamma == v ) {
185 return; 187 return;
186 } 188 }
187 videoGamma = v; 189 videoGamma = v;
188 emit videoGammaChanged( v ); 190 emit videoGammaChanged( v );
189} 191}
190 192
191void MediaPlayerState::setLength( long l ) { 193void MediaPlayerState::setLength( long l ) {
192 if ( curLength == l ) { 194 if ( curLength == l ) {
193 return; 195 return;
194 } 196 }
195 curLength = l; 197 curLength = l;
196 emit lengthChanged(l); 198 emit lengthChanged(l);
197} 199}
198 200
199void MediaPlayerState::setDisplayType( DisplayType displayType ) 201void MediaPlayerState::setDisplayType( DisplayType displayType )
200{ 202{
201 if ( m_displayType == displayType ) 203 if ( m_displayType == displayType )
202 return; 204 return;
203 205
204 m_displayType = displayType; 206 m_displayType = displayType;
205 emit displayTypeChanged( m_displayType ); 207 emit displayTypeChanged( m_displayType );
206} 208}
207 209
208void MediaPlayerState::setPrev(){ 210void MediaPlayerState::setPrev(){
209 emit prev(); 211 emit prev();
210} 212}
211 213
212void MediaPlayerState::setNext() { 214void MediaPlayerState::setNext() {
213 emit next(); 215 emit next();
214} 216}
215 217
216void MediaPlayerState::setList() { 218void MediaPlayerState::setList() {
217 setPlaying( FALSE ); 219 setPlaying( FALSE );
218 paused = false; 220 paused = false;
219 setDisplayType( MediaSelection ); 221 setDisplayType( MediaSelection );
220} 222}
221 223
222void MediaPlayerState::setVideo() { 224void MediaPlayerState::setVideo() {
223 setDisplayType( Video ); 225 setDisplayType( Video );
224} 226}
225 227
226void MediaPlayerState::setAudio() { 228void MediaPlayerState::setAudio() {
227 setDisplayType( Audio ); 229 setDisplayType( Audio );
228} 230}
229 231
230void MediaPlayerState::toggleFullscreen() { 232void MediaPlayerState::toggleFullscreen() {
231 setFullscreen( !fullscreen ); 233 setFullscreen( !fullscreen );
232} 234}
233 235
234void MediaPlayerState::toggleScaled() { 236void MediaPlayerState::toggleScaled() {
235 setScaled( !scaled); 237 setScaled( !scaled);
236} 238}
237 239
238void MediaPlayerState::toggleLooping() { 240void MediaPlayerState::toggleLooping() {
239 setLooping( !looping); 241 setLooping( !looping);
240} 242}
241 243
242void MediaPlayerState::toggleShuffled() { 244void MediaPlayerState::toggleShuffled() {
243 setShuffled( !shuffled); 245 setShuffled( !shuffled);
244} 246}
245 247
246void MediaPlayerState::togglePaused() { 248void MediaPlayerState::togglePaused() {
247 setPaused( !paused); 249 setPaused( !paused);
248} 250}
249 251
250void MediaPlayerState::togglePlaying() { 252void MediaPlayerState::togglePlaying() {
251 setPlaying( !playing); 253 setPlaying( !playing);
252} 254}
253 255
254void MediaPlayerState::toggleBlank() { 256void MediaPlayerState::toggleBlank() {
255 setBlanked( !blanked); 257 setBlanked( !blanked);
256} 258}
257 259
258 260
259 261
262
263
264