author | llornkcor <llornkcor> | 2002-09-01 14:50:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-01 14:50:06 (UTC) |
commit | 4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7 (patch) (unidiff) | |
tree | 4371833546bed60c7e4d48db8527781c57533bec | |
parent | 2dab5b4aa31d795e968f81eb053ab507d96ff541 (diff) | |
download | opie-4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7.zip opie-4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7.tar.gz opie-4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7.tar.bz2 |
fix for bug 0000014
-rw-r--r-- | core/launcher/launcherview.cpp | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 11 |
3 files changed, 15 insertions, 8 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 0ced256..c54a00f 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -536,98 +536,98 @@ void LauncherView::resizeEvent(QResizeEvent *e) | |||
536 | QVBox::resizeEvent( e ); | 536 | QVBox::resizeEvent( e ); |
537 | if ( e->size().width() != e->oldSize().width() ) | 537 | if ( e->size().width() != e->oldSize().width() ) |
538 | sort(); | 538 | sort(); |
539 | } | 539 | } |
540 | 540 | ||
541 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) | 541 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) |
542 | { | 542 | { |
543 | icons->clear(); | 543 | icons->clear(); |
544 | internalPopulate( folder, typefilter ); | 544 | internalPopulate( folder, typefilter ); |
545 | } | 545 | } |
546 | 546 | ||
547 | void LauncherView::selectionChanged() | 547 | void LauncherView::selectionChanged() |
548 | { | 548 | { |
549 | QIconViewItem* item = icons->currentItem(); | 549 | QIconViewItem* item = icons->currentItem(); |
550 | if ( item && item->isSelected() ) { | 550 | if ( item && item->isSelected() ) { |
551 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 551 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
552 | if ( icons->inKeyEvent() ) // not for mouse press | 552 | if ( icons->inKeyEvent() ) // not for mouse press |
553 | emit clicked( appLnk ); | 553 | emit clicked( appLnk ); |
554 | item->setSelected(FALSE); | 554 | item->setSelected(FALSE); |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | void LauncherView::returnPressed( QIconViewItem *item ) | 558 | void LauncherView::returnPressed( QIconViewItem *item ) |
559 | { | 559 | { |
560 | if ( item ) { | 560 | if ( item ) { |
561 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 561 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
562 | emit clicked( appLnk ); | 562 | emit clicked( appLnk ); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
566 | void LauncherView::itemClicked( int btn, QIconViewItem *item ) | 566 | void LauncherView::itemClicked( int btn, QIconViewItem *item ) |
567 | { | 567 | { |
568 | if ( item ) { | 568 | if ( item ) { |
569 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 569 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
570 | if ( btn == LeftButton ) { | 570 | if ( btn == LeftButton ) { |
571 | // Make sure it's the item we execute that gets highlighted | 571 | // Make sure it's the item we execute that gets highlighted |
572 | icons->setCurrentItem( item ); | 572 | icons->setCurrentItem( item ); |
573 | emit clicked( appLnk ); | 573 | emit clicked( appLnk ); |
574 | } | 574 | } |
575 | item->setSelected(FALSE); | 575 | item->setSelected(FALSE); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | void LauncherView::itemPressed( int btn, QIconViewItem *item ) | 579 | void LauncherView::itemPressed( int btn, QIconViewItem *item ) |
580 | { | 580 | { |
581 | if ( item ) { | 581 | if ( item ) { |
582 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 582 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
583 | if ( btn == RightButton ) | 583 | if ( btn == RightButton ) |
584 | emit rightPressed( appLnk ); | 584 | emit rightPressed( appLnk ); |
585 | /* | 585 | /* |
586 | else if ( btn == LeftButton ) | 586 | else if ( btn == LeftButton ) |
587 | emit clicked( appLnk ); | 587 | emit clicked( appLnk ); |
588 | */ | 588 | */ |
589 | item->setSelected(FALSE); | 589 | item->setSelected(FALSE); |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) | 593 | void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) |
594 | { | 594 | { |
595 | QListIterator<AppLnk> it( folder->children() ); | 595 | QListIterator<AppLnk> it( folder->children() ); |
596 | icons->setTypeFilter(typefilter,FALSE); | 596 | icons->setTypeFilter(typefilter,FALSE); |
597 | 597 | ||
598 | while ( it.current() ) { | 598 | while ( it.current() ) { |
599 | // show only the icons for existing files | 599 | // show only the icons for existing files |
600 | if (!QFile(it.current()->file()).exists() ) | 600 | if (!QFile(it.current()->file()).exists() & it.current()->file().left(4) != "http") |
601 | { | 601 | { |
602 | //maybe insert some .desktop file deletion code later | 602 | //maybe insert some .desktop file deletion code later |
603 | //maybe dir specific | 603 | //maybe dir specific |
604 | } | 604 | } |
605 | else | 605 | else |
606 | { | 606 | { |
607 | icons->addItem(*it,FALSE); | 607 | icons->addItem(*it,FALSE); |
608 | } | 608 | } |
609 | ++it; | 609 | ++it; |
610 | } | 610 | } |
611 | 611 | ||
612 | icons->sort(); | 612 | icons->sort(); |
613 | } | 613 | } |
614 | 614 | ||
615 | bool LauncherView::removeLink(const QString& linkfile) | 615 | bool LauncherView::removeLink(const QString& linkfile) |
616 | { | 616 | { |
617 | return icons->removeLink(linkfile); | 617 | return icons->removeLink(linkfile); |
618 | } | 618 | } |
619 | 619 | ||
620 | void LauncherView::sort() | 620 | void LauncherView::sort() |
621 | { | 621 | { |
622 | icons->sort(); | 622 | icons->sort(); |
623 | } | 623 | } |
624 | 624 | ||
625 | void LauncherView::addItem(AppLnk* app, bool resort) | 625 | void LauncherView::addItem(AppLnk* app, bool resort) |
626 | { | 626 | { |
627 | icons->addItem(app,resort); | 627 | icons->addItem(app,resort); |
628 | } | 628 | } |
629 | 629 | ||
630 | void LauncherView::setFileSystems(const QList<FileSystem> &) | 630 | void LauncherView::setFileSystems(const QList<FileSystem> &) |
631 | { | 631 | { |
632 | // ### does nothing now... | 632 | // ### does nothing now... |
633 | } | 633 | } |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 65dc5fb..8d66407 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -969,132 +969,136 @@ void PlayListWidget::listDelete() { | |||
969 | } | 969 | } |
970 | populateAudioView(); | 970 | populateAudioView(); |
971 | } | 971 | } |
972 | break; | 972 | break; |
973 | case 2: | 973 | case 2: |
974 | { | 974 | { |
975 | // file = videoView->selectedItem()->text(0); | 975 | // file = videoView->selectedItem()->text(0); |
976 | // for ( int i = 0; i < noOfFiles; i++ ) { | 976 | // for ( int i = 0; i < noOfFiles; i++ ) { |
977 | // QString entryName; | 977 | // QString entryName; |
978 | // entryName.sprintf( "File%i", i + 1 ); | 978 | // entryName.sprintf( "File%i", i + 1 ); |
979 | // QString linkFile = cfg.readEntry( entryName ); | 979 | // QString linkFile = cfg.readEntry( entryName ); |
980 | // AppLnk lnk( AppLnk(linkFile)); | 980 | // AppLnk lnk( AppLnk(linkFile)); |
981 | // if( lnk.name() == file ) { | 981 | // if( lnk.name() == file ) { |
982 | // LnkProperties prop( &lnk); | 982 | // LnkProperties prop( &lnk); |
983 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 983 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
984 | // prop.showMaximized(); | 984 | // prop.showMaximized(); |
985 | // prop.exec(); | 985 | // prop.exec(); |
986 | // } | 986 | // } |
987 | // } | 987 | // } |
988 | } | 988 | } |
989 | break; | 989 | break; |
990 | }; | 990 | }; |
991 | } | 991 | } |
992 | 992 | ||
993 | void PlayListWidget::scanForAudio() { | 993 | void PlayListWidget::scanForAudio() { |
994 | qDebug("scan for audio"); | 994 | qDebug("scan for audio"); |
995 | files.detachChildren(); | 995 | files.detachChildren(); |
996 | QListIterator<DocLnk> sdit( files.children() ); | 996 | QListIterator<DocLnk> sdit( files.children() ); |
997 | for ( ; sdit.current(); ++sdit ) { | 997 | for ( ; sdit.current(); ++sdit ) { |
998 | delete sdit.current(); | 998 | delete sdit.current(); |
999 | } | 999 | } |
1000 | Global::findDocuments(&files, "audio/*"); | 1000 | Global::findDocuments(&files, "audio/*"); |
1001 | audioScan = TRUE; | 1001 | audioScan = TRUE; |
1002 | } | 1002 | } |
1003 | void PlayListWidget::scanForVideo() { | 1003 | void PlayListWidget::scanForVideo() { |
1004 | qDebug("scan for video"); | 1004 | qDebug("scan for video"); |
1005 | vFiles.detachChildren(); | 1005 | vFiles.detachChildren(); |
1006 | QListIterator<DocLnk> sdit( vFiles.children() ); | 1006 | QListIterator<DocLnk> sdit( vFiles.children() ); |
1007 | for ( ; sdit.current(); ++sdit ) { | 1007 | for ( ; sdit.current(); ++sdit ) { |
1008 | delete sdit.current(); | 1008 | delete sdit.current(); |
1009 | } | 1009 | } |
1010 | Global::findDocuments(&vFiles, "video/*"); | 1010 | Global::findDocuments(&vFiles, "video/*"); |
1011 | videoScan = TRUE; | 1011 | videoScan = TRUE; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | void PlayListWidget::populateAudioView() { | 1014 | void PlayListWidget::populateAudioView() { |
1015 | 1015 | ||
1016 | audioView->clear(); | 1016 | audioView->clear(); |
1017 | StorageInfo storageInfo; | 1017 | StorageInfo storageInfo; |
1018 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1018 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1019 | if(!audioScan) scanForAudio(); | 1019 | if(!audioScan) scanForAudio(); |
1020 | 1020 | ||
1021 | QListIterator<DocLnk> dit( files.children() ); | 1021 | QListIterator<DocLnk> dit( files.children() ); |
1022 | QListIterator<FileSystem> it ( fs ); | 1022 | QListIterator<FileSystem> it ( fs ); |
1023 | 1023 | ||
1024 | QString storage; | 1024 | QString storage; |
1025 | for ( ; dit.current(); ++dit ) { | 1025 | for ( ; dit.current(); ++dit ) { |
1026 | for( ; it.current(); ++it ){ | 1026 | for( ; it.current(); ++it ){ |
1027 | const QString name = (*it)->name(); | 1027 | const QString name = (*it)->name(); |
1028 | const QString path = (*it)->path(); | 1028 | const QString path = (*it)->path(); |
1029 | if(dit.current()->file().find(path) != -1 ) storage=name; | 1029 | if(dit.current()->file().find(path) != -1 ) storage=name; |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | QListViewItem * newItem; | 1032 | QListViewItem * newItem; |
1033 | if ( QFile( dit.current()->file()).exists() ) { | 1033 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
1034 | // qDebug(dit.current()->name()); | 1034 | long size; |
1035 | if( dit.current()->file().left(4) == "http" ) | ||
1036 | size=0; | ||
1037 | else | ||
1038 | size = QFile( dit.current()->file() ).size(); | ||
1035 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1039 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1036 | QString::number( QFile( dit.current()->file()).size() ), storage); | 1040 | QString::number(size ), storage); |
1037 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1041 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1038 | } | 1042 | } |
1039 | } | 1043 | } |
1040 | 1044 | ||
1041 | } | 1045 | } |
1042 | 1046 | ||
1043 | void PlayListWidget::populateVideoView() { | 1047 | void PlayListWidget::populateVideoView() { |
1044 | videoView->clear(); | 1048 | videoView->clear(); |
1045 | StorageInfo storageInfo; | 1049 | StorageInfo storageInfo; |
1046 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1050 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1047 | 1051 | ||
1048 | if(!videoScan ) scanForVideo(); | 1052 | if(!videoScan ) scanForVideo(); |
1049 | 1053 | ||
1050 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1054 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
1051 | QListIterator<FileSystem> it ( fs ); | 1055 | QListIterator<FileSystem> it ( fs ); |
1052 | videoView->clear(); | 1056 | videoView->clear(); |
1053 | QString storage; | 1057 | QString storage; |
1054 | for ( ; Vdit.current(); ++Vdit ) { | 1058 | for ( ; Vdit.current(); ++Vdit ) { |
1055 | for( ; it.current(); ++it ){ | 1059 | for( ; it.current(); ++it ){ |
1056 | const QString name = (*it)->name(); | 1060 | const QString name = (*it)->name(); |
1057 | const QString path = (*it)->path(); | 1061 | const QString path = (*it)->path(); |
1058 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1062 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1059 | } | 1063 | } |
1060 | 1064 | ||
1061 | QListViewItem * newItem; | 1065 | QListViewItem * newItem; |
1062 | if ( QFile( Vdit.current()->file()).exists() ) { | 1066 | if ( QFile( Vdit.current()->file()).exists() ) { |
1063 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1067 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1064 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | 1068 | QString::number( QFile( Vdit.current()->file()).size() ), storage); |
1065 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1069 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1066 | } | 1070 | } |
1067 | } | 1071 | } |
1068 | } | 1072 | } |
1069 | 1073 | ||
1070 | void PlayListWidget::openFile() { | 1074 | void PlayListWidget::openFile() { |
1071 | QString filename, name; | 1075 | QString filename, name; |
1072 | InputDialog *fileDlg; | 1076 | InputDialog *fileDlg; |
1073 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1077 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1074 | fileDlg->exec(); | 1078 | fileDlg->exec(); |
1075 | if( fileDlg->result() == 1 ) { | 1079 | if( fileDlg->result() == 1 ) { |
1076 | filename = fileDlg->LineEdit1->text(); | 1080 | filename = fileDlg->LineEdit1->text(); |
1077 | // http://205.188.234.129:8030 | 1081 | // http://205.188.234.129:8030 |
1078 | // http://66.28.68.70:8000 | 1082 | // http://66.28.68.70:8000 |
1079 | // filename.replace(QRegExp("%20")," "); | 1083 | // filename.replace(QRegExp("%20")," "); |
1080 | qDebug("Selected filename is "+filename); | 1084 | qDebug("Selected filename is "+filename); |
1081 | if(filename.right(3) == "m3u") | 1085 | if(filename.right(3) == "m3u") |
1082 | readm3u( filename); | 1086 | readm3u( filename); |
1083 | else if(filename.right(3) == "pls") | 1087 | else if(filename.right(3) == "pls") |
1084 | readPls( filename); | 1088 | readPls( filename); |
1085 | else { | 1089 | else { |
1086 | DocLnk lnk; | 1090 | DocLnk lnk; |
1087 | 1091 | ||
1088 | lnk.setName(filename); //sets file name | 1092 | lnk.setName(filename); //sets file name |
1089 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | 1093 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") |
1090 | filename += "/"; | 1094 | filename += "/"; |
1091 | lnk.setFile(filename); //sets File property | 1095 | lnk.setFile(filename); //sets File property |
1092 | 1096 | ||
1093 | lnk.setType("audio/x-mpegurl"); | 1097 | lnk.setType("audio/x-mpegurl"); |
1094 | lnk.setExec("opieplayer"); | 1098 | lnk.setExec("opieplayer"); |
1095 | lnk.setIcon("opieplayer/MPEGPlayer"); | 1099 | lnk.setIcon("opieplayer/MPEGPlayer"); |
1096 | 1100 | ||
1097 | if(!lnk.writeLink()) | 1101 | if(!lnk.writeLink()) |
1098 | qDebug("Writing doclink did not work"); | 1102 | qDebug("Writing doclink did not work"); |
1099 | d->selectedFiles->addToSelection( lnk); | 1103 | d->selectedFiles->addToSelection( lnk); |
1100 | // if(fileDlg2) | 1104 | // if(fileDlg2) |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 603a7a3..6c4d07f 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -668,132 +668,135 @@ void PlayListWidget::btnPlay(bool b) { | |||
668 | void PlayListWidget::deletePlaylist() { | 668 | void PlayListWidget::deletePlaylist() { |
669 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 669 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
670 | (tr("You really want to delete\nthis playlist?")), | 670 | (tr("You really want to delete\nthis playlist?")), |
671 | (tr("Yes")), (tr("No")), 0 )){ | 671 | (tr("Yes")), (tr("No")), 0 )){ |
672 | case 0: // Yes clicked, | 672 | case 0: // Yes clicked, |
673 | QFile().remove(playLists->selected()->file()); | 673 | QFile().remove(playLists->selected()->file()); |
674 | QFile().remove(playLists->selected()->linkFile()); | 674 | QFile().remove(playLists->selected()->linkFile()); |
675 | playLists->reread(); | 675 | playLists->reread(); |
676 | break; | 676 | break; |
677 | case 1: // Cancel | 677 | case 1: // Cancel |
678 | break; | 678 | break; |
679 | }; | 679 | }; |
680 | } | 680 | } |
681 | 681 | ||
682 | 682 | ||
683 | void PlayListWidget::playSelected() { | 683 | void PlayListWidget::playSelected() { |
684 | btnPlay( TRUE); | 684 | btnPlay( TRUE); |
685 | } | 685 | } |
686 | 686 | ||
687 | 687 | ||
688 | void PlayListWidget::scanForAudio() { | 688 | void PlayListWidget::scanForAudio() { |
689 | // qDebug("scan for audio"); | 689 | // qDebug("scan for audio"); |
690 | files.detachChildren(); | 690 | files.detachChildren(); |
691 | QListIterator<DocLnk> sdit( files.children() ); | 691 | QListIterator<DocLnk> sdit( files.children() ); |
692 | for ( ; sdit.current(); ++sdit ) { | 692 | for ( ; sdit.current(); ++sdit ) { |
693 | delete sdit.current(); | 693 | delete sdit.current(); |
694 | } | 694 | } |
695 | Global::findDocuments(&files, "audio/*"); | 695 | Global::findDocuments(&files, "audio/*"); |
696 | audioScan = TRUE; | 696 | audioScan = TRUE; |
697 | } | 697 | } |
698 | 698 | ||
699 | void PlayListWidget::scanForVideo() { | 699 | void PlayListWidget::scanForVideo() { |
700 | // qDebug("scan for video"); | 700 | // qDebug("scan for video"); |
701 | vFiles.detachChildren(); | 701 | vFiles.detachChildren(); |
702 | QListIterator<DocLnk> sdit( vFiles.children() ); | 702 | QListIterator<DocLnk> sdit( vFiles.children() ); |
703 | for ( ; sdit.current(); ++sdit ) { | 703 | for ( ; sdit.current(); ++sdit ) { |
704 | delete sdit.current(); | 704 | delete sdit.current(); |
705 | } | 705 | } |
706 | Global::findDocuments(&vFiles, "video/*"); | 706 | Global::findDocuments(&vFiles, "video/*"); |
707 | videoScan = TRUE; | 707 | videoScan = TRUE; |
708 | } | 708 | } |
709 | 709 | ||
710 | void PlayListWidget::populateAudioView() { | 710 | void PlayListWidget::populateAudioView() { |
711 | audioView->clear(); | 711 | audioView->clear(); |
712 | StorageInfo storageInfo; | 712 | StorageInfo storageInfo; |
713 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 713 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
714 | if(!audioScan) { | 714 | if(!audioScan) { |
715 | scanForAudio(); | 715 | scanForAudio(); |
716 | } | 716 | } |
717 | 717 | ||
718 | QListIterator<DocLnk> dit( files.children() ); | 718 | QListIterator<DocLnk> dit( files.children() ); |
719 | QListIterator<FileSystem> it ( fs ); | 719 | QListIterator<FileSystem> it ( fs ); |
720 | 720 | ||
721 | QString storage; | 721 | QString storage; |
722 | for ( ; dit.current(); ++dit ) { | 722 | for ( ; dit.current(); ++dit ) { |
723 | for( ; it.current(); ++it ){ | 723 | for( ; it.current(); ++it ){ |
724 | const QString name = (*it)->name(); | 724 | const QString name = (*it)->name(); |
725 | const QString path = (*it)->path(); | 725 | const QString path = (*it)->path(); |
726 | if(dit.current()->file().find(path) != -1 ) { | 726 | if(dit.current()->file().find(path) != -1 ) { |
727 | storage = name; | 727 | storage = name; |
728 | } | 728 | } |
729 | } | 729 | } |
730 | 730 | ||
731 | QListViewItem * newItem; | 731 | QListViewItem * newItem; |
732 | if ( QFile( dit.current()->file()).exists() ) { | 732 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
733 | // qDebug(dit.current()->name()); | 733 | long size; |
734 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 734 | if( dit.current()->file().left(4) == "http" ) |
735 | QString::number( QFile( dit.current()->file()).size() ), storage); | 735 | size=0; |
736 | else | ||
737 | size = QFile( dit.current()->file() ).size(); | ||
738 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); | ||
736 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 739 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
737 | } | 740 | } |
738 | } | 741 | } |
739 | } | 742 | } |
740 | 743 | ||
741 | 744 | ||
742 | void PlayListWidget::populateVideoView() { | 745 | void PlayListWidget::populateVideoView() { |
743 | videoView->clear(); | 746 | videoView->clear(); |
744 | StorageInfo storageInfo; | 747 | StorageInfo storageInfo; |
745 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 748 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
746 | 749 | ||
747 | if(!videoScan ) { | 750 | if(!videoScan ) { |
748 | scanForVideo(); | 751 | scanForVideo(); |
749 | } | 752 | } |
750 | 753 | ||
751 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 754 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
752 | QListIterator<FileSystem> it ( fs ); | 755 | QListIterator<FileSystem> it ( fs ); |
753 | videoView->clear(); | 756 | videoView->clear(); |
754 | QString storage; | 757 | QString storage; |
755 | for ( ; Vdit.current(); ++Vdit ) { | 758 | for ( ; Vdit.current(); ++Vdit ) { |
756 | for( ; it.current(); ++it ) { | 759 | for( ; it.current(); ++it ) { |
757 | const QString name = (*it)->name(); | 760 | const QString name = (*it)->name(); |
758 | const QString path = (*it)->path(); | 761 | const QString path = (*it)->path(); |
759 | if( Vdit.current()->file().find(path) != -1 ) { | 762 | if( Vdit.current()->file().find(path) != -1 ) { |
760 | storage=name; | 763 | storage=name; |
761 | } | 764 | } |
762 | } | 765 | } |
763 | 766 | ||
764 | QListViewItem * newItem; | 767 | QListViewItem * newItem; |
765 | if ( QFile( Vdit.current()->file() ).exists() ) { | 768 | if ( QFile( Vdit.current()->file() ).exists() ) { |
766 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 769 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
767 | QString::number( QFile( Vdit.current()->file() ).size() ), storage ); | 770 | QString::number( QFile( Vdit.current()->file() ).size() ), storage ); |
768 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 771 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
769 | } | 772 | } |
770 | } | 773 | } |
771 | } | 774 | } |
772 | 775 | ||
773 | 776 | ||
774 | void PlayListWidget::openFile() { | 777 | void PlayListWidget::openFile() { |
775 | QString filename, name; | 778 | QString filename, name; |
776 | InputDialog *fileDlg; | 779 | InputDialog *fileDlg; |
777 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 780 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
778 | fileDlg->exec(); | 781 | fileDlg->exec(); |
779 | if( fileDlg->result() == 1 ) { | 782 | if( fileDlg->result() == 1 ) { |
780 | filename = fileDlg->text(); | 783 | filename = fileDlg->text(); |
781 | 784 | ||
782 | qDebug( "Selected filename is " + filename ); | 785 | qDebug( "Selected filename is " + filename ); |
783 | if( filename.right( 3 ) == "m3u" ) { | 786 | if( filename.right( 3 ) == "m3u" ) { |
784 | readm3u( filename ); | 787 | readm3u( filename ); |
785 | } else if( filename.right(3) == "pls" ) { | 788 | } else if( filename.right(3) == "pls" ) { |
786 | readPls( filename ); | 789 | readPls( filename ); |
787 | } else { | 790 | } else { |
788 | // this doesnt need fixing | 791 | // this doesnt need fixing |
789 | DocLnk lnk; | 792 | DocLnk lnk; |
790 | lnk.setName( filename ); //sets file name | 793 | lnk.setName( filename ); //sets file name |
791 | lnk.setFile( filename ); //sets File property | 794 | lnk.setFile( filename ); //sets File property |
792 | //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); | 795 | //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); |
793 | lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); | 796 | lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); |
794 | lnk.setExec( "opieplayer" ); | 797 | lnk.setExec( "opieplayer" ); |
795 | lnk.setIcon( "opieplayer2/MPEGPlayer" ); | 798 | lnk.setIcon( "opieplayer2/MPEGPlayer" ); |
796 | 799 | ||
797 | if( !lnk.writeLink() ) { | 800 | if( !lnk.writeLink() ) { |
798 | qDebug( "Writing doclink did not work" ); | 801 | qDebug( "Writing doclink did not work" ); |
799 | } | 802 | } |