-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.cpp | 38 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.h | 6 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 51 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 2 |
5 files changed, 90 insertions, 11 deletions
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index ab46a7d..b9e438b 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp @@ -24,65 +24,65 @@ #include <qpe/config.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qwidgetstack.h> #include <qfile.h> #include "mediaplayer.h" #include "playlistwidget.h" #include "audiowidget.h" #include "loopcontrol.h" #include "audiodevice.h" #include "mediaplayerstate.h" extern AudioWidget *audioUI; extern PlayListWidget *playList; extern LoopControl *loopControl; extern MediaPlayerState *mediaPlayerState; MediaPlayer::MediaPlayer( QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { - QPEApplication::grabKeyboard(); + +// QPEApplication::grabKeyboard(); + 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( 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() ) ); } MediaPlayer::~MediaPlayer() { - QPEApplication::grabKeyboard(); - QPEApplication::ungrabKeyboard(); } void MediaPlayer::pauseCheck( bool b ) { // Only pause if playing if ( b && !mediaPlayerState->playing() ) mediaPlayerState->setPaused( FALSE ); } void MediaPlayer::play() { mediaPlayerState->setPlaying( FALSE ); mediaPlayerState->setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { mediaPlayerState->setPaused( FALSE ); loopControl->stop( FALSE ); return; } if ( mediaPlayerState->paused() ) { @@ -164,24 +164,56 @@ void MediaPlayer::startDecreasingVolume() { startTimer( 100 ); AudioDevice::decreaseVolume(); } void MediaPlayer::startIncreasingVolume() { volumeDirection = +1; startTimer( 100 ); AudioDevice::increaseVolume(); } void MediaPlayer::stopChangingVolume() { killTimers(); } void MediaPlayer::timerEvent( QTimerEvent * ) { if ( volumeDirection == +1 ) AudioDevice::increaseVolume(); else if ( volumeDirection == -1 ) AudioDevice::decreaseVolume(); } +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"); + break; + case Key_F13: //mail + break; + } +} + +void MediaPlayer::doBlank() { + +} + +void MediaPlayer::doUnblank() { + +} + +void MediaPlayer::cleanUp() { +// QPEApplication::grabKeyboard(); +// QPEApplication::ungrabKeyboard(); + +} diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h index 0354d21..cf9daea 100644 --- a/core/multimedia/opieplayer/mediaplayer.h +++ b/core/multimedia/opieplayer/mediaplayer.h @@ -26,34 +26,36 @@ #include <qpe/mediaplayerplugininterface.h> class DocLnk; class MediaPlayer : public QObject { Q_OBJECT public: MediaPlayer( QObject *parent, const char *name ); ~MediaPlayer(); private slots: void setPlaying( bool ); void pauseCheck( bool ); void play(); void next(); void prev(); void startIncreasingVolume(); void startDecreasingVolume(); void stopChangingVolume(); protected: void timerEvent( QTimerEvent *e ); -// void keyReleaseEvent( QKeyEvent *e); - + void keyReleaseEvent( QKeyEvent *e); + void doBlank(); + void doUnblank(); + void cleanUp(); private: int volumeDirection; const DocLnk *currentFile; }; #endif // MEDIA_PLAYER_H diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index faa6e3f..70b7cef 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -1,88 +1,100 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // code added by L. J. Potter Sat 03-02-2002 06:17:54 #define QTOPIA_INTERNAL_FSLP +#include <qpe/qcopenvelope_qws.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/fileselector.h> #include <qpe/qpeapplication.h> #include <qpe/lnkproperties.h> #include <qpe/storage.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/resource.h> #include <qaction.h> #include <qimage.h> #include <qfile.h> #include <qdir.h> #include <qlayout.h> #include <qlabel.h> #include <qlist.h> #include <qlistbox.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <qlistview.h> #include <qpoint.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qregexp.h> //#include <qtimer.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include <stdlib.h> #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 extern AudioWidget *audioUI; extern VideoWidget *videoUI; extern MediaPlayerState *mediaPlayerState; // class myFileSelector { // }; class PlayListWidgetPrivate { public: QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; QFrame *playListFrame; FileSelector *files; PlayListSelection *selectedFiles; bool setDocumentUsed; DocLnk *current; }; class ToolButton : public QToolButton { public: @@ -1032,35 +1044,64 @@ void PlayListWidget::openFile() { if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") filename += "/"; lnk.setFile(filename); //sets File property lnk.setType("audio/x-mpegurl"); lnk.setExec("opieplayer"); lnk.setIcon("opieplayer/MPEGPlayer"); if(!lnk.writeLink()) qDebug("Writing doclink did not work"); d->selectedFiles->addToSelection( lnk); // if(fileDlg2) // delete fileDlg2; } if(fileDlg) delete fileDlg; } void PlayListWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_F9: //activity - if(audioUI->isHidden()) - audioUI->showMaximized(); +// if(audioUI->isHidden()) +// audioUI->showMaximized(); break; case Key_F10: //contacts - if( videoUI->isHidden()) - videoUI->showMaximized(); - +// if( videoUI->isHidden()) +// videoUI->showMaximized(); + break; + case Key_F11: //menu + break; + case Key_F12: //home +// doBlank(); + break; + case Key_F13: //mail +// doUnblank(); break; } } + +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 +} diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 16b9905..f22770f 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -36,60 +36,64 @@ class QListView; class QPoint; class QAction; class QLabel; class PlayListWidget : public QMainWindow { Q_OBJECT public: PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); ~PlayListWidget(); QTabWidget * tabWidget; QAction *fullScreenButton, *scaleButton; DocLnkSet files; DocLnkSet vFiles; QListView *audioView, *videoView, *playlistView; QLabel *libString; bool fromSetDocument; bool insanityBool; QString setDocFileRef; // retrieve the current playlist entry (media file link) const DocLnk *current(); void useSelectedDocument(); /* QTimer * menuTimer; */ FileSelector* playLists; QPushButton *tbDeletePlaylist; + int fd; public slots: bool first(); bool last(); bool next(); bool prev(); /* void setFullScreen(); */ /* void setScaled(); */ protected: /* void contentsMousePressEvent( QMouseEvent * e ); */ /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ void keyReleaseEvent( QKeyEvent *e); private: + void doBlank(); + void doUnblank(); + void initializeStates(); void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; PlayListWidgetPrivate *d; // Private implementation data void populateAudioView(); void populateVideoView(); private slots: void openFile(); void setDocument( const QString& fileref ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void setActiveWindow(); // need to handle this to show the right view void setPlaylist( bool ); // Show/Hide the playlist void setView( char ); void clearList(); void addAllToList(); void addAllMusicToList(); void addAllVideoToList(); void saveList(); // Save the playlist void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); void btnPlay(bool); void deletePlaylist(); diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index d0cb764..3bce996 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp @@ -411,49 +411,49 @@ bool VideoWidget::playVideo() { scaledWidth = w; scaledHeight = h; if ( result ) { p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); } } return result; } void VideoWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts - hide(); +// hide(); break; case Key_F11: //menu break; case Key_F12: //home break; case Key_F13: //mail break; case Key_Space: { if(mediaPlayerState->playing()) { mediaPlayerState->setPlaying(FALSE); } else { mediaPlayerState->setPlaying(TRUE); } } break; case Key_Down: // toggleButton(6); // emit lessClicked(); // emit lessReleased(); // toggleButton(6); break; case Key_Up: // toggleButton(5); // emit moreClicked(); |