summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp48
1 files changed, 26 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6bedb57..16467c0 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -684,121 +684,125 @@ void PlayListWidget::scanForAudio() {
684 files.detachChildren(); 684 files.detachChildren();
685 QListIterator<DocLnk> sdit( files.children() ); 685 QListIterator<DocLnk> sdit( files.children() );
686 for ( ; sdit.current(); ++sdit ) { 686 for ( ; sdit.current(); ++sdit ) {
687 delete sdit.current(); 687 delete sdit.current();
688 } 688 }
689// Global::findDocuments( &files, "audio/*"); 689// Global::findDocuments( &files, "audio/*");
690 Global::findDocuments( &files, audioMimes); 690 Global::findDocuments( &files, audioMimes);
691 audioScan = true; 691 audioScan = true;
692 populateAudioView(); 692 populateAudioView();
693} 693}
694 694
695void PlayListWidget::scanForVideo() { 695void PlayListWidget::scanForVideo() {
696// qDebug("scan for video"); 696// qDebug("scan for video");
697 vFiles.detachChildren(); 697 vFiles.detachChildren();
698 QListIterator<DocLnk> sdit( vFiles.children() ); 698 QListIterator<DocLnk> sdit( vFiles.children() );
699 for ( ; sdit.current(); ++sdit ) { 699 for ( ; sdit.current(); ++sdit ) {
700 delete sdit.current(); 700 delete sdit.current();
701 } 701 }
702 Global::findDocuments(&vFiles, "video/*"); 702 Global::findDocuments(&vFiles, "video/*");
703 videoScan = true; 703 videoScan = true;
704 populateVideoView(); 704 populateVideoView();
705} 705}
706 706
707void PlayListWidget::populateAudioView() { 707void PlayListWidget::populateAudioView() {
708 audioView->clear(); 708 audioView->clear();
709 StorageInfo storageInfo; 709 StorageInfo storageInfo;
710 const QList<FileSystem> &fs = storageInfo.fileSystems(); 710 const QList<FileSystem> &fs = storageInfo.fileSystems();
711 if(!audioScan) { 711 if(!audioScan) {
712 scanForAudio(); 712 scanForAudio();
713 } 713 }
714 714
715 QListIterator<DocLnk> dit( files.children() ); 715 QListIterator<DocLnk> dit( files.children() );
716 QListIterator<FileSystem> it ( fs ); 716 // QListIterator<FileSystem> it ( fs );
717 audioView->clear();
717 718
718 QString storage; 719 QString storage;
719 for ( ; dit.current(); ++dit ) { 720 for ( ; dit.current(); ++dit ) {
720 for( ; it.current(); ++it ){ 721// // for( ; it.current(); ++it ){
721 const QString name = (*it)->name(); 722// const QString name = (*dit)->name();
722 const QString path = (*it)->path(); 723// const QString path = (*dit)->path();
723 if(dit.current()->file().find(path) != -1 ) { 724// if(dit.current()->file().find(path) != -1 ) {
724 storage = name; 725// storage = name;
725 } 726// // }
726 } 727// }
727 728
728 QListViewItem * newItem; 729 QListViewItem * newItem;
729 if ( QFile( dit.current()->file()).exists() || 730 if ( QFile( dit.current()->file()).exists() ||
730 dit.current()->file().left(4) == "http" ) { 731 dit.current()->file().left(4) == "http" ) {
731 long size; 732 long size;
732 if( dit.current()->file().left(4) == "http" ) 733 if( dit.current()->file().left(4) == "http" )
733 size=0; 734 size=0;
734 else 735 else
735 size = QFile( dit.current()->file() ).size(); 736 size = QFile( dit.current()->file() ).size();
737
736 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 738 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
737 QString::number(size ), storage, dit.current()->file()); 739 QString::number(size ), "" /*storage*/,
740 dit.current()->file() );
738 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 741 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
739 } 742// qDebug("<<<< "+dit.current()->file());
743 }
740 } 744 }
741 audioPopulated=true; 745 audioPopulated=true;
742} 746}
743 747
744 748
745void PlayListWidget::populateVideoView() { 749void PlayListWidget::populateVideoView() {
746 videoView->clear(); 750 videoView->clear();
747 StorageInfo storageInfo; 751 StorageInfo storageInfo;
748 const QList<FileSystem> &fs = storageInfo.fileSystems(); 752 const QList<FileSystem> &fs = storageInfo.fileSystems();
749 753
750 if(!videoScan ) { 754 if(!videoScan ) {
751 scanForVideo(); 755 scanForVideo();
752 } 756 }
753 757
754 QListIterator<DocLnk> Vdit( vFiles.children() ); 758 QListIterator<DocLnk> Vdit( vFiles.children() );
755 QListIterator<FileSystem> it ( fs ); 759// QListIterator<FileSystem> it ( fs );
756 videoView->clear(); 760 videoView->clear();
757 QString storage, pathName; 761 QString storage, pathName;
758 for ( ; Vdit.current(); ++Vdit ) { 762 for ( ; Vdit.current(); ++Vdit ) {
759 for( ; it.current(); ++it ) { 763// // for( ; it.current(); ++it ) {
760 const QString name = (*it)->name(); 764// const QString name = (*Vdit)->name();
761 const QString path = (*it)->path(); 765// const QString path = (*Vdit)->path();
762 if( Vdit.current()->file().find(path) != -1 ) { 766// if( Vdit.current()->file().find(path) != -1 ) {
763 storage=name; 767// storage=name;
764 pathName=path; 768// pathName=path;
765 } 769// // }
766 } 770// }
767 771
768 QListViewItem * newItem; 772 QListViewItem * newItem;
769 if ( QFile( Vdit.current()->file() ).exists() ) { 773 if ( QFile( Vdit.current()->file() ).exists() ) {
770 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 774 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
771 QString::number( QFile( Vdit.current()->file() ).size() ), 775 QString::number( QFile( Vdit.current()->file() ).size() ),
772 storage, Vdit.current()->file()); 776 ""/*storage*/, Vdit.current()->file());
773 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 777 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
774 } 778 }
775 } 779 }
776 videoPopulated=true; 780 videoPopulated=true;
777} 781}
778 782
779 783
780void PlayListWidget::openFile() { 784void PlayListWidget::openFile() {
781 // http://66.28.164.33:2080 785 // http://66.28.164.33:2080
782 // http://somafm.com/star0242.m3u 786 // http://somafm.com/star0242.m3u
783 QString filename, name; 787 QString filename, name;
784 InputDialog *fileDlg; 788 InputDialog *fileDlg;
785 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 789 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
786 fileDlg->exec(); 790 fileDlg->exec();
787 if( fileDlg->result() == 1 ) { 791 if( fileDlg->result() == 1 ) {
788 filename = fileDlg->text(); 792 filename = fileDlg->text();
789 qDebug( "Selected filename is " + filename ); 793 qDebug( "Selected filename is " + filename );
790 Om3u *m3uList; 794 Om3u *m3uList;
791 DocLnk lnk; 795 DocLnk lnk;
792 Config cfg( "OpiePlayer" ); 796 Config cfg( "OpiePlayer" );
793 cfg.setGroup("PlayList"); 797 cfg.setGroup("PlayList");
794 798
795 if(filename.left(4) == "http") { 799 if(filename.left(4) == "http") {
796 QString m3uFile, m3uFilePath; 800 QString m3uFile, m3uFilePath;
797 if(filename.find(":",8,TRUE) != -1) { //found a port 801 if(filename.find(":",8,TRUE) != -1) { //found a port
798 m3uFile = filename.left( filename.find( ":",8,TRUE)); 802 m3uFile = filename.left( filename.find( ":",8,TRUE));
799 m3uFile = m3uFile.right( 7); 803 m3uFile = m3uFile.right( 7);
800 } else if(filename.left(4) == "http"){ 804 } else if(filename.left(4) == "http"){
801 m3uFile=filename; 805 m3uFile=filename;
802 m3uFile = m3uFile.right( m3uFile.length() - 7); 806 m3uFile = m3uFile.right( m3uFile.length() - 7);
803 } else{ 807 } else{
804 m3uFile=filename; 808 m3uFile=filename;