summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 4926287..b9b63c7 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1108,102 +1108,113 @@ void PlayListWidget::openFile() {
1108 } 1108 }
1109 } 1109 }
1110 } 1110 }
1111 if(fileDlg) 1111 if(fileDlg)
1112 delete fileDlg; 1112 delete fileDlg;
1113} 1113}
1114 1114
1115void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 1115void 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:
1163 if ( !d->selectedFiles->next() )
1164 d->selectedFiles->first();
1165
1166 break;
1167 case Key_Up:
1168 if ( !d->selectedFiles->prev() )
1169 d->selectedFiles->last();
1170
1171 break;
1172
1162 } 1173 }
1163} 1174}
1164 1175
1165void PlayListWidget::keyPressEvent( QKeyEvent *e) 1176void PlayListWidget::keyPressEvent( QKeyEvent *e)
1166{ 1177{
1167// qDebug("Key press"); 1178// qDebug("Key press");
1168// switch ( e->key() ) { 1179// switch ( e->key() ) {
1169// ////////////////////////////// Zaurus keys 1180// ////////////////////////////// Zaurus keys
1170// case Key_A: //add to playlist 1181// case Key_A: //add to playlist
1171// qDebug("Add"); 1182// qDebug("Add");
1172// addSelected(); 1183// addSelected();
1173// break; 1184// break;
1174// case Key_R: //remove from playlist 1185// case Key_R: //remove from playlist
1175// removeSelected(); 1186// removeSelected();
1176// break; 1187// break;
1177// case Key_P: //play 1188// case Key_P: //play
1178// qDebug("Play"); 1189// qDebug("Play");
1179// playSelected(); 1190// playSelected();
1180// break; 1191// break;
1181// case Key_Space: 1192// case Key_Space:
1182// qDebug("Play"); 1193// qDebug("Play");
1183// playSelected(); 1194// playSelected();
1184// break; 1195// break;
1185// } 1196// }
1186} 1197}
1187 1198
1188void PlayListWidget::doBlank() { 1199void PlayListWidget::doBlank() {
1189 qDebug("do blanking"); 1200 qDebug("do blanking");
1190 fd=open("/dev/fb0",O_RDWR); 1201 fd=open("/dev/fb0",O_RDWR);
1191 if (fd != -1) { 1202 if (fd != -1) {
1192 ioctl(fd,FBIOBLANK,1); 1203 ioctl(fd,FBIOBLANK,1);
1193// close(fd); 1204// close(fd);
1194 } 1205 }
1195} 1206}
1196 1207
1197void PlayListWidget::doUnblank() { 1208void PlayListWidget::doUnblank() {
1198 // this crashes opieplayer with a segfault 1209 // this crashes opieplayer with a segfault
1199// int fd; 1210// int fd;
1200// fd=open("/dev/fb0",O_RDWR); 1211// fd=open("/dev/fb0",O_RDWR);
1201 qDebug("do unblanking"); 1212 qDebug("do unblanking");
1202 if (fd != -1) { 1213 if (fd != -1) {
1203 ioctl(fd,FBIOBLANK,0); 1214 ioctl(fd,FBIOBLANK,0);
1204 close(fd); 1215 close(fd);
1205 } 1216 }
1206 QCopEnvelope h("QPE/System", "setBacklight(int)"); 1217 QCopEnvelope h("QPE/System", "setBacklight(int)");
1207 h <<-3;// v[1]; // -3 Force on 1218 h <<-3;// v[1]; // -3 Force on
1208} 1219}
1209 1220
@@ -1291,67 +1302,65 @@ void PlayListWidget::writem3u() {
1291 filename=QPEApplication::documentDir()+"/"+filename; 1302 filename=QPEApplication::documentDir()+"/"+filename;
1292 if(filename.right(3) != "m3u") 1303 if(filename.right(3) != "m3u")
1293 filename=filename+".m3u"; 1304 filename=filename+".m3u";
1294 1305
1295 QFile f(filename); 1306 QFile f(filename);
1296 f.open(IO_WriteOnly); 1307 f.open(IO_WriteOnly);
1297 f.writeBlock(list, list.length()); 1308 f.writeBlock(list, list.length());
1298 f.close(); 1309 f.close();
1299 } 1310 }
1300 if(fileDlg) delete fileDlg; 1311 if(fileDlg) delete fileDlg;
1301} 1312}
1302 1313
1303void PlayListWidget::readPls(const QString &filename) { 1314void PlayListWidget::readPls(const QString &filename) {
1304 1315
1305 qDebug("pls filename is "+filename); 1316 qDebug("pls filename is "+filename);
1306 QFile f(filename); 1317 QFile f(filename);
1307 1318
1308 if(f.open(IO_ReadOnly)) { 1319 if(f.open(IO_ReadOnly)) {
1309 QTextStream t(&f); 1320 QTextStream t(&f);
1310 QString s;//, first, second; 1321 QString s;//, first, second;
1311 int i=0; 1322 int i=0;
1312 while ( !t.atEnd()) { 1323 while ( !t.atEnd()) {
1313 s=t.readLine(); 1324 s=t.readLine();
1314 if(s.left(4) == "File") { 1325 if(s.left(4) == "File") {
1315 s=s.right(s.length() - 6); 1326 s=s.right(s.length() - 6);
1316 s.replace(QRegExp("%20")," "); 1327 s.replace(QRegExp("%20")," ");
1317 qDebug("adding "+s+" to playlist"); 1328 qDebug("adding "+s+" to playlist");
1318// numberofentries=2 1329// numberofentries=2
1319// File1=http 1330// File1=http
1320// Title 1331// Title
1321// Length 1332// Length
1322// Version 1333// Version
1323// File2=http 1334// File2=http
1324 1335
1325 s=s.replace( QRegExp("\\"),"/"); 1336 s=s.replace( QRegExp("\\"),"/");
1326 DocLnk lnk( s ); 1337 DocLnk lnk( s );
1327 QFileInfo f(s); 1338 QFileInfo f(s);
1328 QString name = f.baseName(); 1339 QString name = f.baseName();
1329 if(name.left(4)=="http") 1340 if(name.left(4)=="http")
1330 name = s.right( s.length() - 7); 1341 name = s.right( s.length() - 7);
1331 else 1342 else
1332 name=s; 1343 name=s;
1333 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1344 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1334// QFileInfo f(s); 1345// QFileInfo f(s);
1335// QString name = f.baseName(); 1346// QString name = f.baseName();
1336// name = name.left(name.length()-4); 1347// name = name.left(name.length()-4);
1337// name = name.right(name.findRev("/",0,TRUE)); 1348// name = name.right(name.findRev("/",0,TRUE));
1338 lnk.setName( name); 1349 lnk.setName( name);
1339 if(s.at(s.length()-4) == '.') 1350 if(s.at(s.length()-4) == '.') // if this is probably a file
1340 lnk.setFile( s); 1351 lnk.setFile( s);
1341 else { 1352 else { //if its a url
1342 if( name.right(1).find('/') == -1) 1353 if( name.right(1).find('/') == -1)
1343 s+="/"; 1354 s+="/";
1344 // if(s.right(1) != '/') 1355 lnk.setFile( s);
1345 lnk.setFile( s);
1346
1347 } 1356 }
1348 lnk.setType("audio/x-mpegurl"); 1357 lnk.setType("audio/x-mpegurl");
1349 1358
1350 qDebug("DocLnk add "+name); 1359 qDebug("DocLnk add "+name);
1351 d->selectedFiles->addToSelection( lnk); 1360 d->selectedFiles->addToSelection( lnk);
1352 } 1361 }
1353 } 1362 }
1354 i++; 1363 i++;
1355 } 1364 }
1356} 1365}
1357 1366