author | simon <simon> | 2002-12-02 14:47:45 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 14:47:45 (UTC) |
commit | 3644bde7c86013c699978446c29ec6502220e29c (patch) (unidiff) | |
tree | b3c1df324e8f3051d0b54fdb3e5e7e4904fbde4a | |
parent | 46d64cdfe9a3d949e91ea6a72828405d03337225 (diff) | |
download | opie-3644bde7c86013c699978446c29ec6502220e29c.zip opie-3644bde7c86013c699978446c29ec6502220e29c.tar.gz opie-3644bde7c86013c699978446c29ec6502220e29c.tar.bz2 |
- more whichList usage removed
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 11a7b5c..a708cf6 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -416,39 +416,34 @@ void PlayListWidget::setDocument( const QString& fileref ) { | |||
416 | mediaPlayerState->setPlaying( FALSE ); | 416 | mediaPlayerState->setPlaying( FALSE ); |
417 | mediaPlayerState->setPlaying( TRUE ); | 417 | mediaPlayerState->setPlaying( TRUE ); |
418 | } | 418 | } |
419 | } | 419 | } |
420 | 420 | ||
421 | 421 | ||
422 | void PlayListWidget::useSelectedDocument() { | 422 | void PlayListWidget::useSelectedDocument() { |
423 | d->setDocumentUsed = FALSE; | 423 | d->setDocumentUsed = FALSE; |
424 | } | 424 | } |
425 | 425 | ||
426 | 426 | ||
427 | const DocLnk *PlayListWidget::current() { // this is fugly | 427 | const DocLnk *PlayListWidget::current() { // this is fugly |
428 | switch ( whichList() ) { | 428 | assert( currentTab() == CurrentPlayList ); |
429 | case 0: //playlist | 429 | |
430 | { | ||
431 | // qDebug("playlist"); | 430 | // qDebug("playlist"); |
432 | if ( mediaPlayerState->isUsingPlaylist() ) { | 431 | if ( mediaPlayerState->isUsingPlaylist() ) { |
433 | return d->selectedFiles->current(); | 432 | return d->selectedFiles->current(); |
434 | } else if ( d->setDocumentUsed && d->current ) { | 433 | } else if ( d->setDocumentUsed && d->current ) { |
435 | return d->current; | 434 | return d->current; |
436 | } else { | 435 | } else { |
437 | return &(d->files->selectedDocument()); | 436 | return &(d->files->selectedDocument()); |
438 | } | 437 | } |
439 | } | ||
440 | break; | ||
441 | }; | ||
442 | return 0; | ||
443 | } | 438 | } |
444 | 439 | ||
445 | 440 | ||
446 | bool PlayListWidget::prev() { | 441 | bool PlayListWidget::prev() { |
447 | if ( mediaPlayerState->isUsingPlaylist() ) { | 442 | if ( mediaPlayerState->isUsingPlaylist() ) { |
448 | if ( mediaPlayerState->isShuffled() ) { | 443 | if ( mediaPlayerState->isShuffled() ) { |
449 | const DocLnk *cur = current(); | 444 | const DocLnk *cur = current(); |
450 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 445 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
451 | for ( int i = 0; i < j; i++ ) { | 446 | for ( int i = 0; i < j; i++ ) { |
452 | if ( !d->selectedFiles->next() ) | 447 | if ( !d->selectedFiles->next() ) |
453 | d->selectedFiles->first(); | 448 | d->selectedFiles->first(); |
454 | } | 449 | } |
@@ -1149,22 +1144,21 @@ int PlayListWidget::whichList() const { | |||
1149 | PlayListWidget::TabType PlayListWidget::currentTab() const | 1144 | PlayListWidget::TabType PlayListWidget::currentTab() const |
1150 | { | 1145 | { |
1151 | static const TabType indexToTabType[ NumTabTypes ] = | 1146 | static const TabType indexToTabType[ NumTabTypes ] = |
1152 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 1147 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
1153 | 1148 | ||
1154 | int index = tabWidget->currentPageIndex(); | 1149 | int index = tabWidget->currentPageIndex(); |
1155 | assert( index < NumTabTypes && index >= 0 ); | 1150 | assert( index < NumTabTypes && index >= 0 ); |
1156 | 1151 | ||
1157 | return indexToTabType[ index ]; | 1152 | return indexToTabType[ index ]; |
1158 | } | 1153 | } |
1159 | 1154 | ||
1160 | QString PlayListWidget::currentFileListPathName() const { | 1155 | QString PlayListWidget::currentFileListPathName() const { |
1161 | switch (whichList()) { | 1156 | switch (currentTab()) { |
1162 | case 1: | 1157 | case AudioFiles: |
1163 | return audioView->currentItem()->text(3); | 1158 | return audioView->currentItem()->text(3); |
1164 | break; | 1159 | case VideoFiles: |
1165 | case 2: | ||
1166 | return videoView->currentItem()->text(3); | 1160 | return videoView->currentItem()->text(3); |
1167 | break; | 1161 | default: assert( false ); |
1168 | }; | 1162 | }; |
1169 | return ""; | 1163 | return QString::null; |
1170 | } | 1164 | } |