summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp50
1 files changed, 5 insertions, 45 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index e6afbd8..b8023ca 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,19 +1,20 @@
#include "mediaplayer.h"
#include "audiowidget.h"
#include "videowidget.h"
#include "volumecontrol.h"
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/odevice.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
/* QT */
#include <qfileinfo.h>
/* STD */
#include <linux/fb.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#define FBIOBLANK 0x4611
@@ -25,28 +26,24 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
m_videoUI = 0;
m_xineControl = 0;
xine = new XINE::Lib( XINE::Lib::InitializeInThread );
fd=-1;fl=-1;
playList.setCaption( tr( "OpiePlayer: Initializating" ) );
qApp->processEvents();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
-
-// What is pauseCheck good for? (Simon)
-// 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) ) );
volControl = new VolumeControl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
m_skinLoader = new SkinLoader;
m_skinLoader->schedule( AudioWidget::guiInfo() );
@@ -145,25 +142,25 @@ void MediaPlayer::next() {
if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
if ( playList.next() ) {
play();
} else if ( mediaPlayerState.isLooping() ) {
if ( playList.first() ) {
play();
}
} else {
mediaPlayerState.setList();
}
} else { //if playing from file list, let's just stop
- odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl;
+ odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl;
mediaPlayerState.setPlaying(false);
mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
if(l) mediaPlayerState.setLooping(l);
if(r) mediaPlayerState.setShuffled(r);
}
qApp->processEvents();
}
void MediaPlayer::startDecreasingVolume() {
volumeDirection = -1;
startTimer( 100 );
@@ -272,91 +269,54 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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 ) {
-#ifdef QT_QWS_DEVFS
- fd=open("/dev/fb/0",O_RDWR);
-#else
- fd=open("/dev/fb0",O_RDWR);
-#endif
-#ifdef QT_QWS_SL5XXX
- fl= open( "/dev/fl", O_RDWR );
-#endif
- if (fd != -1) {
- if ( b ) {
- odebug << "do blanking" << oendl;
-#ifdef QT_QWS_SL5XXX
- ioctl( fd, FBIOBLANK, 1 );
- if(fl !=-1) {
- ioctl( fl, 2 );
- ::close(fl);
- }
-#else
- ioctl( fd, FBIOBLANK, 3 );
-#endif
- isBlanked = TRUE;
- } else {
- odebug << "do unblanking" << oendl;
- ioctl( fd, FBIOBLANK, 0);
-#ifdef QT_QWS_SL5XXX
- if(fl != -1) {
- ioctl( fl, 1);
- ::close(fl);
- }
-#endif
- isBlanked = FALSE;
- }
- close( fd );
- } else {
- odebug << "<< /dev/fb0 could not be opened >>" << oendl;
- }
+ Opie::Core::ODevice::inst()->setDisplayStatus( b );
}
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
- odebug << "Blank here" << oendl;
+ odebug << "Blank here" << oendl;
// mediaPlayerState->toggleBlank();
break;
case Key_F13: //mail
- odebug << "Blank here" << oendl;
+ odebug << "Blank here" << oendl;
// mediaPlayerState->toggleBlank();
break;
}
}
void MediaPlayer::cleanUp() {// this happens on closing
Config cfg( "OpiePlayer" );
mediaPlayerState.writeConfig( cfg );
playList.writeDefaultPlaylist( );
-// QPEApplication::grabKeyboard();
-// QPEApplication::ungrabKeyboard();
}
void MediaPlayer::recreateAudioAndVideoWidgets() const
{
delete m_skinLoader;
delete m_xineControl;
delete m_audioUI;
delete m_videoUI;
m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );