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.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 6a38adc..74ab2e3 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -12,49 +12,49 @@
#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 ) {
+ : QObject( parent, name ), volumeDirection( 0 ) {
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( 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() ) );
@@ -74,83 +74,70 @@ MediaPlayer::~MediaPlayer() {
}
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 ) { //check for filelist
- const DocLnk *playListCurrent = playList->current();
- if ( playListCurrent != NULL ) {
- currentFile = playListCurrent;
- }
- xineControl->play( currentFile->file() );
- fileName = currentFile->name();
- long seconds = mediaPlayerState->length();//
- time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
- //qDebug(time);
-
- } else {
+ 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 );
+ }
- fileName = playList->currentFileListPathName();
- xineControl->play( fileName );
- long seconds = mediaPlayerState->length();
- time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
- //qDebug(time);
- if( fileName.left(4) != "http" ) {
- fileName = QFileInfo( fileName ).baseName();
- }
+ 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();
}