author | llornkcor <llornkcor> | 2002-06-19 13:43:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-19 13:43:27 (UTC) |
commit | 110eeb8d44d3065c066a29931761371928df49c4 (patch) (unidiff) | |
tree | 527910aac86ed61e0c2d7d1c885300d841a632ba | |
parent | 94f27897d74d0553bb7a5614f7da0603d490533e (diff) | |
download | opie-110eeb8d44d3065c066a29931761371928df49c4.zip opie-110eeb8d44d3065c066a29931761371928df49c4.tar.gz opie-110eeb8d44d3065c066a29931761371928df49c4.tar.bz2 |
fixed problem with writing doclnk, and local files in an m3u
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 2323ac2..eeaed33 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -824,65 +824,66 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
824 | tbDeletePlaylist->hide(); | 824 | tbDeletePlaylist->hide(); |
825 | d->tbRemoveFromList->setEnabled(FALSE); | 825 | d->tbRemoveFromList->setEnabled(FALSE); |
826 | d->tbAddToList->setEnabled(TRUE); | 826 | d->tbAddToList->setEnabled(TRUE); |
827 | } | 827 | } |
828 | break; | 828 | break; |
829 | case 2: | 829 | case 2: |
830 | { | 830 | { |
831 | videoView->clear(); | 831 | videoView->clear(); |
832 | populateVideoView(); | 832 | populateVideoView(); |
833 | if( !tbDeletePlaylist->isHidden()) | 833 | if( !tbDeletePlaylist->isHidden()) |
834 | tbDeletePlaylist->hide(); | 834 | tbDeletePlaylist->hide(); |
835 | d->tbRemoveFromList->setEnabled(FALSE); | 835 | d->tbRemoveFromList->setEnabled(FALSE); |
836 | d->tbAddToList->setEnabled(TRUE); | 836 | d->tbAddToList->setEnabled(TRUE); |
837 | } | 837 | } |
838 | break; | 838 | break; |
839 | case 3: | 839 | case 3: |
840 | { | 840 | { |
841 | if( tbDeletePlaylist->isHidden()) | 841 | if( tbDeletePlaylist->isHidden()) |
842 | tbDeletePlaylist->show(); | 842 | tbDeletePlaylist->show(); |
843 | playLists->reread(); | 843 | playLists->reread(); |
844 | } | 844 | } |
845 | break; | 845 | break; |
846 | }; | 846 | }; |
847 | } | 847 | } |
848 | 848 | ||
849 | void PlayListWidget::btnPlay(bool b) { | 849 | void PlayListWidget::btnPlay(bool b) { |
850 | 850 | ||
851 | // mediaPlayerState->setPlaying(b); | 851 | // mediaPlayerState->setPlaying(b); |
852 | switch ( tabWidget->currentPageIndex()) { | 852 | switch ( tabWidget->currentPageIndex()) { |
853 | case 0: | 853 | case 0: |
854 | { | 854 | { |
855 | qDebug("here we are"); | 855 | qDebug("here we are"); |
856 | if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | 856 | if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 |
857 | || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | ||
857 | QMessageBox::message("Note","You are trying to play\na malformed url."); | 858 | QMessageBox::message("Note","You are trying to play\na malformed url."); |
858 | 859 | ||
859 | } else { | 860 | } else { |
860 | 861 | ||
861 | mediaPlayerState->setPlaying(b); | 862 | mediaPlayerState->setPlaying(b); |
862 | } } | 863 | } } |
863 | break; | 864 | break; |
864 | case 1: | 865 | case 1: |
865 | { | 866 | { |
866 | addToSelection( audioView->currentItem() ); | 867 | addToSelection( audioView->currentItem() ); |
867 | mediaPlayerState->setPlaying(b); | 868 | mediaPlayerState->setPlaying(b); |
868 | d->selectedFiles->removeSelected( ); | 869 | d->selectedFiles->removeSelected( ); |
869 | tabWidget->setCurrentPage(1); | 870 | tabWidget->setCurrentPage(1); |
870 | d->selectedFiles->unSelect(); | 871 | d->selectedFiles->unSelect(); |
871 | insanityBool=FALSE; | 872 | insanityBool=FALSE; |
872 | }// audioView->clearSelection(); | 873 | }// audioView->clearSelection(); |
873 | break; | 874 | break; |
874 | case 2: | 875 | case 2: |
875 | { | 876 | { |
876 | addToSelection( videoView->currentItem() ); | 877 | addToSelection( videoView->currentItem() ); |
877 | mediaPlayerState->setPlaying(b); | 878 | mediaPlayerState->setPlaying(b); |
878 | qApp->processEvents(); | 879 | qApp->processEvents(); |
879 | d->selectedFiles->removeSelected( ); | 880 | d->selectedFiles->removeSelected( ); |
880 | tabWidget->setCurrentPage(2); | 881 | tabWidget->setCurrentPage(2); |
881 | d->selectedFiles->unSelect(); | 882 | d->selectedFiles->unSelect(); |
882 | insanityBool=FALSE; | 883 | insanityBool=FALSE; |
883 | }// videoView->clearSelection(); | 884 | }// videoView->clearSelection(); |
884 | break; | 885 | break; |
885 | }; | 886 | }; |
886 | 887 | ||
887 | } | 888 | } |
888 | 889 | ||
@@ -1204,78 +1205,87 @@ void PlayListWidget::doUnblank() { | |||
1204 | close(fd); | 1205 | close(fd); |
1205 | } | 1206 | } |
1206 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1207 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1207 | h <<-3;// v[1]; // -3 Force on | 1208 | h <<-3;// v[1]; // -3 Force on |
1208 | } | 1209 | } |
1209 | 1210 | ||
1210 | void PlayListWidget::readm3u(const QString &filename) { | 1211 | void PlayListWidget::readm3u(const QString &filename) { |
1211 | 1212 | ||
1212 | qDebug("m3u filename is "+filename); | 1213 | qDebug("m3u filename is "+filename); |
1213 | QFile f(filename); | 1214 | QFile f(filename); |
1214 | 1215 | ||
1215 | if(f.open(IO_ReadOnly)) { | 1216 | if(f.open(IO_ReadOnly)) { |
1216 | QTextStream t(&f); | 1217 | QTextStream t(&f); |
1217 | QString s;//, first, second; | 1218 | QString s;//, first, second; |
1218 | int i=0; | 1219 | int i=0; |
1219 | while ( !t.atEnd()) { | 1220 | while ( !t.atEnd()) { |
1220 | // Lview->insertLine(t.readLine(),-1); | 1221 | // Lview->insertLine(t.readLine(),-1); |
1221 | s=t.readLine(); | 1222 | s=t.readLine(); |
1222 | if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { | 1223 | if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { |
1223 | QMessageBox::message("Note","Spaces in urls are not allowed."); | 1224 | QMessageBox::message("Note","Spaces in urls are not allowed."); |
1224 | } | 1225 | } |
1225 | else if(s.find("#",0,TRUE) == -1) { | 1226 | else if(s.find("#",0,TRUE) == -1) { |
1226 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1227 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1227 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1228 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1228 | s=s.right(s.length()-2); | 1229 | s=s.right(s.length()-2); |
1229 | DocLnk lnk( s ); | 1230 | DocLnk lnk( s ); |
1230 | QFileInfo f(s); | 1231 | QFileInfo f(s); |
1231 | QString name = f.baseName(); | 1232 | QString name = f.baseName(); |
1232 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1233 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1233 | lnk.setName( name); | 1234 | lnk.setName( name); |
1234 | s=s.replace( QRegExp("\\"),"/"); | 1235 | s=s.replace( QRegExp("\\"),"/"); |
1235 | lnk.setFile( s); | 1236 | lnk.setFile( s); |
1237 | lnk.writeLink(); | ||
1236 | // lnk.setIcon(opieplayer/MPEGPlayer); | 1238 | // lnk.setIcon(opieplayer/MPEGPlayer); |
1237 | qDebug("add "+name); | 1239 | qDebug("add "+name); |
1238 | d->selectedFiles->addToSelection( lnk); | 1240 | d->selectedFiles->addToSelection( lnk); |
1239 | } else { // is url | 1241 | } else { // is url |
1240 | 1242 | ||
1241 | s.replace(QRegExp("%20")," "); | 1243 | s.replace(QRegExp("%20")," "); |
1242 | DocLnk lnk( s); | 1244 | DocLnk lnk( s); |
1243 | QString name = s.right( s.length() - 7); | 1245 | QString name; |
1246 | if(name.left(4)=="http") | ||
1247 | name = s.right( s.length() - 7); | ||
1248 | else | ||
1249 | name=s; | ||
1244 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1250 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1245 | lnk.setName(name); | 1251 | lnk.setName(name); |
1246 | lnk.setFile( s+"/"); | 1252 | if(s.at(s.length()-4) == '.') |
1253 | lnk.setFile( s); | ||
1254 | else | ||
1255 | lnk.setFile( s+"/"); | ||
1247 | // lnk.setFile( filename); | 1256 | // lnk.setFile( filename); |
1248 | // lnk.setComment( s+"/"); | 1257 | // lnk.setComment( s+"/"); |
1249 | lnk.setType("audio/x-mpegurl"); | 1258 | lnk.setType("audio/x-mpegurl"); |
1259 | lnk.writeLink(); | ||
1250 | // lnk.setIcon( "opieplayer/MPEGPlayer"); | 1260 | // lnk.setIcon( "opieplayer/MPEGPlayer"); |
1251 | // qDebug("add "+s); | 1261 | // qDebug("add "+s); |
1252 | d->selectedFiles->addToSelection( lnk); | 1262 | d->selectedFiles->addToSelection( lnk); |
1253 | } | 1263 | } |
1254 | i++; | 1264 | i++; |
1255 | } | 1265 | } |
1256 | } | 1266 | } |
1257 | } | 1267 | } |
1258 | } | 1268 | } |
1259 | f.close(); | 1269 | f.close(); |
1260 | } | 1270 | } |
1261 | 1271 | ||
1262 | void PlayListWidget::writem3u(const QString &filename) { | 1272 | void PlayListWidget::writem3u(const QString &filename) { |
1263 | 1273 | ||
1264 | } | 1274 | } |
1265 | 1275 | ||
1266 | void PlayListWidget::readPls(const QString &filename) { | 1276 | void PlayListWidget::readPls(const QString &filename) { |
1267 | 1277 | ||
1268 | qDebug("pls filename is "+filename); | 1278 | qDebug("pls filename is "+filename); |
1269 | QFile f(filename); | 1279 | QFile f(filename); |
1270 | 1280 | ||
1271 | if(f.open(IO_ReadOnly)) { | 1281 | if(f.open(IO_ReadOnly)) { |
1272 | QTextStream t(&f); | 1282 | QTextStream t(&f); |
1273 | QString s;//, first, second; | 1283 | QString s;//, first, second; |
1274 | int i=0; | 1284 | int i=0; |
1275 | while ( !t.atEnd()) { | 1285 | while ( !t.atEnd()) { |
1276 | s=t.readLine(); | 1286 | s=t.readLine(); |
1277 | if(s.left(4) == "File") { | 1287 | if(s.left(4) == "File") { |
1278 | s=s.right(s.length() - 6); | 1288 | s=s.right(s.length() - 6); |
1279 | s.replace(QRegExp("%20")," "); | 1289 | s.replace(QRegExp("%20")," "); |
1280 | qDebug("adding "+s+" to playlist"); | 1290 | qDebug("adding "+s+" to playlist"); |
1281 | // numberofentries=2 | 1291 | // numberofentries=2 |