-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 9918eeb..ce9faac 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -768,403 +768,403 @@ void PlayListWidget::populateVideoView() { | |||
768 | if(!videoScan ) { | 768 | if(!videoScan ) { |
769 | scanForVideo(); | 769 | scanForVideo(); |
770 | } | 770 | } |
771 | 771 | ||
772 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 772 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
773 | // QListIterator<FileSystem> it ( fs ); | 773 | // QListIterator<FileSystem> it ( fs ); |
774 | videoView->clear(); | 774 | videoView->clear(); |
775 | QString storage, pathName; | 775 | QString storage, pathName; |
776 | for ( ; Vdit.current(); ++Vdit ) { | 776 | for ( ; Vdit.current(); ++Vdit ) { |
777 | // // for( ; it.current(); ++it ) { | 777 | // // for( ; it.current(); ++it ) { |
778 | // const QString name = (*Vdit)->name(); | 778 | // const QString name = (*Vdit)->name(); |
779 | // const QString path = (*Vdit)->path(); | 779 | // const QString path = (*Vdit)->path(); |
780 | // if( Vdit.current()->file().find(path) != -1 ) { | 780 | // if( Vdit.current()->file().find(path) != -1 ) { |
781 | // storage=name; | 781 | // storage=name; |
782 | // pathName=path; | 782 | // pathName=path; |
783 | // // } | 783 | // // } |
784 | // } | 784 | // } |
785 | 785 | ||
786 | QListViewItem * newItem; | 786 | QListViewItem * newItem; |
787 | if ( QFile( Vdit.current()->file() ).exists() ) { | 787 | if ( QFile( Vdit.current()->file() ).exists() ) { |
788 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 788 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
789 | QString::number( QFile( Vdit.current()->file() ).size() ), | 789 | QString::number( QFile( Vdit.current()->file() ).size() ), |
790 | ""/*storage*/, Vdit.current()->file()); | 790 | ""/*storage*/, Vdit.current()->file()); |
791 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 791 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
792 | } | 792 | } |
793 | } | 793 | } |
794 | videoPopulated=true; | 794 | videoPopulated=true; |
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
798 | void PlayListWidget::openFile() { | 798 | void PlayListWidget::openFile() { |
799 | // http://66.28.164.33:2080 | 799 | // http://66.28.164.33:2080 |
800 | // http://somafm.com/star0242.m3u | 800 | // http://somafm.com/star0242.m3u |
801 | QString filename, name; | 801 | QString filename, name; |
802 | InputDialog *fileDlg; | 802 | InputDialog *fileDlg; |
803 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 803 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
804 | fileDlg->exec(); | 804 | fileDlg->exec(); |
805 | if( fileDlg->result() == 1 ) { | 805 | if( fileDlg->result() == 1 ) { |
806 | filename = fileDlg->text(); | 806 | filename = fileDlg->text(); |
807 | qDebug( "Selected filename is " + filename ); | 807 | qDebug( "Selected filename is " + filename ); |
808 | // Om3u *m3uList; | 808 | // Om3u *m3uList; |
809 | DocLnk lnk; | 809 | DocLnk lnk; |
810 | Config cfg( "OpiePlayer" ); | 810 | Config cfg( "OpiePlayer" ); |
811 | cfg.setGroup("PlayList"); | 811 | cfg.setGroup("PlayList"); |
812 | 812 | ||
813 | if(filename.left(4) == "http") { | 813 | if(filename.left(4) == "http") { |
814 | QString m3uFile, m3uFilePath; | 814 | QString m3uFile, m3uFilePath; |
815 | if(filename.find(":",8,TRUE) != -1) { //found a port | 815 | if(filename.find(":",8,TRUE) != -1) { //found a port |
816 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 816 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
817 | m3uFile = m3uFile.right( 7); | 817 | m3uFile = m3uFile.right( 7); |
818 | } else if(filename.left(4) == "http"){ | 818 | } else if(filename.left(4) == "http"){ |
819 | m3uFile=filename; | 819 | m3uFile=filename; |
820 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 820 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
821 | } else{ | 821 | } else{ |
822 | m3uFile=filename; | 822 | m3uFile=filename; |
823 | } | 823 | } |
824 | 824 | ||
825 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 825 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
826 | lnk.setName( filename ); //sets name | 826 | lnk.setName( filename ); //sets name |
827 | lnk.setFile( filename ); //sets file name | 827 | lnk.setFile( filename ); //sets file name |
828 | 828 | ||
829 | // lnk.setIcon("opieplayer2/musicfile"); | 829 | // lnk.setIcon("opieplayer2/musicfile"); |
830 | 830 | ||
831 | d->selectedFiles->addToSelection( lnk ); | 831 | d->selectedFiles->addToSelection( lnk ); |
832 | writeCurrentM3u(); | 832 | writeCurrentM3u(); |
833 | d->selectedFiles->setSelectedItem( lnk.name()); | 833 | d->selectedFiles->setSelectedItem( lnk.name()); |
834 | } | 834 | } |
835 | else if( filename.right( 3) == "m3u" ) { | 835 | else if( filename.right( 3) == "m3u" ) { |
836 | readm3u( filename ); | 836 | readm3u( filename ); |
837 | 837 | ||
838 | } else if( filename.right(3) == "pls" ) { | 838 | } else if( filename.right(3) == "pls" ) { |
839 | readPls( filename ); | 839 | readPls( filename ); |
840 | } else { | 840 | } else { |
841 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 841 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
842 | lnk.setFile( filename ); //sets file name | 842 | lnk.setFile( filename ); //sets file name |
843 | d->selectedFiles->addToSelection( lnk); | 843 | d->selectedFiles->addToSelection( lnk); |
844 | writeCurrentM3u(); | 844 | writeCurrentM3u(); |
845 | d->selectedFiles->setSelectedItem( lnk.name()); | 845 | d->selectedFiles->setSelectedItem( lnk.name()); |
846 | } | 846 | } |
847 | } | 847 | } |
848 | 848 | ||
849 | if( fileDlg ) { | 849 | if( fileDlg ) { |
850 | delete fileDlg; | 850 | delete fileDlg; |
851 | } | 851 | } |
852 | } | 852 | } |
853 | 853 | ||
854 | /* | 854 | /* |
855 | reads m3u and shows files/urls to playlist widget */ | 855 | reads m3u and shows files/urls to playlist widget */ |
856 | void PlayListWidget::readm3u( const QString &filename ) { | 856 | void PlayListWidget::readm3u( const QString &filename ) { |
857 | qDebug( "read m3u filename " + filename ); | 857 | qDebug( "read m3u filename " + filename ); |
858 | 858 | ||
859 | Om3u *m3uList; | 859 | Om3u *m3uList; |
860 | QString s, name; | 860 | QString s, name; |
861 | m3uList = new Om3u( filename, IO_ReadOnly ); | 861 | m3uList = new Om3u( filename, IO_ReadOnly ); |
862 | m3uList->readM3u(); | 862 | m3uList->readM3u(); |
863 | DocLnk lnk; | 863 | DocLnk lnk; |
864 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 864 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
865 | s = *it; | 865 | s = *it; |
866 | // qDebug("reading "+ s); | 866 | // qDebug("reading "+ s); |
867 | if(s.left(4)=="http") { | 867 | if(s.left(4)=="http") { |
868 | lnk.setName( s ); //sets file name | 868 | lnk.setName( s ); //sets file name |
869 | lnk.setIcon("opieplayer2/musicfile"); | 869 | lnk.setIcon("opieplayer2/musicfile"); |
870 | lnk.setFile( s ); //sets file name | 870 | lnk.setFile( s ); //sets file name |
871 | 871 | ||
872 | } else { | 872 | } else { |
873 | // if( QFileInfo( s ).exists() ) { | 873 | // if( QFileInfo( s ).exists() ) { |
874 | lnk.setName( QFileInfo(s).baseName()); | 874 | lnk.setName( QFileInfo(s).baseName()); |
875 | // if(s.right(4) == '.') {//if regular file | 875 | // if(s.right(4) == '.') {//if regular file |
876 | if(s.left(1) != "/") { | 876 | if(s.left(1) != "/") { |
877 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 877 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
878 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 878 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
879 | // lnk.setIcon(MimeType(s).pixmap() ); | 879 | // lnk.setIcon(MimeType(s).pixmap() ); |
880 | // lnk.setIcon("SoundPlayer"); | 880 | // lnk.setIcon("SoundPlayer"); |
881 | } else { | 881 | } else { |
882 | // qDebug("set link2 "+s); | 882 | // qDebug("set link2 "+s); |
883 | lnk.setFile( s); | 883 | lnk.setFile( s); |
884 | // lnk.setIcon(MimeType(s).pixmap() ); | 884 | // lnk.setIcon(MimeType(s).pixmap() ); |
885 | // lnk.setIcon("SoundPlayer"); | 885 | // lnk.setIcon("SoundPlayer"); |
886 | } | 886 | } |
887 | } | 887 | } |
888 | d->selectedFiles->addToSelection( lnk ); | 888 | d->selectedFiles->addToSelection( lnk ); |
889 | } | 889 | } |
890 | Config config( "OpiePlayer" ); | 890 | Config config( "OpiePlayer" ); |
891 | config.setGroup( "PlayList" ); | 891 | config.setGroup( "PlayList" ); |
892 | 892 | ||
893 | config.writeEntry("CurrentPlaylist",filename); | 893 | config.writeEntry("CurrentPlaylist",filename); |
894 | config.write(); | 894 | config.write(); |
895 | currentPlayList=filename; | 895 | currentPlayList=filename; |
896 | 896 | ||
897 | // m3uList->write(); | 897 | // m3uList->write(); |
898 | m3uList->close(); | 898 | m3uList->close(); |
899 | if(m3uList) delete m3uList; | 899 | if(m3uList) delete m3uList; |
900 | 900 | ||
901 | d->selectedFiles->setSelectedItem( s); | 901 | d->selectedFiles->setSelectedItem( s); |
902 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 902 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
903 | 903 | ||
904 | } | 904 | } |
905 | 905 | ||
906 | /* | 906 | /* |
907 | reads pls and adds files/urls to playlist */ | 907 | reads pls and adds files/urls to playlist */ |
908 | void PlayListWidget::readPls( const QString &filename ) { | 908 | void PlayListWidget::readPls( const QString &filename ) { |
909 | 909 | ||
910 | qDebug( "pls filename is " + filename ); | 910 | qDebug( "pls filename is " + filename ); |
911 | Om3u *m3uList; | 911 | Om3u *m3uList; |
912 | QString s, name; | 912 | QString s, name; |
913 | m3uList = new Om3u( filename, IO_ReadOnly ); | 913 | m3uList = new Om3u( filename, IO_ReadOnly ); |
914 | m3uList->readPls(); | 914 | m3uList->readPls(); |
915 | 915 | ||
916 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 916 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
917 | s = *it; | 917 | s = *it; |
918 | // s.replace( QRegExp( "%20" )," " ); | 918 | // s.replace( QRegExp( "%20" )," " ); |
919 | DocLnk lnk( s ); | 919 | DocLnk lnk( s ); |
920 | QFileInfo f( s ); | 920 | QFileInfo f( s ); |
921 | QString name = f.baseName(); | 921 | QString name = f.baseName(); |
922 | 922 | ||
923 | if( name.left( 4 ) == "http" ) { | 923 | if( name.left( 4 ) == "http" ) { |
924 | name = s.right( s.length() - 7); | 924 | name = s.right( s.length() - 7); |
925 | } else { | 925 | } else { |
926 | name = s; | 926 | name = s; |
927 | } | 927 | } |
928 | 928 | ||
929 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 929 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
930 | 930 | ||
931 | lnk.setName( name ); | 931 | lnk.setName( name ); |
932 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | 932 | if( s.at( s.length() - 4) == '.') {// if this is probably a file |
933 | lnk.setFile( s ); | 933 | lnk.setFile( s ); |
934 | } else { //if its a url | 934 | } else { //if its a url |
935 | // if( name.right( 1 ).find( '/' ) == -1) { | 935 | // if( name.right( 1 ).find( '/' ) == -1) { |
936 | // s += "/"; | 936 | // s += "/"; |
937 | // } | 937 | // } |
938 | lnk.setFile( s ); | 938 | lnk.setFile( s ); |
939 | } | 939 | } |
940 | lnk.setType( "audio/x-mpegurl" ); | 940 | lnk.setType( "audio/x-mpegurl" ); |
941 | 941 | ||
942 | lnk.writeLink(); | 942 | lnk.writeLink(); |
943 | d->selectedFiles->addToSelection( lnk ); | 943 | d->selectedFiles->addToSelection( lnk ); |
944 | } | 944 | } |
945 | 945 | ||
946 | m3uList->close(); | 946 | m3uList->close(); |
947 | if(m3uList) delete m3uList; | 947 | if(m3uList) delete m3uList; |
948 | } | 948 | } |
949 | 949 | ||
950 | /* | 950 | /* |
951 | writes current playlist to current m3u file */ | 951 | writes current playlist to current m3u file */ |
952 | void PlayListWidget::writeCurrentM3u() { | 952 | void PlayListWidget::writeCurrentM3u() { |
953 | qDebug("writing to current m3u"); | 953 | qDebug("writing to current m3u"); |
954 | Config cfg( "OpiePlayer" ); | 954 | Config cfg( "OpiePlayer" ); |
955 | cfg.setGroup("PlayList"); | 955 | cfg.setGroup("PlayList"); |
956 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 956 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
957 | 957 | ||
958 | Om3u *m3uList; | 958 | Om3u *m3uList; |
959 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 959 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
960 | if( d->selectedFiles->first()) { | 960 | if( d->selectedFiles->first()) { |
961 | 961 | ||
962 | do { | 962 | do { |
963 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 963 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
964 | m3uList->add( d->selectedFiles->current()->file() ); | 964 | m3uList->add( d->selectedFiles->current()->file() ); |
965 | } | 965 | } |
966 | while ( d->selectedFiles->next() ); | 966 | while ( d->selectedFiles->next() ); |
967 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 967 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
968 | m3uList->write(); | 968 | m3uList->write(); |
969 | m3uList->close(); | 969 | m3uList->close(); |
970 | 970 | ||
971 | if(m3uList) delete m3uList; | 971 | if(m3uList) delete m3uList; |
972 | } | 972 | } |
973 | 973 | ||
974 | } | 974 | } |
975 | 975 | ||
976 | /* | 976 | /* |
977 | writes current playlist to m3u file */ | 977 | writes current playlist to m3u file */ |
978 | void PlayListWidget::writem3u() { | 978 | void PlayListWidget::writem3u() { |
979 | InputDialog *fileDlg; | 979 | InputDialog *fileDlg; |
980 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 980 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
981 | fileDlg->exec(); | 981 | fileDlg->exec(); |
982 | QString name, filename, list; | 982 | QString name, filename, list; |
983 | Om3u *m3uList; | 983 | Om3u *m3uList; |
984 | 984 | ||
985 | if( fileDlg->result() == 1 ) { | 985 | if( fileDlg->result() == 1 ) { |
986 | name = fileDlg->text(); | 986 | name = fileDlg->text(); |
987 | // qDebug( filename ); | 987 | // qDebug( filename ); |
988 | 988 | ||
989 | if( name.left( 1) != "/" ) { | 989 | if( name.left( 1) != "/" ) { |
990 | filename = QPEApplication::documentDir() + "/" + name; | 990 | filename = QPEApplication::documentDir() + "/" + name; |
991 | } | 991 | } |
992 | 992 | ||
993 | if( name.right( 3 ) != "m3u" ) { | 993 | if( name.right( 3 ) != "m3u" ) { |
994 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | 994 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; |
995 | } | 995 | } |
996 | 996 | ||
997 | if( d->selectedFiles->first()) { | 997 | if( d->selectedFiles->first()) { |
998 | m3uList = new Om3u(filename, IO_ReadWrite); | 998 | m3uList = new Om3u(filename, IO_ReadWrite); |
999 | 999 | ||
1000 | do { | 1000 | do { |
1001 | m3uList->add( d->selectedFiles->current()->file()); | 1001 | m3uList->add( d->selectedFiles->current()->file()); |
1002 | } | 1002 | } |
1003 | while ( d->selectedFiles->next() ); | 1003 | while ( d->selectedFiles->next() ); |
1004 | // qDebug( list ); | 1004 | // qDebug( list ); |
1005 | m3uList->write(); | 1005 | m3uList->write(); |
1006 | m3uList->close(); | 1006 | m3uList->close(); |
1007 | if(m3uList) delete m3uList; | 1007 | if(m3uList) delete m3uList; |
1008 | 1008 | ||
1009 | if(fileDlg) delete fileDlg; | 1009 | if(fileDlg) delete fileDlg; |
1010 | 1010 | ||
1011 | DocLnk lnk; | 1011 | DocLnk lnk; |
1012 | lnk.setFile( filename); | 1012 | lnk.setFile( filename); |
1013 | lnk.setIcon("opieplayer2/playlist2"); | 1013 | lnk.setIcon("opieplayer2/playlist2"); |
1014 | lnk.setName( name); //sets file name | 1014 | lnk.setName( name); //sets file name |
1015 | 1015 | ||
1016 | // qDebug(filename); | 1016 | // qDebug(filename); |
1017 | Config config( "OpiePlayer" ); | 1017 | Config config( "OpiePlayer" ); |
1018 | config.setGroup( "PlayList" ); | 1018 | config.setGroup( "PlayList" ); |
1019 | 1019 | ||
1020 | config.writeEntry("CurrentPlaylist",filename); | 1020 | config.writeEntry("CurrentPlaylist",filename); |
1021 | currentPlayList=filename; | 1021 | currentPlayList=filename; |
1022 | 1022 | ||
1023 | if(!lnk.writeLink()) { | 1023 | if(!lnk.writeLink()) { |
1024 | qDebug("Writing doclink did not work"); | 1024 | qDebug("Writing doclink did not work"); |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | setCaption(tr("OpiePlayer: ") + name); | 1027 | setCaption(tr("OpiePlayer: ") + name); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 1032 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
1033 | switch ( e->key() ) { | 1033 | switch ( e->key() ) { |
1034 | ////////////////////////////// Zaurus keys | 1034 | ////////////////////////////// Zaurus keys |
1035 | case Key_F9: //activity | 1035 | case Key_F9: //activity |
1036 | // if(audioUI->isHidden()) | 1036 | // if(audioUI->isHidden()) |
1037 | // audioUI->showMaximized(); | 1037 | // audioUI->showMaximized(); |
1038 | break; | 1038 | break; |
1039 | case Key_F10: //contacts | 1039 | case Key_F10: //contacts |
1040 | // if( videoUI->isHidden()) | 1040 | // if( videoUI->isHidden()) |
1041 | // videoUI->showMaximized(); | 1041 | // videoUI->showMaximized(); |
1042 | break; | 1042 | break; |
1043 | case Key_F11: //menu | 1043 | case Key_F11: //menu |
1044 | break; | 1044 | break; |
1045 | case Key_F12: //home | 1045 | case Key_F12: //home |
1046 | // doBlank(); | 1046 | // doBlank(); |
1047 | break; | 1047 | break; |
1048 | case Key_F13: //mail | 1048 | case Key_F13: //mail |
1049 | // doUnblank(); | 1049 | // doUnblank(); |
1050 | break; | 1050 | break; |
1051 | case Key_Q: //add to playlist | 1051 | case Key_Q: //add to playlist |
1052 | addSelected(); | 1052 | addSelected(); |
1053 | break; | 1053 | break; |
1054 | case Key_R: //remove from playlist | 1054 | case Key_R: //remove from playlist |
1055 | removeSelected(); | 1055 | removeSelected(); |
1056 | break; | 1056 | break; |
1057 | // case Key_P: //play | 1057 | // case Key_P: //play |
1058 | // qDebug("Play"); | 1058 | // qDebug("Play"); |
1059 | // playSelected(); | 1059 | // playSelected(); |
1060 | // break; | 1060 | // break; |
1061 | case Key_Space: | 1061 | case Key_Space: |
1062 | // playSelected(); puh | 1062 | // playSelected(); puh |
1063 | break; | 1063 | break; |
1064 | case Key_1: | 1064 | case Key_1: |
1065 | tabWidget->setCurrentPage( 0 ); | 1065 | tabWidget->setCurrentPage( 0 ); |
1066 | break; | 1066 | break; |
1067 | case Key_2: | 1067 | case Key_2: |
1068 | tabWidget->setCurrentPage( 1 ); | 1068 | tabWidget->setCurrentPage( 1 ); |
1069 | break; | 1069 | break; |
1070 | case Key_3: | 1070 | case Key_3: |
1071 | tabWidget->setCurrentPage( 2 ); | 1071 | tabWidget->setCurrentPage( 2 ); |
1072 | break; | 1072 | break; |
1073 | case Key_4: | 1073 | case Key_4: |
1074 | tabWidget->setCurrentPage( 3 ); | 1074 | tabWidget->setCurrentPage( 3 ); |
1075 | break; | 1075 | break; |
1076 | case Key_Down: | 1076 | case Key_Down: |
1077 | if ( !d->selectedFiles->next() ) | 1077 | if ( !d->selectedFiles->next() ) |
1078 | d->selectedFiles->first(); | 1078 | d->selectedFiles->first(); |
1079 | break; | 1079 | break; |
1080 | case Key_Up: | 1080 | case Key_Up: |
1081 | if ( !d->selectedFiles->prev() ) | 1081 | if ( !d->selectedFiles->prev() ) |
1082 | // d->selectedFiles->last(); | 1082 | // d->selectedFiles->last(); |
1083 | break; | 1083 | break; |
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | void PlayListWidget::pmViewActivated(int index) { | 1087 | void PlayListWidget::pmViewActivated(int index) { |
1088 | // qDebug("%d", index); | 1088 | // qDebug("%d", index); |
1089 | switch(index) { | 1089 | switch(index) { |
1090 | case -16: | 1090 | case -16: |
1091 | { | 1091 | { |
1092 | mediaPlayerState->toggleFullscreen(); | 1092 | mediaPlayerState->toggleFullscreen(); |
1093 | bool b=mediaPlayerState->isFullscreen(); | 1093 | bool b=mediaPlayerState->isFullscreen(); |
1094 | pmView->setItemChecked( index, b); | 1094 | pmView->setItemChecked( index, b); |
1095 | Config cfg( "OpiePlayer" ); | 1095 | Config cfg( "OpiePlayer" ); |
1096 | cfg.writeEntry( "FullScreen", b ); | 1096 | cfg.writeEntry( "FullScreen", b ); |
1097 | } | 1097 | } |
1098 | break; | 1098 | break; |
1099 | }; | 1099 | }; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | void PlayListWidget::populateSkinsMenu() { | 1102 | void PlayListWidget::populateSkinsMenu() { |
1103 | int item = 0; | 1103 | int item = 0; |
1104 | defaultSkinIndex = 0; | 1104 | defaultSkinIndex = 0; |
1105 | QString skinName; | 1105 | QString skinName; |
1106 | Config cfg( "OpiePlayer" ); | 1106 | Config cfg( "OpiePlayer" ); |
1107 | cfg.setGroup("Options" ); | 1107 | cfg.setGroup("Options" ); |
1108 | QString skin = cfg.readEntry( "Skin", "default" ); | 1108 | QString skin = cfg.readEntry( "Skin", "default" ); |
1109 | 1109 | ||
1110 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1110 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1111 | skinsDir.setFilter( QDir::Dirs ); | 1111 | skinsDir.setFilter( QDir::Dirs ); |
1112 | skinsDir.setSorting(QDir::Name ); | 1112 | skinsDir.setSorting(QDir::Name ); |
1113 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1113 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1114 | QFileInfoListIterator it( *skinslist ); | 1114 | QFileInfoListIterator it( *skinslist ); |
1115 | QFileInfo *fi; | 1115 | QFileInfo *fi; |
1116 | while ( ( fi = it.current() ) ) { | 1116 | while ( ( fi = it.current() ) ) { |
1117 | skinName = fi->fileName(); | 1117 | skinName = fi->fileName(); |
1118 | // qDebug( fi->fileName() ); | 1118 | // qDebug( fi->fileName() ); |
1119 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1119 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1120 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1120 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1121 | } | 1121 | } |
1122 | if( skinName == "default" ) { | 1122 | if( skinName == "default" ) { |
1123 | defaultSkinIndex = item; | 1123 | defaultSkinIndex = item; |
1124 | } | 1124 | } |
1125 | if( skinName == skin ) { | 1125 | if( skinName == skin ) { |
1126 | skinsMenu->setItemChecked( item, TRUE ); | 1126 | skinsMenu->setItemChecked( item, TRUE ); |
1127 | } | 1127 | } |
1128 | ++it; | 1128 | ++it; |
1129 | } | 1129 | } |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | void PlayListWidget::skinsMenuActivated( int item ) { | 1132 | void PlayListWidget::skinsMenuActivated( int item ) { |
1133 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1133 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1134 | skinsMenu->setItemChecked( i, FALSE ); | 1134 | skinsMenu->setItemChecked( i, FALSE ); |
1135 | } | 1135 | } |
1136 | skinsMenu->setItemChecked( item, TRUE ); | 1136 | skinsMenu->setItemChecked( item, TRUE ); |
1137 | 1137 | ||
1138 | Config cfg( "OpiePlayer" ); | 1138 | Config cfg( "OpiePlayer" ); |
1139 | cfg.setGroup("Options"); | 1139 | cfg.setGroup("Options"); |
1140 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1140 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1141 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1141 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1142 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1142 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | int PlayListWidget::whichList() { | 1145 | int PlayListWidget::whichList() { |
1146 | return tabWidget->currentPageIndex(); | 1146 | return tabWidget->currentPageIndex(); |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | PlayListWidget::TabType PlayListWidget::currentTab() const | 1149 | PlayListWidget::TabType PlayListWidget::currentTab() const |
1150 | { | 1150 | { |
1151 | static const TabType indexToTabType[ NumTabTypes ] = | 1151 | static const TabType indexToTabType[ NumTabTypes ] = |
1152 | { CurrentPlaylist, AudioFiles, VideoFiles, PlayLists }; | 1152 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
1153 | 1153 | ||
1154 | int index = tabWidget->currentPageIndex(); | 1154 | int index = tabWidget->currentPageIndex(); |
1155 | assert( index < NumTabTypes && index >= 0 ); | 1155 | assert( index < NumTabTypes && index >= 0 ); |
1156 | 1156 | ||
1157 | return indexToTabType[ index ]; | 1157 | return indexToTabType[ index ]; |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | QString PlayListWidget::currentFileListPathName() { | 1160 | QString PlayListWidget::currentFileListPathName() { |
1161 | switch (whichList()) { | 1161 | switch (whichList()) { |
1162 | case 1: | 1162 | case 1: |
1163 | return audioView->currentItem()->text(3); | 1163 | return audioView->currentItem()->text(3); |
1164 | break; | 1164 | break; |
1165 | case 2: | 1165 | case 2: |
1166 | return videoView->currentItem()->text(3); | 1166 | return videoView->currentItem()->text(3); |
1167 | break; | 1167 | break; |
1168 | }; | 1168 | }; |
1169 | return ""; | 1169 | return ""; |
1170 | } | 1170 | } |