-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index b9b63c7..26103c3 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1073,193 +1073,193 @@ void PlayListWidget::openFile() { | |||
1073 | QString filename, name; | 1073 | QString filename, name; |
1074 | InputDialog *fileDlg; | 1074 | InputDialog *fileDlg; |
1075 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1075 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1076 | fileDlg->exec(); | 1076 | fileDlg->exec(); |
1077 | if( fileDlg->result() == 1 ) { | 1077 | if( fileDlg->result() == 1 ) { |
1078 | filename = fileDlg->LineEdit1->text(); | 1078 | filename = fileDlg->LineEdit1->text(); |
1079 | // http://205.188.234.129:8030 | 1079 | // http://205.188.234.129:8030 |
1080 | // http://66.28.68.70:8000 | 1080 | // http://66.28.68.70:8000 |
1081 | // filename.replace(QRegExp("%20")," "); | 1081 | // filename.replace(QRegExp("%20")," "); |
1082 | if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { | 1082 | if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { |
1083 | QMessageBox::message("Note","Spaces in urls are not allowed."); | 1083 | QMessageBox::message("Note","Spaces in urls are not allowed."); |
1084 | return; | 1084 | return; |
1085 | } else { | 1085 | } else { |
1086 | qDebug("Selected filename is "+filename); | 1086 | qDebug("Selected filename is "+filename); |
1087 | if(filename.right(3) == "m3u") | 1087 | if(filename.right(3) == "m3u") |
1088 | readm3u( filename); | 1088 | readm3u( filename); |
1089 | else if(filename.right(3) == "pls") | 1089 | else if(filename.right(3) == "pls") |
1090 | readPls( filename); | 1090 | readPls( filename); |
1091 | else { | 1091 | else { |
1092 | DocLnk lnk; | 1092 | DocLnk lnk; |
1093 | 1093 | ||
1094 | lnk.setName(filename); //sets file name | 1094 | lnk.setName(filename); //sets file name |
1095 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | 1095 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") |
1096 | filename += "/"; | 1096 | filename += "/"; |
1097 | lnk.setFile(filename); //sets File property | 1097 | lnk.setFile(filename); //sets File property |
1098 | 1098 | ||
1099 | lnk.setType("audio/x-mpegurl"); | 1099 | lnk.setType("audio/x-mpegurl"); |
1100 | lnk.setExec("opieplayer"); | 1100 | lnk.setExec("opieplayer"); |
1101 | lnk.setIcon("opieplayer/MPEGPlayer"); | 1101 | lnk.setIcon("opieplayer/MPEGPlayer"); |
1102 | 1102 | ||
1103 | if(!lnk.writeLink()) | 1103 | if(!lnk.writeLink()) |
1104 | qDebug("Writing doclink did not work"); | 1104 | qDebug("Writing doclink did not work"); |
1105 | d->selectedFiles->addToSelection( lnk); | 1105 | d->selectedFiles->addToSelection( lnk); |
1106 | // if(fileDlg2) | 1106 | // if(fileDlg2) |
1107 | // delete fileDlg2; | 1107 | // delete fileDlg2; |
1108 | } | 1108 | } |
1109 | } | 1109 | } |
1110 | } | 1110 | } |
1111 | if(fileDlg) | 1111 | if(fileDlg) |
1112 | delete fileDlg; | 1112 | delete fileDlg; |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 1115 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
1116 | { | 1116 | { |
1117 | switch ( e->key() ) { | 1117 | switch ( e->key() ) { |
1118 | ////////////////////////////// Zaurus keys | 1118 | ////////////////////////////// Zaurus keys |
1119 | case Key_F9: //activity | 1119 | case Key_F9: //activity |
1120 | // if(audioUI->isHidden()) | 1120 | // if(audioUI->isHidden()) |
1121 | // audioUI->showMaximized(); | 1121 | // audioUI->showMaximized(); |
1122 | break; | 1122 | break; |
1123 | case Key_F10: //contacts | 1123 | case Key_F10: //contacts |
1124 | // if( videoUI->isHidden()) | 1124 | // if( videoUI->isHidden()) |
1125 | // videoUI->showMaximized(); | 1125 | // videoUI->showMaximized(); |
1126 | break; | 1126 | break; |
1127 | case Key_F11: //menu | 1127 | case Key_F11: //menu |
1128 | break; | 1128 | break; |
1129 | case Key_F12: //home | 1129 | case Key_F12: //home |
1130 | // doBlank(); | 1130 | // doBlank(); |
1131 | break; | 1131 | break; |
1132 | case Key_F13: //mail | 1132 | case Key_F13: //mail |
1133 | // doUnblank(); | 1133 | // doUnblank(); |
1134 | break; | 1134 | break; |
1135 | case Key_Q: //add to playlist | 1135 | case Key_Q: //add to playlist |
1136 | qDebug("Add"); | 1136 | qDebug("Add"); |
1137 | addSelected(); | 1137 | addSelected(); |
1138 | break; | 1138 | break; |
1139 | case Key_R: //remove from playlist | 1139 | case Key_R: //remove from playlist |
1140 | removeSelected(); | 1140 | removeSelected(); |
1141 | break; | 1141 | break; |
1142 | // case Key_P: //play | 1142 | // case Key_P: //play |
1143 | // qDebug("Play"); | 1143 | // qDebug("Play"); |
1144 | // playSelected(); | 1144 | // playSelected(); |
1145 | // break; | 1145 | // break; |
1146 | case Key_Space: | 1146 | case Key_Space: |
1147 | qDebug("Play"); | 1147 | qDebug("Play"); |
1148 | // playSelected(); puh | 1148 | // playSelected(); puh |
1149 | break; | 1149 | break; |
1150 | case Key_1: | 1150 | case Key_1: |
1151 | tabWidget->setCurrentPage(0); | 1151 | tabWidget->setCurrentPage(0); |
1152 | break; | 1152 | break; |
1153 | case Key_2: | 1153 | case Key_2: |
1154 | tabWidget->setCurrentPage(1); | 1154 | tabWidget->setCurrentPage(1); |
1155 | break; | 1155 | break; |
1156 | case Key_3: | 1156 | case Key_3: |
1157 | tabWidget->setCurrentPage(2); | 1157 | tabWidget->setCurrentPage(2); |
1158 | break; | 1158 | break; |
1159 | case Key_4: | 1159 | case Key_4: |
1160 | tabWidget->setCurrentPage(3); | 1160 | tabWidget->setCurrentPage(3); |
1161 | break; | 1161 | break; |
1162 | case Key_Down: | 1162 | case Key_Down: |
1163 | if ( !d->selectedFiles->next() ) | 1163 | if ( !d->selectedFiles->next() ) |
1164 | d->selectedFiles->first(); | 1164 | d->selectedFiles->first(); |
1165 | 1165 | ||
1166 | break; | 1166 | break; |
1167 | case Key_Up: | 1167 | case Key_Up: |
1168 | if ( !d->selectedFiles->prev() ) | 1168 | if ( !d->selectedFiles->prev() ) |
1169 | d->selectedFiles->last(); | 1169 | // d->selectedFiles->last(); |
1170 | 1170 | ||
1171 | break; | 1171 | break; |
1172 | 1172 | ||
1173 | } | 1173 | } |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | void PlayListWidget::keyPressEvent( QKeyEvent *e) | 1176 | void PlayListWidget::keyPressEvent( QKeyEvent *e) |
1177 | { | 1177 | { |
1178 | // qDebug("Key press"); | 1178 | // qDebug("Key press"); |
1179 | // switch ( e->key() ) { | 1179 | // switch ( e->key() ) { |
1180 | // ////////////////////////////// Zaurus keys | 1180 | // ////////////////////////////// Zaurus keys |
1181 | // case Key_A: //add to playlist | 1181 | // case Key_A: //add to playlist |
1182 | // qDebug("Add"); | 1182 | // qDebug("Add"); |
1183 | // addSelected(); | 1183 | // addSelected(); |
1184 | // break; | 1184 | // break; |
1185 | // case Key_R: //remove from playlist | 1185 | // case Key_R: //remove from playlist |
1186 | // removeSelected(); | 1186 | // removeSelected(); |
1187 | // break; | 1187 | // break; |
1188 | // case Key_P: //play | 1188 | // case Key_P: //play |
1189 | // qDebug("Play"); | 1189 | // qDebug("Play"); |
1190 | // playSelected(); | 1190 | // playSelected(); |
1191 | // break; | 1191 | // break; |
1192 | // case Key_Space: | 1192 | // case Key_Space: |
1193 | // qDebug("Play"); | 1193 | // qDebug("Play"); |
1194 | // playSelected(); | 1194 | // playSelected(); |
1195 | // break; | 1195 | // break; |
1196 | // } | 1196 | // } |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | void PlayListWidget::doBlank() { | 1199 | void PlayListWidget::doBlank() { |
1200 | qDebug("do blanking"); | 1200 | qDebug("do blanking"); |
1201 | fd=open("/dev/fb0",O_RDWR); | 1201 | fd=open("/dev/fb0",O_RDWR); |
1202 | if (fd != -1) { | 1202 | if (fd != -1) { |
1203 | ioctl(fd,FBIOBLANK,1); | 1203 | ioctl(fd,FBIOBLANK,1); |
1204 | // close(fd); | 1204 | // close(fd); |
1205 | } | 1205 | } |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | void PlayListWidget::doUnblank() { | 1208 | void PlayListWidget::doUnblank() { |
1209 | // this crashes opieplayer with a segfault | 1209 | // this crashes opieplayer with a segfault |
1210 | // int fd; | 1210 | // int fd; |
1211 | // fd=open("/dev/fb0",O_RDWR); | 1211 | // fd=open("/dev/fb0",O_RDWR); |
1212 | qDebug("do unblanking"); | 1212 | qDebug("do unblanking"); |
1213 | if (fd != -1) { | 1213 | if (fd != -1) { |
1214 | ioctl(fd,FBIOBLANK,0); | 1214 | ioctl(fd,FBIOBLANK,0); |
1215 | close(fd); | 1215 | close(fd); |
1216 | } | 1216 | } |
1217 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1217 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1218 | h <<-3;// v[1]; // -3 Force on | 1218 | h <<-3;// v[1]; // -3 Force on |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | void PlayListWidget::readm3u(const QString &filename) { | 1221 | void PlayListWidget::readm3u(const QString &filename) { |
1222 | 1222 | ||
1223 | qDebug("m3u filename is "+filename); | 1223 | qDebug("m3u filename is "+filename); |
1224 | QFile f(filename); | 1224 | QFile f(filename); |
1225 | 1225 | ||
1226 | if(f.open(IO_ReadOnly)) { | 1226 | if(f.open(IO_ReadOnly)) { |
1227 | QTextStream t(&f); | 1227 | QTextStream t(&f); |
1228 | QString s;//, first, second; | 1228 | QString s;//, first, second; |
1229 | int i=0; | 1229 | int i=0; |
1230 | while ( !t.atEnd()) { | 1230 | while ( !t.atEnd()) { |
1231 | // Lview->insertLine(t.readLine(),-1); | 1231 | // Lview->insertLine(t.readLine(),-1); |
1232 | s=t.readLine(); | 1232 | s=t.readLine(); |
1233 | if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { | 1233 | if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { |
1234 | QMessageBox::message("Note","Spaces in urls are not allowed."); | 1234 | QMessageBox::message("Note","Spaces in urls are not allowed."); |
1235 | } | 1235 | } |
1236 | else if(s.find("#",0,TRUE) == -1) { | 1236 | else if(s.find("#",0,TRUE) == -1) { |
1237 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1237 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1238 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1238 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1239 | s=s.right(s.length()-2); | 1239 | s=s.right(s.length()-2); |
1240 | DocLnk lnk( s ); | 1240 | DocLnk lnk( s ); |
1241 | QFileInfo f(s); | 1241 | QFileInfo f(s); |
1242 | QString name = f.baseName(); | 1242 | QString name = f.baseName(); |
1243 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1243 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1244 | lnk.setName( name); | 1244 | lnk.setName( name); |
1245 | s=s.replace( QRegExp("\\"),"/"); | 1245 | s=s.replace( QRegExp("\\"),"/"); |
1246 | lnk.setFile( s); | 1246 | lnk.setFile( s); |
1247 | lnk.writeLink(); | 1247 | lnk.writeLink(); |
1248 | // lnk.setIcon(opieplayer/MPEGPlayer); | 1248 | // lnk.setIcon(opieplayer/MPEGPlayer); |
1249 | qDebug("add "+name); | 1249 | qDebug("add "+name); |
1250 | d->selectedFiles->addToSelection( lnk); | 1250 | d->selectedFiles->addToSelection( lnk); |
1251 | } else { // is url | 1251 | } else { // is url |
1252 | 1252 | ||
1253 | s.replace(QRegExp("%20")," "); | 1253 | s.replace(QRegExp("%20")," "); |
1254 | DocLnk lnk( s); | 1254 | DocLnk lnk( s); |
1255 | QString name; | 1255 | QString name; |
1256 | if(name.left(4)=="http") | 1256 | if(name.left(4)=="http") |
1257 | name = s.right( s.length() - 7); | 1257 | name = s.right( s.length() - 7); |
1258 | else | 1258 | else |
1259 | name=s; | 1259 | name=s; |
1260 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1260 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1261 | lnk.setName(name); | 1261 | lnk.setName(name); |
1262 | if(s.at(s.length()-4) == '.') | 1262 | if(s.at(s.length()-4) == '.') |
1263 | lnk.setFile( s); | 1263 | lnk.setFile( s); |
1264 | else | 1264 | else |
1265 | lnk.setFile( s+"/"); | 1265 | lnk.setFile( s+"/"); |