author | harlekin <harlekin> | 2002-08-16 13:39:04 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-16 13:39:04 (UTC) |
commit | 10006a500ed73c7640572b05d9b403e5739bfa0c (patch) (side-by-side diff) | |
tree | 870535988a6f603e9087e770778503d94baabfd6 | |
parent | 5144bf5607a246441f5b37dd0bbb9564017ce017 (diff) | |
download | opie-10006a500ed73c7640572b05d9b403e5739bfa0c.zip opie-10006a500ed73c7640572b05d9b403e5739bfa0c.tar.gz opie-10006a500ed73c7640572b05d9b403e5739bfa0c.tar.bz2 |
playing arround with blank
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 49 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 35 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 10 |
7 files changed, 58 insertions, 65 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 442864f..56203e0 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -536,6 +536,7 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) case Key_F12: //home break; case Key_F13: //mail + mediaPlayerState->toggleBlank(); break; case Key_Space: { if(mediaPlayerState->playing()) { @@ -579,7 +580,7 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) } else if( !mediaPlayerState->isPaused ) { setToggleButton( i, TRUE ); mediaPlayerState->setPaused( TRUE ); - } + } #endif } break; diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8dadf96..858b51f 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -2,6 +2,7 @@ #include <qpe/qlibrary.h> #include <qpe/resource.h> #include <qpe/config.h> +#include <qpe/qcopenvelope_qws.h> #include <qmainwindow.h> #include <qmessagebox.h> @@ -16,6 +17,10 @@ #include "mediaplayerstate.h" +// for setBacklight() +#include <linux/fb.h> +#include <sys/file.h> +#include <sys/ioctl.h> extern AudioWidget *audioUI; @@ -28,7 +33,7 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { - xineControl = new XineControl(); + // xineControl = new XineControl(); // QPEApplication::grabKeyboard(); // EVIL connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); @@ -38,6 +43,7 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); + connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); @@ -50,7 +56,7 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); volControl = new VolumeControl; - + xineControl = new XineControl(); } MediaPlayer::~MediaPlayer() { @@ -71,7 +77,6 @@ void MediaPlayer::play() { void MediaPlayer::setPlaying( bool play ) { if ( !play ) { - // mediaPlayerState->setPaused( FALSE ); return; } @@ -98,12 +103,6 @@ void MediaPlayer::setPlaying( bool play ) { else tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; -// QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); - -// if ( !fileInfo.isEmpty() ) -// tickerText += ", " + fileInfo; -// audioUI->setTickerText( tickerText + "." ); - audioUI->setTickerText( currentFile->file( ) ); } @@ -249,6 +248,24 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { } } + +void MediaPlayer::blank( bool b ) { + fd=open("/dev/fb0",O_RDWR); + if (fd != -1) { + + if ( !b ) { + qDebug("do blanking"); + ioctl( fd, FBIOBLANK, 3 ); + isBlanked = TRUE; + } else { + qDebug("do unblanking"); + ioctl( fd, FBIOBLANK, 0); + isBlanked = FALSE; + } + close( fd ); + } +} + void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys @@ -262,22 +279,16 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { break; case Key_F12: //home qDebug("Blank here"); +// mediaPlayerState->toggleBlank(); break; case Key_F13: //mail - break; + qDebug("Blank here"); +// mediaPlayerState->toggleBlank(); + break; } } -void MediaPlayer::doBlank() { - -} - -void MediaPlayer::doUnblank() { - -} - void MediaPlayer::cleanUp() { // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); - } diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 16213b5..81fab88 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -28,13 +28,14 @@ private slots: void startDecreasingVolume(); void stopChangingVolume(); void cleanUp(); + void blank( bool ); protected: void timerEvent( QTimerEvent *e ); void keyReleaseEvent( QKeyEvent *e); - void doBlank(); - void doUnblank(); private: + bool isBlanked; + int fd; int volumeDirection; const DocLnk *currentFile; XineControl *xineControl; diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index bb8d905..6aafb88 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -115,7 +115,7 @@ void MediaPlayerState::setIsStreaming( bool b ) { } -void MediaPlayerState::setFullscreen( bool b ) { +void MediaPlayerState::setBlank( bool b ) { if ( isFullscreen == b ) { return; } @@ -124,6 +124,15 @@ void MediaPlayerState::setFullscreen( bool b ) { } +void MediaPlayerState::setFullscreen( bool b ) { + if ( isBlanked == b ) { + return; + } + isBlanked = b; + emit blankToggled(b); +} + + void MediaPlayerState::setScaled( bool b ) { if ( isScaled == b ) { return; @@ -257,13 +266,16 @@ void MediaPlayerState::togglePlaylist() { } void MediaPlayerState::togglePaused() { - setPaused( !isPaused); + setPaused( !isPaused); } void MediaPlayerState::togglePlaying() { setPlaying( !isPlaying); } +void MediaPlayerState::toggleBlank() { + setBlank( !isBlanked); +} diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 887c527..3baffd3 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -78,6 +78,7 @@ public slots: void updatePosition( long p ); void setLength( long l ); void setView( char v ); + void setBlank( bool b ); void setPrev(); void setNext(); @@ -92,6 +93,7 @@ public slots: void togglePlaylist(); void togglePaused(); void togglePlaying(); + void toggleBlank(); signals: void fullscreenToggled( bool ); @@ -106,7 +108,7 @@ signals: void positionUpdated( long ); // When the media file progresses void lengthChanged( long ); void viewChanged( char ); - + void blankToggled( bool ); void prev(); void next(); @@ -114,6 +116,7 @@ private: bool isStreaming; bool isFullscreen; bool isScaled; + bool isBlanked; bool isLooping; bool isShuffled; bool usePlaylist; diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 6dcc842..0cfd720 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -1,7 +1,5 @@ #define QTOPIA_INTERNAL_FSLP -#include <qpe/qcopenvelope_qws.h> - #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/fileselector.h> @@ -45,17 +43,6 @@ #include "audiowidget.h" #include "videowidget.h" -#include <unistd.h> -#include <sys/file.h> -#include <sys/ioctl.h> -#include <sys/soundcard.h> - -// for setBacklight() -#include <linux/fb.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <stdlib.h> - #define BUTTONS_ON_TOOLBAR #define SIDE_BUTTONS #define CAN_SAVE_LOAD_PLAYLISTS @@ -1010,7 +997,7 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) case Key_F11: //menu break; case Key_F12: //home -// doBlank(); +// doBlank(); break; case Key_F13: //mail // doUnblank(); @@ -1079,27 +1066,7 @@ void PlayListWidget::keyPressEvent( QKeyEvent *) // } } -void PlayListWidget::doBlank() { - qDebug("do blanking"); - fd=open("/dev/fb0",O_RDWR); - if (fd != -1) { - ioctl(fd,FBIOBLANK,1); -// close(fd); - } -} -void PlayListWidget::doUnblank() { - // this crashes opieplayer with a segfault - // int fd; - // fd=open("/dev/fb0",O_RDWR); - qDebug("do unblanking"); - if (fd != -1) { - ioctl(fd,FBIOBLANK,0); - close(fd); - } - QCopEnvelope h("QPE/System", "setBacklight(int)"); - h <<-3;// v[1]; // -3 Force on -} void PlayListWidget::readm3u(const QString &filename) { diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 67a85a8..dd4bee0 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -42,7 +42,7 @@ public: /* QTimer * menuTimer; */ FileSelector* playLists; QPushButton *tbDeletePlaylist; - int fd, selected; + int selected; public slots: bool first(); bool last(); @@ -56,11 +56,9 @@ protected: void keyReleaseEvent( QKeyEvent *e); void keyPressEvent( QKeyEvent *e); private: - int defaultSkinIndex; - QPopupMenu *skinsMenu; + int defaultSkinIndex; + QPopupMenu *skinsMenu; bool audioScan, videoScan; - void doBlank(); - void doUnblank(); void readm3u(const QString &); void readPls(const QString &); @@ -72,7 +70,7 @@ private: void populateVideoView(); private slots: void populateSkinsMenu(); - void skinsMenuActivated(int); + void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void scanForAudio(); |