author | llornkcor <llornkcor> | 2003-06-11 23:09:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-06-11 23:09:04 (UTC) |
commit | f0fab7d044feb2fe7f6a8c2a8d41653e1a17a538 (patch) (unidiff) | |
tree | 4d8a625d5dd4ab6fba872f14b6d9e5c7e9cb13fe | |
parent | 24097a2790fd7bb241a0a8da24ef2996e4f4ad15 (diff) | |
download | opie-f0fab7d044feb2fe7f6a8c2a8d41653e1a17a538.zip opie-f0fab7d044feb2fe7f6a8c2a8d41653e1a17a538.tar.gz opie-f0fab7d044feb2fe7f6a8c2a8d41653e1a17a538.tar.bz2 |
compile
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 1fc7dd8..efea385 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -987,193 +987,193 @@ void PlayListWidget::scanForAudio() { | |||
987 | } | 987 | } |
988 | void PlayListWidget::scanForVideo() { | 988 | void PlayListWidget::scanForVideo() { |
989 | // qDebug("scan for video"); | 989 | // qDebug("scan for video"); |
990 | vFiles.detachChildren(); | 990 | vFiles.detachChildren(); |
991 | QListIterator<DocLnk> sdit( vFiles.children() ); | 991 | QListIterator<DocLnk> sdit( vFiles.children() ); |
992 | for ( ; sdit.current(); ++sdit ) { | 992 | for ( ; sdit.current(); ++sdit ) { |
993 | delete sdit.current(); | 993 | delete sdit.current(); |
994 | } | 994 | } |
995 | Global::findDocuments(&vFiles, "video/*"); | 995 | Global::findDocuments(&vFiles, "video/*"); |
996 | videoScan = true; | 996 | videoScan = true; |
997 | } | 997 | } |
998 | 998 | ||
999 | void PlayListWidget::populateAudioView() { | 999 | void PlayListWidget::populateAudioView() { |
1000 | 1000 | ||
1001 | audioView->clear(); | 1001 | audioView->clear(); |
1002 | StorageInfo storageInfo; | 1002 | StorageInfo storageInfo; |
1003 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1003 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1004 | if(!audioScan) scanForAudio(); | 1004 | if(!audioScan) scanForAudio(); |
1005 | 1005 | ||
1006 | QListIterator<DocLnk> dit( files.children() ); | 1006 | QListIterator<DocLnk> dit( files.children() ); |
1007 | QListIterator<FileSystem> it ( fs ); | 1007 | QListIterator<FileSystem> it ( fs ); |
1008 | 1008 | ||
1009 | QString storage; | 1009 | QString storage; |
1010 | for ( ; dit.current(); ++dit ) { | 1010 | for ( ; dit.current(); ++dit ) { |
1011 | for( ; it.current(); ++it ){ | 1011 | for( ; it.current(); ++it ){ |
1012 | const QString name = (*it)->name(); | 1012 | const QString name = (*it)->name(); |
1013 | const QString path = (*it)->path(); | 1013 | const QString path = (*it)->path(); |
1014 | if(dit.current()->file().find(path) != -1 ) storage=name; | 1014 | if(dit.current()->file().find(path) != -1 ) storage=name; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | QListViewItem * newItem; | 1017 | QListViewItem * newItem; |
1018 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 1018 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
1019 | long size; | 1019 | long size; |
1020 | if( dit.current()->file().left(4) == "http" ) | 1020 | if( dit.current()->file().left(4) == "http" ) |
1021 | size=0; | 1021 | size=0; |
1022 | else | 1022 | else |
1023 | size = QFile( dit.current()->file() ).size(); | 1023 | size = QFile( dit.current()->file() ).size(); |
1024 | // qDebug(dit.current()->name()); | 1024 | // qDebug(dit.current()->name()); |
1025 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1025 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1026 | QString::number(size ), storage, dit.current()->file()); | 1026 | QString::number(size ), storage, dit.current()->file()); |
1027 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1027 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | void PlayListWidget::populateVideoView() { | 1033 | void PlayListWidget::populateVideoView() { |
1034 | videoView->clear(); | 1034 | videoView->clear(); |
1035 | StorageInfo storageInfo; | 1035 | StorageInfo storageInfo; |
1036 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1036 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1037 | 1037 | ||
1038 | if(!videoScan ) scanForVideo(); | 1038 | if(!videoScan ) scanForVideo(); |
1039 | 1039 | ||
1040 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1040 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
1041 | QListIterator<FileSystem> it ( fs ); | 1041 | QListIterator<FileSystem> it ( fs ); |
1042 | videoView->clear(); | 1042 | videoView->clear(); |
1043 | QString storage; | 1043 | QString storage; |
1044 | for ( ; Vdit.current(); ++Vdit ) { | 1044 | for ( ; Vdit.current(); ++Vdit ) { |
1045 | for( ; it.current(); ++it ){ | 1045 | for( ; it.current(); ++it ){ |
1046 | const QString name = (*it)->name(); | 1046 | const QString name = (*it)->name(); |
1047 | const QString path = (*it)->path(); | 1047 | const QString path = (*it)->path(); |
1048 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1048 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | QListViewItem * newItem; | 1051 | QListViewItem * newItem; |
1052 | if ( QFile( Vdit.current()->file()).exists() ) { | 1052 | if ( QFile( Vdit.current()->file()).exists() ) { |
1053 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1053 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1054 | QString::number( QFile( Vdit.current()->file() ).size() ), | 1054 | QString::number( QFile( Vdit.current()->file() ).size() ), |
1055 | storage, Vdit.current()->file()); | 1055 | storage, Vdit.current()->file()); |
1056 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1056 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | void PlayListWidget::openFile() { | 1061 | void PlayListWidget::openFile() { |
1062 | QString filename, name; | 1062 | QString filename, name; |
1063 | InputDialog *fileDlg; | 1063 | InputDialog *fileDlg; |
1064 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1064 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1065 | fileDlg->exec(); | 1065 | fileDlg->exec(); |
1066 | if( fileDlg->result() == 1 ) { | 1066 | if( fileDlg->result() == 1 ) { |
1067 | filename = fileDlg->text(); | 1067 | filename = fileDlg->text(); |
1068 | // qDebug( "Selected filename is " + filename ); | 1068 | // qDebug( "Selected filename is " + filename ); |
1069 | DocLnk lnk; | 1069 | DocLnk lnk; |
1070 | Config cfg( "OpiePlayer" ); | 1070 | Config cfg( "OpiePlayer" ); |
1071 | cfg.setGroup("PlayList"); | 1071 | cfg.setGroup("PlayList"); |
1072 | 1072 | ||
1073 | QString m3uFile; | 1073 | QString m3uFile; |
1074 | m3uFile = filename; | 1074 | m3uFile = filename; |
1075 | if(filename.left(4) == "http") { | 1075 | if(filename.left(4) == "http") { |
1076 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1076 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1077 | 1077 | ||
1078 | m3uFile = filename; | 1078 | m3uFile = filename; |
1079 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | 1079 | if( m3uFile.right( 1 ).find( '/' ) == -1) { |
1080 | m3uFile += "/"; | 1080 | m3uFile += "/"; |
1081 | } | 1081 | } |
1082 | filename = m3uFile; | 1082 | filename = m3uFile; |
1083 | = } | 1083 | } |
1084 | lnk.setName( m3uFile ); //sets name | 1084 | lnk.setName( m3uFile ); //sets name |
1085 | lnk.setFile( filename ); //sets file name | 1085 | lnk.setFile( filename ); //sets file name |
1086 | lnk.setIcon("opieplayer2/musicfile"); | 1086 | lnk.setIcon("opieplayer2/musicfile"); |
1087 | d->selectedFiles->addToSelection( lnk ); | 1087 | d->selectedFiles->addToSelection( lnk ); |
1088 | writeCurrentM3u(); | 1088 | writeCurrentM3u(); |
1089 | } | 1089 | } |
1090 | else if( filename.right( 3) == "m3u" ) { | 1090 | else if( filename.right( 3) == "m3u" ) { |
1091 | readm3u( filename ); | 1091 | readm3u( filename ); |
1092 | 1092 | ||
1093 | } else if( filename.right(3) == "pls" ) { | 1093 | } else if( filename.right(3) == "pls" ) { |
1094 | readPls( filename ); | 1094 | readPls( filename ); |
1095 | } else { | 1095 | } else { |
1096 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1096 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1097 | lnk.setFile( filename ); //sets file name | 1097 | lnk.setFile( filename ); //sets file name |
1098 | d->selectedFiles->addToSelection( lnk); | 1098 | d->selectedFiles->addToSelection( lnk); |
1099 | lnk.removeLinkFile(); | 1099 | lnk.removeLinkFile(); |
1100 | writeCurrentM3u(); | 1100 | writeCurrentM3u(); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | if( fileDlg ) { | 1104 | if( fileDlg ) { |
1105 | delete fileDlg; | 1105 | delete fileDlg; |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | 1109 | ||
1110 | /* | 1110 | /* |
1111 | reads m3u and shows files/urls to playlist widget */ | 1111 | reads m3u and shows files/urls to playlist widget */ |
1112 | void PlayListWidget::readm3u( const QString &filename ) { | 1112 | void PlayListWidget::readm3u( const QString &filename ) { |
1113 | // qDebug( "read m3u filename " + filename ); | 1113 | // qDebug( "read m3u filename " + filename ); |
1114 | 1114 | ||
1115 | Om3u *m3uList; | 1115 | Om3u *m3uList; |
1116 | QString s, name; | 1116 | QString s, name; |
1117 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1117 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1118 | m3uList->readM3u(); | 1118 | m3uList->readM3u(); |
1119 | DocLnk lnk; | 1119 | DocLnk lnk; |
1120 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1120 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1121 | s = *it; | 1121 | s = *it; |
1122 | // qDebug("reading "+ s); | 1122 | // qDebug("reading "+ s); |
1123 | if(s.left(4)=="http") { | 1123 | if(s.left(4)=="http") { |
1124 | lnk.setName( s ); //sets file name | 1124 | lnk.setName( s ); //sets file name |
1125 | lnk.setIcon("opieplayer2/musicfile"); | 1125 | lnk.setIcon("opieplayer2/musicfile"); |
1126 | 1126 | ||
1127 | // if(s.right(4) != '.' || s.right(5) != '.') | 1127 | // if(s.right(4) != '.' || s.right(5) != '.') |
1128 | if(s.right(4) != '.' || s.right(5) != '.' ) | 1128 | if(s.right(4) != '.' || s.right(5) != '.' ) |
1129 | if( s.right(1) != "/") | 1129 | if( s.right(1) != "/") |
1130 | lnk.setFile( s+"/"); //if url with no extension | 1130 | lnk.setFile( s+"/"); //if url with no extension |
1131 | else | 1131 | else |
1132 | lnk.setFile( s ); //sets file name | 1132 | lnk.setFile( s ); //sets file name |
1133 | 1133 | ||
1134 | } else { | 1134 | } else { |
1135 | // if( QFileInfo( s ).exists() ) { | 1135 | // if( QFileInfo( s ).exists() ) { |
1136 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1136 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1137 | // if(s.right(4) == '.') {//if regular file | 1137 | // if(s.right(4) == '.') {//if regular file |
1138 | if(s.left(1) != "/") { | 1138 | if(s.left(1) != "/") { |
1139 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 1139 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
1140 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1140 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1141 | lnk.setIcon("SoundPlayer"); | 1141 | lnk.setIcon("SoundPlayer"); |
1142 | } else { | 1142 | } else { |
1143 | // qDebug("set link2 "+s); | 1143 | // qDebug("set link2 "+s); |
1144 | lnk.setFile( s); | 1144 | lnk.setFile( s); |
1145 | lnk.setIcon("SoundPlayer"); | 1145 | lnk.setIcon("SoundPlayer"); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | d->selectedFiles->addToSelection( lnk ); | 1148 | d->selectedFiles->addToSelection( lnk ); |
1149 | } | 1149 | } |
1150 | Config config( "OpiePlayer" ); | 1150 | Config config( "OpiePlayer" ); |
1151 | config.setGroup( "PlayList" ); | 1151 | config.setGroup( "PlayList" ); |
1152 | 1152 | ||
1153 | config.writeEntry("CurrentPlaylist",filename); | 1153 | config.writeEntry("CurrentPlaylist",filename); |
1154 | config.write(); | 1154 | config.write(); |
1155 | currentPlayList=filename; | 1155 | currentPlayList=filename; |
1156 | 1156 | ||
1157 | // m3uList->write(); | 1157 | // m3uList->write(); |
1158 | m3uList->close(); | 1158 | m3uList->close(); |
1159 | if(m3uList) delete m3uList; | 1159 | if(m3uList) delete m3uList; |
1160 | 1160 | ||
1161 | d->selectedFiles->setSelectedItem( s); | 1161 | d->selectedFiles->setSelectedItem( s); |
1162 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); | 1162 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); |
1163 | 1163 | ||
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | /* | 1166 | /* |
1167 | reads pls and adds files/urls to playlist */ | 1167 | reads pls and adds files/urls to playlist */ |
1168 | void PlayListWidget::readPls( const QString &filename ) { | 1168 | void PlayListWidget::readPls( const QString &filename ) { |
1169 | 1169 | ||
1170 | // qDebug( "pls filename is " + filename ); | 1170 | // qDebug( "pls filename is " + filename ); |
1171 | Om3u *m3uList; | 1171 | Om3u *m3uList; |
1172 | QString s, name; | 1172 | QString s, name; |
1173 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1173 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1174 | m3uList->readPls(); | 1174 | m3uList->readPls(); |
1175 | 1175 | ||
1176 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1176 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1177 | s = *it; | 1177 | s = *it; |
1178 | // s.replace( QRegExp( "%20" )," " ); | 1178 | // s.replace( QRegExp( "%20" )," " ); |
1179 | DocLnk lnk( s ); | 1179 | DocLnk lnk( s ); |