author | llornkcor <llornkcor> | 2002-06-11 23:19:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-11 23:19:17 (UTC) |
commit | 37ab41238538d7c89090c083953b794cfdc29c6a (patch) (unidiff) | |
tree | 3a7db52fd8f8b2510d798fab094d65484e7227d8 | |
parent | 7bace0e2b8613aaf229acea03107c68159cfa6de (diff) | |
download | opie-37ab41238538d7c89090c083953b794cfdc29c6a.zip opie-37ab41238538d7c89090c083953b794cfdc29c6a.tar.gz opie-37ab41238538d7c89090c083953b794cfdc29c6a.tar.bz2 |
in theory, clicking on a pls, or m3u list will now open them and add the url's to the playlist...
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 78c2822..930560e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -364,201 +364,199 @@ void PlayListWidget::readConfig( Config& cfg ) { | |||
364 | QString entryName; | 364 | QString entryName; |
365 | entryName.sprintf( "File%i", i + 1 ); | 365 | entryName.sprintf( "File%i", i + 1 ); |
366 | QString linkFile = cfg.readEntry( entryName ); | 366 | QString linkFile = cfg.readEntry( entryName ); |
367 | DocLnk lnk( linkFile ); | 367 | DocLnk lnk( linkFile ); |
368 | if ( lnk.isValid() ) { | 368 | if ( lnk.isValid() ) { |
369 | d->selectedFiles->addToSelection( lnk ); | 369 | d->selectedFiles->addToSelection( lnk ); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | d->selectedFiles->setSelectedItem( currentString); | 372 | d->selectedFiles->setSelectedItem( currentString); |
373 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); | 373 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | void PlayListWidget::writeConfig( Config& cfg ) const { | 377 | void PlayListWidget::writeConfig( Config& cfg ) const { |
378 | 378 | ||
379 | d->selectedFiles->writeCurrent( cfg); | 379 | d->selectedFiles->writeCurrent( cfg); |
380 | cfg.setGroup("PlayList"); | 380 | cfg.setGroup("PlayList"); |
381 | int noOfFiles = 0; | 381 | int noOfFiles = 0; |
382 | d->selectedFiles->first(); | 382 | d->selectedFiles->first(); |
383 | do { | 383 | do { |
384 | const DocLnk *lnk = d->selectedFiles->current(); | 384 | const DocLnk *lnk = d->selectedFiles->current(); |
385 | if ( lnk ) { | 385 | if ( lnk ) { |
386 | QString entryName; | 386 | QString entryName; |
387 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 387 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
388 | // qDebug(entryName); | 388 | // qDebug(entryName); |
389 | cfg.writeEntry( entryName, lnk->linkFile() ); | 389 | cfg.writeEntry( entryName, lnk->linkFile() ); |
390 | // if this link does exist, add it so we have the file | 390 | // if this link does exist, add it so we have the file |
391 | // next time... | 391 | // next time... |
392 | if ( !QFile::exists( lnk->linkFile() ) ) { | 392 | if ( !QFile::exists( lnk->linkFile() ) ) { |
393 | // the way writing lnks doesn't really check for out | 393 | // the way writing lnks doesn't really check for out |
394 | // of disk space, but check it anyway. | 394 | // of disk space, but check it anyway. |
395 | if ( !lnk->writeLink() ) { | 395 | if ( !lnk->writeLink() ) { |
396 | QMessageBox::critical( 0, tr("Out of space"), | 396 | QMessageBox::critical( 0, tr("Out of space"), |
397 | tr( "There was a problem saving " | 397 | tr( "There was a problem saving " |
398 | "the playlist.\n" | 398 | "the playlist.\n" |
399 | "Your playlist " | 399 | "Your playlist " |
400 | "may be missing some entries\n" | 400 | "may be missing some entries\n" |
401 | "the next time you start it." ) | 401 | "the next time you start it." ) |
402 | ); | 402 | ); |
403 | } | 403 | } |
404 | } | 404 | } |
405 | noOfFiles++; | 405 | noOfFiles++; |
406 | } | 406 | } |
407 | } | 407 | } |
408 | while ( d->selectedFiles->next() ); | 408 | while ( d->selectedFiles->next() ); |
409 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 409 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
410 | } | 410 | } |
411 | 411 | ||
412 | 412 | ||
413 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 413 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
414 | // qDebug("add"); | 414 | // qDebug("add"); |
415 | d->setDocumentUsed = FALSE; | 415 | d->setDocumentUsed = FALSE; |
416 | if ( mediaPlayerState->playlist() ) | 416 | if ( mediaPlayerState->playlist() ) |
417 | d->selectedFiles->addToSelection( lnk ); | 417 | d->selectedFiles->addToSelection( lnk ); |
418 | else | 418 | else |
419 | mediaPlayerState->setPlaying( TRUE ); | 419 | mediaPlayerState->setPlaying( TRUE ); |
420 | } | 420 | } |
421 | 421 | ||
422 | 422 | ||
423 | void PlayListWidget::clearList() { | 423 | void PlayListWidget::clearList() { |
424 | while ( first() ) | 424 | while ( first() ) |
425 | d->selectedFiles->removeSelected(); | 425 | d->selectedFiles->removeSelected(); |
426 | } | 426 | } |
427 | 427 | ||
428 | 428 | ||
429 | void PlayListWidget::addAllToList() { | 429 | void PlayListWidget::addAllToList() { |
430 | DocLnkSet filesAll; | 430 | DocLnkSet filesAll; |
431 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 431 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
432 | QListIterator<DocLnk> Adit( filesAll.children() ); | 432 | QListIterator<DocLnk> Adit( filesAll.children() ); |
433 | for ( ; Adit.current(); ++Adit ) | 433 | for ( ; Adit.current(); ++Adit ) |
434 | d->selectedFiles->addToSelection( **Adit ); | 434 | d->selectedFiles->addToSelection( **Adit ); |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | void PlayListWidget::addAllMusicToList() { | 438 | void PlayListWidget::addAllMusicToList() { |
439 | QListIterator<DocLnk> dit( files.children() ); | 439 | QListIterator<DocLnk> dit( files.children() ); |
440 | for ( ; dit.current(); ++dit ) | 440 | for ( ; dit.current(); ++dit ) |
441 | d->selectedFiles->addToSelection( **dit ); | 441 | d->selectedFiles->addToSelection( **dit ); |
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||
445 | void PlayListWidget::addAllVideoToList() { | 445 | void PlayListWidget::addAllVideoToList() { |
446 | QListIterator<DocLnk> dit( vFiles.children() ); | 446 | QListIterator<DocLnk> dit( vFiles.children() ); |
447 | for ( ; dit.current(); ++dit ) | 447 | for ( ; dit.current(); ++dit ) |
448 | d->selectedFiles->addToSelection( **dit ); | 448 | d->selectedFiles->addToSelection( **dit ); |
449 | } | 449 | } |
450 | 450 | ||
451 | 451 | ||
452 | void PlayListWidget::setDocument(const QString& fileref) { | 452 | void PlayListWidget::setDocument(const QString& fileref) { |
453 | qDebug(fileref); | 453 | qDebug(fileref); |
454 | fromSetDocument = TRUE; | 454 | fromSetDocument = TRUE; |
455 | if ( fileref.isNull() ) { | 455 | if ( fileref.isNull() ) { |
456 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 456 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
457 | return; | 457 | return; |
458 | } | 458 | } |
459 | // qDebug("setDocument "+fileref); | 459 | // qDebug("setDocument "+fileref); |
460 | // if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 460 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
461 | // clearList(); | 461 | readm3u( fileref); |
462 | // addToSelection( DocLnk( fileref ) ); | 462 | } |
463 | // d->setDocumentUsed = TRUE; | 463 | else if(fileref.find("pls",0,TRUE) != -1) { //is pls |
464 | // d->selectedFiles->first(); | 464 | readPls( fileref); |
465 | // qApp->processEvents(); | 465 | } |
466 | // } | 466 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist |
467 | // else | ||
468 | if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | ||
469 | clearList(); | 467 | clearList(); |
470 | loadList(DocLnk(fileref)); | 468 | loadList(DocLnk(fileref)); |
471 | d->selectedFiles->first(); | 469 | d->selectedFiles->first(); |
472 | } else { | 470 | } else { |
473 | clearList(); | 471 | clearList(); |
474 | addToSelection( DocLnk( fileref ) ); | 472 | addToSelection( DocLnk( fileref ) ); |
475 | d->setDocumentUsed = TRUE; | 473 | d->setDocumentUsed = TRUE; |
476 | mediaPlayerState->setPlaying( FALSE ); | 474 | mediaPlayerState->setPlaying( FALSE ); |
477 | qApp->processEvents(); | 475 | qApp->processEvents(); |
478 | mediaPlayerState->setPlaying( TRUE ); | 476 | mediaPlayerState->setPlaying( TRUE ); |
479 | qApp->processEvents(); | 477 | qApp->processEvents(); |
480 | setCaption(tr("OpiePlayer")); | 478 | setCaption(tr("OpiePlayer")); |
481 | } | 479 | } |
482 | } | 480 | } |
483 | 481 | ||
484 | 482 | ||
485 | void PlayListWidget::setActiveWindow() { | 483 | void PlayListWidget::setActiveWindow() { |
486 | // When we get raised we need to ensure that it switches views | 484 | // When we get raised we need to ensure that it switches views |
487 | char origView = mediaPlayerState->view(); | 485 | char origView = mediaPlayerState->view(); |
488 | mediaPlayerState->setView( 'l' ); // invalidate | 486 | mediaPlayerState->setView( 'l' ); // invalidate |
489 | mediaPlayerState->setView( origView ); // now switch back | 487 | mediaPlayerState->setView( origView ); // now switch back |
490 | } | 488 | } |
491 | 489 | ||
492 | 490 | ||
493 | void PlayListWidget::useSelectedDocument() { | 491 | void PlayListWidget::useSelectedDocument() { |
494 | d->setDocumentUsed = FALSE; | 492 | d->setDocumentUsed = FALSE; |
495 | } | 493 | } |
496 | 494 | ||
497 | 495 | ||
498 | const DocLnk *PlayListWidget::current() { // this is fugly | 496 | const DocLnk *PlayListWidget::current() { // this is fugly |
499 | 497 | ||
500 | // if( fromSetDocument) { | 498 | // if( fromSetDocument) { |
501 | // qDebug("from setDoc"); | 499 | // qDebug("from setDoc"); |
502 | // DocLnkSet files; | 500 | // DocLnkSet files; |
503 | // Global::findDocuments(&files, "video/*;audio/*"); | 501 | // Global::findDocuments(&files, "video/*;audio/*"); |
504 | // QListIterator<DocLnk> dit( files.children() ); | 502 | // QListIterator<DocLnk> dit( files.children() ); |
505 | // for ( ; dit.current(); ++dit ) { | 503 | // for ( ; dit.current(); ++dit ) { |
506 | // if(dit.current()->linkFile() == setDocFileRef) { | 504 | // if(dit.current()->linkFile() == setDocFileRef) { |
507 | // qDebug(setDocFileRef); | 505 | // qDebug(setDocFileRef); |
508 | // return dit; | 506 | // return dit; |
509 | // } | 507 | // } |
510 | // } | 508 | // } |
511 | // } else | 509 | // } else |
512 | 510 | ||
513 | 511 | ||
514 | switch (tabWidget->currentPageIndex()) { | 512 | switch (tabWidget->currentPageIndex()) { |
515 | case 0: //playlist | 513 | case 0: //playlist |
516 | { | 514 | { |
517 | qDebug("playlist"); | 515 | qDebug("playlist"); |
518 | if ( mediaPlayerState->playlist() ) { | 516 | if ( mediaPlayerState->playlist() ) { |
519 | return d->selectedFiles->current(); | 517 | return d->selectedFiles->current(); |
520 | } | 518 | } |
521 | else if ( d->setDocumentUsed && d->current ) { | 519 | else if ( d->setDocumentUsed && d->current ) { |
522 | return d->current; | 520 | return d->current; |
523 | } else { | 521 | } else { |
524 | return d->files->selected(); | 522 | return d->files->selected(); |
525 | } | 523 | } |
526 | } | 524 | } |
527 | break; | 525 | break; |
528 | case 1://audio | 526 | case 1://audio |
529 | { | 527 | { |
530 | qDebug("audioView"); | 528 | qDebug("audioView"); |
531 | QListIterator<DocLnk> dit( files.children() ); | 529 | QListIterator<DocLnk> dit( files.children() ); |
532 | for ( ; dit.current(); ++dit ) { | 530 | for ( ; dit.current(); ++dit ) { |
533 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 531 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
534 | qDebug("here"); | 532 | qDebug("here"); |
535 | insanityBool=TRUE; | 533 | insanityBool=TRUE; |
536 | return dit; | 534 | return dit; |
537 | } | 535 | } |
538 | } | 536 | } |
539 | } | 537 | } |
540 | break; | 538 | break; |
541 | case 2: // video | 539 | case 2: // video |
542 | { | 540 | { |
543 | qDebug("videoView"); | 541 | qDebug("videoView"); |
544 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 542 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
545 | for ( ; Vdit.current(); ++Vdit ) { | 543 | for ( ; Vdit.current(); ++Vdit ) { |
546 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { | 544 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { |
547 | insanityBool=TRUE; | 545 | insanityBool=TRUE; |
548 | return Vdit; | 546 | return Vdit; |
549 | } | 547 | } |
550 | } | 548 | } |
551 | } | 549 | } |
552 | break; | 550 | break; |
553 | }; | 551 | }; |
554 | return 0; | 552 | return 0; |
555 | } | 553 | } |
556 | 554 | ||
557 | bool PlayListWidget::prev() { | 555 | bool PlayListWidget::prev() { |
558 | if ( mediaPlayerState->playlist() ) { | 556 | if ( mediaPlayerState->playlist() ) { |
559 | if ( mediaPlayerState->shuffled() ) { | 557 | if ( mediaPlayerState->shuffled() ) { |
560 | const DocLnk *cur = current(); | 558 | const DocLnk *cur = current(); |
561 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 559 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
562 | for ( int i = 0; i < j; i++ ) { | 560 | for ( int i = 0; i < j; i++ ) { |
563 | if ( !d->selectedFiles->next() ) | 561 | if ( !d->selectedFiles->next() ) |
564 | d->selectedFiles->first(); | 562 | d->selectedFiles->first(); |
@@ -1093,171 +1091,189 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1093 | { | 1091 | { |
1094 | switch ( e->key() ) { | 1092 | switch ( e->key() ) { |
1095 | ////////////////////////////// Zaurus keys | 1093 | ////////////////////////////// Zaurus keys |
1096 | case Key_F9: //activity | 1094 | case Key_F9: //activity |
1097 | // if(audioUI->isHidden()) | 1095 | // if(audioUI->isHidden()) |
1098 | // audioUI->showMaximized(); | 1096 | // audioUI->showMaximized(); |
1099 | break; | 1097 | break; |
1100 | case Key_F10: //contacts | 1098 | case Key_F10: //contacts |
1101 | // if( videoUI->isHidden()) | 1099 | // if( videoUI->isHidden()) |
1102 | // videoUI->showMaximized(); | 1100 | // videoUI->showMaximized(); |
1103 | break; | 1101 | break; |
1104 | case Key_F11: //menu | 1102 | case Key_F11: //menu |
1105 | break; | 1103 | break; |
1106 | case Key_F12: //home | 1104 | case Key_F12: //home |
1107 | // doBlank(); | 1105 | // doBlank(); |
1108 | break; | 1106 | break; |
1109 | case Key_F13: //mail | 1107 | case Key_F13: //mail |
1110 | // doUnblank(); | 1108 | // doUnblank(); |
1111 | break; | 1109 | break; |
1112 | case Key_Q: //add to playlist | 1110 | case Key_Q: //add to playlist |
1113 | qDebug("Add"); | 1111 | qDebug("Add"); |
1114 | addSelected(); | 1112 | addSelected(); |
1115 | break; | 1113 | break; |
1116 | case Key_R: //remove from playlist | 1114 | case Key_R: //remove from playlist |
1117 | removeSelected(); | 1115 | removeSelected(); |
1118 | break; | 1116 | break; |
1119 | // case Key_P: //play | 1117 | // case Key_P: //play |
1120 | // qDebug("Play"); | 1118 | // qDebug("Play"); |
1121 | // playSelected(); | 1119 | // playSelected(); |
1122 | // break; | 1120 | // break; |
1123 | case Key_Space: | 1121 | case Key_Space: |
1124 | qDebug("Play"); | 1122 | qDebug("Play"); |
1125 | // playSelected(); puh | 1123 | // playSelected(); puh |
1126 | break; | 1124 | break; |
1127 | case Key_1: | 1125 | case Key_1: |
1128 | tabWidget->setCurrentPage(0); | 1126 | tabWidget->setCurrentPage(0); |
1129 | break; | 1127 | break; |
1130 | case Key_2: | 1128 | case Key_2: |
1131 | tabWidget->setCurrentPage(1); | 1129 | tabWidget->setCurrentPage(1); |
1132 | break; | 1130 | break; |
1133 | case Key_3: | 1131 | case Key_3: |
1134 | tabWidget->setCurrentPage(2); | 1132 | tabWidget->setCurrentPage(2); |
1135 | break; | 1133 | break; |
1136 | case Key_4: | 1134 | case Key_4: |
1137 | tabWidget->setCurrentPage(3); | 1135 | tabWidget->setCurrentPage(3); |
1138 | break; | 1136 | break; |
1139 | } | 1137 | } |
1140 | } | 1138 | } |
1141 | 1139 | ||
1142 | void PlayListWidget::keyPressEvent( QKeyEvent *e) | 1140 | void PlayListWidget::keyPressEvent( QKeyEvent *e) |
1143 | { | 1141 | { |
1144 | // qDebug("Key press"); | 1142 | // qDebug("Key press"); |
1145 | // switch ( e->key() ) { | 1143 | // switch ( e->key() ) { |
1146 | // ////////////////////////////// Zaurus keys | 1144 | // ////////////////////////////// Zaurus keys |
1147 | // case Key_A: //add to playlist | 1145 | // case Key_A: //add to playlist |
1148 | // qDebug("Add"); | 1146 | // qDebug("Add"); |
1149 | // addSelected(); | 1147 | // addSelected(); |
1150 | // break; | 1148 | // break; |
1151 | // case Key_R: //remove from playlist | 1149 | // case Key_R: //remove from playlist |
1152 | // removeSelected(); | 1150 | // removeSelected(); |
1153 | // break; | 1151 | // break; |
1154 | // case Key_P: //play | 1152 | // case Key_P: //play |
1155 | // qDebug("Play"); | 1153 | // qDebug("Play"); |
1156 | // playSelected(); | 1154 | // playSelected(); |
1157 | // break; | 1155 | // break; |
1158 | // case Key_Space: | 1156 | // case Key_Space: |
1159 | // qDebug("Play"); | 1157 | // qDebug("Play"); |
1160 | // playSelected(); | 1158 | // playSelected(); |
1161 | // break; | 1159 | // break; |
1162 | // } | 1160 | // } |
1163 | } | 1161 | } |
1164 | 1162 | ||
1165 | void PlayListWidget::doBlank() { | 1163 | void PlayListWidget::doBlank() { |
1166 | qDebug("do blanking"); | 1164 | qDebug("do blanking"); |
1167 | fd=open("/dev/fb0",O_RDWR); | 1165 | fd=open("/dev/fb0",O_RDWR); |
1168 | if (fd != -1) { | 1166 | if (fd != -1) { |
1169 | ioctl(fd,FBIOBLANK,1); | 1167 | ioctl(fd,FBIOBLANK,1); |
1170 | // close(fd); | 1168 | // close(fd); |
1171 | } | 1169 | } |
1172 | } | 1170 | } |
1173 | 1171 | ||
1174 | void PlayListWidget::doUnblank() { | 1172 | void PlayListWidget::doUnblank() { |
1175 | // this crashes opieplayer with a segfault | 1173 | // this crashes opieplayer with a segfault |
1176 | // int fd; | 1174 | // int fd; |
1177 | // fd=open("/dev/fb0",O_RDWR); | 1175 | // fd=open("/dev/fb0",O_RDWR); |
1178 | qDebug("do unblanking"); | 1176 | qDebug("do unblanking"); |
1179 | if (fd != -1) { | 1177 | if (fd != -1) { |
1180 | ioctl(fd,FBIOBLANK,0); | 1178 | ioctl(fd,FBIOBLANK,0); |
1181 | close(fd); | 1179 | close(fd); |
1182 | } | 1180 | } |
1183 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1181 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1184 | h <<-3;// v[1]; // -3 Force on | 1182 | h <<-3;// v[1]; // -3 Force on |
1185 | } | 1183 | } |
1186 | 1184 | ||
1187 | void PlayListWidget::readm3u(const QString &filename) { | 1185 | void PlayListWidget::readm3u(const QString &filename) { |
1188 | 1186 | ||
1189 | qDebug("playlist filename is "+filename); | 1187 | qDebug("m3u filename is "+filename); |
1190 | QFile f(filename); | 1188 | QFile f(filename); |
1191 | 1189 | ||
1192 | if(f.open(IO_ReadOnly)) { | 1190 | if(f.open(IO_ReadOnly)) { |
1193 | QTextStream t(&f); | 1191 | QTextStream t(&f); |
1194 | QString s;//, first, second; | 1192 | QString s;//, first, second; |
1195 | int i=0; | 1193 | int i=0; |
1196 | while ( !t.atEnd()) { | 1194 | while ( !t.atEnd()) { |
1197 | // Lview->insertLine(t.readLine(),-1); | 1195 | // Lview->insertLine(t.readLine(),-1); |
1198 | s=t.readLine(); | 1196 | s=t.readLine(); |
1199 | if(s.find("#",0,TRUE) == -1) { | 1197 | if(s.find("#",0,TRUE) == -1) { |
1200 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1198 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1201 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1199 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1202 | s=s.right(s.length()-2); | 1200 | s=s.right(s.length()-2); |
1203 | DocLnk lnk( s ); | 1201 | DocLnk lnk( s ); |
1204 | QFileInfo f(s); | 1202 | QFileInfo f(s); |
1205 | QString name = f.baseName(); | 1203 | QString name = f.baseName(); |
1206 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1204 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1207 | lnk.setName( name); | 1205 | lnk.setName( name); |
1208 | s=s.replace( QRegExp("\\"),"/"); | 1206 | s=s.replace( QRegExp("\\"),"/"); |
1209 | lnk.setFile( s); | 1207 | lnk.setFile( s); |
1210 | // lnk.setIcon(opieplayer/MPEGPlayer); | 1208 | // lnk.setIcon(opieplayer/MPEGPlayer); |
1211 | qDebug("add "+name); | 1209 | qDebug("add "+name); |
1212 | d->selectedFiles->addToSelection( lnk); | 1210 | d->selectedFiles->addToSelection( lnk); |
1213 | } else { // is url | 1211 | } else { // is url |
1214 | DocLnk lnk( s); | 1212 | DocLnk lnk( s); |
1215 | QString name = s.right( s.length() - 7); | 1213 | QString name = s.right( s.length() - 7); |
1216 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1214 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1217 | lnk.setName(name); | 1215 | lnk.setName(name); |
1218 | lnk.setFile( s+"/"); | 1216 | lnk.setFile( s+"/"); |
1219 | // lnk.setFile( filename); | 1217 | // lnk.setFile( filename); |
1220 | // lnk.setComment( s+"/"); | 1218 | // lnk.setComment( s+"/"); |
1221 | lnk.setType("audio/x-mpegurl"); | 1219 | lnk.setType("audio/x-mpegurl"); |
1222 | // lnk.setIcon( "opieplayer/MPEGPlayer"); | 1220 | // lnk.setIcon( "opieplayer/MPEGPlayer"); |
1223 | // qDebug("add "+s); | 1221 | // qDebug("add "+s); |
1224 | d->selectedFiles->addToSelection( lnk); | 1222 | d->selectedFiles->addToSelection( lnk); |
1225 | } | 1223 | } |
1226 | i++; | 1224 | i++; |
1227 | } | 1225 | } |
1228 | } | 1226 | } |
1229 | } | 1227 | } |
1230 | } | 1228 | } |
1231 | } | 1229 | } |
1232 | 1230 | ||
1233 | void PlayListWidget::writem3u(const QString &filename) { | 1231 | void PlayListWidget::writem3u(const QString &filename) { |
1234 | 1232 | ||
1235 | } | 1233 | } |
1236 | 1234 | ||
1237 | void PlayListWidget::readPls(const QString &filename) { | 1235 | void PlayListWidget::readPls(const QString &filename) { |
1238 | 1236 | ||
1239 | qDebug("playlist filename is "+filename); | 1237 | qDebug("pls filename is "+filename); |
1240 | QFile f(filename); | 1238 | QFile f(filename); |
1241 | 1239 | ||
1242 | if(f.open(IO_ReadOnly)) { | 1240 | if(f.open(IO_ReadOnly)) { |
1243 | QTextStream t(&f); | 1241 | QTextStream t(&f); |
1244 | QString s;//, first, second; | 1242 | QString s;//, first, second; |
1245 | int i=0; | 1243 | int i=0; |
1246 | while ( !t.atEnd()) { | 1244 | while ( !t.atEnd()) { |
1245 | s=t.readLine(); | ||
1246 | if(s.left(4) == "File") { | ||
1247 | s=s.right(s.length() - 6); | ||
1248 | qDebug("adding "+s+" to playlist"); | ||
1249 | // numberofentries=2 | ||
1250 | // File1=http | ||
1251 | // Title | ||
1252 | // Length | ||
1253 | // Version | ||
1254 | // File2=http | ||
1255 | |||
1256 | s=s.replace( QRegExp("\\"),"/"); | ||
1247 | // Lview->insertLine(t.readLine(),-1); | 1257 | // Lview->insertLine(t.readLine(),-1); |
1248 | // s=t.readLine(); | 1258 | // s=t.readLine(); |
1249 | // s=s.right(s.length()-2); | 1259 | // s=s.right(s.length()-2); |
1250 | // DocLnk lnk( s ); | 1260 | DocLnk lnk( s ); |
1261 | QFileInfo f(s); | ||
1262 | QString name = f.baseName(); | ||
1263 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | ||
1251 | // QFileInfo f(s); | 1264 | // QFileInfo f(s); |
1252 | // QString name = f.baseName(); | 1265 | // QString name = f.baseName(); |
1253 | // // name = name.left(name.length()-4); | 1266 | // // name = name.left(name.length()-4); |
1254 | // name = name.right(name.findRev("/",0,TRUE)); | 1267 | // name = name.right(name.findRev("/",0,TRUE)); |
1255 | // lnk.setName( name); | 1268 | lnk.setName( name); |
1256 | // lnk.setFile( s); | 1269 | lnk.setFile( s+"/"); |
1257 | // qDebug("add "+name); | 1270 | lnk.setType("audio/x-mpegurl"); |
1258 | // d->selectedFiles->addToSelection( lnk); | 1271 | |
1272 | qDebug("DocLnk add "+name); | ||
1273 | d->selectedFiles->addToSelection( lnk); | ||
1274 | } | ||
1259 | } | 1275 | } |
1260 | i++; | 1276 | i++; |
1261 | } | 1277 | } |
1262 | } | 1278 | } |
1263 | 1279 | ||