summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index ce73252..b04fe8d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -405,424 +405,428 @@ void PlayListWidget::setDocument( const QString& fileref ) {
405 readm3u( DocLnk( fileref).file() ); 405 readm3u( DocLnk( fileref).file() );
406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
407 readPls( fileref ); 407 readPls( fileref );
408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
409 readPls( DocLnk( fileref).file() ); 409 readPls( DocLnk( fileref).file() );
410 } else { 410 } else {
411 clearList(); 411 clearList();
412 addToSelection( DocLnk( fileref ) ); 412 addToSelection( DocLnk( fileref ) );
413 writeCurrentM3u(); 413 writeCurrentM3u();
414 414
415 d->setDocumentUsed = TRUE; 415 d->setDocumentUsed = TRUE;
416 mediaPlayerState->setPlaying( FALSE ); 416 mediaPlayerState->setPlaying( FALSE );
417 mediaPlayerState->setPlaying( TRUE ); 417 mediaPlayerState->setPlaying( TRUE );
418 } 418 }
419} 419}
420 420
421 421
422void PlayListWidget::useSelectedDocument() { 422void PlayListWidget::useSelectedDocument() {
423 d->setDocumentUsed = FALSE; 423 d->setDocumentUsed = FALSE;
424} 424}
425 425
426 426
427const DocLnk *PlayListWidget::current() const { // this is fugly 427const DocLnk *PlayListWidget::current() const { // this is fugly
428 assert( currentTab() == CurrentPlayList ); 428 assert( currentTab() == CurrentPlayList );
429 429
430// qDebug("playlist"); 430// qDebug("playlist");
431 if ( mediaPlayerState->isUsingPlaylist() ) { 431 if ( mediaPlayerState->isUsingPlaylist() ) {
432 return d->selectedFiles->current(); 432 return d->selectedFiles->current();
433 } else if ( d->setDocumentUsed && d->current ) { 433 } else if ( d->setDocumentUsed && d->current ) {
434 return d->current; 434 return d->current;
435 } else { 435 } else {
436 return &(d->files->selectedDocument()); 436 return &(d->files->selectedDocument());
437 } 437 }
438} 438}
439 439
440 440
441bool PlayListWidget::prev() { 441bool PlayListWidget::prev() {
442 if ( mediaPlayerState->isUsingPlaylist() ) { 442 if ( mediaPlayerState->isUsingPlaylist() ) {
443 if ( mediaPlayerState->isShuffled() ) { 443 if ( mediaPlayerState->isShuffled() ) {
444 const DocLnk *cur = current(); 444 const DocLnk *cur = current();
445 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 445 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
446 for ( int i = 0; i < j; i++ ) { 446 for ( int i = 0; i < j; i++ ) {
447 if ( !d->selectedFiles->next() ) 447 if ( !d->selectedFiles->next() )
448 d->selectedFiles->first(); 448 d->selectedFiles->first();
449 } 449 }
450 if ( cur == current() ) 450 if ( cur == current() )
451 if ( !d->selectedFiles->next() ) { 451 if ( !d->selectedFiles->next() ) {
452 d->selectedFiles->first(); 452 d->selectedFiles->first();
453 } 453 }
454 return TRUE; 454 return TRUE;
455 } else { 455 } else {
456 if ( !d->selectedFiles->prev() ) { 456 if ( !d->selectedFiles->prev() ) {
457 if ( mediaPlayerState->isLooping() ) { 457 if ( mediaPlayerState->isLooping() ) {
458 return d->selectedFiles->last(); 458 return d->selectedFiles->last();
459 } else { 459 } else {
460 return FALSE; 460 return FALSE;
461 } 461 }
462 } 462 }
463 return TRUE; 463 return TRUE;
464 } 464 }
465 } else { 465 } else {
466 return mediaPlayerState->isLooping(); 466 return mediaPlayerState->isLooping();
467 } 467 }
468} 468}
469 469
470 470
471bool PlayListWidget::next() { 471bool PlayListWidget::next() {
472//qDebug("<<<<<<<<<<<<next()"); 472//qDebug("<<<<<<<<<<<<next()");
473 if ( mediaPlayerState->isUsingPlaylist() ) { 473 if ( mediaPlayerState->isUsingPlaylist() ) {
474 if ( mediaPlayerState->isShuffled() ) { 474 if ( mediaPlayerState->isShuffled() ) {
475 return prev(); 475 return prev();
476 } else { 476 } else {
477 if ( !d->selectedFiles->next() ) { 477 if ( !d->selectedFiles->next() ) {
478 if ( mediaPlayerState->isLooping() ) { 478 if ( mediaPlayerState->isLooping() ) {
479 return d->selectedFiles->first(); 479 return d->selectedFiles->first();
480 } else { 480 } else {
481 return FALSE; 481 return FALSE;
482 } 482 }
483 } 483 }
484 return TRUE; 484 return TRUE;
485 } 485 }
486 } else { 486 } else {
487 return mediaPlayerState->isLooping(); 487 return mediaPlayerState->isLooping();
488 } 488 }
489} 489}
490 490
491 491
492bool PlayListWidget::first() { 492bool PlayListWidget::first() {
493 if ( mediaPlayerState->isUsingPlaylist() ) 493 if ( mediaPlayerState->isUsingPlaylist() )
494 return d->selectedFiles->first(); 494 return d->selectedFiles->first();
495 else 495 else
496 return mediaPlayerState->isLooping(); 496 return mediaPlayerState->isLooping();
497} 497}
498 498
499 499
500bool PlayListWidget::last() { 500bool PlayListWidget::last() {
501 if ( mediaPlayerState->isUsingPlaylist() ) 501 if ( mediaPlayerState->isUsingPlaylist() )
502 return d->selectedFiles->last(); 502 return d->selectedFiles->last();
503 else 503 else
504 return mediaPlayerState->isLooping(); 504 return mediaPlayerState->isLooping();
505} 505}
506 506
507 507
508 void PlayListWidget::saveList() { 508 void PlayListWidget::saveList() {
509 writem3u(); 509 writem3u();
510 } 510 }
511 511
512 512
513void PlayListWidget::loadList( const DocLnk & lnk) { 513void PlayListWidget::loadList( const DocLnk & lnk) {
514 QString name = lnk.name(); 514 QString name = lnk.name();
515 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 515 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
516 516
517 if( name.length()>0) { 517 if( name.length()>0) {
518 setCaption("OpiePlayer: "+name); 518 setCaption("OpiePlayer: "+name);
519// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 519// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
520 clearList(); 520 clearList();
521 readm3u(lnk.file()); 521 readm3u(lnk.file());
522 tabWidget->setCurrentPage(0); 522 tabWidget->setCurrentPage(0);
523 } 523 }
524} 524}
525 525
526 526
527void PlayListWidget::setPlaylist( bool shown ) { 527void PlayListWidget::setPlaylist( bool shown ) {
528 if ( shown ) { 528 if ( shown ) {
529 d->playListFrame->show(); 529 d->playListFrame->show();
530 } else { 530 } else {
531 d->playListFrame->hide(); 531 d->playListFrame->hide();
532 } 532 }
533} 533}
534 534
535 535
536void PlayListWidget::addSelected() { 536void PlayListWidget::addSelected() {
537 assert( inFileListMode() ); 537 assert( inFileListMode() );
538 538
539 QListView *fileListView = currentFileListView(); 539 QListView *fileListView = currentFileListView();
540 QListViewItemIterator it( fileListView ); 540 QListViewItemIterator it( fileListView );
541 for ( ; it.current(); ++it ) 541 for ( ; it.current(); ++it )
542 if ( it.current()->isSelected() ) { 542 if ( it.current()->isSelected() ) {
543 QString filename = it.current()->text(3); 543 QString filename = it.current()->text(3);
544 544
545 DocLnk lnk; 545 DocLnk lnk;
546 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 546 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
547 lnk.setFile( filename ); //sets file name 547 lnk.setFile( filename ); //sets file name
548 548
549 d->selectedFiles->addToSelection( lnk ); 549 d->selectedFiles->addToSelection( lnk );
550 } 550 }
551 551
552 fileListView->clearSelection(); 552 fileListView->clearSelection();
553 553
554 tabWidget->setCurrentPage( 0 ); 554 tabWidget->setCurrentPage( 0 );
555 writeCurrentM3u(); 555 writeCurrentM3u();
556} 556}
557 557
558 558
559void PlayListWidget::removeSelected() { 559void PlayListWidget::removeSelected() {
560 d->selectedFiles->removeSelected( ); 560 d->selectedFiles->removeSelected( );
561 writeCurrentM3u(); 561 writeCurrentM3u();
562} 562}
563 563
564 564
565void PlayListWidget::playIt( QListViewItem *it) { 565void PlayListWidget::playIt( QListViewItem *it) {
566 if(!it) return; 566 if(!it) return;
567 mediaPlayerState->setPlaying(FALSE); 567 mediaPlayerState->setPlaying(FALSE);
568 mediaPlayerState->setPlaying(TRUE); 568 mediaPlayerState->setPlaying(TRUE);
569 d->selectedFiles->unSelect(); 569 d->selectedFiles->unSelect();
570} 570}
571 571
572 572
573void PlayListWidget::addToSelection( QListViewItem *it) { 573void PlayListWidget::addToSelection( QListViewItem *it) {
574 d->setDocumentUsed = FALSE; 574 d->setDocumentUsed = FALSE;
575 575
576 if(it) { 576 if(it) {
577 if ( currentTab() == CurrentPlayList ) 577 if ( currentTab() == CurrentPlayList )
578 return; 578 return;
579 // case 1: { 579 // case 1: {
580 DocLnk lnk; 580 DocLnk lnk;
581 QString filename; 581 QString filename;
582 582
583 filename=it->text(3); 583 filename=it->text(3);
584 lnk.setName( QFileInfo(filename).baseName() ); //sets name 584 lnk.setName( QFileInfo(filename).baseName() ); //sets name
585 lnk.setFile( filename ); //sets file name 585 lnk.setFile( filename ); //sets file name
586 d->selectedFiles->addToSelection( lnk); 586 d->selectedFiles->addToSelection( lnk);
587 587
588 writeCurrentM3u(); 588 writeCurrentM3u();
589 tabWidget->setCurrentPage(0); 589 tabWidget->setCurrentPage(0);
590 590
591 } 591 }
592} 592}
593 593
594 594
595void PlayListWidget::tabChanged(QWidget *) { 595void PlayListWidget::tabChanged(QWidget *) {
596 596
597 d->tbPlay->setEnabled( true );
598
597 switch ( currentTab() ) { 599 switch ( currentTab() ) {
598 case CurrentPlayList: 600 case CurrentPlayList:
599 { 601 {
600 if( !tbDeletePlaylist->isHidden() ) { 602 if( !tbDeletePlaylist->isHidden() ) {
601 tbDeletePlaylist->hide(); 603 tbDeletePlaylist->hide();
602 } 604 }
603 d->tbRemoveFromList->setEnabled(TRUE); 605 d->tbRemoveFromList->setEnabled(TRUE);
604 d->tbAddToList->setEnabled(FALSE); 606 d->tbAddToList->setEnabled(FALSE);
605 } 607 }
606 break; 608 break;
607 case AudioFiles: 609 case AudioFiles:
608 { 610 {
609 // audioView->clear(); 611 // audioView->clear();
610 if(!audioPopulated) populateAudioView(); 612 if(!audioPopulated) populateAudioView();
611 613
612 if( !tbDeletePlaylist->isHidden() ) { 614 if( !tbDeletePlaylist->isHidden() ) {
613 tbDeletePlaylist->hide(); 615 tbDeletePlaylist->hide();
614 } 616 }
615 d->tbRemoveFromList->setEnabled(FALSE); 617 d->tbRemoveFromList->setEnabled(FALSE);
616 d->tbAddToList->setEnabled(TRUE); 618 d->tbAddToList->setEnabled(TRUE);
617 } 619 }
618 break; 620 break;
619 case VideoFiles: 621 case VideoFiles:
620 { 622 {
621 // videoView->clear(); 623 // videoView->clear();
622 if(!videoPopulated) populateVideoView(); 624 if(!videoPopulated) populateVideoView();
623 if( !tbDeletePlaylist->isHidden() ) { 625 if( !tbDeletePlaylist->isHidden() ) {
624 tbDeletePlaylist->hide(); 626 tbDeletePlaylist->hide();
625 } 627 }
626 d->tbRemoveFromList->setEnabled(FALSE); 628 d->tbRemoveFromList->setEnabled(FALSE);
627 d->tbAddToList->setEnabled(TRUE); 629 d->tbAddToList->setEnabled(TRUE);
628 } 630 }
629 break; 631 break;
630 case PlayLists: 632 case PlayLists:
631 { 633 {
632 if( tbDeletePlaylist->isHidden() ) { 634 if( tbDeletePlaylist->isHidden() ) {
633 tbDeletePlaylist->show(); 635 tbDeletePlaylist->show();
634 } 636 }
635 playLists->reread(); 637 playLists->reread();
636 d->tbAddToList->setEnabled(FALSE); 638 d->tbAddToList->setEnabled(FALSE);
639
640 d->tbPlay->setEnabled( false );
637 } 641 }
638 break; 642 break;
639 }; 643 };
640} 644}
641 645
642 646
643void PlayListWidget::btnPlay(bool b) { 647void PlayListWidget::btnPlay(bool b) {
644// mediaPlayerState->setPlaying(false); 648// mediaPlayerState->setPlaying(false);
645 mediaPlayerState->setPlaying(b); 649 mediaPlayerState->setPlaying(b);
646 insanityBool=FALSE; 650 insanityBool=FALSE;
647} 651}
648 652
649void PlayListWidget::deletePlaylist() { 653void PlayListWidget::deletePlaylist() {
650 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 654 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
651 (tr("You really want to delete\nthis playlist?")), 655 (tr("You really want to delete\nthis playlist?")),
652 (tr("Yes")), (tr("No")), 0 )){ 656 (tr("Yes")), (tr("No")), 0 )){
653 case 0: // Yes clicked, 657 case 0: // Yes clicked,
654 QFile().remove(playLists->selectedDocument().file()); 658 QFile().remove(playLists->selectedDocument().file());
655 QFile().remove(playLists->selectedDocument().linkFile()); 659 QFile().remove(playLists->selectedDocument().linkFile());
656 playLists->reread(); 660 playLists->reread();
657 break; 661 break;
658 case 1: // Cancel 662 case 1: // Cancel
659 break; 663 break;
660 }; 664 };
661} 665}
662 666
663 667
664void PlayListWidget::playSelected() { 668void PlayListWidget::playSelected() {
665 btnPlay( TRUE); 669 btnPlay( TRUE);
666} 670}
667 671
668 672
669void PlayListWidget::scanForAudio() { 673void PlayListWidget::scanForAudio() {
670// qDebug("scan for audio"); 674// qDebug("scan for audio");
671 files.detachChildren(); 675 files.detachChildren();
672 QListIterator<DocLnk> sdit( files.children() ); 676 QListIterator<DocLnk> sdit( files.children() );
673 for ( ; sdit.current(); ++sdit ) { 677 for ( ; sdit.current(); ++sdit ) {
674 delete sdit.current(); 678 delete sdit.current();
675 } 679 }
676// Global::findDocuments( &files, "audio/*"); 680// Global::findDocuments( &files, "audio/*");
677 Global::findDocuments( &files, audioMimes); 681 Global::findDocuments( &files, audioMimes);
678 audioScan = true; 682 audioScan = true;
679 populateAudioView(); 683 populateAudioView();
680} 684}
681 685
682void PlayListWidget::scanForVideo() { 686void PlayListWidget::scanForVideo() {
683// qDebug("scan for video"); 687// qDebug("scan for video");
684 vFiles.detachChildren(); 688 vFiles.detachChildren();
685 QListIterator<DocLnk> sdit( vFiles.children() ); 689 QListIterator<DocLnk> sdit( vFiles.children() );
686 for ( ; sdit.current(); ++sdit ) { 690 for ( ; sdit.current(); ++sdit ) {
687 delete sdit.current(); 691 delete sdit.current();
688 } 692 }
689 Global::findDocuments(&vFiles, "video/*"); 693 Global::findDocuments(&vFiles, "video/*");
690 videoScan = true; 694 videoScan = true;
691 populateVideoView(); 695 populateVideoView();
692} 696}
693 697
694void PlayListWidget::populateAudioView() { 698void PlayListWidget::populateAudioView() {
695 audioView->clear(); 699 audioView->clear();
696 StorageInfo storageInfo; 700 StorageInfo storageInfo;
697 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 701 // const QList<FileSystem> &fs = storageInfo.fileSystems();
698 if(!audioScan) { 702 if(!audioScan) {
699 scanForAudio(); 703 scanForAudio();
700 } 704 }
701 705
702 QListIterator<DocLnk> dit( files.children() ); 706 QListIterator<DocLnk> dit( files.children() );
703 // QListIterator<FileSystem> it ( fs ); 707 // QListIterator<FileSystem> it ( fs );
704 audioView->clear(); 708 audioView->clear();
705 709
706 QString storage; 710 QString storage;
707 for ( ; dit.current(); ++dit ) { 711 for ( ; dit.current(); ++dit ) {
708// // for( ; it.current(); ++it ){ 712// // for( ; it.current(); ++it ){
709// const QString name = (*dit)->name(); 713// const QString name = (*dit)->name();
710// const QString path = (*dit)->path(); 714// const QString path = (*dit)->path();
711// if(dit.current()->file().find(path) != -1 ) { 715// if(dit.current()->file().find(path) != -1 ) {
712// storage = name; 716// storage = name;
713// // } 717// // }
714// } 718// }
715 719
716 QListViewItem * newItem; 720 QListViewItem * newItem;
717 if ( QFile( dit.current()->file()).exists() || 721 if ( QFile( dit.current()->file()).exists() ||
718 dit.current()->file().left(4) == "http" ) { 722 dit.current()->file().left(4) == "http" ) {
719 long size; 723 long size;
720 if( dit.current()->file().left(4) == "http" ) 724 if( dit.current()->file().left(4) == "http" )
721 size=0; 725 size=0;
722 else 726 else
723 size = QFile( dit.current()->file() ).size(); 727 size = QFile( dit.current()->file() ).size();
724 728
725 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 729 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
726 QString::number(size ), "" /*storage*/, 730 QString::number(size ), "" /*storage*/,
727 dit.current()->file() ); 731 dit.current()->file() );
728 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 732 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
729// qDebug("<<<< "+dit.current()->file()); 733// qDebug("<<<< "+dit.current()->file());
730 } 734 }
731 } 735 }
732 audioPopulated=true; 736 audioPopulated=true;
733} 737}
734 738
735 739
736void PlayListWidget::populateVideoView() { 740void PlayListWidget::populateVideoView() {
737 videoView->clear(); 741 videoView->clear();
738 StorageInfo storageInfo; 742 StorageInfo storageInfo;
739 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 743 // const QList<FileSystem> &fs = storageInfo.fileSystems();
740 744
741 if(!videoScan ) { 745 if(!videoScan ) {
742 scanForVideo(); 746 scanForVideo();
743 } 747 }
744 748
745 QListIterator<DocLnk> Vdit( vFiles.children() ); 749 QListIterator<DocLnk> Vdit( vFiles.children() );
746// QListIterator<FileSystem> it ( fs ); 750// QListIterator<FileSystem> it ( fs );
747 videoView->clear(); 751 videoView->clear();
748 QString storage, pathName; 752 QString storage, pathName;
749 for ( ; Vdit.current(); ++Vdit ) { 753 for ( ; Vdit.current(); ++Vdit ) {
750// // for( ; it.current(); ++it ) { 754// // for( ; it.current(); ++it ) {
751// const QString name = (*Vdit)->name(); 755// const QString name = (*Vdit)->name();
752// const QString path = (*Vdit)->path(); 756// const QString path = (*Vdit)->path();
753// if( Vdit.current()->file().find(path) != -1 ) { 757// if( Vdit.current()->file().find(path) != -1 ) {
754// storage=name; 758// storage=name;
755// pathName=path; 759// pathName=path;
756// // } 760// // }
757// } 761// }
758 762
759 QListViewItem * newItem; 763 QListViewItem * newItem;
760 if ( QFile( Vdit.current()->file() ).exists() ) { 764 if ( QFile( Vdit.current()->file() ).exists() ) {
761 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 765 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
762 QString::number( QFile( Vdit.current()->file() ).size() ), 766 QString::number( QFile( Vdit.current()->file() ).size() ),
763 ""/*storage*/, Vdit.current()->file()); 767 ""/*storage*/, Vdit.current()->file());
764 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 768 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
765 } 769 }
766 } 770 }
767 videoPopulated=true; 771 videoPopulated=true;
768} 772}
769 773
770QListView *PlayListWidget::currentFileListView() const 774QListView *PlayListWidget::currentFileListView() const
771{ 775{
772 switch ( currentTab() ) { 776 switch ( currentTab() ) {
773 case AudioFiles: return audioView; 777 case AudioFiles: return audioView;
774 case VideoFiles: return videoView; 778 case VideoFiles: return videoView;
775 default: assert( false ); 779 default: assert( false );
776 } 780 }
777 return 0; 781 return 0;
778} 782}
779 783
780bool PlayListWidget::inFileListMode() const 784bool PlayListWidget::inFileListMode() const
781{ 785{
782 TabType tab = currentTab(); 786 TabType tab = currentTab();
783 return tab == AudioFiles || tab == VideoFiles; 787 return tab == AudioFiles || tab == VideoFiles;
784} 788}
785 789
786void PlayListWidget::openFile() { 790void PlayListWidget::openFile() {
787 // http://66.28.164.33:2080 791 // http://66.28.164.33:2080
788 // http://somafm.com/star0242.m3u 792 // http://somafm.com/star0242.m3u
789 QString filename, name; 793 QString filename, name;
790 InputDialog *fileDlg; 794 InputDialog *fileDlg;
791 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 795 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
792 fileDlg->exec(); 796 fileDlg->exec();
793 if( fileDlg->result() == 1 ) { 797 if( fileDlg->result() == 1 ) {
794 filename = fileDlg->text(); 798 filename = fileDlg->text();
795 qDebug( "Selected filename is " + filename ); 799 qDebug( "Selected filename is " + filename );
796 // Om3u *m3uList; 800 // Om3u *m3uList;
797 DocLnk lnk; 801 DocLnk lnk;
798 Config cfg( "OpiePlayer" ); 802 Config cfg( "OpiePlayer" );
799 cfg.setGroup("PlayList"); 803 cfg.setGroup("PlayList");
800 804
801 if(filename.left(4) == "http") { 805 if(filename.left(4) == "http") {
802 QString m3uFile, m3uFilePath; 806 QString m3uFile, m3uFilePath;
803 if(filename.find(":",8,TRUE) != -1) { //found a port 807 if(filename.find(":",8,TRUE) != -1) { //found a port
804 m3uFile = filename.left( filename.find( ":",8,TRUE)); 808 m3uFile = filename.left( filename.find( ":",8,TRUE));
805 m3uFile = m3uFile.right( 7); 809 m3uFile = m3uFile.right( 7);
806 } else if(filename.left(4) == "http"){ 810 } else if(filename.left(4) == "http"){
807 m3uFile=filename; 811 m3uFile=filename;
808 m3uFile = m3uFile.right( m3uFile.length() - 7); 812 m3uFile = m3uFile.right( m3uFile.length() - 7);
809 } else{ 813 } else{
810 m3uFile=filename; 814 m3uFile=filename;
811 } 815 }
812 816
813// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 817// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
814 lnk.setName( filename ); //sets name 818 lnk.setName( filename ); //sets name
815 lnk.setFile( filename ); //sets file name 819 lnk.setFile( filename ); //sets file name
816 820
817// lnk.setIcon("opieplayer2/musicfile"); 821// lnk.setIcon("opieplayer2/musicfile");
818 822
819 d->selectedFiles->addToSelection( lnk ); 823 d->selectedFiles->addToSelection( lnk );
820 writeCurrentM3u(); 824 writeCurrentM3u();
821 d->selectedFiles->setSelectedItem( lnk.name()); 825 d->selectedFiles->setSelectedItem( lnk.name());
822 } 826 }
823 else if( filename.right( 3) == "m3u" ) { 827 else if( filename.right( 3) == "m3u" ) {
824 readm3u( filename ); 828 readm3u( filename );
825 829
826 } else if( filename.right(3) == "pls" ) { 830 } else if( filename.right(3) == "pls" ) {
827 readPls( filename ); 831 readPls( filename );
828 } else { 832 } else {