author | simon <simon> | 2002-12-02 14:47:45 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 14:47:45 (UTC) |
commit | 3644bde7c86013c699978446c29ec6502220e29c (patch) (side-by-side diff) | |
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 | 20 |
1 files changed, 7 insertions, 13 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 @@ -380,112 +380,107 @@ void PlayListWidget::addAllVideoToList() { for ( ; dit.current(); ++dit ) { if( QFileInfo( dit.current()->file() ).exists() ) { d->selectedFiles->addToSelection( **dit ); } } */ tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::setDocument( const QString& fileref ) { // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); fromSetDocument = TRUE; if ( fileref.isNull() ) { QMessageBox::warning( this, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); return; } clearList(); if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u readm3u( fileref ); } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { readm3u( DocLnk( fileref).file() ); } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls readPls( fileref ); } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { readPls( DocLnk( fileref).file() ); } else { clearList(); addToSelection( DocLnk( fileref ) ); writeCurrentM3u(); d->setDocumentUsed = TRUE; mediaPlayerState->setPlaying( FALSE ); mediaPlayerState->setPlaying( TRUE ); } } void PlayListWidget::useSelectedDocument() { d->setDocumentUsed = FALSE; } const DocLnk *PlayListWidget::current() { // this is fugly - switch ( whichList() ) { - case 0: //playlist - { + assert( currentTab() == CurrentPlayList ); + // qDebug("playlist"); if ( mediaPlayerState->isUsingPlaylist() ) { return d->selectedFiles->current(); } else if ( d->setDocumentUsed && d->current ) { return d->current; } else { return &(d->files->selectedDocument()); } } - break; - }; - return 0; -} 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 ( 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 { return mediaPlayerState->isLooping(); } } 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; } } return TRUE; } } else { @@ -1113,58 +1108,57 @@ void PlayListWidget::populateSkinsMenu() { const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( ( fi = it.current() ) ) { skinName = fi->fileName(); // qDebug( fi->fileName() ); if( skinName != "." && skinName != ".." && skinName !="CVS" ) { item = skinsMenu->insertItem( fi->fileName() ) ; } if( skinName == "default" ) { defaultSkinIndex = item; } if( skinName == skin ) { skinsMenu->setItemChecked( item, TRUE ); } ++it; } } void PlayListWidget::skinsMenuActivated( int item ) { for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { skinsMenu->setItemChecked( i, FALSE ); } skinsMenu->setItemChecked( item, TRUE ); Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); cfg.writeEntry("Skin", skinsMenu->text( item ) ); QMessageBox::warning( this, tr( "OpiePlayer" ), tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); } int PlayListWidget::whichList() const { return tabWidget->currentPageIndex(); } PlayListWidget::TabType PlayListWidget::currentTab() const { static const TabType indexToTabType[ NumTabTypes ] = { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; int index = tabWidget->currentPageIndex(); assert( index < NumTabTypes && index >= 0 ); return indexToTabType[ index ]; } QString PlayListWidget::currentFileListPathName() const { - switch (whichList()) { - case 1: + switch (currentTab()) { + case AudioFiles: return audioView->currentItem()->text(3); - break; - case 2: + case VideoFiles: return videoView->currentItem()->text(3); - break; + default: assert( false ); }; - return ""; + return QString::null; } |