summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-17 02:45:43 (UTC)
committer llornkcor <llornkcor>2002-10-17 02:45:43 (UTC)
commitce65a2b92c8d647b0621120358bde62f7a893129 (patch) (unidiff)
tree819bc79171edb15aff5e0da7224110f0b5928906
parent4f2dc0f59515dd456dbe7b32eeda835ea231fca9 (diff)
downloadopie-ce65a2b92c8d647b0621120358bde62f7a893129.zip
opie-ce65a2b92c8d647b0621120358bde62f7a893129.tar.gz
opie-ce65a2b92c8d647b0621120358bde62f7a893129.tar.bz2
zaurus screenblanking - maybe better, maybe not- needs testing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 606f8e9..f0a01a1 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -14,48 +14,49 @@
14#include "playlistwidget.h" 14#include "playlistwidget.h"
15#include "audiowidget.h" 15#include "audiowidget.h"
16#include "videowidget.h" 16#include "videowidget.h"
17#include "volumecontrol.h" 17#include "volumecontrol.h"
18 18
19#include "mediaplayerstate.h" 19#include "mediaplayerstate.h"
20 20
21// for setBacklight() 21// for setBacklight()
22#include <linux/fb.h> 22#include <linux/fb.h>
23#include <sys/file.h> 23#include <sys/file.h>
24#include <sys/ioctl.h> 24#include <sys/ioctl.h>
25 25
26 26
27extern AudioWidget *audioUI; 27extern AudioWidget *audioUI;
28extern VideoWidget *videoUI; 28extern VideoWidget *videoUI;
29extern PlayListWidget *playList; 29extern PlayListWidget *playList;
30extern MediaPlayerState *mediaPlayerState; 30extern MediaPlayerState *mediaPlayerState;
31 31
32 32
33#define FBIOBLANK 0x4611 33#define FBIOBLANK 0x4611
34 34
35MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 35MediaPlayer::MediaPlayer( QObject *parent, const char *name )
36 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 36 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
37 37
38 fd=-1;fl=-1;
38 playList->setCaption( tr( "OpiePlayer: Initializating" ) ); 39 playList->setCaption( tr( "OpiePlayer: Initializating" ) );
39 40
40 qApp->processEvents(); 41 qApp->processEvents();
41 // QPEApplication::grabKeyboard(); // EVIL 42 // QPEApplication::grabKeyboard(); // EVIL
42 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
43 44
44 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
45 46
46 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 47 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
47 48
48 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 49 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
49 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 50 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
50 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
51 52
52 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 53 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
53 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 54 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
54 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 55 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
55 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 56 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
56 57
57 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 58 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
58 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 59 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
59 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 60 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
60 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 61 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
61 62
@@ -277,56 +278,73 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
277 onScreenDisplayVolume = v; 278 onScreenDisplayVolume = v;
278 QPainter p( videoUI ); 279 QPainter p( videoUI );
279 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 280 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
280 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 281 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
281 282
282 QFont f; 283 QFont f;
283 f.setPixelSize( 20 ); 284 f.setPixelSize( 20 );
284 f.setBold( TRUE ); 285 f.setBold( TRUE );
285 p.setFont( f ); 286 p.setFont( f );
286 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 287 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
287 288
288 for ( unsigned int i = 0; i < 10; i++ ) { 289 for ( unsigned int i = 0; i < 10; i++ ) {
289 if ( v > i ) { 290 if ( v > i ) {
290 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 291 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
291 } else { 292 } else {
292 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 293 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
293 } 294 }
294 } 295 }
295 } 296 }
296} 297}
297 298
298 299
299void MediaPlayer::blank( bool b ) { 300void MediaPlayer::blank( bool b ) {
300 fd=open("/dev/fb0",O_RDWR); 301 fd=open("/dev/fb0",O_RDWR);
302#ifdef QT_QWS_EBX
303 fl= open( "/dev/fl", O_RDWR );
304#endif
301 if (fd != -1) { 305 if (fd != -1) {
302 if ( b ) { 306 if ( b ) {
303 qDebug("do blanking"); 307 qDebug("do blanking");
308#ifdef QT_QWS_EBX
309 ioctl( fd, FBIOBLANK, 1 );
310 if(fl !=-1) {
311 ioctl( fl, 2 );
312 ::close(fl);
313 }
314#else
304 ioctl( fd, FBIOBLANK, 3 ); 315 ioctl( fd, FBIOBLANK, 3 );
316#endif
305 isBlanked = TRUE; 317 isBlanked = TRUE;
306 } else { 318 } else {
307 qDebug("do unblanking"); 319 qDebug("do unblanking");
308 ioctl( fd, FBIOBLANK, 0); 320 ioctl( fd, FBIOBLANK, 0);
321#ifdef QT_QWS_EBX
322 if(fl != -1) {
323 ioctl( fl, 1);
324 ::close(fl);
325 }
326#endif
309 isBlanked = FALSE; 327 isBlanked = FALSE;
310 } 328 }
311 close( fd ); 329 close( fd );
312 } else { 330 } else {
313 qDebug("<< /dev/fb0 could not be opened >>"); 331 qDebug("<< /dev/fb0 could not be opened >>");
314 } 332 }
315} 333}
316 334
317void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 335void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
318 switch ( e->key() ) { 336 switch ( e->key() ) {
319////////////////////////////// Zaurus keys 337////////////////////////////// Zaurus keys
320 case Key_Home: 338 case Key_Home:
321 break; 339 break;
322 case Key_F9: //activity 340 case Key_F9: //activity
323 break; 341 break;
324 case Key_F10: //contacts 342 case Key_F10: //contacts
325 break; 343 break;
326 case Key_F11: //menu 344 case Key_F11: //menu
327 break; 345 break;
328 case Key_F12: //home 346 case Key_F12: //home
329 qDebug("Blank here"); 347 qDebug("Blank here");
330// mediaPlayerState->toggleBlank(); 348// mediaPlayerState->toggleBlank();
331 break; 349 break;
332 case Key_F13: //mail 350 case Key_F13: //mail