author | llornkcor <llornkcor> | 2003-01-19 23:35:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-01-19 23:35:26 (UTC) |
commit | 02090d2e63ad8398c0a8a9f1fb895a9c6e42514b (patch) (unidiff) | |
tree | ad318ac407d4963e3de2444b46663d403fe8ceee | |
parent | 512e600c777643230a032e89f7446b4099f54a86 (diff) | |
download | opie-02090d2e63ad8398c0a8a9f1fb895a9c6e42514b.zip opie-02090d2e63ad8398c0a8a9f1fb895a9c6e42514b.tar.gz opie-02090d2e63ad8398c0a8a9f1fb895a9c6e42514b.tar.bz2 |
add multiselection add to playlist
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 19c8056..3c5734e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -602,207 +602,221 @@ bool PlayListWidget::prev() { | |||
602 | if ( !d->selectedFiles->next() ) | 602 | if ( !d->selectedFiles->next() ) |
603 | d->selectedFiles->first(); | 603 | d->selectedFiles->first(); |
604 | return TRUE; | 604 | return TRUE; |
605 | } else { | 605 | } else { |
606 | if ( !d->selectedFiles->prev() ) { | 606 | if ( !d->selectedFiles->prev() ) { |
607 | if ( mediaPlayerState->looping() ) { | 607 | if ( mediaPlayerState->looping() ) { |
608 | return d->selectedFiles->last(); | 608 | return d->selectedFiles->last(); |
609 | } else { | 609 | } else { |
610 | return FALSE; | 610 | return FALSE; |
611 | } | 611 | } |
612 | } | 612 | } |
613 | return TRUE; | 613 | return TRUE; |
614 | } | 614 | } |
615 | } else { | 615 | } else { |
616 | return mediaPlayerState->looping(); | 616 | return mediaPlayerState->looping(); |
617 | } | 617 | } |
618 | } | 618 | } |
619 | 619 | ||
620 | 620 | ||
621 | bool PlayListWidget::next() { | 621 | bool PlayListWidget::next() { |
622 | if ( mediaPlayerState->playlist() ) { | 622 | if ( mediaPlayerState->playlist() ) { |
623 | if ( mediaPlayerState->shuffled() ) { | 623 | if ( mediaPlayerState->shuffled() ) { |
624 | return prev(); | 624 | return prev(); |
625 | } else { | 625 | } else { |
626 | if ( !d->selectedFiles->next() ) { | 626 | if ( !d->selectedFiles->next() ) { |
627 | if ( mediaPlayerState->looping() ) { | 627 | if ( mediaPlayerState->looping() ) { |
628 | return d->selectedFiles->first(); | 628 | return d->selectedFiles->first(); |
629 | } else { | 629 | } else { |
630 | return FALSE; | 630 | return FALSE; |
631 | } | 631 | } |
632 | } | 632 | } |
633 | return TRUE; | 633 | return TRUE; |
634 | } | 634 | } |
635 | } else { | 635 | } else { |
636 | return mediaPlayerState->looping(); | 636 | return mediaPlayerState->looping(); |
637 | } | 637 | } |
638 | } | 638 | } |
639 | 639 | ||
640 | 640 | ||
641 | bool PlayListWidget::first() { | 641 | bool PlayListWidget::first() { |
642 | if ( mediaPlayerState->playlist() ) | 642 | if ( mediaPlayerState->playlist() ) |
643 | return d->selectedFiles->first(); | 643 | return d->selectedFiles->first(); |
644 | else | 644 | else |
645 | return mediaPlayerState->looping(); | 645 | return mediaPlayerState->looping(); |
646 | } | 646 | } |
647 | 647 | ||
648 | 648 | ||
649 | bool PlayListWidget::last() { | 649 | bool PlayListWidget::last() { |
650 | if ( mediaPlayerState->playlist() ) | 650 | if ( mediaPlayerState->playlist() ) |
651 | return d->selectedFiles->last(); | 651 | return d->selectedFiles->last(); |
652 | else | 652 | else |
653 | return mediaPlayerState->looping(); | 653 | return mediaPlayerState->looping(); |
654 | } | 654 | } |
655 | 655 | ||
656 | 656 | ||
657 | void PlayListWidget::saveList() { | 657 | void PlayListWidget::saveList() { |
658 | writem3u(); | 658 | writem3u(); |
659 | } | 659 | } |
660 | 660 | ||
661 | void PlayListWidget::loadList( const DocLnk & lnk) { | 661 | void PlayListWidget::loadList( const DocLnk & lnk) { |
662 | QString name = lnk.name(); | 662 | QString name = lnk.name(); |
663 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 663 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); |
664 | 664 | ||
665 | if( name.length()>0) { | 665 | if( name.length()>0) { |
666 | setCaption("OpiePlayer: "+name); | 666 | setCaption("OpiePlayer: "+name); |
667 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 667 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
668 | clearList(); | 668 | clearList(); |
669 | readm3u(lnk.file()); | 669 | readm3u(lnk.file()); |
670 | tabWidget->setCurrentPage(0); | 670 | tabWidget->setCurrentPage(0); |
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||
674 | void PlayListWidget::setPlaylist( bool shown ) { | 674 | void PlayListWidget::setPlaylist( bool shown ) { |
675 | if ( shown ) | 675 | if ( shown ) |
676 | d->playListFrame->show(); | 676 | d->playListFrame->show(); |
677 | else | 677 | else |
678 | d->playListFrame->hide(); | 678 | d->playListFrame->hide(); |
679 | } | 679 | } |
680 | 680 | ||
681 | void PlayListWidget::setView( char view ) { | 681 | void PlayListWidget::setView( char view ) { |
682 | if ( view == 'l' ) | 682 | if ( view == 'l' ) |
683 | showMaximized(); | 683 | showMaximized(); |
684 | else | 684 | else |
685 | hide(); | 685 | hide(); |
686 | } | 686 | } |
687 | 687 | ||
688 | void PlayListWidget::addSelected() { | 688 | void PlayListWidget::addSelected() { |
689 | qDebug("addSelected"); | 689 | qDebug("addSelected"); |
690 | DocLnk lnk; | 690 | DocLnk lnk; |
691 | QString filename; | 691 | QString filename; |
692 | switch (tabWidget->currentPageIndex()) { | 692 | switch (tabWidget->currentPageIndex()) { |
693 | 693 | ||
694 | case 0: //playlist | 694 | case 0: //playlist |
695 | return; | 695 | return; |
696 | break; | 696 | break; |
697 | case 1: { //audio | 697 | case 1: { //audio |
698 | filename=audioView->currentItem()->text(3); | 698 | QListViewItemIterator it( audioView ); |
699 | // d->selectedFiles->next(); | 699 | for ( ; it.current(); ++it ) { |
700 | if ( it.current()->isSelected() ) { | ||
701 | filename = it.current()->text(3); | ||
702 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
703 | lnk.setFile( filename ); //sets file name | ||
704 | d->selectedFiles->addToSelection( lnk); | ||
705 | } | ||
706 | } | ||
707 | audioView->clearSelection(); | ||
708 | // d->selectedFiles->next(); | ||
700 | } | 709 | } |
701 | break; | 710 | break; |
702 | 711 | ||
703 | case 2: { // video | 712 | case 2: { // video |
704 | filename=videoView->currentItem()->text(3); | 713 | QListViewItemIterator it( videoView ); |
705 | // tabWidget->setCurrentPage(0); | 714 | for ( ; it.current(); ++it ) { |
706 | 715 | if ( it.current()->isSelected() ) { | |
716 | |||
717 | filename = it.current()->text(3); | ||
718 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
719 | lnk.setFile( filename ); //sets file name | ||
720 | d->selectedFiles->addToSelection( lnk); | ||
721 | } | ||
722 | } | ||
723 | videoView->clearSelection(); | ||
707 | } | 724 | } |
708 | break; | 725 | break; |
709 | }; | 726 | }; |
710 | lnk.setName( fullBaseName ( QFileInfo(filename))); //sets name | ||
711 | lnk.setFile( filename ); //sets file name | ||
712 | d->selectedFiles->addToSelection( lnk); | ||
713 | tabWidget->setCurrentPage(0); | 727 | tabWidget->setCurrentPage(0); |
714 | writeCurrentM3u(); | 728 | writeCurrentM3u(); |
715 | 729 | ||
716 | } | 730 | } |
717 | 731 | ||
718 | void PlayListWidget::removeSelected() { | 732 | void PlayListWidget::removeSelected() { |
719 | d->selectedFiles->removeSelected( ); | 733 | d->selectedFiles->removeSelected( ); |
720 | } | 734 | } |
721 | 735 | ||
722 | void PlayListWidget::playIt( QListViewItem *) { | 736 | void PlayListWidget::playIt( QListViewItem *) { |
723 | // d->setDocumentUsed = FALSE; | 737 | // d->setDocumentUsed = FALSE; |
724 | // mediaPlayerState->curPosition =0; | 738 | // mediaPlayerState->curPosition =0; |
725 | qDebug("playIt"); | 739 | qDebug("playIt"); |
726 | mediaPlayerState->setPlaying(FALSE); | 740 | mediaPlayerState->setPlaying(FALSE); |
727 | mediaPlayerState->setPlaying(TRUE); | 741 | mediaPlayerState->setPlaying(TRUE); |
728 | d->selectedFiles->unSelect(); | 742 | d->selectedFiles->unSelect(); |
729 | } | 743 | } |
730 | 744 | ||
731 | void PlayListWidget::addToSelection( QListViewItem *it) { | 745 | void PlayListWidget::addToSelection( QListViewItem *it) { |
732 | d->setDocumentUsed = FALSE; | 746 | d->setDocumentUsed = FALSE; |
733 | 747 | ||
734 | if(it) { | 748 | if(it) { |
735 | switch ( tabWidget->currentPageIndex()) { | 749 | switch ( tabWidget->currentPageIndex()) { |
736 | case 0: //playlist | 750 | case 0: //playlist |
737 | return; | 751 | return; |
738 | break; | 752 | break; |
739 | }; | 753 | }; |
740 | // case 1: { | 754 | // case 1: { |
741 | DocLnk lnk; | 755 | DocLnk lnk; |
742 | QString filename; | 756 | QString filename; |
743 | 757 | ||
744 | filename=it->text(3); | 758 | filename=it->text(3); |
745 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 759 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
746 | lnk.setFile( filename ); //sets file name | 760 | lnk.setFile( filename ); //sets file name |
747 | d->selectedFiles->addToSelection( lnk); | 761 | d->selectedFiles->addToSelection( lnk); |
748 | 762 | ||
749 | writeCurrentM3u(); | 763 | writeCurrentM3u(); |
750 | tabWidget->setCurrentPage(0); | 764 | tabWidget->setCurrentPage(0); |
751 | 765 | ||
752 | } | 766 | } |
753 | } | 767 | } |
754 | 768 | ||
755 | void PlayListWidget::tabChanged(QWidget *) { | 769 | void PlayListWidget::tabChanged(QWidget *) { |
756 | 770 | ||
757 | switch ( tabWidget->currentPageIndex()) { | 771 | switch ( tabWidget->currentPageIndex()) { |
758 | case 0: | 772 | case 0: |
759 | { | 773 | { |
760 | if( !tbDeletePlaylist->isHidden()) | 774 | if( !tbDeletePlaylist->isHidden()) |
761 | tbDeletePlaylist->hide(); | 775 | tbDeletePlaylist->hide(); |
762 | d->tbRemoveFromList->setEnabled(TRUE); | 776 | d->tbRemoveFromList->setEnabled(TRUE); |
763 | d->tbAddToList->setEnabled(FALSE); | 777 | d->tbAddToList->setEnabled(FALSE); |
764 | } | 778 | } |
765 | break; | 779 | break; |
766 | case 1: | 780 | case 1: |
767 | { | 781 | { |
768 | audioView->clear(); | 782 | audioView->clear(); |
769 | populateAudioView(); | 783 | populateAudioView(); |
770 | 784 | ||
771 | if( !tbDeletePlaylist->isHidden()) | 785 | if( !tbDeletePlaylist->isHidden()) |
772 | tbDeletePlaylist->hide(); | 786 | tbDeletePlaylist->hide(); |
773 | d->tbRemoveFromList->setEnabled(FALSE); | 787 | d->tbRemoveFromList->setEnabled(FALSE); |
774 | d->tbAddToList->setEnabled(TRUE); | 788 | d->tbAddToList->setEnabled(TRUE); |
775 | } | 789 | } |
776 | break; | 790 | break; |
777 | case 2: | 791 | case 2: |
778 | { | 792 | { |
779 | videoView->clear(); | 793 | videoView->clear(); |
780 | populateVideoView(); | 794 | populateVideoView(); |
781 | if( !tbDeletePlaylist->isHidden()) | 795 | if( !tbDeletePlaylist->isHidden()) |
782 | tbDeletePlaylist->hide(); | 796 | tbDeletePlaylist->hide(); |
783 | d->tbRemoveFromList->setEnabled(FALSE); | 797 | d->tbRemoveFromList->setEnabled(FALSE); |
784 | d->tbAddToList->setEnabled(TRUE); | 798 | d->tbAddToList->setEnabled(TRUE); |
785 | } | 799 | } |
786 | break; | 800 | break; |
787 | case 3: | 801 | case 3: |
788 | { | 802 | { |
789 | if( tbDeletePlaylist->isHidden()) | 803 | if( tbDeletePlaylist->isHidden()) |
790 | tbDeletePlaylist->show(); | 804 | tbDeletePlaylist->show(); |
791 | playLists->reread(); | 805 | playLists->reread(); |
792 | } | 806 | } |
793 | break; | 807 | break; |
794 | }; | 808 | }; |
795 | } | 809 | } |
796 | 810 | ||
797 | void PlayListWidget::btnPlay(bool b) { | 811 | void PlayListWidget::btnPlay(bool b) { |
798 | qDebug("<<<<<<<<<<<<<<<BtnPlay"); | 812 | qDebug("<<<<<<<<<<<<<<<BtnPlay"); |
799 | // mediaPlayerState->setPlaying(b); | 813 | // mediaPlayerState->setPlaying(b); |
800 | switch ( tabWidget->currentPageIndex()) { | 814 | switch ( tabWidget->currentPageIndex()) { |
801 | case 0: | 815 | case 0: |
802 | { | 816 | { |
803 | qDebug("1"); | 817 | qDebug("1"); |
804 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 | 818 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 |
805 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | 819 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { |
806 | // QMessageBox::message("Note","You are trying to play\na malformed url."); | 820 | // QMessageBox::message("Note","You are trying to play\na malformed url."); |
807 | // } else { | 821 | // } else { |
808 | mediaPlayerState->setPlaying(b); | 822 | mediaPlayerState->setPlaying(b); |