summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp49
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp35
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h10
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
@@ -533,12 +533,13 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e)
break;
case Key_F11: //menu
break;
case Key_F12: //home
break;
case Key_F13: //mail
+ mediaPlayerState->toggleBlank();
break;
case Key_Space: {
if(mediaPlayerState->playing()) {
// toggleButton(1);
mediaPlayerState->setPlaying(FALSE);
// toggleButton(1);
@@ -576,13 +577,13 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e)
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 8dadf96..858b51f 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,10 +1,11 @@
#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>
@@ -13,47 +14,52 @@
#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;
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()) );
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;
}
@@ -68,13 +74,12 @@ void MediaPlayer::play() {
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
void MediaPlayer::setPlaying( bool play ) {
if ( !play ) {
- // mediaPlayerState->setPaused( FALSE );
return;
}
if ( mediaPlayerState->paused() ) {
mediaPlayerState->setPaused( FALSE );
return;
@@ -95,18 +100,12 @@ void MediaPlayer::setPlaying( bool play ) {
QString tickerText;
if( currentFile->file().left(4) == "http" )
tickerText= tr( " File: " ) + currentFile->name();
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( ) );
}
void MediaPlayer::prev() {
@@ -246,12 +245,30 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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 ) {
+ 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
case Key_Home:
break;
case Key_F9: //activity
@@ -259,25 +276,19 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
case Key_F10: //contacts
break;
case Key_F11: //menu
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
@@ -25,19 +25,20 @@ private slots:
void next();
void prev();
void startIncreasingVolume();
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;
VolumeControl *volControl;
};
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
@@ -112,21 +112,30 @@ void MediaPlayerState::setIsStreaming( bool b ) {
return;
}
isStreaming = b;
}
-void MediaPlayerState::setFullscreen( bool b ) {
+void MediaPlayerState::setBlank( bool b ) {
if ( isFullscreen == b ) {
return;
}
isFullscreen = b;
emit fullscreenToggled(b);
}
+void MediaPlayerState::setFullscreen( 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);
@@ -254,16 +263,19 @@ void MediaPlayerState::toggleShuffled() {
void MediaPlayerState::togglePlaylist() {
setPlaylist( !usePlaylist);
}
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
@@ -75,12 +75,13 @@ public slots:
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 setPrev();
void setNext();
void setList();
void setVideo();
void setAudio();
@@ -89,12 +90,13 @@ public slots:
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 );
@@ -103,20 +105,21 @@ signals:
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;
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,10 +1,8 @@
#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>
@@ -42,23 +40,12 @@
#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 MediaPlayerState *mediaPlayerState;
@@ -1007,13 +994,13 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
// if( videoUI->isHidden())
// videoUI->showMaximized();
break;
case Key_F11: //menu
break;
case Key_F12: //home
-// doBlank();
+// doBlank();
break;
case Key_F13: //mail
// doUnblank();
break;
case Key_Q: //add to playlist
qDebug("Add");
@@ -1076,33 +1063,13 @@ void PlayListWidget::keyPressEvent( QKeyEvent *)
// qDebug("Play");
// playSelected();
// 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
-}
void PlayListWidget::readm3u(const QString &filename) {
qDebug("m3u filename is "+filename);
QFile f(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
@@ -39,13 +39,13 @@ public:
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
/* QTimer * menuTimer; */
FileSelector* playLists;
QPushButton *tbDeletePlaylist;
- int fd, selected;
+ int selected;
public slots:
bool first();
bool last();
bool next();
bool prev();
/* void setFullScreen(); */
@@ -53,29 +53,27 @@ public slots:
protected:
/* void contentsMousePressEvent( QMouseEvent * e ); */
/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
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 &);
void initializeStates();
void readConfig( Config& cfg );
void writeConfig( Config& cfg ) const;
PlayListWidgetPrivate *d; // Private implementation data
void populateAudioView();
void populateVideoView();
private slots:
void populateSkinsMenu();
- void skinsMenuActivated(int);
+ void skinsMenuActivated(int);
void pmViewActivated(int);
void writem3u();
void scanForAudio();
void scanForVideo();
void openFile();
void setDocument( const QString& fileref );