summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h2
2 files changed, 0 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index aa85176..43040c2 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -16,258 +16,246 @@
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
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::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
59MediaPlayerState::~MediaPlayerState() { 59MediaPlayerState::~MediaPlayerState() {
60} 60}
61 61
62 62
63void MediaPlayerState::readConfig( Config& cfg ) { 63void 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
81void MediaPlayerState::writeConfig( Config& cfg ) const { 81void 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
92void MediaPlayerState::setIsStreaming( bool b ) { 92void MediaPlayerState::setIsStreaming( bool b ) {
93 streaming = b; 93 streaming = b;
94} 94}
95 95
96void MediaPlayerState::setIsSeekable( bool b ) { 96void MediaPlayerState::setIsSeekable( bool b ) {
97 seekable = b; 97 seekable = b;
98 emit isSeekableToggled(b); 98 emit isSeekableToggled(b);
99} 99}
100 100
101 101
102void MediaPlayerState::setFullscreen( bool b ) { 102void MediaPlayerState::setFullscreen( bool b ) {
103 if ( fullscreen == b ) { 103 if ( fullscreen == b ) {
104 return; 104 return;
105 } 105 }
106 fullscreen = b; 106 fullscreen = b;
107 emit fullscreenToggled(b); 107 emit fullscreenToggled(b);
108} 108}
109 109
110 110
111void MediaPlayerState::setBlanked( bool b ) { 111void MediaPlayerState::setBlanked( bool b ) {
112 if ( blanked == b ) { 112 if ( blanked == b ) {
113 return; 113 return;
114 } 114 }
115 blanked = b; 115 blanked = b;
116 emit blankToggled(b); 116 emit blankToggled(b);
117} 117}
118 118
119 119
120void MediaPlayerState::setScaled( bool b ) { 120void MediaPlayerState::setScaled( bool b ) {
121 if ( scaled == b ) { 121 if ( scaled == b ) {
122 return; 122 return;
123 } 123 }
124 scaled = b; 124 scaled = b;
125 emit scaledToggled(b); 125 emit scaledToggled(b);
126} 126}
127 127
128void MediaPlayerState::setLooping( bool b ) { 128void MediaPlayerState::setLooping( bool b ) {
129 if ( looping == b ) { 129 if ( looping == b ) {
130 return; 130 return;
131 } 131 }
132 looping = b; 132 looping = b;
133 emit loopingToggled(b); 133 emit loopingToggled(b);
134} 134}
135 135
136void MediaPlayerState::setShuffled( bool b ) { 136void MediaPlayerState::setShuffled( bool b ) {
137 if ( shuffled == b ) { 137 if ( shuffled == b ) {
138 return; 138 return;
139 } 139 }
140 shuffled = b; 140 shuffled = b;
141 emit shuffledToggled(b); 141 emit shuffledToggled(b);
142} 142}
143 143
144void MediaPlayerState::setUsingPlaylist( bool b ) {
145 if ( usePlaylist == b ) {
146 return;
147 }
148 usePlaylist = b;
149 emit playlistToggled(b);
150}
151
152void MediaPlayerState::setPaused( bool b ) { 144void MediaPlayerState::setPaused( bool b ) {
153 if ( paused == b ) { 145 if ( paused == b ) {
154 paused = FALSE; 146 paused = FALSE;
155 emit pausedToggled(FALSE); 147 emit pausedToggled(FALSE);
156 return; 148 return;
157 } 149 }
158 paused = b; 150 paused = b;
159 emit pausedToggled(b); 151 emit pausedToggled(b);
160} 152}
161 153
162void MediaPlayerState::setPlaying( bool b ) { 154void MediaPlayerState::setPlaying( bool b ) {
163 if ( playing == b ) { 155 if ( playing == b ) {
164 return; 156 return;
165 } 157 }
166 playing = b; 158 playing = b;
167 stopped = !b; 159 stopped = !b;
168 emit playingToggled(b); 160 emit playingToggled(b);
169} 161}
170 162
171void MediaPlayerState::setStopped( bool b ) { 163void MediaPlayerState::setStopped( bool b ) {
172 if ( stopped == b ) { 164 if ( stopped == b ) {
173 return; 165 return;
174 } 166 }
175 stopped = b; 167 stopped = b;
176 emit stopToggled(b); 168 emit stopToggled(b);
177} 169}
178 170
179void MediaPlayerState::setPosition( long p ) { 171void MediaPlayerState::setPosition( long p ) {
180 if ( curPosition == p ) { 172 if ( curPosition == p ) {
181 return; 173 return;
182 } 174 }
183 curPosition = p; 175 curPosition = p;
184 emit positionChanged(p); 176 emit positionChanged(p);
185} 177}
186 178
187void MediaPlayerState::updatePosition( long p ){ 179void MediaPlayerState::updatePosition( long p ){
188 if ( curPosition == p ) { 180 if ( curPosition == p ) {
189 return; 181 return;
190 } 182 }
191 curPosition = p; 183 curPosition = p;
192 emit positionUpdated(p); 184 emit positionUpdated(p);
193} 185}
194 186
195void MediaPlayerState::setVideoGamma( int v ){ 187void MediaPlayerState::setVideoGamma( int v ){
196 if ( videoGamma == v ) { 188 if ( videoGamma == v ) {
197 return; 189 return;
198 } 190 }
199 videoGamma = v; 191 videoGamma = v;
200 emit videoGammaChanged( v ); 192 emit videoGammaChanged( v );
201} 193}
202 194
203void MediaPlayerState::setLength( long l ) { 195void MediaPlayerState::setLength( long l ) {
204 if ( curLength == l ) { 196 if ( curLength == l ) {
205 return; 197 return;
206 } 198 }
207 curLength = l; 199 curLength = l;
208 emit lengthChanged(l); 200 emit lengthChanged(l);
209} 201}
210 202
211void MediaPlayerState::setView( char v ) { 203void MediaPlayerState::setView( char v ) {
212 if ( curView == v ) { 204 if ( curView == v ) {
213 return; 205 return;
214 } 206 }
215 curView = v; 207 curView = v;
216 emit viewChanged(v); 208 emit viewChanged(v);
217} 209}
218 210
219void MediaPlayerState::setPrev(){ 211void MediaPlayerState::setPrev(){
220 emit prev(); 212 emit prev();
221} 213}
222 214
223void MediaPlayerState::setNext() { 215void MediaPlayerState::setNext() {
224 emit next(); 216 emit next();
225} 217}
226 218
227void MediaPlayerState::setList() { 219void MediaPlayerState::setList() {
228 setPlaying( FALSE ); 220 setPlaying( FALSE );
229 setView('l'); 221 setView('l');
230} 222}
231 223
232void MediaPlayerState::setVideo() { 224void MediaPlayerState::setVideo() {
233 setView('v'); 225 setView('v');
234} 226}
235 227
236void MediaPlayerState::setAudio() { 228void MediaPlayerState::setAudio() {
237 setView('a'); 229 setView('a');
238} 230}
239 231
240void MediaPlayerState::toggleFullscreen() { 232void MediaPlayerState::toggleFullscreen() {
241 setFullscreen( !fullscreen ); 233 setFullscreen( !fullscreen );
242} 234}
243 235
244void MediaPlayerState::toggleScaled() { 236void MediaPlayerState::toggleScaled() {
245 setScaled( !scaled); 237 setScaled( !scaled);
246} 238}
247 239
248void MediaPlayerState::toggleLooping() { 240void MediaPlayerState::toggleLooping() {
249 setLooping( !looping); 241 setLooping( !looping);
250} 242}
251 243
252void MediaPlayerState::toggleShuffled() { 244void MediaPlayerState::toggleShuffled() {
253 setShuffled( !shuffled); 245 setShuffled( !shuffled);
254} 246}
255 247
256void MediaPlayerState::togglePlaylist() {
257 setUsingPlaylist( !usePlaylist);
258}
259
260void MediaPlayerState::togglePaused() { 248void MediaPlayerState::togglePaused() {
261 setPaused( !paused); 249 setPaused( !paused);
262} 250}
263 251
264void MediaPlayerState::togglePlaying() { 252void MediaPlayerState::togglePlaying() {
265 setPlaying( !playing); 253 setPlaying( !playing);
266} 254}
267 255
268void MediaPlayerState::toggleBlank() { 256void MediaPlayerState::toggleBlank() {
269 setBlanked( !blanked); 257 setBlanked( !blanked);
270} 258}
271 259
272 260
273 261
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 163586b..d15894f 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -1,143 +1,141 @@
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
43class MediaPlayerDecoder; 43class MediaPlayerDecoder;
44class Config; 44class Config;
45 45
46 46
47class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
48Q_OBJECT 48Q_OBJECT
49public: 49public:
50 MediaPlayerState( QObject *parent, const char *name ); 50 MediaPlayerState( QObject *parent, const char *name );
51 ~MediaPlayerState(); 51 ~MediaPlayerState();
52 52
53 bool isStreaming() const { return streaming; } 53 bool isStreaming() const { return streaming; }
54 bool isSeekable() const { return seekable; } 54 bool isSeekable() const { return seekable; }
55 bool isFullscreen() const { return fullscreen; } 55 bool isFullscreen() const { return fullscreen; }
56 bool isScaled() const { return scaled; } 56 bool isScaled() const { return scaled; }
57 bool isLooping() const { return looping; } 57 bool isLooping() const { return looping; }
58 bool isShuffled() const { return shuffled; } 58 bool isShuffled() const { return shuffled; }
59 bool isUsingPlaylist() const { return usePlaylist; } 59 bool isUsingPlaylist() const { return usePlaylist; }
60 bool isPaused() const { return paused; } 60 bool isPaused() const { return paused; }
61 bool isPlaying() const { return playing; } 61 bool isPlaying() const { return playing; }
62 bool isStopped() const { return stopped; } 62 bool isStopped() const { return stopped; }
63 long position() const { return curPosition; } 63 long position() const { return curPosition; }
64 long length() const { return curLength; } 64 long length() const { return curLength; }
65 char view() const { return curView; } 65 char view() const { return curView; }
66 66
67public slots: 67public 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 setUsingPlaylist( bool b );
75 void setPaused( bool b ); 74 void setPaused( bool b );
76 void setPlaying( bool b ); 75 void setPlaying( bool b );
77 void setStopped( bool b ); 76 void setStopped( bool b );
78 void setPosition( long p ); 77 void setPosition( long p );
79 void updatePosition( long p ); 78 void updatePosition( long p );
80 void setLength( long l ); 79 void setLength( long l );
81 void setView( char v ); 80 void setView( char v );
82 void setBlanked( bool b ); 81 void setBlanked( bool b );
83 void setVideoGamma( int v ); 82 void setVideoGamma( int v );
84 83
85 void setPrev(); 84 void setPrev();
86 void setNext(); 85 void setNext();
87 void setList(); 86 void setList();
88 void setVideo(); 87 void setVideo();
89 void setAudio(); 88 void setAudio();
90 89
91 void toggleFullscreen(); 90 void toggleFullscreen();
92 void toggleScaled(); 91 void toggleScaled();
93 void toggleLooping(); 92 void toggleLooping();
94 void toggleShuffled(); 93 void toggleShuffled();
95 void togglePlaylist();
96 void togglePaused(); 94 void togglePaused();
97 void togglePlaying(); 95 void togglePlaying();
98 void toggleBlank(); 96 void toggleBlank();
99 void writeConfig( Config& cfg ) const; 97 void writeConfig( Config& cfg ) const;
100 98
101 99
102signals: 100signals:
103 void fullscreenToggled( bool ); 101 void fullscreenToggled( bool );
104 void scaledToggled( bool ); 102 void scaledToggled( bool );
105 void loopingToggled( bool ); 103 void loopingToggled( bool );
106 void shuffledToggled( bool ); 104 void shuffledToggled( bool );
107 void playlistToggled( bool ); 105 void playlistToggled( bool );
108 void pausedToggled( bool ); 106 void pausedToggled( bool );
109 void playingToggled( bool ); 107 void playingToggled( bool );
110 void stopToggled( bool ); 108 void stopToggled( bool );
111 void positionChanged( long ); // When the slider is moved 109 void positionChanged( long ); // When the slider is moved
112 void positionUpdated( long ); // When the media file progresses 110 void positionUpdated( long ); // When the media file progresses
113 void lengthChanged( long ); 111 void lengthChanged( long );
114 void viewChanged( char ); 112 void viewChanged( char );
115 void isSeekableToggled( bool ); 113 void isSeekableToggled( bool );
116 void blankToggled( bool ); 114 void blankToggled( bool );
117 void videoGammaChanged( int ); 115 void videoGammaChanged( int );
118 void prev(); 116 void prev();
119 void next(); 117 void next();
120 118
121private: 119private:
122 bool streaming : 1; 120 bool streaming : 1;
123 bool seekable : 1; 121 bool seekable : 1;
124 bool fullscreen: 1; 122 bool fullscreen: 1;
125 bool scaled : 1; 123 bool scaled : 1;
126 bool blanked : 1; 124 bool blanked : 1;
127 bool looping : 1; 125 bool looping : 1;
128 bool shuffled : 1; 126 bool shuffled : 1;
129 bool usePlaylist : 1; 127 bool usePlaylist : 1;
130 bool paused : 1; 128 bool paused : 1;
131 bool playing : 1; 129 bool playing : 1;
132 bool stopped : 1; 130 bool stopped : 1;
133 long curPosition; 131 long curPosition;
134 long curLength; 132 long curLength;
135 char curView; 133 char curView;
136 int videoGamma; 134 int videoGamma;
137 void readConfig( Config& cfg ); 135 void readConfig( Config& cfg );
138 136
139}; 137};
140 138
141 139
142#endif // MEDIA_PLAYER_STATE_H 140#endif // MEDIA_PLAYER_STATE_H
143 141