author | harlekin <harlekin> | 2002-08-16 15:16:13 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-16 15:16:13 (UTC) |
commit | aa9eba407a8236c72822d24643b58d4d48ae80c0 (patch) (side-by-side diff) | |
tree | 178c91d1a1d33a3ae6ae7bf91746fc1a4fd499e2 | |
parent | c150d03ae4d626c57531f89413710033d1ef5151 (diff) | |
download | opie-aa9eba407a8236c72822d24643b58d4d48ae80c0.zip opie-aa9eba407a8236c72822d24643b58d4d48ae80c0.tar.gz opie-aa9eba407a8236c72822d24643b58d4d48ae80c0.tar.bz2 |
blank now works, mail key on ipaq
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 11 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 2 |
4 files changed, 13 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 56203e0..604ed3a 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -487,101 +487,102 @@ void AudioWidget::mousePressEvent( QMouseEvent *event ) { void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void AudioWidget::showEvent( QShowEvent* ) { QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); mouseMoveEvent( &event ); } void AudioWidget::closeEvent( QCloseEvent* ) { mediaPlayerState->setList(); } void AudioWidget::paintEvent( QPaintEvent * pe) { if ( !pe->erased() ) { // Combine with background and double buffer QPixmap pix( pe->rect().size() ); QPainter p( &pix ); p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); for ( int i = 0; i < numButtons; i++ ) paintButton( &p, i ); QPainter p2( this ); p2.drawPixmap( pe->rect().topLeft(), pix ); } else { QPainter p( this ); for ( int i = 0; i < numButtons; i++ ) paintButton( &p, i ); } } void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity hide(); // qDebug("Audio F9"); break; case Key_F10: //contacts break; case Key_F11: //menu + mediaPlayerState->toggleBlank(); break; case Key_F12: //home break; case Key_F13: //mail - mediaPlayerState->toggleBlank(); + mediaPlayerState->toggleBlank(); break; case Key_Space: { if(mediaPlayerState->playing()) { // toggleButton(1); mediaPlayerState->setPlaying(FALSE); // toggleButton(1); } else { // toggleButton(0); mediaPlayerState->setPlaying(TRUE); // toggleButton(0); } } break; case Key_Down: // toggleButton(6); emit lessClicked(); emit lessReleased(); // toggleButton(6); break; case Key_Up: // toggleButton(5); emit moreClicked(); emit moreReleased(); // toggleButton(5); break; case Key_Right: // toggleButton(3); mediaPlayerState->setNext(); // toggleButton(3); break; case Key_Left: // toggleButton(4); mediaPlayerState->setPrev(); // toggleButton(4); break; case Key_Escape: { #if defined(QT_QWS_IPAQ) if( mediaPlayerState->isPaused ) { setToggleButton( i, FALSE ); mediaPlayerState->setPaused( FALSE ); } 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 858b51f..87f4f0c 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -1,79 +1,81 @@ #include <qpe/qpeapplication.h> #include <qpe/qlibrary.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qwidgetstack.h> #include <qfile.h> #include "mediaplayer.h" #include "playlistwidget.h" #include "audiowidget.h" #include "videowidget.h" #include "volumecontrol.h" #include "mediaplayerstate.h" // for setBacklight() #include <linux/fb.h> #include <sys/file.h> #include <sys/ioctl.h> extern AudioWidget *audioUI; extern VideoWidget *videoUI; extern PlayListWidget *playList; extern MediaPlayerState *mediaPlayerState; +#define FBIOBLANK 0x4611 + MediaPlayer::MediaPlayer( QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { // xineControl = new XineControl(); // QPEApplication::grabKeyboard(); // EVIL connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 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() ) ); connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); volControl = new VolumeControl; xineControl = new XineControl(); } MediaPlayer::~MediaPlayer() { delete xineControl; delete volControl; } void MediaPlayer::pauseCheck( bool b ) { if ( b && !mediaPlayerState->playing() ) { mediaPlayerState->setPaused( FALSE ); } } void MediaPlayer::play() { mediaPlayerState->setPlaying( FALSE ); mediaPlayerState->setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { @@ -207,88 +209,89 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { QFont f; f.setPixelSize( 20 ); f.setBold( TRUE ); p.setFont( f ); p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); for ( unsigned int i = 0; i < 10; i++ ) { if ( v > i ) { p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); } else { p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); } } } else { w = videoUI->width(); h = videoUI->height(); if ( drawnOnScreenDisplay ) { if ( onScreenDisplayVolume > v ) { videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); } } drawnOnScreenDisplay = TRUE; onScreenDisplayVolume = v; QPainter p( videoUI ); p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); QFont f; f.setPixelSize( 20 ); f.setBold( TRUE ); p.setFont( f ); p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); for ( unsigned int i = 0; i < 10; i++ ) { if ( v > i ) { p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); } else { p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); } } } } void MediaPlayer::blank( bool b ) { fd=open("/dev/fb0",O_RDWR); if (fd != -1) { - - if ( !b ) { + if ( b ) { qDebug("do blanking"); ioctl( fd, FBIOBLANK, 3 ); isBlanked = TRUE; } else { qDebug("do unblanking"); ioctl( fd, FBIOBLANK, 0); isBlanked = FALSE; } close( fd ); + } else { + qDebug("<< /dev/fb0 could not be opend >>"); } } void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts break; case Key_F11: //menu break; case Key_F12: //home qDebug("Blank here"); // mediaPlayerState->toggleBlank(); break; case Key_F13: //mail qDebug("Blank here"); -// mediaPlayerState->toggleBlank(); - break; + // mediaPlayerState->toggleBlank(); + break; } } void MediaPlayer::cleanUp() { // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 6aafb88..6833e07 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -70,106 +70,106 @@ bool MediaPlayerState::scaled() { bool MediaPlayerState::looping() { return isLooping; } bool MediaPlayerState::shuffled() { return isShuffled; } bool MediaPlayerState:: playlist() { return usePlaylist; } bool MediaPlayerState::paused() { return isPaused; } bool MediaPlayerState::playing() { return isPlaying; } bool MediaPlayerState::stop() { return isStoped; } long MediaPlayerState::position() { return curPosition; } long MediaPlayerState::length() { return curLength; } char MediaPlayerState::view() { return curView; } // slots void MediaPlayerState::setIsStreaming( bool b ) { if ( isStreaming == b ) { return; } isStreaming = b; } -void MediaPlayerState::setBlank( bool b ) { +void MediaPlayerState::setFullscreen( bool b ) { if ( isFullscreen == b ) { return; } isFullscreen = b; emit fullscreenToggled(b); } -void MediaPlayerState::setFullscreen( bool b ) { +void MediaPlayerState::setBlanked( bool b ) { if ( isBlanked == b ) { return; } isBlanked = b; emit blankToggled(b); } void MediaPlayerState::setScaled( bool b ) { if ( isScaled == b ) { return; } isScaled = b; emit scaledToggled(b); } void MediaPlayerState::setLooping( bool b ) { if ( isLooping == b ) { return; } isLooping = b; emit loopingToggled(b); } void MediaPlayerState::setShuffled( bool b ) { if ( isShuffled == b ) { return; } isShuffled = b; emit shuffledToggled(b); } void MediaPlayerState::setPlaylist( bool b ) { if ( usePlaylist == b ) { return; } usePlaylist = b; emit playlistToggled(b); } void MediaPlayerState::setPaused( bool b ) { if ( isPaused == b ) { isPaused = FALSE; emit pausedToggled(FALSE); return; } isPaused = b; emit pausedToggled(b); @@ -229,53 +229,53 @@ void MediaPlayerState::setPrev(){ } void MediaPlayerState::setNext() { emit next(); } void MediaPlayerState::setList() { setPlaying( FALSE ); setView('l'); } void MediaPlayerState::setVideo() { setView('v'); } void MediaPlayerState::setAudio() { setView('a'); } void MediaPlayerState::toggleFullscreen() { setFullscreen( !isFullscreen ); } void MediaPlayerState::toggleScaled() { setScaled( !isScaled); } void MediaPlayerState::toggleLooping() { setLooping( !isLooping); } void MediaPlayerState::toggleShuffled() { setShuffled( !isShuffled); } void MediaPlayerState::togglePlaylist() { setPlaylist( !usePlaylist); } void MediaPlayerState::togglePaused() { setPaused( !isPaused); } void MediaPlayerState::togglePlaying() { setPlaying( !isPlaying); } void MediaPlayerState::toggleBlank() { - setBlank( !isBlanked); + setBlanked( !isBlanked); } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 3baffd3..b3431d7 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -33,97 +33,97 @@ #ifndef MEDIA_PLAYER_STATE_H #define MEDIA_PLAYER_STATE_H #include <qobject.h> class MediaPlayerDecoder; class Config; class MediaPlayerState : public QObject { Q_OBJECT public: MediaPlayerState( QObject *parent, const char *name ); ~MediaPlayerState(); bool isPaused; bool isPlaying; bool isStoped; bool streaming(); bool fullscreen(); bool scaled(); bool looping(); bool shuffled(); bool playlist(); bool paused(); bool playing(); bool stop(); long position(); long length(); char view(); public slots: void setIsStreaming( bool b ); void setFullscreen( bool b ); void setScaled( bool b ); void setLooping( bool b ); void setShuffled( bool b ); void setPlaylist( bool b ); void setPaused( bool b ); void setPlaying( bool b ); void setStop( bool b ); void setPosition( long p ); void updatePosition( long p ); void setLength( long l ); void setView( char v ); - void setBlank( bool b ); + void setBlanked( bool b ); void setPrev(); void setNext(); void setList(); void setVideo(); void setAudio(); void toggleFullscreen(); void toggleScaled(); void toggleLooping(); void toggleShuffled(); void togglePlaylist(); void togglePaused(); void togglePlaying(); void toggleBlank(); signals: void fullscreenToggled( bool ); void scaledToggled( bool ); void loopingToggled( bool ); void shuffledToggled( bool ); void playlistToggled( bool ); void pausedToggled( bool ); void playingToggled( bool ); void stopToggled( bool ); void positionChanged( long ); // When the slider is moved void positionUpdated( long ); // When the media file progresses void lengthChanged( long ); void viewChanged( char ); void blankToggled( bool ); void prev(); void next(); private: bool isStreaming; bool isFullscreen; bool isScaled; bool isBlanked; bool isLooping; bool isShuffled; bool usePlaylist; long curPosition; long curLength; char curView; void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; |