summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h15
4 files changed, 34 insertions, 25 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
@@ -35,3 +35,3 @@ extern MediaPlayerState *mediaPlayerState;
MediaPlayer::MediaPlayer( QObject *parent, const char *name )
- : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
+ : QObject( parent, name ), volumeDirection( 0 ) {
@@ -97,14 +97,3 @@ void MediaPlayer::setPlaying( bool play ) {
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
@@ -119,15 +108,13 @@ void MediaPlayer::setPlaying( bool play ) {
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() ) {
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 002311a..1e34c88 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -70,3 +70,2 @@ private:
int volumeDirection;
- const DocLnk *currentFile;
XineControl *xineControl;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index fd256b7..ce73252 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -426,3 +426,3 @@ void PlayListWidget::useSelectedDocument() {
-const DocLnk *PlayListWidget::current() { // this is fugly
+const DocLnk *PlayListWidget::current() const { // this is fugly
assert( currentTab() == CurrentPlayList );
@@ -1143,2 +1143,12 @@ PlayListWidget::TabType PlayListWidget::currentTab() const
+PlayListWidget::Entry PlayListWidget::currentEntry() const
+{
+ if ( currentTab() == CurrentPlayList ) {
+ const DocLnk *lnk = current();
+ return Entry( lnk->name(), lnk->file() );
+ }
+
+ return Entry( currentFileListPathName() );
+}
+
QString PlayListWidget::currentFileListPathName() const {
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 2e2ff89..511a192 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -60,2 +60,13 @@ public:
+ struct Entry
+ {
+ Entry( const QString &_name, const QString &_fileName )
+ : name( _name ), file( _fileName ) {}
+ Entry( const QString &_fileName )
+ : name( _fileName ), file( _fileName ) {}
+
+ QString name;
+ QString file;
+ };
+
PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
@@ -68,3 +79,3 @@ public:
// retrieve the current playlist entry (media file link)
- const DocLnk *current();
+ const DocLnk *current() const;
void useSelectedDocument();
@@ -73,2 +84,4 @@ public:
+ Entry currentEntry() const;
+
public slots: