author | llornkcor <llornkcor> | 2002-06-16 19:23:12 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-16 19:23:12 (UTC) |
commit | 1eca76c99326afc111efeb2bf55a306a4f37eb1e (patch) (unidiff) | |
tree | a46c4c7d373688300cafc254a1e0ca9de508609e | |
parent | b1d106338eca0c28573e2fc83c63c8ed3c76a239 (diff) | |
download | opie-1eca76c99326afc111efeb2bf55a306a4f37eb1e.zip opie-1eca76c99326afc111efeb2bf55a306a4f37eb1e.tar.gz opie-1eca76c99326afc111efeb2bf55a306a4f37eb1e.tar.bz2 |
lame attempt to deal with illegal urls
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index d7447b7..200ec16 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -867,410 +867,414 @@ void PlayListWidget::btnPlay(bool b) { | |||
867 | void PlayListWidget::deletePlaylist() { | 867 | void PlayListWidget::deletePlaylist() { |
868 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 868 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
869 | (tr("You really want to delete\nthis playlist?")), | 869 | (tr("You really want to delete\nthis playlist?")), |
870 | (tr("Yes")), (tr("No")), 0 )){ | 870 | (tr("Yes")), (tr("No")), 0 )){ |
871 | case 0: // Yes clicked, | 871 | case 0: // Yes clicked, |
872 | QFile().remove(playLists->selected()->file()); | 872 | QFile().remove(playLists->selected()->file()); |
873 | QFile().remove(playLists->selected()->linkFile()); | 873 | QFile().remove(playLists->selected()->linkFile()); |
874 | playLists->reread(); | 874 | playLists->reread(); |
875 | break; | 875 | break; |
876 | case 1: // Cancel | 876 | case 1: // Cancel |
877 | break; | 877 | break; |
878 | }; | 878 | }; |
879 | } | 879 | } |
880 | 880 | ||
881 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 881 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
882 | { | 882 | { |
883 | switch (mouse) { | 883 | switch (mouse) { |
884 | case 1: | 884 | case 1: |
885 | break; | 885 | break; |
886 | case 2:{ | 886 | case 2:{ |
887 | 887 | ||
888 | QPopupMenu m; | 888 | QPopupMenu m; |
889 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 889 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
890 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 890 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
891 | m.insertSeparator(); | 891 | m.insertSeparator(); |
892 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) | 892 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) |
893 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 893 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
894 | 894 | ||
895 | m.exec( QCursor::pos() ); | 895 | m.exec( QCursor::pos() ); |
896 | } | 896 | } |
897 | break; | 897 | break; |
898 | }; | 898 | }; |
899 | } | 899 | } |
900 | 900 | ||
901 | void PlayListWidget::playSelected() | 901 | void PlayListWidget::playSelected() |
902 | { | 902 | { |
903 | btnPlay( TRUE); | 903 | btnPlay( TRUE); |
904 | // d->selectedFiles->unSelect(); | 904 | // d->selectedFiles->unSelect(); |
905 | } | 905 | } |
906 | 906 | ||
907 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 907 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
908 | { | 908 | { |
909 | switch (mouse) { | 909 | switch (mouse) { |
910 | case 1: | 910 | case 1: |
911 | 911 | ||
912 | break; | 912 | break; |
913 | case 2:{ | 913 | case 2:{ |
914 | QPopupMenu m; | 914 | QPopupMenu m; |
915 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 915 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
916 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 916 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
917 | // m.insertSeparator(); | 917 | // m.insertSeparator(); |
918 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 918 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
919 | m.exec( QCursor::pos() ); | 919 | m.exec( QCursor::pos() ); |
920 | } | 920 | } |
921 | break; | 921 | break; |
922 | }; | 922 | }; |
923 | 923 | ||
924 | } | 924 | } |
925 | 925 | ||
926 | void PlayListWidget::listDelete() { | 926 | void PlayListWidget::listDelete() { |
927 | Config cfg( "OpiePlayer" ); | 927 | Config cfg( "OpiePlayer" ); |
928 | cfg.setGroup("PlayList"); | 928 | cfg.setGroup("PlayList"); |
929 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 929 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
930 | QString file; | 930 | QString file; |
931 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 931 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
932 | switch ( tabWidget->currentPageIndex()) { | 932 | switch ( tabWidget->currentPageIndex()) { |
933 | case 0: | 933 | case 0: |
934 | break; | 934 | break; |
935 | case 1: | 935 | case 1: |
936 | { | 936 | { |
937 | file = audioView->selectedItem()->text(0); | 937 | file = audioView->selectedItem()->text(0); |
938 | // Global::findDocuments(&files, "audio/*"); | 938 | // Global::findDocuments(&files, "audio/*"); |
939 | // AppLnkSet appFiles; | 939 | // AppLnkSet appFiles; |
940 | QListIterator<DocLnk> dit( files.children() ); | 940 | QListIterator<DocLnk> dit( files.children() ); |
941 | for ( ; dit.current(); ++dit ) { | 941 | for ( ; dit.current(); ++dit ) { |
942 | if( dit.current()->name() == file) { | 942 | if( dit.current()->name() == file) { |
943 | // qDebug(file); | 943 | // qDebug(file); |
944 | LnkProperties prop( dit.current() ); | 944 | LnkProperties prop( dit.current() ); |
945 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 945 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
946 | prop.showMaximized(); | 946 | prop.showMaximized(); |
947 | prop.exec(); | 947 | prop.exec(); |
948 | } | 948 | } |
949 | } | 949 | } |
950 | populateAudioView(); | 950 | populateAudioView(); |
951 | } | 951 | } |
952 | break; | 952 | break; |
953 | case 2: | 953 | case 2: |
954 | { | 954 | { |
955 | // file = videoView->selectedItem()->text(0); | 955 | // file = videoView->selectedItem()->text(0); |
956 | // for ( int i = 0; i < noOfFiles; i++ ) { | 956 | // for ( int i = 0; i < noOfFiles; i++ ) { |
957 | // QString entryName; | 957 | // QString entryName; |
958 | // entryName.sprintf( "File%i", i + 1 ); | 958 | // entryName.sprintf( "File%i", i + 1 ); |
959 | // QString linkFile = cfg.readEntry( entryName ); | 959 | // QString linkFile = cfg.readEntry( entryName ); |
960 | // AppLnk lnk( AppLnk(linkFile)); | 960 | // AppLnk lnk( AppLnk(linkFile)); |
961 | // if( lnk.name() == file ) { | 961 | // if( lnk.name() == file ) { |
962 | // LnkProperties prop( &lnk); | 962 | // LnkProperties prop( &lnk); |
963 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 963 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
964 | // prop.showMaximized(); | 964 | // prop.showMaximized(); |
965 | // prop.exec(); | 965 | // prop.exec(); |
966 | // } | 966 | // } |
967 | // } | 967 | // } |
968 | } | 968 | } |
969 | break; | 969 | break; |
970 | }; | 970 | }; |
971 | } | 971 | } |
972 | 972 | ||
973 | void PlayListWidget::scanForAudio() { | 973 | void PlayListWidget::scanForAudio() { |
974 | qDebug("scan for audio"); | 974 | qDebug("scan for audio"); |
975 | files.detachChildren(); | 975 | files.detachChildren(); |
976 | QListIterator<DocLnk> sdit( files.children() ); | 976 | QListIterator<DocLnk> sdit( files.children() ); |
977 | for ( ; sdit.current(); ++sdit ) { | 977 | for ( ; sdit.current(); ++sdit ) { |
978 | delete sdit.current(); | 978 | delete sdit.current(); |
979 | } | 979 | } |
980 | Global::findDocuments(&files, "audio/*"); | 980 | Global::findDocuments(&files, "audio/*"); |
981 | audioScan = TRUE; | 981 | audioScan = TRUE; |
982 | } | 982 | } |
983 | void PlayListWidget::scanForVideo() { | 983 | void PlayListWidget::scanForVideo() { |
984 | qDebug("scan for video"); | 984 | qDebug("scan for video"); |
985 | vFiles.detachChildren(); | 985 | vFiles.detachChildren(); |
986 | QListIterator<DocLnk> sdit( vFiles.children() ); | 986 | QListIterator<DocLnk> sdit( vFiles.children() ); |
987 | for ( ; sdit.current(); ++sdit ) { | 987 | for ( ; sdit.current(); ++sdit ) { |
988 | delete sdit.current(); | 988 | delete sdit.current(); |
989 | } | 989 | } |
990 | Global::findDocuments(&vFiles, "video/*"); | 990 | Global::findDocuments(&vFiles, "video/*"); |
991 | videoScan = TRUE; | 991 | videoScan = TRUE; |
992 | } | 992 | } |
993 | 993 | ||
994 | void PlayListWidget::populateAudioView() { | 994 | void PlayListWidget::populateAudioView() { |
995 | 995 | ||
996 | audioView->clear(); | 996 | audioView->clear(); |
997 | StorageInfo storageInfo; | 997 | StorageInfo storageInfo; |
998 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 998 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
999 | if(!audioScan) scanForAudio(); | 999 | if(!audioScan) scanForAudio(); |
1000 | 1000 | ||
1001 | QListIterator<DocLnk> dit( files.children() ); | 1001 | QListIterator<DocLnk> dit( files.children() ); |
1002 | QListIterator<FileSystem> it ( fs ); | 1002 | QListIterator<FileSystem> it ( fs ); |
1003 | 1003 | ||
1004 | QString storage; | 1004 | QString storage; |
1005 | for ( ; dit.current(); ++dit ) { | 1005 | for ( ; dit.current(); ++dit ) { |
1006 | for( ; it.current(); ++it ){ | 1006 | for( ; it.current(); ++it ){ |
1007 | const QString name = (*it)->name(); | 1007 | const QString name = (*it)->name(); |
1008 | const QString path = (*it)->path(); | 1008 | const QString path = (*it)->path(); |
1009 | if(dit.current()->file().find(path) != -1 ) storage=name; | 1009 | if(dit.current()->file().find(path) != -1 ) storage=name; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | QListViewItem * newItem; | 1012 | QListViewItem * newItem; |
1013 | if ( QFile( dit.current()->file()).exists() ) { | 1013 | if ( QFile( dit.current()->file()).exists() ) { |
1014 | // qDebug(dit.current()->name()); | 1014 | // qDebug(dit.current()->name()); |
1015 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1015 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1016 | QString::number( QFile( dit.current()->file()).size() ), storage); | 1016 | QString::number( QFile( dit.current()->file()).size() ), storage); |
1017 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1017 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1018 | } | 1018 | } |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void PlayListWidget::populateVideoView() { | 1023 | void PlayListWidget::populateVideoView() { |
1024 | videoView->clear(); | 1024 | videoView->clear(); |
1025 | StorageInfo storageInfo; | 1025 | StorageInfo storageInfo; |
1026 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1026 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1027 | 1027 | ||
1028 | if(!videoScan ) scanForVideo(); | 1028 | if(!videoScan ) scanForVideo(); |
1029 | 1029 | ||
1030 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1030 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
1031 | QListIterator<FileSystem> it ( fs ); | 1031 | QListIterator<FileSystem> it ( fs ); |
1032 | videoView->clear(); | 1032 | videoView->clear(); |
1033 | QString storage; | 1033 | QString storage; |
1034 | for ( ; Vdit.current(); ++Vdit ) { | 1034 | for ( ; Vdit.current(); ++Vdit ) { |
1035 | for( ; it.current(); ++it ){ | 1035 | for( ; it.current(); ++it ){ |
1036 | const QString name = (*it)->name(); | 1036 | const QString name = (*it)->name(); |
1037 | const QString path = (*it)->path(); | 1037 | const QString path = (*it)->path(); |
1038 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1038 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | QListViewItem * newItem; | 1041 | QListViewItem * newItem; |
1042 | if ( QFile( Vdit.current()->file()).exists() ) { | 1042 | if ( QFile( Vdit.current()->file()).exists() ) { |
1043 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1043 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1044 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | 1044 | QString::number( QFile( Vdit.current()->file()).size() ), storage); |
1045 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1045 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1046 | } | 1046 | } |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | void PlayListWidget::openFile() { | 1050 | void PlayListWidget::openFile() { |
1051 | QString filename, name; | 1051 | QString filename, name; |
1052 | InputDialog *fileDlg; | 1052 | InputDialog *fileDlg; |
1053 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1053 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1054 | fileDlg->exec(); | 1054 | fileDlg->exec(); |
1055 | if( fileDlg->result() == 1 ) { | 1055 | if( fileDlg->result() == 1 ) { |
1056 | filename = fileDlg->LineEdit1->text(); | 1056 | filename = fileDlg->LineEdit1->text(); |
1057 | // http://205.188.234.129:8030 | 1057 | // http://205.188.234.129:8030 |
1058 | // http://66.28.68.70:8000 | 1058 | // http://66.28.68.70:8000 |
1059 | qDebug("Selected filename is "+filename); | 1059 | filename.replace(QRegExp("%20")," "); |
1060 | |||
1061 | qDebug("Selected filename is "+filename); | ||
1060 | if(filename.right(3) == "m3u") | 1062 | if(filename.right(3) == "m3u") |
1061 | readm3u( filename); | 1063 | readm3u( filename); |
1062 | else if(filename.right(3) == "pls") | 1064 | else if(filename.right(3) == "pls") |
1063 | readPls( filename); | 1065 | readPls( filename); |
1064 | else { | 1066 | else { |
1065 | DocLnk lnk; | 1067 | DocLnk lnk; |
1066 | 1068 | ||
1067 | lnk.setName(filename); //sets file name | 1069 | lnk.setName(filename); //sets file name |
1068 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | 1070 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") |
1069 | filename += "/"; | 1071 | filename += "/"; |
1070 | lnk.setFile(filename); //sets File property | 1072 | lnk.setFile(filename); //sets File property |
1071 | 1073 | ||
1072 | lnk.setType("audio/x-mpegurl"); | 1074 | lnk.setType("audio/x-mpegurl"); |
1073 | lnk.setExec("opieplayer"); | 1075 | lnk.setExec("opieplayer"); |
1074 | lnk.setIcon("opieplayer/MPEGPlayer"); | 1076 | lnk.setIcon("opieplayer/MPEGPlayer"); |
1075 | 1077 | ||
1076 | if(!lnk.writeLink()) | 1078 | if(!lnk.writeLink()) |
1077 | qDebug("Writing doclink did not work"); | 1079 | qDebug("Writing doclink did not work"); |
1078 | d->selectedFiles->addToSelection( lnk); | 1080 | d->selectedFiles->addToSelection( lnk); |
1079 | // if(fileDlg2) | 1081 | // if(fileDlg2) |
1080 | // delete fileDlg2; | 1082 | // delete fileDlg2; |
1081 | } | 1083 | } |
1082 | } | 1084 | } |
1083 | if(fileDlg) | 1085 | if(fileDlg) |
1084 | delete fileDlg; | 1086 | delete fileDlg; |
1085 | } | 1087 | } |
1086 | 1088 | ||
1087 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 1089 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
1088 | { | 1090 | { |
1089 | switch ( e->key() ) { | 1091 | switch ( e->key() ) { |
1090 | ////////////////////////////// Zaurus keys | 1092 | ////////////////////////////// Zaurus keys |
1091 | case Key_F9: //activity | 1093 | case Key_F9: //activity |
1092 | // if(audioUI->isHidden()) | 1094 | // if(audioUI->isHidden()) |
1093 | // audioUI->showMaximized(); | 1095 | // audioUI->showMaximized(); |
1094 | break; | 1096 | break; |
1095 | case Key_F10: //contacts | 1097 | case Key_F10: //contacts |
1096 | // if( videoUI->isHidden()) | 1098 | // if( videoUI->isHidden()) |
1097 | // videoUI->showMaximized(); | 1099 | // videoUI->showMaximized(); |
1098 | break; | 1100 | break; |
1099 | case Key_F11: //menu | 1101 | case Key_F11: //menu |
1100 | break; | 1102 | break; |
1101 | case Key_F12: //home | 1103 | case Key_F12: //home |
1102 | // doBlank(); | 1104 | // doBlank(); |
1103 | break; | 1105 | break; |
1104 | case Key_F13: //mail | 1106 | case Key_F13: //mail |
1105 | // doUnblank(); | 1107 | // doUnblank(); |
1106 | break; | 1108 | break; |
1107 | case Key_Q: //add to playlist | 1109 | case Key_Q: //add to playlist |
1108 | qDebug("Add"); | 1110 | qDebug("Add"); |
1109 | addSelected(); | 1111 | addSelected(); |
1110 | break; | 1112 | break; |
1111 | case Key_R: //remove from playlist | 1113 | case Key_R: //remove from playlist |
1112 | removeSelected(); | 1114 | removeSelected(); |
1113 | break; | 1115 | break; |
1114 | // case Key_P: //play | 1116 | // case Key_P: //play |
1115 | // qDebug("Play"); | 1117 | // qDebug("Play"); |
1116 | // playSelected(); | 1118 | // playSelected(); |
1117 | // break; | 1119 | // break; |
1118 | case Key_Space: | 1120 | case Key_Space: |
1119 | qDebug("Play"); | 1121 | qDebug("Play"); |
1120 | // playSelected(); puh | 1122 | // playSelected(); puh |
1121 | break; | 1123 | break; |
1122 | case Key_1: | 1124 | case Key_1: |
1123 | tabWidget->setCurrentPage(0); | 1125 | tabWidget->setCurrentPage(0); |
1124 | break; | 1126 | break; |
1125 | case Key_2: | 1127 | case Key_2: |
1126 | tabWidget->setCurrentPage(1); | 1128 | tabWidget->setCurrentPage(1); |
1127 | break; | 1129 | break; |
1128 | case Key_3: | 1130 | case Key_3: |
1129 | tabWidget->setCurrentPage(2); | 1131 | tabWidget->setCurrentPage(2); |
1130 | break; | 1132 | break; |
1131 | case Key_4: | 1133 | case Key_4: |
1132 | tabWidget->setCurrentPage(3); | 1134 | tabWidget->setCurrentPage(3); |
1133 | break; | 1135 | break; |
1134 | } | 1136 | } |
1135 | } | 1137 | } |
1136 | 1138 | ||
1137 | void PlayListWidget::keyPressEvent( QKeyEvent *e) | 1139 | void PlayListWidget::keyPressEvent( QKeyEvent *e) |
1138 | { | 1140 | { |
1139 | // qDebug("Key press"); | 1141 | // qDebug("Key press"); |
1140 | // switch ( e->key() ) { | 1142 | // switch ( e->key() ) { |
1141 | // ////////////////////////////// Zaurus keys | 1143 | // ////////////////////////////// Zaurus keys |
1142 | // case Key_A: //add to playlist | 1144 | // case Key_A: //add to playlist |
1143 | // qDebug("Add"); | 1145 | // qDebug("Add"); |
1144 | // addSelected(); | 1146 | // addSelected(); |
1145 | // break; | 1147 | // break; |
1146 | // case Key_R: //remove from playlist | 1148 | // case Key_R: //remove from playlist |
1147 | // removeSelected(); | 1149 | // removeSelected(); |
1148 | // break; | 1150 | // break; |
1149 | // case Key_P: //play | 1151 | // case Key_P: //play |
1150 | // qDebug("Play"); | 1152 | // qDebug("Play"); |
1151 | // playSelected(); | 1153 | // playSelected(); |
1152 | // break; | 1154 | // break; |
1153 | // case Key_Space: | 1155 | // case Key_Space: |
1154 | // qDebug("Play"); | 1156 | // qDebug("Play"); |
1155 | // playSelected(); | 1157 | // playSelected(); |
1156 | // break; | 1158 | // break; |
1157 | // } | 1159 | // } |
1158 | } | 1160 | } |
1159 | 1161 | ||
1160 | void PlayListWidget::doBlank() { | 1162 | void PlayListWidget::doBlank() { |
1161 | qDebug("do blanking"); | 1163 | qDebug("do blanking"); |
1162 | fd=open("/dev/fb0",O_RDWR); | 1164 | fd=open("/dev/fb0",O_RDWR); |
1163 | if (fd != -1) { | 1165 | if (fd != -1) { |
1164 | ioctl(fd,FBIOBLANK,1); | 1166 | ioctl(fd,FBIOBLANK,1); |
1165 | // close(fd); | 1167 | // close(fd); |
1166 | } | 1168 | } |
1167 | } | 1169 | } |
1168 | 1170 | ||
1169 | void PlayListWidget::doUnblank() { | 1171 | void PlayListWidget::doUnblank() { |
1170 | // this crashes opieplayer with a segfault | 1172 | // this crashes opieplayer with a segfault |
1171 | // int fd; | 1173 | // int fd; |
1172 | // fd=open("/dev/fb0",O_RDWR); | 1174 | // fd=open("/dev/fb0",O_RDWR); |
1173 | qDebug("do unblanking"); | 1175 | qDebug("do unblanking"); |
1174 | if (fd != -1) { | 1176 | if (fd != -1) { |
1175 | ioctl(fd,FBIOBLANK,0); | 1177 | ioctl(fd,FBIOBLANK,0); |
1176 | close(fd); | 1178 | close(fd); |
1177 | } | 1179 | } |
1178 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1180 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1179 | h <<-3;// v[1]; // -3 Force on | 1181 | h <<-3;// v[1]; // -3 Force on |
1180 | } | 1182 | } |
1181 | 1183 | ||
1182 | void PlayListWidget::readm3u(const QString &filename) { | 1184 | void PlayListWidget::readm3u(const QString &filename) { |
1183 | 1185 | ||
1184 | qDebug("m3u filename is "+filename); | 1186 | qDebug("m3u filename is "+filename); |
1185 | QFile f(filename); | 1187 | QFile f(filename); |
1186 | 1188 | ||
1187 | if(f.open(IO_ReadOnly)) { | 1189 | if(f.open(IO_ReadOnly)) { |
1188 | QTextStream t(&f); | 1190 | QTextStream t(&f); |
1189 | QString s;//, first, second; | 1191 | QString s;//, first, second; |
1190 | int i=0; | 1192 | int i=0; |
1191 | while ( !t.atEnd()) { | 1193 | while ( !t.atEnd()) { |
1192 | // Lview->insertLine(t.readLine(),-1); | 1194 | // Lview->insertLine(t.readLine(),-1); |
1193 | s=t.readLine(); | 1195 | s=t.readLine(); |
1194 | if(s.find("#",0,TRUE) == -1) { | 1196 | if(s.find("#",0,TRUE) == -1) { |
1195 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1197 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1196 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1198 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1197 | s=s.right(s.length()-2); | 1199 | s=s.right(s.length()-2); |
1198 | DocLnk lnk( s ); | 1200 | DocLnk lnk( s ); |
1199 | QFileInfo f(s); | 1201 | QFileInfo f(s); |
1200 | QString name = f.baseName(); | 1202 | QString name = f.baseName(); |
1201 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1203 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1202 | lnk.setName( name); | 1204 | lnk.setName( name); |
1203 | s=s.replace( QRegExp("\\"),"/"); | 1205 | s=s.replace( QRegExp("\\"),"/"); |
1204 | lnk.setFile( s); | 1206 | lnk.setFile( s); |
1205 | // lnk.setIcon(opieplayer/MPEGPlayer); | 1207 | // lnk.setIcon(opieplayer/MPEGPlayer); |
1206 | qDebug("add "+name); | 1208 | qDebug("add "+name); |
1207 | d->selectedFiles->addToSelection( lnk); | 1209 | d->selectedFiles->addToSelection( lnk); |
1208 | } else { // is url | 1210 | } else { // is url |
1211 | s.replace(QRegExp("%20")," "); | ||
1209 | DocLnk lnk( s); | 1212 | DocLnk lnk( s); |
1210 | QString name = s.right( s.length() - 7); | 1213 | QString name = s.right( s.length() - 7); |
1211 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1214 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1212 | lnk.setName(name); | 1215 | lnk.setName(name); |
1213 | lnk.setFile( s+"/"); | 1216 | lnk.setFile( s+"/"); |
1214 | // lnk.setFile( filename); | 1217 | // lnk.setFile( filename); |
1215 | // lnk.setComment( s+"/"); | 1218 | // lnk.setComment( s+"/"); |
1216 | lnk.setType("audio/x-mpegurl"); | 1219 | lnk.setType("audio/x-mpegurl"); |
1217 | // lnk.setIcon( "opieplayer/MPEGPlayer"); | 1220 | // lnk.setIcon( "opieplayer/MPEGPlayer"); |
1218 | // qDebug("add "+s); | 1221 | // qDebug("add "+s); |
1219 | d->selectedFiles->addToSelection( lnk); | 1222 | d->selectedFiles->addToSelection( lnk); |
1220 | } | 1223 | } |
1221 | i++; | 1224 | i++; |
1222 | } | 1225 | } |
1223 | } | 1226 | } |
1224 | } | 1227 | } |
1225 | } | 1228 | } |
1226 | } | 1229 | } |
1227 | 1230 | ||
1228 | void PlayListWidget::writem3u(const QString &filename) { | 1231 | void PlayListWidget::writem3u(const QString &filename) { |
1229 | 1232 | ||
1230 | } | 1233 | } |
1231 | 1234 | ||
1232 | void PlayListWidget::readPls(const QString &filename) { | 1235 | void PlayListWidget::readPls(const QString &filename) { |
1233 | 1236 | ||
1234 | qDebug("pls filename is "+filename); | 1237 | qDebug("pls filename is "+filename); |
1235 | QFile f(filename); | 1238 | QFile f(filename); |
1236 | 1239 | ||
1237 | if(f.open(IO_ReadOnly)) { | 1240 | if(f.open(IO_ReadOnly)) { |
1238 | QTextStream t(&f); | 1241 | QTextStream t(&f); |
1239 | QString s;//, first, second; | 1242 | QString s;//, first, second; |
1240 | int i=0; | 1243 | int i=0; |
1241 | while ( !t.atEnd()) { | 1244 | while ( !t.atEnd()) { |
1242 | s=t.readLine(); | 1245 | s=t.readLine(); |
1243 | if(s.left(4) == "File") { | 1246 | if(s.left(4) == "File") { |
1244 | s=s.right(s.length() - 6); | 1247 | s=s.right(s.length() - 6); |
1248 | s.replace(QRegExp("%20")," "); | ||
1245 | qDebug("adding "+s+" to playlist"); | 1249 | qDebug("adding "+s+" to playlist"); |
1246 | // numberofentries=2 | 1250 | // numberofentries=2 |
1247 | // File1=http | 1251 | // File1=http |
1248 | // Title | 1252 | // Title |
1249 | // Length | 1253 | // Length |
1250 | // Version | 1254 | // Version |
1251 | // File2=http | 1255 | // File2=http |
1252 | 1256 | ||
1253 | s=s.replace( QRegExp("\\"),"/"); | 1257 | s=s.replace( QRegExp("\\"),"/"); |
1254 | // Lview->insertLine(t.readLine(),-1); | 1258 | // Lview->insertLine(t.readLine(),-1); |
1255 | // s=t.readLine(); | 1259 | // s=t.readLine(); |
1256 | // s=s.right(s.length()-2); | 1260 | // s=s.right(s.length()-2); |
1257 | DocLnk lnk( s ); | 1261 | DocLnk lnk( s ); |
1258 | QFileInfo f(s); | 1262 | QFileInfo f(s); |
1259 | QString name = f.baseName(); | 1263 | QString name = f.baseName(); |
1260 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1264 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1261 | // QFileInfo f(s); | 1265 | // QFileInfo f(s); |
1262 | // QString name = f.baseName(); | 1266 | // QString name = f.baseName(); |
1263 | // // name = name.left(name.length()-4); | 1267 | // // name = name.left(name.length()-4); |
1264 | // name = name.right(name.findRev("/",0,TRUE)); | 1268 | // name = name.right(name.findRev("/",0,TRUE)); |
1265 | lnk.setName( name); | 1269 | lnk.setName( name); |
1266 | lnk.setFile( s+"/"); | 1270 | lnk.setFile( s+"/"); |
1267 | lnk.setType("audio/x-mpegurl"); | 1271 | lnk.setType("audio/x-mpegurl"); |
1268 | 1272 | ||
1269 | qDebug("DocLnk add "+name); | 1273 | qDebug("DocLnk add "+name); |
1270 | d->selectedFiles->addToSelection( lnk); | 1274 | d->selectedFiles->addToSelection( lnk); |
1271 | } | 1275 | } |
1272 | } | 1276 | } |
1273 | i++; | 1277 | i++; |
1274 | } | 1278 | } |
1275 | } | 1279 | } |
1276 | 1280 | ||