author | simon <simon> | 2002-12-05 19:13:57 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-05 19:13:57 (UTC) |
commit | 15d4d1f2fc8b37d30694acc5765a822718af6c13 (patch) (unidiff) | |
tree | 53769a23884812cf009f48271fbb02bc55531754 | |
parent | 4b77aaa27305f0ec120aa6ec4d860f62b7fa7a3f (diff) | |
download | opie-15d4d1f2fc8b37d30694acc5765a822718af6c13.zip opie-15d4d1f2fc8b37d30694acc5765a822718af6c13.tar.gz opie-15d4d1f2fc8b37d30694acc5765a822718af6c13.tar.bz2 |
- fixed a minor memory leak
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index ac52b07..2df7f27 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -606,395 +606,394 @@ void PlayListWidget::deletePlaylist() { | |||
606 | QFile().remove(playLists->selectedDocument().file()); | 606 | QFile().remove(playLists->selectedDocument().file()); |
607 | QFile().remove(playLists->selectedDocument().linkFile()); | 607 | QFile().remove(playLists->selectedDocument().linkFile()); |
608 | playLists->reread(); | 608 | playLists->reread(); |
609 | break; | 609 | break; |
610 | case 1: // Cancel | 610 | case 1: // Cancel |
611 | break; | 611 | break; |
612 | }; | 612 | }; |
613 | } | 613 | } |
614 | 614 | ||
615 | 615 | ||
616 | void PlayListWidget::playSelected() { | 616 | void PlayListWidget::playSelected() { |
617 | btnPlay( TRUE); | 617 | btnPlay( TRUE); |
618 | } | 618 | } |
619 | 619 | ||
620 | QListView *PlayListWidget::currentFileListView() const | 620 | QListView *PlayListWidget::currentFileListView() const |
621 | { | 621 | { |
622 | switch ( currentTab() ) { | 622 | switch ( currentTab() ) { |
623 | case AudioFiles: return audioView; | 623 | case AudioFiles: return audioView; |
624 | case VideoFiles: return videoView; | 624 | case VideoFiles: return videoView; |
625 | default: assert( false ); | 625 | default: assert( false ); |
626 | } | 626 | } |
627 | return 0; | 627 | return 0; |
628 | } | 628 | } |
629 | 629 | ||
630 | bool PlayListWidget::inFileListMode() const | 630 | bool PlayListWidget::inFileListMode() const |
631 | { | 631 | { |
632 | TabType tab = currentTab(); | 632 | TabType tab = currentTab(); |
633 | return tab == AudioFiles || tab == VideoFiles; | 633 | return tab == AudioFiles || tab == VideoFiles; |
634 | } | 634 | } |
635 | 635 | ||
636 | void PlayListWidget::openFile() { | 636 | void PlayListWidget::openFile() { |
637 | // http://66.28.164.33:2080 | 637 | // http://66.28.164.33:2080 |
638 | // http://somafm.com/star0242.m3u | 638 | // http://somafm.com/star0242.m3u |
639 | QString filename, name; | 639 | QString filename, name; |
640 | InputDialog *fileDlg; | 640 | InputDialog *fileDlg; |
641 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 641 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
642 | fileDlg->exec(); | 642 | fileDlg->exec(); |
643 | if( fileDlg->result() == 1 ) { | 643 | if( fileDlg->result() == 1 ) { |
644 | filename = fileDlg->text(); | 644 | filename = fileDlg->text(); |
645 | qDebug( "Selected filename is " + filename ); | 645 | qDebug( "Selected filename is " + filename ); |
646 | // Om3u *m3uList; | 646 | // Om3u *m3uList; |
647 | DocLnk lnk; | 647 | DocLnk lnk; |
648 | Config cfg( "OpiePlayer" ); | 648 | Config cfg( "OpiePlayer" ); |
649 | cfg.setGroup("PlayList"); | 649 | cfg.setGroup("PlayList"); |
650 | 650 | ||
651 | if(filename.left(4) == "http") { | 651 | if(filename.left(4) == "http") { |
652 | QString m3uFile, m3uFilePath; | 652 | QString m3uFile, m3uFilePath; |
653 | if(filename.find(":",8,TRUE) != -1) { //found a port | 653 | if(filename.find(":",8,TRUE) != -1) { //found a port |
654 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 654 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
655 | m3uFile = m3uFile.right( 7); | 655 | m3uFile = m3uFile.right( 7); |
656 | } else if(filename.left(4) == "http"){ | 656 | } else if(filename.left(4) == "http"){ |
657 | m3uFile=filename; | 657 | m3uFile=filename; |
658 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 658 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
659 | } else{ | 659 | } else{ |
660 | m3uFile=filename; | 660 | m3uFile=filename; |
661 | } | 661 | } |
662 | 662 | ||
663 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 663 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
664 | lnk.setName( filename ); //sets name | 664 | lnk.setName( filename ); //sets name |
665 | lnk.setFile( filename ); //sets file name | 665 | lnk.setFile( filename ); //sets file name |
666 | 666 | ||
667 | // lnk.setIcon("opieplayer2/musicfile"); | 667 | // lnk.setIcon("opieplayer2/musicfile"); |
668 | 668 | ||
669 | d->selectedFiles->addToSelection( lnk ); | 669 | d->selectedFiles->addToSelection( lnk ); |
670 | writeCurrentM3u(); | 670 | writeCurrentM3u(); |
671 | d->selectedFiles->setSelectedItem( lnk.name()); | 671 | d->selectedFiles->setSelectedItem( lnk.name()); |
672 | } | 672 | } |
673 | else if( filename.right( 3) == "m3u" ) { | 673 | else if( filename.right( 3) == "m3u" ) { |
674 | readm3u( filename ); | 674 | readm3u( filename ); |
675 | 675 | ||
676 | } else if( filename.right(3) == "pls" ) { | 676 | } else if( filename.right(3) == "pls" ) { |
677 | readPls( filename ); | 677 | readPls( filename ); |
678 | } else { | 678 | } else { |
679 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 679 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
680 | lnk.setFile( filename ); //sets file name | 680 | lnk.setFile( filename ); //sets file name |
681 | d->selectedFiles->addToSelection( lnk); | 681 | d->selectedFiles->addToSelection( lnk); |
682 | writeCurrentM3u(); | 682 | writeCurrentM3u(); |
683 | d->selectedFiles->setSelectedItem( lnk.name()); | 683 | d->selectedFiles->setSelectedItem( lnk.name()); |
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | delete fileDlg; | 687 | delete fileDlg; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* | 690 | /* |
691 | reads m3u and shows files/urls to playlist widget */ | 691 | reads m3u and shows files/urls to playlist widget */ |
692 | void PlayListWidget::readm3u( const QString &filename ) { | 692 | void PlayListWidget::readm3u( const QString &filename ) { |
693 | qDebug( "read m3u filename " + filename ); | 693 | qDebug( "read m3u filename " + filename ); |
694 | 694 | ||
695 | Om3u *m3uList; | 695 | Om3u *m3uList; |
696 | QString s, name; | 696 | QString s, name; |
697 | m3uList = new Om3u( filename, IO_ReadOnly ); | 697 | m3uList = new Om3u( filename, IO_ReadOnly ); |
698 | m3uList->readM3u(); | 698 | m3uList->readM3u(); |
699 | DocLnk lnk; | 699 | DocLnk lnk; |
700 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 700 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
701 | s = *it; | 701 | s = *it; |
702 | // qDebug("reading "+ s); | 702 | // qDebug("reading "+ s); |
703 | if(s.left(4)=="http") { | 703 | if(s.left(4)=="http") { |
704 | lnk.setName( s ); //sets file name | 704 | lnk.setName( s ); //sets file name |
705 | lnk.setIcon("opieplayer2/musicfile"); | 705 | lnk.setIcon("opieplayer2/musicfile"); |
706 | lnk.setFile( s ); //sets file name | 706 | lnk.setFile( s ); //sets file name |
707 | 707 | ||
708 | } else { | 708 | } else { |
709 | // if( QFileInfo( s ).exists() ) { | 709 | // if( QFileInfo( s ).exists() ) { |
710 | lnk.setName( QFileInfo(s).baseName()); | 710 | lnk.setName( QFileInfo(s).baseName()); |
711 | // if(s.right(4) == '.') {//if regular file | 711 | // if(s.right(4) == '.') {//if regular file |
712 | if(s.left(1) != "/") { | 712 | if(s.left(1) != "/") { |
713 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 713 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
714 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 714 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
715 | // lnk.setIcon(MimeType(s).pixmap() ); | 715 | // lnk.setIcon(MimeType(s).pixmap() ); |
716 | // lnk.setIcon("SoundPlayer"); | 716 | // lnk.setIcon("SoundPlayer"); |
717 | } else { | 717 | } else { |
718 | // qDebug("set link2 "+s); | 718 | // qDebug("set link2 "+s); |
719 | lnk.setFile( s); | 719 | lnk.setFile( s); |
720 | // lnk.setIcon(MimeType(s).pixmap() ); | 720 | // lnk.setIcon(MimeType(s).pixmap() ); |
721 | // lnk.setIcon("SoundPlayer"); | 721 | // lnk.setIcon("SoundPlayer"); |
722 | } | 722 | } |
723 | } | 723 | } |
724 | d->selectedFiles->addToSelection( lnk ); | 724 | d->selectedFiles->addToSelection( lnk ); |
725 | } | 725 | } |
726 | Config config( "OpiePlayer" ); | 726 | Config config( "OpiePlayer" ); |
727 | config.setGroup( "PlayList" ); | 727 | config.setGroup( "PlayList" ); |
728 | 728 | ||
729 | config.writeEntry("CurrentPlaylist",filename); | 729 | config.writeEntry("CurrentPlaylist",filename); |
730 | config.write(); | 730 | config.write(); |
731 | currentPlayList=filename; | 731 | currentPlayList=filename; |
732 | 732 | ||
733 | // m3uList->write(); | 733 | // m3uList->write(); |
734 | m3uList->close(); | 734 | m3uList->close(); |
735 | delete m3uList; | 735 | delete m3uList; |
736 | 736 | ||
737 | d->selectedFiles->setSelectedItem( s); | 737 | d->selectedFiles->setSelectedItem( s); |
738 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 738 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
739 | 739 | ||
740 | } | 740 | } |
741 | 741 | ||
742 | /* | 742 | /* |
743 | reads pls and adds files/urls to playlist */ | 743 | reads pls and adds files/urls to playlist */ |
744 | void PlayListWidget::readPls( const QString &filename ) { | 744 | void PlayListWidget::readPls( const QString &filename ) { |
745 | 745 | ||
746 | qDebug( "pls filename is " + filename ); | 746 | qDebug( "pls filename is " + filename ); |
747 | Om3u *m3uList; | 747 | Om3u *m3uList; |
748 | QString s, name; | 748 | QString s, name; |
749 | m3uList = new Om3u( filename, IO_ReadOnly ); | 749 | m3uList = new Om3u( filename, IO_ReadOnly ); |
750 | m3uList->readPls(); | 750 | m3uList->readPls(); |
751 | 751 | ||
752 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 752 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
753 | s = *it; | 753 | s = *it; |
754 | // s.replace( QRegExp( "%20" )," " ); | 754 | // s.replace( QRegExp( "%20" )," " ); |
755 | DocLnk lnk( s ); | 755 | DocLnk lnk( s ); |
756 | QFileInfo f( s ); | 756 | QFileInfo f( s ); |
757 | QString name = f.baseName(); | 757 | QString name = f.baseName(); |
758 | 758 | ||
759 | if( name.left( 4 ) == "http" ) { | 759 | if( name.left( 4 ) == "http" ) { |
760 | name = s.right( s.length() - 7); | 760 | name = s.right( s.length() - 7); |
761 | } else { | 761 | } else { |
762 | name = s; | 762 | name = s; |
763 | } | 763 | } |
764 | 764 | ||
765 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 765 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
766 | 766 | ||
767 | lnk.setName( name ); | 767 | lnk.setName( name ); |
768 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | 768 | if( s.at( s.length() - 4) == '.') {// if this is probably a file |
769 | lnk.setFile( s ); | 769 | lnk.setFile( s ); |
770 | } else { //if its a url | 770 | } else { //if its a url |
771 | // if( name.right( 1 ).find( '/' ) == -1) { | 771 | // if( name.right( 1 ).find( '/' ) == -1) { |
772 | // s += "/"; | 772 | // s += "/"; |
773 | // } | 773 | // } |
774 | lnk.setFile( s ); | 774 | lnk.setFile( s ); |
775 | } | 775 | } |
776 | lnk.setType( "audio/x-mpegurl" ); | 776 | lnk.setType( "audio/x-mpegurl" ); |
777 | 777 | ||
778 | lnk.writeLink(); | 778 | lnk.writeLink(); |
779 | d->selectedFiles->addToSelection( lnk ); | 779 | d->selectedFiles->addToSelection( lnk ); |
780 | } | 780 | } |
781 | 781 | ||
782 | m3uList->close(); | 782 | m3uList->close(); |
783 | delete m3uList; | 783 | delete m3uList; |
784 | } | 784 | } |
785 | 785 | ||
786 | /* | 786 | /* |
787 | writes current playlist to current m3u file */ | 787 | writes current playlist to current m3u file */ |
788 | void PlayListWidget::writeCurrentM3u() { | 788 | void PlayListWidget::writeCurrentM3u() { |
789 | qDebug("writing to current m3u"); | 789 | qDebug("writing to current m3u"); |
790 | Config cfg( "OpiePlayer" ); | 790 | Config cfg( "OpiePlayer" ); |
791 | cfg.setGroup("PlayList"); | 791 | cfg.setGroup("PlayList"); |
792 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 792 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
793 | 793 | ||
794 | Om3u *m3uList; | 794 | Om3u *m3uList; |
795 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 795 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
796 | if( d->selectedFiles->first()) { | 796 | if( d->selectedFiles->first()) { |
797 | 797 | ||
798 | do { | 798 | do { |
799 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 799 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
800 | m3uList->add( d->selectedFiles->current()->file() ); | 800 | m3uList->add( d->selectedFiles->current()->file() ); |
801 | } | ||
802 | while ( d->selectedFiles->next() ); | ||
803 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | ||
804 | m3uList->write(); | ||
805 | m3uList->close(); | ||
801 | } | 806 | } |
802 | while ( d->selectedFiles->next() ); | ||
803 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | ||
804 | m3uList->write(); | ||
805 | m3uList->close(); | ||
806 | |||
807 | delete m3uList; | 807 | delete m3uList; |
808 | } | ||
809 | 808 | ||
810 | } | 809 | } |
811 | 810 | ||
812 | /* | 811 | /* |
813 | writes current playlist to m3u file */ | 812 | writes current playlist to m3u file */ |
814 | void PlayListWidget::writem3u() { | 813 | void PlayListWidget::writem3u() { |
815 | InputDialog *fileDlg; | 814 | InputDialog *fileDlg; |
816 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 815 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
817 | fileDlg->exec(); | 816 | fileDlg->exec(); |
818 | QString name, filename, list; | 817 | QString name, filename, list; |
819 | Om3u *m3uList; | 818 | Om3u *m3uList; |
820 | 819 | ||
821 | if( fileDlg->result() == 1 ) { | 820 | if( fileDlg->result() == 1 ) { |
822 | name = fileDlg->text(); | 821 | name = fileDlg->text(); |
823 | // qDebug( filename ); | 822 | // qDebug( filename ); |
824 | 823 | ||
825 | if( name.left( 1) != "/" ) { | 824 | if( name.left( 1) != "/" ) { |
826 | filename = QPEApplication::documentDir() + "/" + name; | 825 | filename = QPEApplication::documentDir() + "/" + name; |
827 | } | 826 | } |
828 | 827 | ||
829 | if( name.right( 3 ) != "m3u" ) { | 828 | if( name.right( 3 ) != "m3u" ) { |
830 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | 829 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; |
831 | } | 830 | } |
832 | 831 | ||
833 | if( d->selectedFiles->first()) { | 832 | if( d->selectedFiles->first()) { |
834 | m3uList = new Om3u(filename, IO_ReadWrite); | 833 | m3uList = new Om3u(filename, IO_ReadWrite); |
835 | 834 | ||
836 | do { | 835 | do { |
837 | m3uList->add( d->selectedFiles->current()->file()); | 836 | m3uList->add( d->selectedFiles->current()->file()); |
838 | } | 837 | } |
839 | while ( d->selectedFiles->next() ); | 838 | while ( d->selectedFiles->next() ); |
840 | // qDebug( list ); | 839 | // qDebug( list ); |
841 | m3uList->write(); | 840 | m3uList->write(); |
842 | m3uList->close(); | 841 | m3uList->close(); |
843 | delete m3uList; | 842 | delete m3uList; |
844 | 843 | ||
845 | delete fileDlg; | 844 | delete fileDlg; |
846 | 845 | ||
847 | DocLnk lnk; | 846 | DocLnk lnk; |
848 | lnk.setFile( filename); | 847 | lnk.setFile( filename); |
849 | lnk.setIcon("opieplayer2/playlist2"); | 848 | lnk.setIcon("opieplayer2/playlist2"); |
850 | lnk.setName( name); //sets file name | 849 | lnk.setName( name); //sets file name |
851 | 850 | ||
852 | // qDebug(filename); | 851 | // qDebug(filename); |
853 | Config config( "OpiePlayer" ); | 852 | Config config( "OpiePlayer" ); |
854 | config.setGroup( "PlayList" ); | 853 | config.setGroup( "PlayList" ); |
855 | 854 | ||
856 | config.writeEntry("CurrentPlaylist",filename); | 855 | config.writeEntry("CurrentPlaylist",filename); |
857 | currentPlayList=filename; | 856 | currentPlayList=filename; |
858 | 857 | ||
859 | if(!lnk.writeLink()) { | 858 | if(!lnk.writeLink()) { |
860 | qDebug("Writing doclink did not work"); | 859 | qDebug("Writing doclink did not work"); |
861 | } | 860 | } |
862 | 861 | ||
863 | setCaption(tr("OpiePlayer: ") + name); | 862 | setCaption(tr("OpiePlayer: ") + name); |
864 | } | 863 | } |
865 | } | 864 | } |
866 | } | 865 | } |
867 | 866 | ||
868 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 867 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
869 | switch ( e->key() ) { | 868 | switch ( e->key() ) { |
870 | ////////////////////////////// Zaurus keys | 869 | ////////////////////////////// Zaurus keys |
871 | case Key_F9: //activity | 870 | case Key_F9: //activity |
872 | // if(audioUI->isHidden()) | 871 | // if(audioUI->isHidden()) |
873 | // audioUI->showMaximized(); | 872 | // audioUI->showMaximized(); |
874 | break; | 873 | break; |
875 | case Key_F10: //contacts | 874 | case Key_F10: //contacts |
876 | // if( videoUI->isHidden()) | 875 | // if( videoUI->isHidden()) |
877 | // videoUI->showMaximized(); | 876 | // videoUI->showMaximized(); |
878 | break; | 877 | break; |
879 | case Key_F11: //menu | 878 | case Key_F11: //menu |
880 | break; | 879 | break; |
881 | case Key_F12: //home | 880 | case Key_F12: //home |
882 | // doBlank(); | 881 | // doBlank(); |
883 | break; | 882 | break; |
884 | case Key_F13: //mail | 883 | case Key_F13: //mail |
885 | // doUnblank(); | 884 | // doUnblank(); |
886 | break; | 885 | break; |
887 | case Key_Q: //add to playlist | 886 | case Key_Q: //add to playlist |
888 | addSelected(); | 887 | addSelected(); |
889 | break; | 888 | break; |
890 | case Key_R: //remove from playlist | 889 | case Key_R: //remove from playlist |
891 | removeSelected(); | 890 | removeSelected(); |
892 | break; | 891 | break; |
893 | // case Key_P: //play | 892 | // case Key_P: //play |
894 | // qDebug("Play"); | 893 | // qDebug("Play"); |
895 | // playSelected(); | 894 | // playSelected(); |
896 | // break; | 895 | // break; |
897 | case Key_Space: | 896 | case Key_Space: |
898 | // playSelected(); puh | 897 | // playSelected(); puh |
899 | break; | 898 | break; |
900 | case Key_1: | 899 | case Key_1: |
901 | tabWidget->setCurrentPage( 0 ); | 900 | tabWidget->setCurrentPage( 0 ); |
902 | break; | 901 | break; |
903 | case Key_2: | 902 | case Key_2: |
904 | tabWidget->setCurrentPage( 1 ); | 903 | tabWidget->setCurrentPage( 1 ); |
905 | break; | 904 | break; |
906 | case Key_3: | 905 | case Key_3: |
907 | tabWidget->setCurrentPage( 2 ); | 906 | tabWidget->setCurrentPage( 2 ); |
908 | break; | 907 | break; |
909 | case Key_4: | 908 | case Key_4: |
910 | tabWidget->setCurrentPage( 3 ); | 909 | tabWidget->setCurrentPage( 3 ); |
911 | break; | 910 | break; |
912 | case Key_Down: | 911 | case Key_Down: |
913 | if ( !d->selectedFiles->next() ) | 912 | if ( !d->selectedFiles->next() ) |
914 | d->selectedFiles->first(); | 913 | d->selectedFiles->first(); |
915 | break; | 914 | break; |
916 | case Key_Up: | 915 | case Key_Up: |
917 | if ( !d->selectedFiles->prev() ) | 916 | if ( !d->selectedFiles->prev() ) |
918 | // d->selectedFiles->last(); | 917 | // d->selectedFiles->last(); |
919 | break; | 918 | break; |
920 | } | 919 | } |
921 | } | 920 | } |
922 | 921 | ||
923 | void PlayListWidget::pmViewActivated(int index) { | 922 | void PlayListWidget::pmViewActivated(int index) { |
924 | // qDebug("%d", index); | 923 | // qDebug("%d", index); |
925 | switch(index) { | 924 | switch(index) { |
926 | case -16: | 925 | case -16: |
927 | { | 926 | { |
928 | mediaPlayerState.toggleFullscreen(); | 927 | mediaPlayerState.toggleFullscreen(); |
929 | bool b=mediaPlayerState.isFullscreen(); | 928 | bool b=mediaPlayerState.isFullscreen(); |
930 | pmView->setItemChecked( index, b); | 929 | pmView->setItemChecked( index, b); |
931 | Config cfg( "OpiePlayer" ); | 930 | Config cfg( "OpiePlayer" ); |
932 | cfg.writeEntry( "FullScreen", b ); | 931 | cfg.writeEntry( "FullScreen", b ); |
933 | } | 932 | } |
934 | break; | 933 | break; |
935 | }; | 934 | }; |
936 | } | 935 | } |
937 | 936 | ||
938 | void PlayListWidget::populateSkinsMenu() { | 937 | void PlayListWidget::populateSkinsMenu() { |
939 | int item = 0; | 938 | int item = 0; |
940 | defaultSkinIndex = 0; | 939 | defaultSkinIndex = 0; |
941 | QString skinName; | 940 | QString skinName; |
942 | Config cfg( "OpiePlayer" ); | 941 | Config cfg( "OpiePlayer" ); |
943 | cfg.setGroup("Options" ); | 942 | cfg.setGroup("Options" ); |
944 | QString skin = cfg.readEntry( "Skin", "default" ); | 943 | QString skin = cfg.readEntry( "Skin", "default" ); |
945 | 944 | ||
946 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 945 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
947 | skinsDir.setFilter( QDir::Dirs ); | 946 | skinsDir.setFilter( QDir::Dirs ); |
948 | skinsDir.setSorting(QDir::Name ); | 947 | skinsDir.setSorting(QDir::Name ); |
949 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 948 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
950 | QFileInfoListIterator it( *skinslist ); | 949 | QFileInfoListIterator it( *skinslist ); |
951 | QFileInfo *fi; | 950 | QFileInfo *fi; |
952 | while ( ( fi = it.current() ) ) { | 951 | while ( ( fi = it.current() ) ) { |
953 | skinName = fi->fileName(); | 952 | skinName = fi->fileName(); |
954 | // qDebug( fi->fileName() ); | 953 | // qDebug( fi->fileName() ); |
955 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 954 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
956 | item = skinsMenu->insertItem( fi->fileName() ) ; | 955 | item = skinsMenu->insertItem( fi->fileName() ) ; |
957 | } | 956 | } |
958 | if( skinName == "default" ) { | 957 | if( skinName == "default" ) { |
959 | defaultSkinIndex = item; | 958 | defaultSkinIndex = item; |
960 | } | 959 | } |
961 | if( skinName == skin ) { | 960 | if( skinName == skin ) { |
962 | skinsMenu->setItemChecked( item, TRUE ); | 961 | skinsMenu->setItemChecked( item, TRUE ); |
963 | } | 962 | } |
964 | ++it; | 963 | ++it; |
965 | } | 964 | } |
966 | } | 965 | } |
967 | 966 | ||
968 | void PlayListWidget::skinsMenuActivated( int item ) { | 967 | void PlayListWidget::skinsMenuActivated( int item ) { |
969 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 968 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
970 | skinsMenu->setItemChecked( i, FALSE ); | 969 | skinsMenu->setItemChecked( i, FALSE ); |
971 | } | 970 | } |
972 | skinsMenu->setItemChecked( item, TRUE ); | 971 | skinsMenu->setItemChecked( item, TRUE ); |
973 | 972 | ||
974 | { | 973 | { |
975 | Config cfg( "OpiePlayer" ); | 974 | Config cfg( "OpiePlayer" ); |
976 | cfg.setGroup("Options"); | 975 | cfg.setGroup("Options"); |
977 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 976 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
978 | } | 977 | } |
979 | 978 | ||
980 | emit skinSelected(); | 979 | emit skinSelected(); |
981 | } | 980 | } |
982 | 981 | ||
983 | PlayListWidget::TabType PlayListWidget::currentTab() const | 982 | PlayListWidget::TabType PlayListWidget::currentTab() const |
984 | { | 983 | { |
985 | static const TabType indexToTabType[ TabTypeCount ] = | 984 | static const TabType indexToTabType[ TabTypeCount ] = |
986 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 985 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
987 | 986 | ||
988 | int index = tabWidget->currentPageIndex(); | 987 | int index = tabWidget->currentPageIndex(); |
989 | assert( index < TabTypeCount && index >= 0 ); | 988 | assert( index < TabTypeCount && index >= 0 ); |
990 | 989 | ||
991 | return indexToTabType[ index ]; | 990 | return indexToTabType[ index ]; |
992 | } | 991 | } |
993 | 992 | ||
994 | PlayListWidget::Entry PlayListWidget::currentEntry() const | 993 | PlayListWidget::Entry PlayListWidget::currentEntry() const |
995 | { | 994 | { |
996 | if ( currentTab() == CurrentPlayList ) { | 995 | if ( currentTab() == CurrentPlayList ) { |
997 | const DocLnk *lnk = current(); | 996 | const DocLnk *lnk = current(); |
998 | return Entry( lnk->name(), lnk->file() ); | 997 | return Entry( lnk->name(), lnk->file() ); |
999 | } | 998 | } |
1000 | 999 | ||