author | simon <simon> | 2002-12-02 17:27:32 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 17:27:32 (UTC) |
commit | 2f2f6cfbc31e0144060588b26814301ce99ebd39 (patch) (unidiff) | |
tree | 9ca13234ce515afc57b2a11b5b4f9c2144a6b038 /noncore/multimedia | |
parent | 28f9d0587b2ee6a6a9467f658567a45ab7e95b94 (diff) | |
download | opie-2f2f6cfbc31e0144060588b26814301ce99ebd39.zip opie-2f2f6cfbc31e0144060588b26814301ce99ebd39.tar.gz opie-2f2f6cfbc31e0144060588b26814301ce99ebd39.tar.bz2 |
- as MediaPlayerState::isUsingPlaylist() always returns true we can remove
it and simplify some code in the playlistwidget due to that
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 92 |
3 files changed, 35 insertions, 61 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 43040c2..586870c 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -68,5 +68,3 @@ void MediaPlayerState::readConfig( Config& cfg ) { | |||
68 | shuffled = cfg.readBoolEntry( "Shuffle" ); | 68 | shuffled = cfg.readBoolEntry( "Shuffle" ); |
69 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | ||
70 | videoGamma = cfg.readNumEntry( "VideoGamma" ); | 69 | videoGamma = cfg.readNumEntry( "VideoGamma" ); |
71 | usePlaylist = TRUE; | ||
72 | playing = FALSE; | 70 | playing = FALSE; |
@@ -86,3 +84,2 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
86 | cfg.writeEntry( "Shuffle", shuffled ); | 84 | cfg.writeEntry( "Shuffle", shuffled ); |
87 | cfg.writeEntry( "UsePlayList", usePlaylist ); | ||
88 | cfg.writeEntry( "VideoGamma", videoGamma ); | 85 | cfg.writeEntry( "VideoGamma", videoGamma ); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 7a80ad8..fc4e6cb 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -58,3 +58,2 @@ public: | |||
58 | bool isShuffled() const { return shuffled; } | 58 | bool isShuffled() const { return shuffled; } |
59 | bool isUsingPlaylist() const { return usePlaylist; } | ||
60 | bool isPaused() const { return paused; } | 59 | bool isPaused() const { return paused; } |
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 ) { | |||
207 | d->setDocumentUsed = FALSE; | 207 | d->setDocumentUsed = FALSE; |
208 | if ( mediaPlayerState->isUsingPlaylist() ) { | 208 | if( QFileInfo( lnk.file() ).exists() || |
209 | if( QFileInfo( lnk.file() ).exists() || | 209 | lnk.file().left(4) == "http" ) { |
210 | lnk.file().left(4) == "http" ) { | 210 | d->selectedFiles->addToSelection( lnk ); |
211 | d->selectedFiles->addToSelection( lnk ); | ||
212 | } | ||
213 | // writeCurrentM3u(); | ||
214 | } | 211 | } |
215 | else | 212 | // writeCurrentM3u(); |
216 | mediaPlayerState->setPlaying( TRUE ); | ||
217 | } | 213 | } |
@@ -424,7 +420,3 @@ const DocLnk *PlayListWidget::current() const { // this is fugly | |||
424 | 420 | ||
425 | // qDebug("playlist"); | 421 | return d->selectedFiles->current(); |
426 | if ( mediaPlayerState->isUsingPlaylist() ) | ||
427 | return d->selectedFiles->current(); | ||
428 | |||
429 | assert( false ); | ||
430 | } | 422 | } |
@@ -433,28 +425,24 @@ const DocLnk *PlayListWidget::current() const { // this is fugly | |||
433 | bool PlayListWidget::prev() { | 425 | bool PlayListWidget::prev() { |
434 | if ( mediaPlayerState->isUsingPlaylist() ) { | 426 | if ( mediaPlayerState->isShuffled() ) { |
435 | if ( mediaPlayerState->isShuffled() ) { | 427 | const DocLnk *cur = current(); |
436 | const DocLnk *cur = current(); | 428 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
437 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 429 | for ( int i = 0; i < j; i++ ) { |
438 | for ( int i = 0; i < j; i++ ) { | 430 | if ( !d->selectedFiles->next() ) |
439 | if ( !d->selectedFiles->next() ) | 431 | d->selectedFiles->first(); |
440 | d->selectedFiles->first(); | 432 | } |
433 | if ( cur == current() ) | ||
434 | if ( !d->selectedFiles->next() ) { | ||
435 | d->selectedFiles->first(); | ||
441 | } | 436 | } |
442 | if ( cur == current() ) | 437 | return TRUE; |
443 | if ( !d->selectedFiles->next() ) { | 438 | } else { |
444 | d->selectedFiles->first(); | 439 | if ( !d->selectedFiles->prev() ) { |
445 | } | 440 | if ( mediaPlayerState->isLooping() ) { |
446 | return TRUE; | 441 | return d->selectedFiles->last(); |
447 | } else { | 442 | } else { |
448 | if ( !d->selectedFiles->prev() ) { | 443 | return FALSE; |
449 | if ( mediaPlayerState->isLooping() ) { | ||
450 | return d->selectedFiles->last(); | ||
451 | } else { | ||
452 | return FALSE; | ||
453 | } | ||
454 | } | 444 | } |
455 | return TRUE; | ||
456 | } | 445 | } |
457 | } else { | 446 | return TRUE; |
458 | return mediaPlayerState->isLooping(); | 447 | } |
459 | } | ||
460 | } | 448 | } |
@@ -464,17 +452,13 @@ bool PlayListWidget::next() { | |||
464 | //qDebug("<<<<<<<<<<<<next()"); | 452 | //qDebug("<<<<<<<<<<<<next()"); |
465 | if ( mediaPlayerState->isUsingPlaylist() ) { | 453 | if ( mediaPlayerState->isShuffled() ) { |
466 | if ( mediaPlayerState->isShuffled() ) { | 454 | return prev(); |
467 | return prev(); | 455 | } else { |
468 | } else { | 456 | if ( !d->selectedFiles->next() ) { |
469 | if ( !d->selectedFiles->next() ) { | 457 | if ( mediaPlayerState->isLooping() ) { |
470 | if ( mediaPlayerState->isLooping() ) { | 458 | return d->selectedFiles->first(); |
471 | return d->selectedFiles->first(); | 459 | } else { |
472 | } else { | 460 | return FALSE; |
473 | return FALSE; | ||
474 | } | ||
475 | } | 461 | } |
476 | return TRUE; | ||
477 | } | 462 | } |
478 | } else { | 463 | return TRUE; |
479 | return mediaPlayerState->isLooping(); | ||
480 | } | 464 | } |
@@ -484,6 +468,3 @@ bool PlayListWidget::next() { | |||
484 | bool PlayListWidget::first() { | 468 | bool PlayListWidget::first() { |
485 | if ( mediaPlayerState->isUsingPlaylist() ) | 469 | return d->selectedFiles->first(); |
486 | return d->selectedFiles->first(); | ||
487 | else | ||
488 | return mediaPlayerState->isLooping(); | ||
489 | } | 470 | } |
@@ -492,6 +473,3 @@ bool PlayListWidget::first() { | |||
492 | bool PlayListWidget::last() { | 473 | bool PlayListWidget::last() { |
493 | if ( mediaPlayerState->isUsingPlaylist() ) | 474 | return d->selectedFiles->last(); |
494 | return d->selectedFiles->last(); | ||
495 | else | ||
496 | return mediaPlayerState->isLooping(); | ||
497 | } | 475 | } |