Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 92da73b..c9ae225 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -534,45 +534,25 @@ void PlayListWidget::setPlaylist( bool shown ) { | |||
534 | 534 | ||
535 | 535 | ||
536 | void PlayListWidget::addSelected() { | 536 | void PlayListWidget::addSelected() { |
537 | qDebug("addSelected"); | 537 | assert( inFileListMode() ); |
538 | DocLnk lnk; | ||
539 | QString filename; | ||
540 | switch (whichList()) { | ||
541 | 538 | ||
542 | case 0: //playlist | 539 | QListView *fileListView = currentFileListView(); |
543 | return; | 540 | QListViewItemIterator it( fileListView ); |
544 | break; | 541 | for ( ; it.current(); ++it ) |
545 | case 1: { //audio | ||
546 | QListViewItemIterator it( audioView ); | ||
547 | for ( ; it.current(); ++it ) { | ||
548 | if ( it.current()->isSelected() ) { | 542 | if ( it.current()->isSelected() ) { |
549 | filename=it.current()->text(3); | 543 | QString filename = it.current()->text(3); |
550 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 544 | |
551 | lnk.setFile( filename ); //sets file name | 545 | DocLnk lnk; |
552 | d->selectedFiles->addToSelection( lnk); | 546 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name |
553 | 547 | lnk.setFile( filename ); //sets file name | |
554 | } | 548 | |
555 | } | 549 | d->selectedFiles->addToSelection( lnk ); |
556 | audioView->clearSelection(); | ||
557 | } | ||
558 | break; | ||
559 | |||
560 | case 2: { // video | ||
561 | QListViewItemIterator it( videoView ); | ||
562 | for ( ; it.current(); ++it ) { | ||
563 | if ( it.current()->isSelected() ) { | ||
564 | filename=it.current()->text(3); | ||
565 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
566 | lnk.setFile( filename ); //sets file name | ||
567 | d->selectedFiles->addToSelection( lnk); | ||
568 | } | 550 | } |
569 | } | 551 | |
570 | videoView->clearSelection(); | 552 | fileListView->clearSelection(); |
571 | } | 553 | |
572 | break; | 554 | tabWidget->setCurrentPage( 0 ); |
573 | }; | 555 | writeCurrentM3u(); |
574 | tabWidget->setCurrentPage(0); | ||
575 | writeCurrentM3u(); | ||
576 | } | 556 | } |
577 | 557 | ||
578 | 558 | ||
@@ -799,6 +779,12 @@ QListView *PlayListWidget::currentFileListView() const | |||
799 | return 0; | 779 | return 0; |
800 | } | 780 | } |
801 | 781 | ||
782 | bool PlayListWidget::inFileListMode() const | ||
783 | { | ||
784 | TabType tab = currentTab(); | ||
785 | return tab == AudioFiles || tab == VideoFiles; | ||
786 | } | ||
787 | |||
802 | void PlayListWidget::openFile() { | 788 | void PlayListWidget::openFile() { |
803 | // http://66.28.164.33:2080 | 789 | // http://66.28.164.33:2080 |
804 | // http://somafm.com/star0242.m3u | 790 | // http://somafm.com/star0242.m3u |