Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 92 |
1 files changed, 35 insertions, 57 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 5b277cc..f53def6 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -207,11 +207,7 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { d->setDocumentUsed = FALSE; - if ( mediaPlayerState->isUsingPlaylist() ) { - if( QFileInfo( lnk.file() ).exists() || - lnk.file().left(4) == "http" ) { - d->selectedFiles->addToSelection( lnk ); - } -// writeCurrentM3u(); + if( QFileInfo( lnk.file() ).exists() || + lnk.file().left(4) == "http" ) { + d->selectedFiles->addToSelection( lnk ); } - else - mediaPlayerState->setPlaying( TRUE ); +// writeCurrentM3u(); } @@ -424,7 +420,3 @@ const DocLnk *PlayListWidget::current() const { // this is fugly -// qDebug("playlist"); - if ( mediaPlayerState->isUsingPlaylist() ) - return d->selectedFiles->current(); - - assert( false ); + return d->selectedFiles->current(); } @@ -433,28 +425,24 @@ const DocLnk *PlayListWidget::current() const { // this is fugly bool PlayListWidget::prev() { - if ( mediaPlayerState->isUsingPlaylist() ) { - if ( mediaPlayerState->isShuffled() ) { - const DocLnk *cur = current(); - int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); - for ( int i = 0; i < j; i++ ) { - if ( !d->selectedFiles->next() ) - d->selectedFiles->first(); + if ( mediaPlayerState->isShuffled() ) { + const DocLnk *cur = current(); + int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); + for ( int i = 0; i < j; i++ ) { + if ( !d->selectedFiles->next() ) + d->selectedFiles->first(); + } + if ( cur == current() ) + if ( !d->selectedFiles->next() ) { + d->selectedFiles->first(); } - if ( cur == current() ) - if ( !d->selectedFiles->next() ) { - d->selectedFiles->first(); - } - return TRUE; - } else { - if ( !d->selectedFiles->prev() ) { - if ( mediaPlayerState->isLooping() ) { - return d->selectedFiles->last(); - } else { - return FALSE; - } + return TRUE; + } else { + if ( !d->selectedFiles->prev() ) { + if ( mediaPlayerState->isLooping() ) { + return d->selectedFiles->last(); + } else { + return FALSE; } - return TRUE; } - } else { - return mediaPlayerState->isLooping(); - } + return TRUE; + } } @@ -464,17 +452,13 @@ bool PlayListWidget::next() { //qDebug("<<<<<<<<<<<<next()"); - if ( mediaPlayerState->isUsingPlaylist() ) { - if ( mediaPlayerState->isShuffled() ) { - return prev(); - } else { - if ( !d->selectedFiles->next() ) { - if ( mediaPlayerState->isLooping() ) { - return d->selectedFiles->first(); - } else { - return FALSE; - } + if ( mediaPlayerState->isShuffled() ) { + return prev(); + } else { + if ( !d->selectedFiles->next() ) { + if ( mediaPlayerState->isLooping() ) { + return d->selectedFiles->first(); + } else { + return FALSE; } - return TRUE; } - } else { - return mediaPlayerState->isLooping(); + return TRUE; } @@ -484,6 +468,3 @@ bool PlayListWidget::next() { bool PlayListWidget::first() { - if ( mediaPlayerState->isUsingPlaylist() ) - return d->selectedFiles->first(); - else - return mediaPlayerState->isLooping(); + return d->selectedFiles->first(); } @@ -492,6 +473,3 @@ bool PlayListWidget::first() { bool PlayListWidget::last() { - if ( mediaPlayerState->isUsingPlaylist() ) - return d->selectedFiles->last(); - else - return mediaPlayerState->isLooping(); + return d->selectedFiles->last(); } |