author | llornkcor <llornkcor> | 2002-09-04 23:38:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-04 23:38:09 (UTC) |
commit | 3f2a74813b552c6f7a4450ec6294bbbcc5b811c5 (patch) (side-by-side diff) | |
tree | a29f6d3436365b13b71615052cf08817225d0d78 /noncore/multimedia/opieplayer2/mediaplayer.cpp | |
parent | 95d24f601f7845e49092068ad358030024fa6097 (diff) | |
download | opie-3f2a74813b552c6f7a4450ec6294bbbcc5b811c5.zip opie-3f2a74813b552c6f7a4450ec6294bbbcc5b811c5.tar.gz opie-3f2a74813b552c6f7a4450ec6294bbbcc5b811c5.tar.bz2 |
change playing in file lists. no loop mode
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 100 |
1 files changed, 65 insertions, 35 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index bf2acc8..553e3c1 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -5,2 +5,3 @@ #include <qpe/qcopenvelope_qws.h> +#include <qfileinfo.h> @@ -77,4 +78,4 @@ void MediaPlayer::pauseCheck( bool b ) { void MediaPlayer::play() { - mediaPlayerState->setPlaying( FALSE ); - mediaPlayerState->setPlaying( TRUE ); + mediaPlayerState->setPlaying( FALSE ); + mediaPlayerState->setPlaying( TRUE ); } @@ -86,26 +87,43 @@ void MediaPlayer::setPlaying( bool play ) { - if ( mediaPlayerState->paused() ) { - mediaPlayerState->setPaused( FALSE ); - return; - } - - const DocLnk *playListCurrent = playList->current(); - if ( playListCurrent != NULL ) { - currentFile = playListCurrent; + if ( mediaPlayerState->paused() ) { + mediaPlayerState->setPaused( FALSE ); + return; } - xineControl->play( currentFile->file() ); - - long seconds = mediaPlayerState->length();// - QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); - qDebug(time); - - QString tickerText; - if( currentFile->file().left(4) == "http" ) - tickerText= tr( " File: " ) + currentFile->name(); - else - tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; - - audioUI->setTickerText( currentFile->file( ) ); + QString tickerText, time, fileName; + if( playList->whichList() == 0 ) { //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 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->looping(); + if(l) + mediaPlayerState->setLooping( false ); + r = mediaPlayerState->shuffled(); + 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(); + } + if( fileName.left(4) == "http" ) + tickerText= tr( " File: " ) + fileName; + else + tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time; + audioUI->setTickerText( tickerText ); } @@ -114,10 +132,12 @@ void MediaPlayer::setPlaying( bool play ) { void MediaPlayer::prev() { - if ( playList->prev() ) { - play(); - } else if ( mediaPlayerState->looping() ) { - if ( playList->last() ) { + if(playList->whichList() == 0) { //if using the playlist + if ( playList->prev() ) { play(); + } else if ( mediaPlayerState->looping() ) { + if ( playList->last() ) { + play(); + } + } else { + mediaPlayerState->setList(); } - } else { - mediaPlayerState->setList(); } @@ -127,11 +147,21 @@ void MediaPlayer::prev() { void MediaPlayer::next() { - if ( playList->next() ) { - play(); - } else if ( mediaPlayerState->looping() ) { - if ( playList->first() ) { + + if(playList->whichList() == 0) { //if using the playlist + if ( playList->next() ) { play(); + } else if ( mediaPlayerState->looping() ) { + if ( playList->first() ) { + play(); + } + } else { + mediaPlayerState->setList(); } - } else { - mediaPlayerState->setList(); + } else { //if playing from file list, let's just stop + qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); + mediaPlayerState->setPlaying(false); + mediaPlayerState->setView('l'); + if(l) mediaPlayerState->setLooping(l); + if(r) mediaPlayerState->setShuffled(r); } + qApp->processEvents(); } |