summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-08-20 12:32:06 (UTC)
committer llornkcor <llornkcor>2002-08-20 12:32:06 (UTC)
commitec61d92a7ea43e517d38d26af71164d0fd70d16c (patch) (unidiff)
tree53464e7755944a00ff3c4f282abd235a5225dac9
parent41fe19a4e2e808d48429c84f4b7dd6b9af797ead (diff)
downloadopie-ec61d92a7ea43e517d38d26af71164d0fd70d16c.zip
opie-ec61d92a7ea43e517d38d26af71164d0fd70d16c.tar.gz
opie-ec61d92a7ea43e517d38d26af71164d0fd70d16c.tar.bz2
need to still write playerstate to config
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h4
2 files changed, 4 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 5503705..603d426 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,301 +1,302 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6 6
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qwidgetstack.h> 9#include <qwidgetstack.h>
10#include <qfile.h> 10#include <qfile.h>
11 11
12#include "mediaplayer.h" 12#include "mediaplayer.h"
13#include "playlistwidget.h" 13#include "playlistwidget.h"
14#include "audiowidget.h" 14#include "audiowidget.h"
15#include "videowidget.h" 15#include "videowidget.h"
16#include "volumecontrol.h" 16#include "volumecontrol.h"
17 17
18#include "mediaplayerstate.h" 18#include "mediaplayerstate.h"
19 19
20// for setBacklight() 20// for setBacklight()
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <sys/file.h> 22#include <sys/file.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24 24
25 25
26extern AudioWidget *audioUI; 26extern AudioWidget *audioUI;
27extern VideoWidget *videoUI; 27extern VideoWidget *videoUI;
28extern PlayListWidget *playList; 28extern PlayListWidget *playList;
29extern MediaPlayerState *mediaPlayerState; 29extern MediaPlayerState *mediaPlayerState;
30 30
31 31
32#define FBIOBLANK 0x4611 32#define FBIOBLANK 0x4611
33 33
34MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 34MediaPlayer::MediaPlayer( QObject *parent, const char *name )
35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
36 36
37 playList->setCaption(tr("OpiePlayer: Initializating")); 37 playList->setCaption(tr("OpiePlayer: Initializating"));
38 38
39 qApp->processEvents(); 39 qApp->processEvents();
40 // QPEApplication::grabKeyboard(); // EVIL 40 // QPEApplication::grabKeyboard(); // EVIL
41 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 41 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
42 42
43 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 43 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
44 44
45 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
46 46
47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
49 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 49 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
50 50
51 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 51 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
52 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 52 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
53 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 53 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
54 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 54 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
55 55
56 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 56 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
57 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 57 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
58 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 58 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
59 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 59 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
60 60
61 volControl = new VolumeControl; 61 volControl = new VolumeControl;
62 xineControl = new XineControl(); 62 xineControl = new XineControl();
63 playList->setCaption(tr("OpiePlayer")); 63 playList->setCaption(tr("OpiePlayer"));
64} 64}
65 65
66MediaPlayer::~MediaPlayer() { 66MediaPlayer::~MediaPlayer() {
67 delete xineControl; 67 delete xineControl;
68 delete volControl; 68 delete volControl;
69} 69}
70 70
71void MediaPlayer::pauseCheck( bool b ) { 71void MediaPlayer::pauseCheck( bool b ) {
72 if ( b && !mediaPlayerState->playing() ) { 72 if ( b && !mediaPlayerState->playing() ) {
73 mediaPlayerState->setPaused( FALSE ); 73 mediaPlayerState->setPaused( FALSE );
74 } 74 }
75} 75}
76 76
77void MediaPlayer::play() { 77void MediaPlayer::play() {
78 mediaPlayerState->setPlaying( FALSE ); 78 mediaPlayerState->setPlaying( FALSE );
79 mediaPlayerState->setPlaying( TRUE ); 79 mediaPlayerState->setPlaying( TRUE );
80} 80}
81 81
82void MediaPlayer::setPlaying( bool play ) { 82void MediaPlayer::setPlaying( bool play ) {
83 if ( !play ) { 83 if ( !play ) {
84 return; 84 return;
85 } 85 }
86 86
87 if ( mediaPlayerState->paused() ) { 87 if ( mediaPlayerState->paused() ) {
88 mediaPlayerState->setPaused( FALSE ); 88 mediaPlayerState->setPaused( FALSE );
89 return; 89 return;
90 } 90 }
91 91
92 const DocLnk *playListCurrent = playList->current(); 92 const DocLnk *playListCurrent = playList->current();
93 if ( playListCurrent != NULL ) { 93 if ( playListCurrent != NULL ) {
94 currentFile = playListCurrent; 94 currentFile = playListCurrent;
95 } 95 }
96 96
97 xineControl->play( currentFile->file() ); 97 xineControl->play( currentFile->file() );
98 98
99 long seconds = mediaPlayerState->length();// 99 long seconds = mediaPlayerState->length();//
100 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 100 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
101 qDebug(time); 101 qDebug(time);
102 102
103 QString tickerText; 103 QString tickerText;
104 if( currentFile->file().left(4) == "http" ) 104 if( currentFile->file().left(4) == "http" )
105 tickerText= tr( " File: " ) + currentFile->name(); 105 tickerText= tr( " File: " ) + currentFile->name();
106 else 106 else
107 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 107 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
108 108
109 audioUI->setTickerText( currentFile->file( ) ); 109 audioUI->setTickerText( currentFile->file( ) );
110 110
111} 111}
112 112
113 113
114void MediaPlayer::prev() { 114void MediaPlayer::prev() {
115 if ( playList->prev() ) { 115 if ( playList->prev() ) {
116 play(); 116 play();
117 } else if ( mediaPlayerState->looping() ) { 117 } else if ( mediaPlayerState->looping() ) {
118 if ( playList->last() ) { 118 if ( playList->last() ) {
119 play(); 119 play();
120 } 120 }
121 } else { 121 } else {
122 mediaPlayerState->setList(); 122 mediaPlayerState->setList();
123 } 123 }
124} 124}
125 125
126 126
127void MediaPlayer::next() { 127void MediaPlayer::next() {
128 if ( playList->next() ) { 128 if ( playList->next() ) {
129 play(); 129 play();
130 } else if ( mediaPlayerState->looping() ) { 130 } else if ( mediaPlayerState->looping() ) {
131 if ( playList->first() ) { 131 if ( playList->first() ) {
132 play(); 132 play();
133 } 133 }
134 } else { 134 } else {
135 mediaPlayerState->setList(); 135 mediaPlayerState->setList();
136 } 136 }
137} 137}
138 138
139 139
140void MediaPlayer::startDecreasingVolume() { 140void MediaPlayer::startDecreasingVolume() {
141 volumeDirection = -1; 141 volumeDirection = -1;
142 startTimer( 100 ); 142 startTimer( 100 );
143 volControl->decVol(2); 143 volControl->decVol(2);
144} 144}
145 145
146 146
147void MediaPlayer::startIncreasingVolume() { 147void MediaPlayer::startIncreasingVolume() {
148 volumeDirection = +1; 148 volumeDirection = +1;
149 startTimer( 100 ); 149 startTimer( 100 );
150 volControl->incVol(2); 150 volControl->incVol(2);
151} 151}
152 152
153 153
154bool drawnOnScreenDisplay = FALSE; 154bool drawnOnScreenDisplay = FALSE;
155unsigned int onScreenDisplayVolume = 0; 155unsigned int onScreenDisplayVolume = 0;
156const int yoff = 110; 156const int yoff = 110;
157 157
158void MediaPlayer::stopChangingVolume() { 158void MediaPlayer::stopChangingVolume() {
159 killTimers(); 159 killTimers();
160 // Get rid of the on-screen display stuff 160 // Get rid of the on-screen display stuff
161 drawnOnScreenDisplay = FALSE; 161 drawnOnScreenDisplay = FALSE;
162 onScreenDisplayVolume = 0; 162 onScreenDisplayVolume = 0;
163 int w=0; 163 int w=0;
164 int h=0; 164 int h=0;
165 if( !xineControl->hasVideo()) { 165 if( !xineControl->hasVideo()) {
166 w = audioUI->width(); 166 w = audioUI->width();
167 h = audioUI->height(); 167 h = audioUI->height();
168 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 168 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
169 } else { 169 } else {
170 w = videoUI->width(); 170 w = videoUI->width();
171 h = videoUI->height(); 171 h = videoUI->height();
172 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 172 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
173 } 173 }
174} 174}
175 175
176 176
177void MediaPlayer::timerEvent( QTimerEvent * ) { 177void MediaPlayer::timerEvent( QTimerEvent * ) {
178 if ( volumeDirection == +1 ) { 178 if ( volumeDirection == +1 ) {
179 volControl->incVol(2); 179 volControl->incVol(2);
180 } else if ( volumeDirection == -1 ) { 180 } else if ( volumeDirection == -1 ) {
181 volControl->decVol(2); 181 volControl->decVol(2);
182 } 182 }
183 183
184 184
185 // TODO FIXME 185 // TODO FIXME
186 unsigned int v= 0; 186 unsigned int v= 0;
187 v = volControl->volume(); 187 v = volControl->volume();
188 v = v / 10; 188 v = v / 10;
189 189
190 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 190 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
191 return; 191 return;
192 } 192 }
193 193
194 int w=0; int h=0; 194 int w=0; int h=0;
195 if( !xineControl->hasVideo()) { 195 if( !xineControl->hasVideo()) {
196 w = audioUI->width(); 196 w = audioUI->width();
197 h = audioUI->height(); 197 h = audioUI->height();
198 198
199 if ( drawnOnScreenDisplay ) { 199 if ( drawnOnScreenDisplay ) {
200 if ( onScreenDisplayVolume > v ) { 200 if ( onScreenDisplayVolume > v ) {
201 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 201 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
202 } 202 }
203 } 203 }
204 drawnOnScreenDisplay = TRUE; 204 drawnOnScreenDisplay = TRUE;
205 onScreenDisplayVolume = v; 205 onScreenDisplayVolume = v;
206 QPainter p( audioUI ); 206 QPainter p( audioUI );
207 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 207 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
208 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 208 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
209 209
210 QFont f; 210 QFont f;
211 f.setPixelSize( 20 ); 211 f.setPixelSize( 20 );
212 f.setBold( TRUE ); 212 f.setBold( TRUE );
213 p.setFont( f ); 213 p.setFont( f );
214 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 214 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
215 215
216 for ( unsigned int i = 0; i < 10; i++ ) { 216 for ( unsigned int i = 0; i < 10; i++ ) {
217 if ( v > i ) { 217 if ( v > i ) {
218 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 218 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
219 } else { 219 } else {
220 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 220 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
221 } 221 }
222 } 222 }
223 } else { 223 } else {
224 w = videoUI->width(); 224 w = videoUI->width();
225 h = videoUI->height(); 225 h = videoUI->height();
226 226
227 if ( drawnOnScreenDisplay ) { 227 if ( drawnOnScreenDisplay ) {
228 if ( onScreenDisplayVolume > v ) { 228 if ( onScreenDisplayVolume > v ) {
229 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 229 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
230 } 230 }
231 } 231 }
232 drawnOnScreenDisplay = TRUE; 232 drawnOnScreenDisplay = TRUE;
233 onScreenDisplayVolume = v; 233 onScreenDisplayVolume = v;
234 QPainter p( videoUI ); 234 QPainter p( videoUI );
235 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 235 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
236 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 236 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
237 237
238 QFont f; 238 QFont f;
239 f.setPixelSize( 20 ); 239 f.setPixelSize( 20 );
240 f.setBold( TRUE ); 240 f.setBold( TRUE );
241 p.setFont( f ); 241 p.setFont( f );
242 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 242 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
243 243
244 for ( unsigned int i = 0; i < 10; i++ ) { 244 for ( unsigned int i = 0; i < 10; i++ ) {
245 if ( v > i ) { 245 if ( v > i ) {
246 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 246 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
247 } else { 247 } else {
248 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 248 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
249 } 249 }
250 } 250 }
251 } 251 }
252} 252}
253 253
254 254
255void MediaPlayer::blank( bool b ) { 255void MediaPlayer::blank( bool b ) {
256 fd=open("/dev/fb0",O_RDWR); 256 fd=open("/dev/fb0",O_RDWR);
257 if (fd != -1) { 257 if (fd != -1) {
258 if ( b ) { 258 if ( b ) {
259 qDebug("do blanking"); 259 qDebug("do blanking");
260 ioctl( fd, FBIOBLANK, 3 ); 260 ioctl( fd, FBIOBLANK, 3 );
261 isBlanked = TRUE; 261 isBlanked = TRUE;
262 } else { 262 } else {
263 qDebug("do unblanking"); 263 qDebug("do unblanking");
264 ioctl( fd, FBIOBLANK, 0); 264 ioctl( fd, FBIOBLANK, 0);
265 isBlanked = FALSE; 265 isBlanked = FALSE;
266 } 266 }
267 close( fd ); 267 close( fd );
268 } else { 268 } else {
269 qDebug("<< /dev/fb0 could not be opened >>"); 269 qDebug("<< /dev/fb0 could not be opened >>");
270 } 270 }
271} 271}
272 272
273void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 273void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
274 switch ( e->key() ) { 274 switch ( e->key() ) {
275////////////////////////////// Zaurus keys 275////////////////////////////// Zaurus keys
276 case Key_Home: 276 case Key_Home:
277 break; 277 break;
278 case Key_F9: //activity 278 case Key_F9: //activity
279 break; 279 break;
280 case Key_F10: //contacts 280 case Key_F10: //contacts
281 break; 281 break;
282 case Key_F11: //menu 282 case Key_F11: //menu
283 break; 283 break;
284 case Key_F12: //home 284 case Key_F12: //home
285 qDebug("Blank here"); 285 qDebug("Blank here");
286// mediaPlayerState->toggleBlank(); 286// mediaPlayerState->toggleBlank();
287 break; 287 break;
288 case Key_F13: //mail 288 case Key_F13: //mail
289 qDebug("Blank here"); 289 qDebug("Blank here");
290 // mediaPlayerState->toggleBlank(); 290 // mediaPlayerState->toggleBlank();
291 break; 291 break;
292 } 292 }
293} 293}
294 294
295void MediaPlayer::cleanUp() {// this happens on closing 295void MediaPlayer::cleanUp() {// this happens on closing
296 Config cfg( "OpiePlayer" ); 296 Config cfg( "OpiePlayer" );
297 playList->writeConfig( cfg ); 297 mediaPlayerState->writeConfig( cfg );
298 playList->writeConfig( cfg );
298 299
299// QPEApplication::grabKeyboard(); 300// QPEApplication::grabKeyboard();
300// QPEApplication::ungrabKeyboard(); 301// QPEApplication::ungrabKeyboard();
301} 302}
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index b3431d7..215a2a8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -1,135 +1,135 @@
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..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library 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  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library 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#ifndef MEDIA_PLAYER_STATE_H 34#ifndef MEDIA_PLAYER_STATE_H
35#define MEDIA_PLAYER_STATE_H 35#define MEDIA_PLAYER_STATE_H
36 36
37 37
38#include <qobject.h> 38#include <qobject.h>
39 39
40 40
41class MediaPlayerDecoder; 41class MediaPlayerDecoder;
42class Config; 42class Config;
43 43
44 44
45class MediaPlayerState : public QObject { 45class MediaPlayerState : public QObject {
46Q_OBJECT 46Q_OBJECT
47public: 47public:
48 MediaPlayerState( QObject *parent, const char *name ); 48 MediaPlayerState( QObject *parent, const char *name );
49 ~MediaPlayerState(); 49 ~MediaPlayerState();
50 50
51 bool isPaused; 51 bool isPaused;
52 bool isPlaying; 52 bool isPlaying;
53 bool isStoped; 53 bool isStoped;
54 bool streaming(); 54 bool streaming();
55 bool fullscreen(); 55 bool fullscreen();
56 bool scaled(); 56 bool scaled();
57 bool looping(); 57 bool looping();
58 bool shuffled(); 58 bool shuffled();
59 bool playlist(); 59 bool playlist();
60 bool paused(); 60 bool paused();
61 bool playing(); 61 bool playing();
62 bool stop(); 62 bool stop();
63 long position(); 63 long position();
64 long length(); 64 long length();
65 char view(); 65 char view();
66 66
67public slots: 67public slots:
68 void setIsStreaming( bool b ); 68 void setIsStreaming( bool b );
69 void setFullscreen( bool b ); 69 void setFullscreen( bool b );
70 void setScaled( bool b ); 70 void setScaled( bool b );
71 void setLooping( bool b ); 71 void setLooping( bool b );
72 void setShuffled( bool b ); 72 void setShuffled( bool b );
73 void setPlaylist( bool b ); 73 void setPlaylist( bool b );
74 void setPaused( bool b ); 74 void setPaused( bool b );
75 void setPlaying( bool b ); 75 void setPlaying( bool b );
76 void setStop( bool b ); 76 void setStop( bool b );
77 void setPosition( long p ); 77 void setPosition( long p );
78 void updatePosition( long p ); 78 void updatePosition( long p );
79 void setLength( long l ); 79 void setLength( long l );
80 void setView( char v ); 80 void setView( char v );
81 void setBlanked( bool b ); 81 void setBlanked( bool b );
82 82
83 void setPrev(); 83 void setPrev();
84 void setNext(); 84 void setNext();
85 void setList(); 85 void setList();
86 void setVideo(); 86 void setVideo();
87 void setAudio(); 87 void setAudio();
88 88
89 void toggleFullscreen(); 89 void toggleFullscreen();
90 void toggleScaled(); 90 void toggleScaled();
91 void toggleLooping(); 91 void toggleLooping();
92 void toggleShuffled(); 92 void toggleShuffled();
93 void togglePlaylist(); 93 void togglePlaylist();
94 void togglePaused(); 94 void togglePaused();
95 void togglePlaying(); 95 void togglePlaying();
96 void toggleBlank(); 96 void toggleBlank();
97 void writeConfig( Config& cfg ) const;
98
97 99
98signals: 100signals:
99 void fullscreenToggled( bool ); 101 void fullscreenToggled( bool );
100 void scaledToggled( bool ); 102 void scaledToggled( bool );
101 void loopingToggled( bool ); 103 void loopingToggled( bool );
102 void shuffledToggled( bool ); 104 void shuffledToggled( bool );
103 void playlistToggled( bool ); 105 void playlistToggled( bool );
104 void pausedToggled( bool ); 106 void pausedToggled( bool );
105 void playingToggled( bool ); 107 void playingToggled( bool );
106 void stopToggled( bool ); 108 void stopToggled( bool );
107 void positionChanged( long ); // When the slider is moved 109 void positionChanged( long ); // When the slider is moved
108 void positionUpdated( long ); // When the media file progresses 110 void positionUpdated( long ); // When the media file progresses
109 void lengthChanged( long ); 111 void lengthChanged( long );
110 void viewChanged( char ); 112 void viewChanged( char );
111 void blankToggled( bool ); 113 void blankToggled( bool );
112 void prev(); 114 void prev();
113 void next(); 115 void next();
114 116
115private: 117private:
116 bool isStreaming; 118 bool isStreaming;
117 bool isFullscreen; 119 bool isFullscreen;
118 bool isScaled; 120 bool isScaled;
119 bool isBlanked; 121 bool isBlanked;
120 bool isLooping; 122 bool isLooping;
121 bool isShuffled; 123 bool isShuffled;
122 bool usePlaylist; 124 bool usePlaylist;
123 long curPosition; 125 long curPosition;
124 long curLength; 126 long curLength;
125 char curView; 127 char curView;
126 128
127 void readConfig( Config& cfg ); 129 void readConfig( Config& cfg );
128 void writeConfig( Config& cfg ) const;
129
130 130
131}; 131};
132 132
133 133
134#endif // MEDIA_PLAYER_STATE_H 134#endif // MEDIA_PLAYER_STATE_H
135 135