Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 44 |
1 files changed, 2 insertions, 42 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,19 +1,20 @@ | |||
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 |
@@ -25,28 +26,24 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla | |||
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() ); |
@@ -272,60 +269,25 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
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 |
@@ -337,26 +299,24 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | |||
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 | ||