-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 35 |
1 files changed, 27 insertions, 8 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 | |||
@@ -416,6 +416,11 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
416 | 416 | ||
417 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 417 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
418 | // qDebug("add"); | 418 | // qDebug("add"); |
419 | if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) { | ||
420 | QMessageBox::message("Note","You are trying to play\na malformed url."); | ||
421 | |||
422 | } else { | ||
423 | |||
419 | d->setDocumentUsed = FALSE; | 424 | d->setDocumentUsed = FALSE; |
420 | if ( mediaPlayerState->playlist() ) { | 425 | if ( mediaPlayerState->playlist() ) { |
421 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | 426 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) |
@@ -424,6 +429,7 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
424 | else | 429 | else |
425 | mediaPlayerState->setPlaying( TRUE ); | 430 | mediaPlayerState->setPlaying( TRUE ); |
426 | } | 431 | } |
432 | } | ||
427 | 433 | ||
428 | 434 | ||
429 | void PlayListWidget::clearList() { | 435 | void PlayListWidget::clearList() { |
@@ -846,9 +852,14 @@ void PlayListWidget::btnPlay(bool b) { | |||
846 | switch ( tabWidget->currentPageIndex()) { | 852 | switch ( tabWidget->currentPageIndex()) { |
847 | case 0: | 853 | case 0: |
848 | { | 854 | { |
855 | qDebug("here we are"); | ||
856 | if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | ||
857 | QMessageBox::message("Note","You are trying to play\na malformed url."); | ||
858 | |||
859 | } else { | ||
849 | 860 | ||
850 | mediaPlayerState->setPlaying(b); | 861 | mediaPlayerState->setPlaying(b); |
851 | } | 862 | } } |
852 | break; | 863 | break; |
853 | case 1: | 864 | case 1: |
854 | { | 865 | { |
@@ -858,8 +869,7 @@ void PlayListWidget::btnPlay(bool b) { | |||
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 | { |
@@ -870,10 +880,10 @@ void PlayListWidget::btnPlay(bool b) { | |||
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() { |
@@ -1068,8 +1078,11 @@ void PlayListWidget::openFile() { | |||
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) { | |
1083 | QMessageBox::message("Note","Spaces in urls are not allowed."); | ||
1084 | return; | ||
1085 | } else { | ||
1073 | qDebug("Selected filename is "+filename); | 1086 | qDebug("Selected filename is "+filename); |
1074 | if(filename.right(3) == "m3u") | 1087 | if(filename.right(3) == "m3u") |
1075 | readm3u( filename); | 1088 | readm3u( filename); |
@@ -1094,6 +1107,7 @@ void PlayListWidget::openFile() { | |||
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 | } |
@@ -1205,7 +1219,10 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
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); |
@@ -1220,6 +1237,7 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
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); |
@@ -1238,6 +1256,7 @@ void PlayListWidget::readm3u(const QString &filename) { | |||
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) { |