-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 0825eed..60eb0c8 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -507,47 +507,54 @@ void PlayListWidget::playIt( QListViewItem *it) { | |||
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | void PlayListWidget::addToSelection( QListViewItem *it) { | 510 | void PlayListWidget::addToSelection( QListViewItem *it) { |
511 | d->setDocumentUsed = FALSE; | 511 | d->setDocumentUsed = FALSE; |
512 | 512 | ||
513 | if(it) { | 513 | if(it) { |
514 | switch ( whichList()) { | 514 | switch ( whichList()) { |
515 | case 1: { | 515 | case 1: { |
516 | QListIterator<DocLnk> dit( files.children() ); | 516 | QListIterator<DocLnk> dit( files.children() ); |
517 | for ( ; dit.current(); ++dit ) { | 517 | for ( ; dit.current(); ++dit ) { |
518 | if( dit.current()->name() == it->text(0)) { | 518 | if( dit.current()->name() == it->text(0)) { |
519 | if(QFileInfo( dit.current()->file()).exists()) | 519 | if(QFileInfo( dit.current()->file()).exists()) { |
520 | d->selectedFiles->addToSelection( **dit ); | 520 | d->selectedFiles->addToSelection( **dit ); |
521 | qDebug("blah "+ dit.current()->name()); | ||
522 | d->selectedFiles->setSelectedItem( dit.current()->name()); | ||
523 | } | ||
521 | } | 524 | } |
522 | } | 525 | } |
523 | writeCurrentM3u(); | 526 | writeCurrentM3u(); |
524 | } | 527 | } |
525 | break; | 528 | break; |
526 | case 2: { | 529 | case 2: { |
527 | QListIterator<DocLnk> dit( vFiles.children() ); | 530 | QListIterator<DocLnk> dit( vFiles.children() ); |
528 | for ( ; dit.current(); ++dit ) { | 531 | for ( ; dit.current(); ++dit ) { |
529 | if( dit.current()->name() == it->text(0)) { | 532 | if( dit.current()->name() == it->text(0)) { |
530 | if( QFileInfo( dit.current()->file()).exists() ) | 533 | if( QFileInfo( dit.current()->file()).exists() ) { |
531 | d->selectedFiles->addToSelection( **dit ); | 534 | d->selectedFiles->addToSelection( **dit ); |
535 | qDebug("blah "+ dit.current()->name()); | ||
536 | d->selectedFiles->setSelectedItem( dit.current()->name()); | ||
537 | } | ||
532 | } | 538 | } |
533 | } | 539 | } |
534 | writeCurrentM3u(); | 540 | writeCurrentM3u(); |
535 | 541 | ||
536 | } | 542 | } |
537 | break; | 543 | break; |
538 | case 0: | 544 | case 0: |
539 | break; | 545 | break; |
540 | }; | 546 | }; |
541 | tabWidget->setCurrentPage(0); | 547 | tabWidget->setCurrentPage(0); |
548 | |||
542 | } | 549 | } |
543 | } | 550 | } |
544 | 551 | ||
545 | 552 | ||
546 | void PlayListWidget::tabChanged(QWidget *) { | 553 | void PlayListWidget::tabChanged(QWidget *) { |
547 | 554 | ||
548 | switch ( whichList()) { | 555 | switch ( whichList()) { |
549 | case 0: | 556 | case 0: |
550 | { | 557 | { |
551 | if( !tbDeletePlaylist->isHidden() ) { | 558 | if( !tbDeletePlaylist->isHidden() ) { |
552 | tbDeletePlaylist->hide(); | 559 | tbDeletePlaylist->hide(); |
553 | } | 560 | } |
@@ -736,35 +743,37 @@ void PlayListWidget::openFile() { | |||
736 | } else{ | 743 | } else{ |
737 | m3uFile=filename; | 744 | m3uFile=filename; |
738 | } | 745 | } |
739 | 746 | ||
740 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 747 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
741 | lnk.setName( filename ); //sets name | 748 | lnk.setName( filename ); //sets name |
742 | lnk.setFile( filename ); //sets file name | 749 | lnk.setFile( filename ); //sets file name |
743 | 750 | ||
744 | // lnk.setIcon("opieplayer2/musicfile"); | 751 | // lnk.setIcon("opieplayer2/musicfile"); |
745 | 752 | ||
746 | d->selectedFiles->addToSelection( lnk ); | 753 | d->selectedFiles->addToSelection( lnk ); |
747 | writeCurrentM3u(); | 754 | writeCurrentM3u(); |
755 | d->selectedFiles->setSelectedItem( lnk->name()); | ||
748 | } | 756 | } |
749 | else if( filename.right( 3) == "m3u" ) { | 757 | else if( filename.right( 3) == "m3u" ) { |
750 | readm3u( filename ); | 758 | readm3u( filename ); |
751 | 759 | ||
752 | } else if( filename.right(3) == "pls" ) { | 760 | } else if( filename.right(3) == "pls" ) { |
753 | readPls( filename ); | 761 | readPls( filename ); |
754 | } else { | 762 | } else { |
755 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 763 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
756 | lnk.setFile( filename ); //sets file name | 764 | lnk.setFile( filename ); //sets file name |
757 | d->selectedFiles->addToSelection( lnk); | 765 | d->selectedFiles->addToSelection( lnk); |
758 | writeCurrentM3u(); | 766 | writeCurrentM3u(); |
767 | d->selectedFiles->setSelectedItem( lnk.name()); | ||
759 | } | 768 | } |
760 | } | 769 | } |
761 | 770 | ||
762 | if( fileDlg ) { | 771 | if( fileDlg ) { |
763 | delete fileDlg; | 772 | delete fileDlg; |
764 | } | 773 | } |
765 | } | 774 | } |
766 | 775 | ||
767 | /* | 776 | /* |
768 | reads m3u and shows files/urls to playlist widget */ | 777 | reads m3u and shows files/urls to playlist widget */ |
769 | void PlayListWidget::readm3u( const QString &filename ) { | 778 | void PlayListWidget::readm3u( const QString &filename ) { |
770 | qDebug( "read m3u filename " + filename ); | 779 | qDebug( "read m3u filename " + filename ); |
@@ -877,24 +886,25 @@ void PlayListWidget::writeCurrentM3u() { | |||
877 | 886 | ||
878 | do { | 887 | do { |
879 | qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 888 | qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
880 | m3uList->add( d->selectedFiles->current()->file() ); | 889 | m3uList->add( d->selectedFiles->current()->file() ); |
881 | } | 890 | } |
882 | while ( d->selectedFiles->next() ); | 891 | while ( d->selectedFiles->next() ); |
883 | qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 892 | qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
884 | m3uList->write(); | 893 | m3uList->write(); |
885 | m3uList->close(); | 894 | m3uList->close(); |
886 | 895 | ||
887 | if(m3uList) delete m3uList; | 896 | if(m3uList) delete m3uList; |
888 | } | 897 | } |
898 | |||
889 | } | 899 | } |
890 | 900 | ||
891 | /* | 901 | /* |
892 | writes current playlist to m3u file */ | 902 | writes current playlist to m3u file */ |
893 | void PlayListWidget::writem3u() { | 903 | void PlayListWidget::writem3u() { |
894 | InputDialog *fileDlg; | 904 | InputDialog *fileDlg; |
895 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 905 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
896 | fileDlg->exec(); | 906 | fileDlg->exec(); |
897 | QString name, filename, list; | 907 | QString name, filename, list; |
898 | Om3u *m3uList; | 908 | Om3u *m3uList; |
899 | 909 | ||
900 | if( fileDlg->result() == 1 ) { | 910 | if( fileDlg->result() == 1 ) { |