author | zecke <zecke> | 2005-05-12 21:21:14 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-05-12 21:21:14 (UTC) |
commit | ed2d14794cee66441f06be923623694f4ad2e06b (patch) (unidiff) | |
tree | 92a30a25343f9aa97285ed4f8d95209923ab1c0d | |
parent | 9d1113376da0ba95a5b4121bd953756311ac5a97 (diff) | |
download | opie-ed2d14794cee66441f06be923623694f4ad2e06b.zip opie-ed2d14794cee66441f06be923623694f4ad2e06b.tar.gz opie-ed2d14794cee66441f06be923623694f4ad2e06b.tar.bz2 |
Fix for #1657 to show the play button when we've playable files
patch courtsey Gints Polis
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 83eb83b..98326a8 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -577,384 +577,390 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
577 | d->tbAddToList->setEnabled(TRUE); | 577 | d->tbAddToList->setEnabled(TRUE); |
578 | 578 | ||
579 | connect( audioView, SIGNAL( itemsSelected(bool) ), | 579 | connect( audioView, SIGNAL( itemsSelected(bool) ), |
580 | d->tbPlay, SLOT( setEnabled(bool) ) ); | 580 | d->tbPlay, SLOT( setEnabled(bool) ) ); |
581 | 581 | ||
582 | currentFileListView = audioView; | 582 | currentFileListView = audioView; |
583 | } | 583 | } |
584 | break; | 584 | break; |
585 | case VideoFiles: | 585 | case VideoFiles: |
586 | { | 586 | { |
587 | videoView->populateView(); | 587 | videoView->populateView(); |
588 | if( !tbDeletePlaylist->isHidden() ) { | 588 | if( !tbDeletePlaylist->isHidden() ) { |
589 | tbDeletePlaylist->hide(); | 589 | tbDeletePlaylist->hide(); |
590 | } | 590 | } |
591 | d->tbAddToList->setEnabled(TRUE); | 591 | d->tbAddToList->setEnabled(TRUE); |
592 | 592 | ||
593 | connect( videoView, SIGNAL( itemsSelected(bool) ), | 593 | connect( videoView, SIGNAL( itemsSelected(bool) ), |
594 | d->tbPlay, SLOT( setEnabled(bool) ) ); | 594 | d->tbPlay, SLOT( setEnabled(bool) ) ); |
595 | 595 | ||
596 | currentFileListView = videoView; | 596 | currentFileListView = videoView; |
597 | } | 597 | } |
598 | break; | 598 | break; |
599 | case PlayLists: | 599 | case PlayLists: |
600 | { | 600 | { |
601 | if( tbDeletePlaylist->isHidden() ) { | 601 | if( tbDeletePlaylist->isHidden() ) { |
602 | tbDeletePlaylist->show(); | 602 | tbDeletePlaylist->show(); |
603 | } | 603 | } |
604 | playLists->reread(); | 604 | playLists->reread(); |
605 | d->tbAddToList->setEnabled(FALSE); | 605 | d->tbAddToList->setEnabled(FALSE); |
606 | 606 | ||
607 | } | 607 | } |
608 | break; | 608 | break; |
609 | }; | 609 | }; |
610 | 610 | ||
611 | setButtons(); | 611 | setButtons(); |
612 | } | 612 | } |
613 | 613 | ||
614 | 614 | ||
615 | void PlayListWidget::btnPlay(bool b) { | 615 | void PlayListWidget::btnPlay(bool b) { |
616 | // mediaPlayerState->setPlaying(false); | 616 | // mediaPlayerState->setPlaying(false); |
617 | mediaPlayerState->setPlaying(b); | 617 | mediaPlayerState->setPlaying(b); |
618 | insanityBool=FALSE; | 618 | insanityBool=FALSE; |
619 | } | 619 | } |
620 | 620 | ||
621 | void PlayListWidget::deletePlaylist() { | 621 | void PlayListWidget::deletePlaylist() { |
622 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 622 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
623 | (tr("You really want to delete\nthis playlist?")), | 623 | (tr("You really want to delete\nthis playlist?")), |
624 | (tr("Yes")), (tr("No")), 0 )){ | 624 | (tr("Yes")), (tr("No")), 0 )){ |
625 | case 0: // Yes clicked, | 625 | case 0: // Yes clicked, |
626 | QFile().remove(playLists->selectedDocument().file()); | 626 | QFile().remove(playLists->selectedDocument().file()); |
627 | QFile().remove(playLists->selectedDocument().linkFile()); | 627 | QFile().remove(playLists->selectedDocument().linkFile()); |
628 | playLists->reread(); | 628 | playLists->reread(); |
629 | break; | 629 | break; |
630 | case 1: // Cancel | 630 | case 1: // Cancel |
631 | break; | 631 | break; |
632 | }; | 632 | }; |
633 | } | 633 | } |
634 | 634 | ||
635 | 635 | ||
636 | void PlayListWidget::playSelected() { | 636 | void PlayListWidget::playSelected() { |
637 | btnPlay( TRUE); | 637 | btnPlay( TRUE); |
638 | } | 638 | } |
639 | 639 | ||
640 | bool PlayListWidget::inFileListMode() const | 640 | bool PlayListWidget::inFileListMode() const |
641 | { | 641 | { |
642 | TabType tab = currentTab(); | 642 | TabType tab = currentTab(); |
643 | return tab == AudioFiles || tab == VideoFiles; | 643 | return tab == AudioFiles || tab == VideoFiles; |
644 | } | 644 | } |
645 | 645 | ||
646 | void PlayListWidget::openURL() { | 646 | void PlayListWidget::openURL() { |
647 | // http://66.28.164.33:2080 | 647 | // http://66.28.164.33:2080 |
648 | // http://somafm.com/star0242.m3u | 648 | // http://somafm.com/star0242.m3u |
649 | QString filename, name; | 649 | QString filename, name; |
650 | InputDialog *fileDlg; | 650 | InputDialog *fileDlg; |
651 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); | 651 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); |
652 | fileDlg->exec(); | 652 | fileDlg->exec(); |
653 | if( fileDlg->result() == 1 ) { | 653 | if( fileDlg->result() == 1 ) { |
654 | filename = fileDlg->text(); | 654 | filename = fileDlg->text(); |
655 | odebug << "Selected filename is " + filename << oendl; | 655 | odebug << "Selected filename is " + filename << oendl; |
656 | // Om3u *m3uList; | 656 | // Om3u *m3uList; |
657 | DocLnk lnk; | 657 | DocLnk lnk; |
658 | Config cfg( "OpiePlayer" ); | 658 | Config cfg( "OpiePlayer" ); |
659 | cfg.setGroup("PlayList"); | 659 | cfg.setGroup("PlayList"); |
660 | 660 | ||
661 | if(filename.left(4) == "http") { | 661 | if(filename.left(4) == "http") { |
662 | QString m3uFile, m3uFilePath; | 662 | QString m3uFile, m3uFilePath; |
663 | if(filename.find(":",8,TRUE) != -1) { //found a port | 663 | if(filename.find(":",8,TRUE) != -1) { //found a port |
664 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 664 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
665 | m3uFile = m3uFile.right( 7); | 665 | m3uFile = m3uFile.right( 7); |
666 | } else if(filename.left(4) == "http"){ | 666 | } else if(filename.left(4) == "http"){ |
667 | m3uFile=filename; | 667 | m3uFile=filename; |
668 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 668 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
669 | } else{ | 669 | } else{ |
670 | m3uFile=filename; | 670 | m3uFile=filename; |
671 | } | 671 | } |
672 | 672 | ||
673 | lnk.setName( filename ); //sets name | 673 | lnk.setName( filename ); //sets name |
674 | lnk.setFile( filename ); //sets file name | 674 | lnk.setFile( filename ); //sets file name |
675 | 675 | ||
676 | // lnk.setIcon("opieplayer2/musicfile"); | 676 | // lnk.setIcon("opieplayer2/musicfile"); |
677 | 677 | ||
678 | d->selectedFiles->addToSelection( lnk ); | 678 | d->selectedFiles->addToSelection( lnk ); |
679 | writeCurrentM3u(); | 679 | writeCurrentM3u(); |
680 | d->selectedFiles->setSelectedItem( lnk.name()); | 680 | d->selectedFiles->setSelectedItem( lnk.name()); |
681 | } | 681 | } |
682 | else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { | 682 | else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { |
683 | readListFromFile( filename ); | 683 | readListFromFile( filename ); |
684 | } else { | 684 | } else { |
685 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 685 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
686 | lnk.setFile( filename ); //sets file name | 686 | lnk.setFile( filename ); //sets file name |
687 | d->selectedFiles->addToSelection( lnk); | 687 | d->selectedFiles->addToSelection( lnk); |
688 | writeCurrentM3u(); | 688 | writeCurrentM3u(); |
689 | d->selectedFiles->setSelectedItem( lnk.name()); | 689 | d->selectedFiles->setSelectedItem( lnk.name()); |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | 693 | ||
694 | delete fileDlg; | 694 | delete fileDlg; |
695 | } | 695 | } |
696 | 696 | ||
697 | 697 | ||
698 | static MimeTypes fileSelectorMimeTypes() { | 698 | static MimeTypes fileSelectorMimeTypes() { |
699 | MimeTypes types; | 699 | MimeTypes types; |
700 | QStringList audio, video, all; | 700 | QStringList audio, video, all; |
701 | audio << "audio/*"; | 701 | audio << "audio/*"; |
702 | audio << "playlist/plain"; | 702 | audio << "playlist/plain"; |
703 | audio << "audio/x-ogg"; | 703 | audio << "audio/x-ogg"; |
704 | audio << "audio/x-mpegurl"; | 704 | audio << "audio/x-mpegurl"; |
705 | 705 | ||
706 | video << "video/*"; | 706 | video << "video/*"; |
707 | video << "playlist/plain"; | 707 | video << "playlist/plain"; |
708 | 708 | ||
709 | all += audio; | 709 | all += audio; |
710 | all += video; | 710 | all += video; |
711 | types.insert("All Media Files", all ); | 711 | types.insert("All Media Files", all ); |
712 | types.insert("Audio", audio ); | 712 | types.insert("Audio", audio ); |
713 | types.insert("Video", video ); | 713 | types.insert("Video", video ); |
714 | 714 | ||
715 | return types; | 715 | return types; |
716 | } | 716 | } |
717 | 717 | ||
718 | void PlayListWidget::openFile() { | 718 | void PlayListWidget::openFile() { |
719 | 719 | ||
720 | QString filename, name; | 720 | QString filename, name; |
721 | 721 | ||
722 | Config cfg( "OpiePlayer" ); | 722 | Config cfg( "OpiePlayer" ); |
723 | cfg.setGroup("Dialog"); | 723 | cfg.setGroup("Dialog"); |
724 | MimeTypes types = fileSelectorMimeTypes(); | 724 | MimeTypes types = fileSelectorMimeTypes(); |
725 | 725 | ||
726 | 726 | ||
727 | QString str = OFileDialog::getOpenFileName( 1, QString::null, | 727 | QString str = OFileDialog::getOpenFileName( 1, QString::null, |
728 | QString::null, types, 0, | 728 | QString::null, types, 0, |
729 | tr("Add File to Playlist") ); | 729 | tr("Add File to Playlist") ); |
730 | 730 | ||
731 | if( str.isEmpty() ) | 731 | if( str.isEmpty() ) |
732 | return; | 732 | return; |
733 | 733 | ||
734 | if(str.left(2) == "//") str=str.right(str.length()-1); | 734 | if(str.left(2) == "//") str=str.right(str.length()-1); |
735 | 735 | ||
736 | 736 | ||
737 | if( str.right( 3) == "m3u" || str.right(3) == "pls" ) { | 737 | if( str.right( 3) == "m3u" || str.right(3) == "pls" ) { |
738 | readListFromFile( str ); | 738 | readListFromFile( str ); |
739 | } else { | 739 | } else { |
740 | QFileInfo info( str ); | 740 | QFileInfo info( str ); |
741 | DocLnk lnk = addFileToPlaylist( str, info.baseName() ); | 741 | DocLnk lnk = addFileToPlaylist( str, info.baseName() ); |
742 | d->selectedFiles->setSelectedItem( lnk.name() ); | 742 | d->selectedFiles->setSelectedItem( lnk.name() ); |
743 | } | 743 | } |
744 | 744 | ||
745 | setButtons(); | 745 | setButtons(); |
746 | } | 746 | } |
747 | 747 | ||
748 | void PlayListWidget::openDirectory() { | 748 | void PlayListWidget::openDirectory() { |
749 | QString str = OFileDialog::getDirectory( OFileSelector::DirectorySelector, | 749 | QString str = OFileDialog::getDirectory( OFileSelector::DirectorySelector, |
750 | QString::null, 0, | 750 | QString::null, 0, |
751 | tr( "Add Files from Directory")); | 751 | tr( "Add Files from Directory")); |
752 | 752 | ||
753 | if(str.isEmpty() ) | 753 | if(str.isEmpty() ) |
754 | return; | 754 | return; |
755 | 755 | ||
756 | if(str.left(2) == "//") str=str.right(str.length()-1); | 756 | if(str.left(2) == "//") str=str.right(str.length()-1); |
757 | QDir dir( str ); | 757 | QDir dir( str ); |
758 | QStringList lst = dir.entryList(QDir::Files|QDir::Readable); | 758 | QStringList lst = dir.entryList(QDir::Files|QDir::Readable); |
759 | 759 | ||
760 | for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 760 | for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
761 | QString filename = str + "/" + *it; | 761 | QString filename = str + "/" + *it; |
762 | 762 | ||
763 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) | 763 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) |
764 | readListFromFile( filename ); | 764 | readListFromFile( filename ); |
765 | else { | 765 | else { |
766 | addFileToPlaylist( filename, QFileInfo(*it).baseName() ); | 766 | addFileToPlaylist( filename, QFileInfo(*it).baseName() ); |
767 | } | 767 | } |
768 | } | 768 | } |
769 | |||
770 | if (!d->selectedFiles->isEmpty()) { | ||
771 | d->selectedFiles->first(); | ||
772 | |||
773 | setButtons(); | ||
774 | } | ||
769 | } | 775 | } |
770 | 776 | ||
771 | void PlayListWidget::readListFromFile( const QString &filename ) { | 777 | void PlayListWidget::readListFromFile( const QString &filename ) { |
772 | odebug << "read list filename " + filename << oendl; | 778 | odebug << "read list filename " + filename << oendl; |
773 | QFileInfo fi(filename); | 779 | QFileInfo fi(filename); |
774 | Om3u *m3uList; | 780 | Om3u *m3uList; |
775 | QString s, name; | 781 | QString s, name; |
776 | m3uList = new Om3u( filename, IO_ReadOnly ); | 782 | m3uList = new Om3u( filename, IO_ReadOnly ); |
777 | if(fi.extension(false).find("m3u",0,false) != -1 ) | 783 | if(fi.extension(false).find("m3u",0,false) != -1 ) |
778 | m3uList->readM3u(); | 784 | m3uList->readM3u(); |
779 | else if(fi.extension(false).find("pls",0,false) != -1 ) | 785 | else if(fi.extension(false).find("pls",0,false) != -1 ) |
780 | m3uList->readPls(); | 786 | m3uList->readPls(); |
781 | 787 | ||
782 | DocLnk lnk; | 788 | DocLnk lnk; |
783 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 789 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
784 | s = *it; | 790 | s = *it; |
785 | // odebug << s << oendl; | 791 | // odebug << s << oendl; |
786 | if(s.left(4)=="http") { | 792 | if(s.left(4)=="http") { |
787 | lnk.setName( s ); //sets file name | 793 | lnk.setName( s ); //sets file name |
788 | lnk.setIcon("opieplayer2/musicfile"); | 794 | lnk.setIcon("opieplayer2/musicfile"); |
789 | lnk.setFile( s ); //sets file name | 795 | lnk.setFile( s ); //sets file name |
790 | 796 | ||
791 | } else { //is file | 797 | } else { //is file |
792 | lnk.setName( QFileInfo(s).baseName()); | 798 | lnk.setName( QFileInfo(s).baseName()); |
793 | if(s.left(1) != "/") { | 799 | if(s.left(1) != "/") { |
794 | 800 | ||
795 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 801 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
796 | } else { | 802 | } else { |
797 | lnk.setFile( s); | 803 | lnk.setFile( s); |
798 | } | 804 | } |
799 | } | 805 | } |
800 | d->selectedFiles->addToSelection( lnk ); | 806 | d->selectedFiles->addToSelection( lnk ); |
801 | } | 807 | } |
802 | Config config( "OpiePlayer" ); | 808 | Config config( "OpiePlayer" ); |
803 | config.setGroup( "PlayList" ); | 809 | config.setGroup( "PlayList" ); |
804 | 810 | ||
805 | config.writeEntry("CurrentPlaylist",filename); | 811 | config.writeEntry("CurrentPlaylist",filename); |
806 | config.write(); | 812 | config.write(); |
807 | currentPlayList=filename; | 813 | currentPlayList=filename; |
808 | 814 | ||
809 | m3uList->close(); | 815 | m3uList->close(); |
810 | delete m3uList; | 816 | delete m3uList; |
811 | 817 | ||
812 | d->selectedFiles->setSelectedItem( s); | 818 | d->selectedFiles->setSelectedItem( s); |
813 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 819 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
814 | 820 | ||
815 | setButtons(); | 821 | setButtons(); |
816 | } | 822 | } |
817 | 823 | ||
818 | // writes current playlist to current m3u file */ | 824 | // writes current playlist to current m3u file */ |
819 | void PlayListWidget::writeCurrentM3u() { | 825 | void PlayListWidget::writeCurrentM3u() { |
820 | odebug << "writing to current m3u" << oendl; | 826 | odebug << "writing to current m3u" << oendl; |
821 | Config cfg( "OpiePlayer" ); | 827 | Config cfg( "OpiePlayer" ); |
822 | cfg.setGroup("PlayList"); | 828 | cfg.setGroup("PlayList"); |
823 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 829 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
824 | 830 | ||
825 | Om3u *m3uList; | 831 | Om3u *m3uList; |
826 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 832 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
827 | if( d->selectedFiles->first()) { | 833 | if( d->selectedFiles->first()) { |
828 | 834 | ||
829 | do { | 835 | do { |
830 | // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; | 836 | // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; |
831 | m3uList->add( d->selectedFiles->current()->file() ); | 837 | m3uList->add( d->selectedFiles->current()->file() ); |
832 | } | 838 | } |
833 | while ( d->selectedFiles->next() ); | 839 | while ( d->selectedFiles->next() ); |
834 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; | 840 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; |
835 | m3uList->write(); | 841 | m3uList->write(); |
836 | m3uList->close(); | 842 | m3uList->close(); |
837 | } | 843 | } |
838 | delete m3uList; | 844 | delete m3uList; |
839 | 845 | ||
840 | } | 846 | } |
841 | 847 | ||
842 | /* | 848 | /* |
843 | writes current playlist to m3u file */ | 849 | writes current playlist to m3u file */ |
844 | void PlayListWidget::writem3u() { | 850 | void PlayListWidget::writem3u() { |
845 | 851 | ||
846 | Config cfg( "OpiePlayer" ); | 852 | Config cfg( "OpiePlayer" ); |
847 | cfg.setGroup("Dialog"); | 853 | cfg.setGroup("Dialog"); |
848 | MimeTypes types = fileSelectorMimeTypes(); | 854 | MimeTypes types = fileSelectorMimeTypes(); |
849 | 855 | ||
850 | QString str = OFileDialog::getOpenFileName( 1, QString::null, | 856 | QString str = OFileDialog::getOpenFileName( 1, QString::null, |
851 | QString::null, types, 0, | 857 | QString::null, types, 0, |
852 | tr( "Save Playlist" )); | 858 | tr( "Save Playlist" )); |
853 | 859 | ||
854 | if(str.left(2) == "//") str=str.right(str.length()-1); | 860 | if(str.left(2) == "//") str=str.right(str.length()-1); |
855 | 861 | ||
856 | QString name, filename, list; | 862 | QString name, filename, list; |
857 | Om3u *m3uList; | 863 | Om3u *m3uList; |
858 | 864 | ||
859 | if( !str.isEmpty() ) { | 865 | if( !str.isEmpty() ) { |
860 | name = str; | 866 | name = str; |
861 | // name = fileDlg->text(); | 867 | // name = fileDlg->text(); |
862 | // odebug << filename << oendl; | 868 | // odebug << filename << oendl; |
863 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 869 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
864 | filename = name; | 870 | filename = name; |
865 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 871 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
866 | } | 872 | } |
867 | else //otherwise dump it somewhere noticable | 873 | else //otherwise dump it somewhere noticable |
868 | filename = QPEApplication::documentDir() + "/" + name; | 874 | filename = QPEApplication::documentDir() + "/" + name; |
869 | 875 | ||
870 | if( filename.right( 3 ) != "m3u" ) //needs filename extension | 876 | if( filename.right( 3 ) != "m3u" ) //needs filename extension |
871 | filename += ".m3u"; | 877 | filename += ".m3u"; |
872 | 878 | ||
873 | if( d->selectedFiles->first()) { //ramble through playlist view | 879 | if( d->selectedFiles->first()) { //ramble through playlist view |
874 | m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); | 880 | m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); |
875 | 881 | ||
876 | do { | 882 | do { |
877 | m3uList->add( d->selectedFiles->current()->file()); | 883 | m3uList->add( d->selectedFiles->current()->file()); |
878 | } | 884 | } |
879 | while ( d->selectedFiles->next() ); | 885 | while ( d->selectedFiles->next() ); |
880 | // odebug << list << oendl; | 886 | // odebug << list << oendl; |
881 | m3uList->write(); | 887 | m3uList->write(); |
882 | m3uList->close(); | 888 | m3uList->close(); |
883 | delete m3uList; | 889 | delete m3uList; |
884 | 890 | ||
885 | //delete fileDlg; | 891 | //delete fileDlg; |
886 | 892 | ||
887 | DocLnk lnk; | 893 | DocLnk lnk; |
888 | lnk.setFile( filename); | 894 | lnk.setFile( filename); |
889 | lnk.setIcon("opieplayer2/playlist2"); | 895 | lnk.setIcon("opieplayer2/playlist2"); |
890 | lnk.setName( name); //sets file name | 896 | lnk.setName( name); //sets file name |
891 | 897 | ||
892 | // odebug << filename << oendl; | 898 | // odebug << filename << oendl; |
893 | Config config( "OpiePlayer" ); | 899 | Config config( "OpiePlayer" ); |
894 | config.setGroup( "PlayList" ); | 900 | config.setGroup( "PlayList" ); |
895 | 901 | ||
896 | config.writeEntry("CurrentPlaylist",filename); | 902 | config.writeEntry("CurrentPlaylist",filename); |
897 | currentPlayList=filename; | 903 | currentPlayList=filename; |
898 | 904 | ||
899 | if(!lnk.writeLink()) { | 905 | if(!lnk.writeLink()) { |
900 | odebug << "Writing doclink did not work" << oendl; | 906 | odebug << "Writing doclink did not work" << oendl; |
901 | } | 907 | } |
902 | 908 | ||
903 | setCaption(tr("OpiePlayer: ") + name); | 909 | setCaption(tr("OpiePlayer: ") + name); |
904 | } | 910 | } |
905 | } | 911 | } |
906 | } | 912 | } |
907 | 913 | ||
908 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 914 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
909 | switch ( e->key() ) { | 915 | switch ( e->key() ) { |
910 | ////////////////////////////// Zaurus keys | 916 | ////////////////////////////// Zaurus keys |
911 | case Key_F9: //activity | 917 | case Key_F9: //activity |
912 | // if(audioUI->isHidden()) | 918 | // if(audioUI->isHidden()) |
913 | // audioUI->showMaximized(); | 919 | // audioUI->showMaximized(); |
914 | break; | 920 | break; |
915 | case Key_F10: //contacts | 921 | case Key_F10: //contacts |
916 | // if( videoUI->isHidden()) | 922 | // if( videoUI->isHidden()) |
917 | // videoUI->showMaximized(); | 923 | // videoUI->showMaximized(); |
918 | break; | 924 | break; |
919 | case Key_F11: //menu | 925 | case Key_F11: //menu |
920 | break; | 926 | break; |
921 | case Key_F12: //home | 927 | case Key_F12: //home |
922 | // doBlank(); | 928 | // doBlank(); |
923 | break; | 929 | break; |
924 | case Key_F13: //mail | 930 | case Key_F13: //mail |
925 | // doUnblank(); | 931 | // doUnblank(); |
926 | break; | 932 | break; |
927 | case Key_Q: //add to playlist | 933 | case Key_Q: //add to playlist |
928 | addSelected(); | 934 | addSelected(); |
929 | break; | 935 | break; |
930 | case Key_R: //remove from playlist | 936 | case Key_R: //remove from playlist |
931 | removeSelected(); | 937 | removeSelected(); |
932 | break; | 938 | break; |
933 | // case Key_P: //play | 939 | // case Key_P: //play |
934 | // odebug << "Play" << oendl; | 940 | // odebug << "Play" << oendl; |
935 | // playSelected(); | 941 | // playSelected(); |
936 | // break; | 942 | // break; |
937 | case Key_Space: | 943 | case Key_Space: |
938 | // playSelected(); puh | 944 | // playSelected(); puh |
939 | break; | 945 | break; |
940 | case Key_1: | 946 | case Key_1: |
941 | tabWidget->setCurrentPage( 0 ); | 947 | tabWidget->setCurrentPage( 0 ); |
942 | break; | 948 | break; |
943 | case Key_2: | 949 | case Key_2: |
944 | tabWidget->setCurrentPage( 1 ); | 950 | tabWidget->setCurrentPage( 1 ); |
945 | break; | 951 | break; |
946 | case Key_3: | 952 | case Key_3: |
947 | tabWidget->setCurrentPage( 2 ); | 953 | tabWidget->setCurrentPage( 2 ); |
948 | break; | 954 | break; |
949 | case Key_4: | 955 | case Key_4: |
950 | tabWidget->setCurrentPage( 3 ); | 956 | tabWidget->setCurrentPage( 3 ); |
951 | break; | 957 | break; |
952 | case Key_Down: | 958 | case Key_Down: |
953 | if ( !d->selectedFiles->next() ) | 959 | if ( !d->selectedFiles->next() ) |
954 | d->selectedFiles->first(); | 960 | d->selectedFiles->first(); |
955 | break; | 961 | break; |
956 | case Key_Up: | 962 | case Key_Up: |
957 | if ( !d->selectedFiles->prev() ) | 963 | if ( !d->selectedFiles->prev() ) |
958 | // d->selectedFiles->last(); | 964 | // d->selectedFiles->last(); |
959 | break; | 965 | break; |
960 | } | 966 | } |