-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 0764c01..809d5ac 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -466,60 +466,61 @@ const DocLnk *PlayListWidget::current() { // this is fugly // QListIterator<DocLnk> dit( files.children() ); // for ( ; dit.current(); ++dit ) { // if(dit.current()->linkFile() == setDocFileRef) { // qDebug(setDocFileRef); // return dit; // } // } // } else -// qDebug("current"); -// switch (tabWidget->currentPageIndex()) { -// case 0: //playlist -// { -// qDebug("playlist"); - if ( mediaPlayerState->playlist() ) { - return d->selectedFiles->current(); - } - else if ( d->setDocumentUsed && d->current ) { - return d->current; - } else { - return d->files->selected(); - } -// } -// break; -// case 1://audio -// { -// qDebug("audioView"); -// Global::findDocuments(&files, "audio/*"); -// QListIterator<DocLnk> dit( files.children() ); -// for ( ; dit.current(); ++dit ) { -// if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { -// qDebug("here"); -// insanityBool=TRUE; -// return dit; -// } -// } -// } -// break; -// case 2: // video -// { -// qDebug("videoView"); -// Global::findDocuments(&vFiles, "video/*"); -// QListIterator<DocLnk> Vdit( vFiles.children() ); -// for ( ; Vdit.current(); ++Vdit ) { -// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { -// insanityBool=TRUE; -// return Vdit; -// } -// } -// } -// break; -// }; -// return 0; + + + switch (tabWidget->currentPageIndex()) { + case 0: //playlist + { + qDebug("playlist"); + if ( mediaPlayerState->playlist() ) { + return d->selectedFiles->current(); + } + else if ( d->setDocumentUsed && d->current ) { + return d->current; + } else { + return d->files->selected(); + } + } + break; + case 1://audio + { + qDebug("audioView"); +// Global::findDocuments(&files, "audio/*"); + QListIterator<DocLnk> dit( files.children() ); + for ( ; dit.current(); ++dit ) { + if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { + qDebug("here"); + insanityBool=TRUE; + return dit; + } + } + } + break; + case 2: // video + { + qDebug("videoView"); +// Global::findDocuments(&vFiles, "video/*"); + QListIterator<DocLnk> Vdit( vFiles.children() ); + for ( ; Vdit.current(); ++Vdit ) { + if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { + insanityBool=TRUE; + return Vdit; + } + } + } + break; + }; + return 0; } bool PlayListWidget::prev() { if ( mediaPlayerState->playlist() ) { if ( mediaPlayerState->shuffled() ) { const DocLnk *cur = current(); int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); for ( int i = 0; i < j; i++ ) { @@ -789,34 +790,31 @@ void PlayListWidget::btnPlay(bool b) { { mediaPlayerState->setPlaying(b); } break; case 1: { addToSelection( audioView->selectedItem() ); mediaPlayerState->setPlaying(b); -// qApp->processEvents(); d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(1); - audioView->clearSelection(); -// d->selectedFiles->unSelect(); -// mediaPlayerState->setPlaying(FALSE); + d->selectedFiles->unSelect(); +// audioView->clearSelection(); } break; case 2: { addToSelection( videoView->selectedItem() ); mediaPlayerState->setPlaying(b); qApp->processEvents(); d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(2); - videoView->clearSelection(); -// d->selectedFiles->unSelect(); -// mediaPlayerState->setPlaying(FALSE); + d->selectedFiles->unSelect(); +// videoView->clearSelection(); } break; }; } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), |