-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 41fcb30..2323ac2 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -415,15 +415,21 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
415 | 415 | ||
416 | 416 | ||
417 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 417 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
418 | // qDebug("add"); | 418 | // qDebug("add"); |
419 | d->setDocumentUsed = FALSE; | 419 | if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) { |
420 | if ( mediaPlayerState->playlist() ) { | 420 | QMessageBox::message("Note","You are trying to play\na malformed url."); |
421 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | 421 | |
422 | d->selectedFiles->addToSelection( lnk ); | 422 | } else { |
423 | |||
424 | d->setDocumentUsed = FALSE; | ||
425 | if ( mediaPlayerState->playlist() ) { | ||
426 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | ||
427 | d->selectedFiles->addToSelection( lnk ); | ||
428 | } | ||
429 | else | ||
430 | mediaPlayerState->setPlaying( TRUE ); | ||
423 | } | 431 | } |
424 | else | ||
425 | mediaPlayerState->setPlaying( TRUE ); | ||
426 | } | 432 | } |
427 | 433 | ||
428 | 434 | ||
429 | void PlayListWidget::clearList() { | 435 | void PlayListWidget::clearList() { |
@@ -845,36 +851,40 @@ void PlayListWidget::btnPlay(bool b) { | |||
845 | // mediaPlayerState->setPlaying(b); | 851 | // mediaPlayerState->setPlaying(b); |
846 | switch ( tabWidget->currentPageIndex()) { | 852 | switch ( tabWidget->currentPageIndex()) { |
847 | case 0: | 853 | case 0: |
848 | { | 854 | { |
849 | 855 | qDebug("here we are"); | |
850 | mediaPlayerState->setPlaying(b); | 856 | if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { |
851 | } | 857 | QMessageBox::message("Note","You are trying to play\na malformed url."); |
858 | |||
859 | } else { | ||
860 | |||
861 | mediaPlayerState->setPlaying(b); | ||
862 | } } | ||
852 | break; | 863 | break; |
853 | case 1: | 864 | case 1: |
854 | { | 865 | { |
855 | addToSelection( audioView->currentItem() ); | 866 | addToSelection( audioView->currentItem() ); |
856 | mediaPlayerState->setPlaying(b); | 867 | mediaPlayerState->setPlaying(b); |
857 | d->selectedFiles->removeSelected( ); | 868 | d->selectedFiles->removeSelected( ); |
858 | tabWidget->setCurrentPage(1); | 869 | tabWidget->setCurrentPage(1); |
859 | d->selectedFiles->unSelect(); | 870 | d->selectedFiles->unSelect(); |
860 | insanityBool=FALSE; | 871 | insanityBool=FALSE; |
861 | // audioView->clearSelection(); | 872 | }// audioView->clearSelection(); |
862 | } | ||
863 | break; | 873 | break; |
864 | case 2: | 874 | case 2: |
865 | { | 875 | { |
866 | addToSelection( videoView->currentItem() ); | 876 | addToSelection( videoView->currentItem() ); |
867 | mediaPlayerState->setPlaying(b); | 877 | mediaPlayerState->setPlaying(b); |
868 | qApp->processEvents(); | 878 | qApp->processEvents(); |
869 | d->selectedFiles->removeSelected( ); | 879 | d->selectedFiles->removeSelected( ); |
870 | tabWidget->setCurrentPage(2); | 880 | tabWidget->setCurrentPage(2); |
871 | d->selectedFiles->unSelect(); | 881 | d->selectedFiles->unSelect(); |
872 | insanityBool=FALSE; | 882 | insanityBool=FALSE; |
873 | // videoView->clearSelection(); | 883 | }// videoView->clearSelection(); |
874 | } | ||
875 | break; | 884 | break; |
876 | }; | 885 | }; |
886 | |||
877 | } | 887 | } |
878 | 888 | ||
879 | void PlayListWidget::deletePlaylist() { | 889 | void PlayListWidget::deletePlaylist() { |
880 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 890 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
@@ -1067,11 +1077,14 @@ void PlayListWidget::openFile() { | |||
1067 | if( fileDlg->result() == 1 ) { | 1077 | if( fileDlg->result() == 1 ) { |
1068 | filename = fileDlg->LineEdit1->text(); | 1078 | filename = fileDlg->LineEdit1->text(); |
1069 | // http://205.188.234.129:8030 | 1079 | // http://205.188.234.129:8030 |
1070 | // http://66.28.68.70:8000 | 1080 | // http://66.28.68.70:8000 |
1071 | filename.replace(QRegExp("%20")," "); | 1081 | // filename.replace(QRegExp("%20")," "); |
1072 | 1082 | if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { | |
1073 | qDebug("Selected filename is "+filename); | 1083 | QMessageBox::message("Note","Spaces in urls are not allowed."); |
1084 | return; | ||
1085 | } else { | ||
1086 | qDebug("Selected filename is "+filename); | ||
1074 | if(filename.right(3) == "m3u") | 1087 | if(filename.right(3) == "m3u") |
1075 | readm3u( filename); | 1088 | readm3u( filename); |
1076 | else if(filename.right(3) == "pls") | 1089 | else if(filename.right(3) == "pls") |
1077 | readPls( filename); | 1090 | readPls( filename); |
@@ -1093,8 +1106,9 @@ void PlayListWidget::openFile() { | |||
1093 | // if(fileDlg2) | 1106 | // if(fileDlg2) |
1094 | // delete fileDlg2; | 1107 | // delete fileDlg2; |
1095 | } | 1108 | } |
1096 | } | 1109 | } |
1110 | } | ||
1097 | if(fileDlg) | 1111 | if(fileDlg) |
1098 | delete fileDlg; | 1112 | delete fileDlg; |
1099 | } | 1113 | } |
1100 | 1114 | ||
@@ -1204,9 +1218,12 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
1204 | int i=0; | 1218 | int i=0; |
1205 | while ( !t.atEnd()) { | 1219 | while ( !t.atEnd()) { |
1206 | // Lview->insertLine(t.readLine(),-1); | 1220 | // Lview->insertLine(t.readLine(),-1); |
1207 | s=t.readLine(); | 1221 | s=t.readLine(); |
1208 | if(s.find("#",0,TRUE) == -1) { | 1222 | if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { |
1223 | QMessageBox::message("Note","Spaces in urls are not allowed."); | ||
1224 | } | ||
1225 | else if(s.find("#",0,TRUE) == -1) { | ||
1209 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1226 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1210 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1227 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1211 | s=s.right(s.length()-2); | 1228 | s=s.right(s.length()-2); |
1212 | DocLnk lnk( s ); | 1229 | DocLnk lnk( s ); |
@@ -1219,8 +1236,9 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
1219 | // lnk.setIcon(opieplayer/MPEGPlayer); | 1236 | // lnk.setIcon(opieplayer/MPEGPlayer); |
1220 | qDebug("add "+name); | 1237 | qDebug("add "+name); |
1221 | d->selectedFiles->addToSelection( lnk); | 1238 | d->selectedFiles->addToSelection( lnk); |
1222 | } else { // is url | 1239 | } else { // is url |
1240 | |||
1223 | s.replace(QRegExp("%20")," "); | 1241 | s.replace(QRegExp("%20")," "); |
1224 | DocLnk lnk( s); | 1242 | DocLnk lnk( s); |
1225 | QString name = s.right( s.length() - 7); | 1243 | QString name = s.right( s.length() - 7); |
1226 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1244 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
@@ -1237,8 +1255,9 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
1237 | } | 1255 | } |
1238 | } | 1256 | } |
1239 | } | 1257 | } |
1240 | } | 1258 | } |
1259 | f.close(); | ||
1241 | } | 1260 | } |
1242 | 1261 | ||
1243 | void PlayListWidget::writem3u(const QString &filename) { | 1262 | void PlayListWidget::writem3u(const QString &filename) { |
1244 | 1263 | ||