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.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 9f51006..1e6bc4d 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,141 +1,141 @@
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qfileinfo.h>
#include "mediaplayer.h"
#include "playlistwidget.h"
#include "audiowidget.h"
#include "videowidget.h"
#include "volumecontrol.h"
#include "lib.h"
#include "mediaplayerstate.h"
// for setBacklight()
#include <linux/fb.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#define FBIOBLANK 0x4611
MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
: QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
m_audioUI = 0;
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 ) ) );
+ 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( 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( &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() );
m_skinLoader->schedule( VideoWidget::guiInfo() );
m_skinLoader->start();
}
MediaPlayer::~MediaPlayer() {
// this shold never happen, but one never knows...
if ( xine ) {
xine->ensureInitialized();
delete xine;
}
delete m_xineControl;
delete m_audioUI;
delete m_videoUI;
delete volControl;
}
void MediaPlayer::pauseCheck( bool b ) {
if ( b && !mediaPlayerState.isPlaying() ) {
mediaPlayerState.setPaused( FALSE );
}
}
void MediaPlayer::play() {
mediaPlayerState.setPlaying( FALSE );
mediaPlayerState.setPlaying( TRUE );
}
void MediaPlayer::setPlaying( bool play ) {
if ( !play ) {
return;
}
if ( mediaPlayerState.isPaused() ) {
mediaPlayerState.setPaused( FALSE );
return;
}
QString tickerText, time, fileName;
if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
//if playing in file list.. play in a different way
// random and looping settings enabled causes problems here,
// since there is no selected file in the playlist, but a selected file in the file list,
// so we remember and shutoff
l = mediaPlayerState.isLooping();
if(l) {
mediaPlayerState.setLooping( false );
}
r = mediaPlayerState.isShuffled();
mediaPlayerState.setShuffled( false );
}
PlayListWidget::Entry playListEntry = playList.currentEntry();
fileName = playListEntry.name;
xineControl()->play( playListEntry.file );
long seconds = mediaPlayerState.length();
time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
if( fileName.left(4) == "http" ) {
fileName = QFileInfo( fileName ).baseName();
if ( xineControl()->getMetaInfo().isEmpty() ) {
tickerText = tr( " File: " ) + fileName;
} else {
tickerText = xineControl()->getMetaInfo();
}
} else {
if ( xineControl()->getMetaInfo().isEmpty() ) {
tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
} else {
tickerText = xineControl()->getMetaInfo() + " Length: " + time + " ";
}
}
audioUI()->setTickerText( tickerText );
}
void MediaPlayer::prev() {
if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
if ( playList.prev() ) {
play();
} else if ( mediaPlayerState.isLooping() ) {
if ( playList.last() ) {
play();
}
} else {
mediaPlayerState.setList();
}