author | zecke <zecke> | 2004-09-23 21:38:02 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-23 21:38:02 (UTC) |
commit | 97ab73d99688443d02086b4f00d1de7c81faa3c7 (patch) (unidiff) | |
tree | 63864e847abc41442d2ed88ca27a27ad1942c15a /noncore/multimedia/opieplayer2/mediaplayer.cpp | |
parent | 3080b2095fd9dddc4937cbf74037ce1dbc7fa6b2 (diff) | |
download | opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.zip opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.tar.gz opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.tar.bz2 |
-Remove bogus whitespaces
-Remove stl dependency
-Make switching from fullscreen video to audio work
-Remove debug output
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index e6afbd8..b8023ca 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,88 +1,85 @@ | |||
1 | #include "mediaplayer.h" | 1 | #include "mediaplayer.h" |
2 | #include "audiowidget.h" | 2 | #include "audiowidget.h" |
3 | #include "videowidget.h" | 3 | #include "videowidget.h" |
4 | #include "volumecontrol.h" | 4 | #include "volumecontrol.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
8 | #include <opie2/odevice.h> | ||
8 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
10 | 11 | ||
11 | /* QT */ | 12 | /* QT */ |
12 | #include <qfileinfo.h> | 13 | #include <qfileinfo.h> |
13 | 14 | ||
14 | /* STD */ | 15 | /* STD */ |
15 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
16 | #include <sys/file.h> | 17 | #include <sys/file.h> |
17 | #include <sys/ioctl.h> | 18 | #include <sys/ioctl.h> |
18 | 19 | ||
19 | #define FBIOBLANK 0x4611 | 20 | #define FBIOBLANK 0x4611 |
20 | 21 | ||
21 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 22 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
22 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { | 23 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { |
23 | 24 | ||
24 | m_audioUI = 0; | 25 | m_audioUI = 0; |
25 | m_videoUI = 0; | 26 | m_videoUI = 0; |
26 | m_xineControl = 0; | 27 | m_xineControl = 0; |
27 | xine = new XINE::Lib( XINE::Lib::InitializeInThread ); | 28 | xine = new XINE::Lib( XINE::Lib::InitializeInThread ); |
28 | 29 | ||
29 | fd=-1;fl=-1; | 30 | fd=-1;fl=-1; |
30 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); | 31 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
31 | 32 | ||
32 | qApp->processEvents(); | 33 | qApp->processEvents(); |
33 | // QPEApplication::grabKeyboard(); // EVIL | 34 | // QPEApplication::grabKeyboard(); // EVIL |
34 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 35 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
35 | 36 | ||
36 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 37 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
37 | |||
38 | // What is pauseCheck good for? (Simon) | ||
39 | // connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) ); | ||
40 | |||
41 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 38 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
42 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 39 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
43 | connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) ); | 40 | connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) ); |
44 | 41 | ||
45 | volControl = new VolumeControl; | 42 | volControl = new VolumeControl; |
46 | Config cfg( "OpiePlayer" ); | 43 | Config cfg( "OpiePlayer" ); |
47 | cfg.setGroup("PlayList"); | 44 | cfg.setGroup("PlayList"); |
48 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 45 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
49 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 46 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
50 | 47 | ||
51 | m_skinLoader = new SkinLoader; | 48 | m_skinLoader = new SkinLoader; |
52 | m_skinLoader->schedule( AudioWidget::guiInfo() ); | 49 | m_skinLoader->schedule( AudioWidget::guiInfo() ); |
53 | m_skinLoader->schedule( VideoWidget::guiInfo() ); | 50 | m_skinLoader->schedule( VideoWidget::guiInfo() ); |
54 | m_skinLoader->start(); | 51 | m_skinLoader->start(); |
55 | } | 52 | } |
56 | 53 | ||
57 | MediaPlayer::~MediaPlayer() { | 54 | MediaPlayer::~MediaPlayer() { |
58 | // this shold never happen, but one never knows... | 55 | // this shold never happen, but one never knows... |
59 | if ( xine ) { | 56 | if ( xine ) { |
60 | xine->ensureInitialized(); | 57 | xine->ensureInitialized(); |
61 | delete xine; | 58 | delete xine; |
62 | } | 59 | } |
63 | delete m_xineControl; | 60 | delete m_xineControl; |
64 | delete m_audioUI; | 61 | delete m_audioUI; |
65 | delete m_videoUI; | 62 | delete m_videoUI; |
66 | delete volControl; | 63 | delete volControl; |
67 | } | 64 | } |
68 | 65 | ||
69 | void MediaPlayer::pauseCheck( bool b ) { | 66 | void MediaPlayer::pauseCheck( bool b ) { |
70 | if ( b && !mediaPlayerState.isPlaying() ) { | 67 | if ( b && !mediaPlayerState.isPlaying() ) { |
71 | mediaPlayerState.setPaused( FALSE ); | 68 | mediaPlayerState.setPaused( FALSE ); |
72 | } | 69 | } |
73 | } | 70 | } |
74 | 71 | ||
75 | void MediaPlayer::play() { | 72 | void MediaPlayer::play() { |
76 | mediaPlayerState.setPlaying( FALSE ); | 73 | mediaPlayerState.setPlaying( FALSE ); |
77 | mediaPlayerState.setPlaying( TRUE ); | 74 | mediaPlayerState.setPlaying( TRUE ); |
78 | } | 75 | } |
79 | 76 | ||
80 | void MediaPlayer::setPlaying( bool play ) { | 77 | void MediaPlayer::setPlaying( bool play ) { |
81 | if ( !play ) { | 78 | if ( !play ) { |
82 | return; | 79 | return; |
83 | } | 80 | } |
84 | 81 | ||
85 | if ( mediaPlayerState.isPaused() ) { | 82 | if ( mediaPlayerState.isPaused() ) { |
86 | mediaPlayerState.setPaused( FALSE ); | 83 | mediaPlayerState.setPaused( FALSE ); |
87 | return; | 84 | return; |
88 | } | 85 | } |
@@ -109,97 +106,97 @@ void MediaPlayer::setPlaying( bool play ) { | |||
109 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 106 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
110 | 107 | ||
111 | if( fileName.left(4) == "http" ) { | 108 | if( fileName.left(4) == "http" ) { |
112 | fileName = QFileInfo( fileName ).baseName(); | 109 | fileName = QFileInfo( fileName ).baseName(); |
113 | if ( xineControl()->getMetaInfo().isEmpty() ) { | 110 | if ( xineControl()->getMetaInfo().isEmpty() ) { |
114 | tickerText = tr( " File: " ) + fileName; | 111 | tickerText = tr( " File: " ) + fileName; |
115 | } else { | 112 | } else { |
116 | tickerText = xineControl()->getMetaInfo(); | 113 | tickerText = xineControl()->getMetaInfo(); |
117 | } | 114 | } |
118 | } else { | 115 | } else { |
119 | if ( xineControl()->getMetaInfo().isEmpty() ) { | 116 | if ( xineControl()->getMetaInfo().isEmpty() ) { |
120 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 117 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
121 | } else { | 118 | } else { |
122 | tickerText = xineControl()->getMetaInfo() + " Length: " + time + " "; | 119 | tickerText = xineControl()->getMetaInfo() + " Length: " + time + " "; |
123 | } | 120 | } |
124 | } | 121 | } |
125 | audioUI()->setTickerText( tickerText ); | 122 | audioUI()->setTickerText( tickerText ); |
126 | } | 123 | } |
127 | 124 | ||
128 | 125 | ||
129 | void MediaPlayer::prev() { | 126 | void MediaPlayer::prev() { |
130 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist | 127 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist |
131 | if ( playList.prev() ) { | 128 | if ( playList.prev() ) { |
132 | play(); | 129 | play(); |
133 | } else if ( mediaPlayerState.isLooping() ) { | 130 | } else if ( mediaPlayerState.isLooping() ) { |
134 | if ( playList.last() ) { | 131 | if ( playList.last() ) { |
135 | play(); | 132 | play(); |
136 | } | 133 | } |
137 | } else { | 134 | } else { |
138 | mediaPlayerState.setList(); | 135 | mediaPlayerState.setList(); |
139 | } | 136 | } |
140 | } | 137 | } |
141 | } | 138 | } |
142 | 139 | ||
143 | 140 | ||
144 | void MediaPlayer::next() { | 141 | void MediaPlayer::next() { |
145 | 142 | ||
146 | if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist | 143 | if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist |
147 | if ( playList.next() ) { | 144 | if ( playList.next() ) { |
148 | play(); | 145 | play(); |
149 | } else if ( mediaPlayerState.isLooping() ) { | 146 | } else if ( mediaPlayerState.isLooping() ) { |
150 | if ( playList.first() ) { | 147 | if ( playList.first() ) { |
151 | play(); | 148 | play(); |
152 | } | 149 | } |
153 | } else { | 150 | } else { |
154 | mediaPlayerState.setList(); | 151 | mediaPlayerState.setList(); |
155 | } | 152 | } |
156 | } else { //if playing from file list, let's just stop | 153 | } else { //if playing from file list, let's just stop |
157 | odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl; | 154 | odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl; |
158 | mediaPlayerState.setPlaying(false); | 155 | mediaPlayerState.setPlaying(false); |
159 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); | 156 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); |
160 | if(l) mediaPlayerState.setLooping(l); | 157 | if(l) mediaPlayerState.setLooping(l); |
161 | if(r) mediaPlayerState.setShuffled(r); | 158 | if(r) mediaPlayerState.setShuffled(r); |
162 | } | 159 | } |
163 | qApp->processEvents(); | 160 | qApp->processEvents(); |
164 | } | 161 | } |
165 | 162 | ||
166 | 163 | ||
167 | void MediaPlayer::startDecreasingVolume() { | 164 | void MediaPlayer::startDecreasingVolume() { |
168 | volumeDirection = -1; | 165 | volumeDirection = -1; |
169 | startTimer( 100 ); | 166 | startTimer( 100 ); |
170 | volControl->decVol(2); | 167 | volControl->decVol(2); |
171 | } | 168 | } |
172 | 169 | ||
173 | 170 | ||
174 | void MediaPlayer::startIncreasingVolume() { | 171 | void MediaPlayer::startIncreasingVolume() { |
175 | volumeDirection = +1; | 172 | volumeDirection = +1; |
176 | startTimer( 100 ); | 173 | startTimer( 100 ); |
177 | volControl->incVol(2); | 174 | volControl->incVol(2); |
178 | } | 175 | } |
179 | 176 | ||
180 | 177 | ||
181 | bool drawnOnScreenDisplay = FALSE; | 178 | bool drawnOnScreenDisplay = FALSE; |
182 | unsigned int onScreenDisplayVolume = 0; | 179 | unsigned int onScreenDisplayVolume = 0; |
183 | const int yoff = 110; | 180 | const int yoff = 110; |
184 | 181 | ||
185 | void MediaPlayer::stopChangingVolume() { | 182 | void MediaPlayer::stopChangingVolume() { |
186 | killTimers(); | 183 | killTimers(); |
187 | // Get rid of the on-screen display stuff | 184 | // Get rid of the on-screen display stuff |
188 | drawnOnScreenDisplay = FALSE; | 185 | drawnOnScreenDisplay = FALSE; |
189 | onScreenDisplayVolume = 0; | 186 | onScreenDisplayVolume = 0; |
190 | int w=0; | 187 | int w=0; |
191 | int h=0; | 188 | int h=0; |
192 | if( !xineControl()->hasVideo() ) { | 189 | if( !xineControl()->hasVideo() ) { |
193 | w = audioUI()->width(); | 190 | w = audioUI()->width(); |
194 | h = audioUI()->height(); | 191 | h = audioUI()->height(); |
195 | audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 192 | audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
196 | } else { | 193 | } else { |
197 | w = videoUI()->width(); | 194 | w = videoUI()->width(); |
198 | h = videoUI()->height(); | 195 | h = videoUI()->height(); |
199 | videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 196 | videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
200 | } | 197 | } |
201 | } | 198 | } |
202 | 199 | ||
203 | 200 | ||
204 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 201 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
205 | if ( volumeDirection == +1 ) { | 202 | if ( volumeDirection == +1 ) { |
@@ -236,163 +233,126 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
236 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 233 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
237 | 234 | ||
238 | QFont f; | 235 | QFont f; |
239 | f.setPixelSize( 20 ); | 236 | f.setPixelSize( 20 ); |
240 | f.setBold( TRUE ); | 237 | f.setBold( TRUE ); |
241 | p.setFont( f ); | 238 | p.setFont( f ); |
242 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 239 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
243 | 240 | ||
244 | for ( unsigned int i = 0; i < 10; i++ ) { | 241 | for ( unsigned int i = 0; i < 10; i++ ) { |
245 | if ( v > i ) { | 242 | if ( v > i ) { |
246 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 243 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
247 | } else { | 244 | } else { |
248 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 245 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
249 | } | 246 | } |
250 | } | 247 | } |
251 | } else { | 248 | } else { |
252 | w = videoUI()->width(); | 249 | w = videoUI()->width(); |
253 | h = videoUI()->height(); | 250 | h = videoUI()->height(); |
254 | 251 | ||
255 | if ( drawnOnScreenDisplay ) { | 252 | if ( drawnOnScreenDisplay ) { |
256 | if ( onScreenDisplayVolume > v ) { | 253 | if ( onScreenDisplayVolume > v ) { |
257 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 254 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
258 | } | 255 | } |
259 | } | 256 | } |
260 | drawnOnScreenDisplay = TRUE; | 257 | drawnOnScreenDisplay = TRUE; |
261 | onScreenDisplayVolume = v; | 258 | onScreenDisplayVolume = v; |
262 | QPainter p( videoUI() ); | 259 | QPainter p( videoUI() ); |
263 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 260 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
264 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 261 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
265 | 262 | ||
266 | QFont f; | 263 | QFont f; |
267 | f.setPixelSize( 20 ); | 264 | f.setPixelSize( 20 ); |
268 | f.setBold( TRUE ); | 265 | f.setBold( TRUE ); |
269 | p.setFont( f ); | 266 | p.setFont( f ); |
270 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); | 267 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
271 | 268 | ||
272 | for ( unsigned int i = 0; i < 10; i++ ) { | 269 | for ( unsigned int i = 0; i < 10; i++ ) { |
273 | if ( v > i ) { | 270 | if ( v > i ) { |
274 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 271 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
275 | } else { | 272 | } else { |
276 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 273 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
277 | } | 274 | } |
278 | } | 275 | } |
279 | } | 276 | } |
280 | } | 277 | } |
281 | 278 | ||
282 | 279 | ||
283 | void MediaPlayer::blank( bool b ) { | 280 | void MediaPlayer::blank( bool b ) { |
284 | #ifdef QT_QWS_DEVFS | 281 | Opie::Core::ODevice::inst()->setDisplayStatus( b ); |
285 | fd=open("/dev/fb/0",O_RDWR); | ||
286 | #else | ||
287 | fd=open("/dev/fb0",O_RDWR); | ||
288 | #endif | ||
289 | #ifdef QT_QWS_SL5XXX | ||
290 | fl= open( "/dev/fl", O_RDWR ); | ||
291 | #endif | ||
292 | if (fd != -1) { | ||
293 | if ( b ) { | ||
294 | odebug << "do blanking" << oendl; | ||
295 | #ifdef QT_QWS_SL5XXX | ||
296 | ioctl( fd, FBIOBLANK, 1 ); | ||
297 | if(fl !=-1) { | ||
298 | ioctl( fl, 2 ); | ||
299 | ::close(fl); | ||
300 | } | ||
301 | #else | ||
302 | ioctl( fd, FBIOBLANK, 3 ); | ||
303 | #endif | ||
304 | isBlanked = TRUE; | ||
305 | } else { | ||
306 | odebug << "do unblanking" << oendl; | ||
307 | ioctl( fd, FBIOBLANK, 0); | ||
308 | #ifdef QT_QWS_SL5XXX | ||
309 | if(fl != -1) { | ||
310 | ioctl( fl, 1); | ||
311 | ::close(fl); | ||
312 | } | ||
313 | #endif | ||
314 | isBlanked = FALSE; | ||
315 | } | ||
316 | close( fd ); | ||
317 | } else { | ||
318 | odebug << "<< /dev/fb0 could not be opened >>" << oendl; | ||
319 | } | ||
320 | } | 282 | } |
321 | 283 | ||
322 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 284 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
323 | switch ( e->key() ) { | 285 | switch ( e->key() ) { |
324 | ////////////////////////////// Zaurus keys | 286 | ////////////////////////////// Zaurus keys |
325 | case Key_Home: | 287 | case Key_Home: |
326 | break; | 288 | break; |
327 | case Key_F9: //activity | 289 | case Key_F9: //activity |
328 | break; | 290 | break; |
329 | case Key_F10: //contacts | 291 | case Key_F10: //contacts |
330 | break; | 292 | break; |
331 | case Key_F11: //menu | 293 | case Key_F11: //menu |
332 | break; | 294 | break; |
333 | case Key_F12: //home | 295 | case Key_F12: //home |
334 | odebug << "Blank here" << oendl; | 296 | odebug << "Blank here" << oendl; |
335 | // mediaPlayerState->toggleBlank(); | 297 | // mediaPlayerState->toggleBlank(); |
336 | break; | 298 | break; |
337 | case Key_F13: //mail | 299 | case Key_F13: //mail |
338 | odebug << "Blank here" << oendl; | 300 | odebug << "Blank here" << oendl; |
339 | // mediaPlayerState->toggleBlank(); | 301 | // mediaPlayerState->toggleBlank(); |
340 | break; | 302 | break; |
341 | } | 303 | } |
342 | } | 304 | } |
343 | 305 | ||
344 | void MediaPlayer::cleanUp() {// this happens on closing | 306 | void MediaPlayer::cleanUp() {// this happens on closing |
345 | Config cfg( "OpiePlayer" ); | 307 | Config cfg( "OpiePlayer" ); |
346 | mediaPlayerState.writeConfig( cfg ); | 308 | mediaPlayerState.writeConfig( cfg ); |
347 | playList.writeDefaultPlaylist( ); | 309 | playList.writeDefaultPlaylist( ); |
348 | 310 | ||
349 | // QPEApplication::grabKeyboard(); | ||
350 | // QPEApplication::ungrabKeyboard(); | ||
351 | } | 311 | } |
352 | 312 | ||
353 | void MediaPlayer::recreateAudioAndVideoWidgets() const | 313 | void MediaPlayer::recreateAudioAndVideoWidgets() const |
354 | { | 314 | { |
355 | delete m_skinLoader; | 315 | delete m_skinLoader; |
356 | 316 | ||
357 | delete m_xineControl; | 317 | delete m_xineControl; |
358 | delete m_audioUI; | 318 | delete m_audioUI; |
359 | delete m_videoUI; | 319 | delete m_videoUI; |
360 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); | 320 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); |
361 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); | 321 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); |
362 | 322 | ||
363 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 323 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
364 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 324 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
365 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 325 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
366 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 326 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
367 | 327 | ||
368 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 328 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
369 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 329 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
370 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 330 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
371 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 331 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
372 | 332 | ||
373 | if ( !xine ) | 333 | if ( !xine ) |
374 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); | 334 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); |
375 | 335 | ||
376 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); | 336 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); |
377 | 337 | ||
378 | xine = 0; | 338 | xine = 0; |
379 | } | 339 | } |
380 | 340 | ||
381 | AudioWidget *MediaPlayer::audioUI() const | 341 | AudioWidget *MediaPlayer::audioUI() const |
382 | { | 342 | { |
383 | if ( !m_audioUI ) | 343 | if ( !m_audioUI ) |
384 | recreateAudioAndVideoWidgets(); | 344 | recreateAudioAndVideoWidgets(); |
385 | return m_audioUI; | 345 | return m_audioUI; |
386 | } | 346 | } |
387 | 347 | ||
388 | VideoWidget *MediaPlayer::videoUI() const | 348 | VideoWidget *MediaPlayer::videoUI() const |
389 | { | 349 | { |
390 | if ( !m_videoUI ) | 350 | if ( !m_videoUI ) |
391 | recreateAudioAndVideoWidgets(); | 351 | recreateAudioAndVideoWidgets(); |
392 | return m_videoUI; | 352 | return m_videoUI; |
393 | } | 353 | } |
394 | 354 | ||
395 | XineControl *MediaPlayer::xineControl() const | 355 | XineControl *MediaPlayer::xineControl() const |
396 | { | 356 | { |
397 | if ( !m_xineControl ) | 357 | if ( !m_xineControl ) |
398 | recreateAudioAndVideoWidgets(); | 358 | recreateAudioAndVideoWidgets(); |