summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp79
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 {
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
// qDebug("add");
- d->setDocumentUsed = FALSE;
- if ( mediaPlayerState->playlist() ) {
- if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
- d->selectedFiles->addToSelection( lnk );
+ if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) {
+ QMessageBox::message("Note","You are trying to play\na malformed url.");
+
+ } else {
+
+ d->setDocumentUsed = FALSE;
+ if ( mediaPlayerState->playlist() ) {
+ if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
+ d->selectedFiles->addToSelection( lnk );
+ }
+ else
+ mediaPlayerState->setPlaying( TRUE );
}
- else
- mediaPlayerState->setPlaying( TRUE );
}
void PlayListWidget::clearList() {
@@ -845,36 +851,40 @@ void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
-
- mediaPlayerState->setPlaying(b);
- }
+ qDebug("here we are");
+ if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
+ QMessageBox::message("Note","You are trying to play\na malformed url.");
+
+ } else {
+
+ mediaPlayerState->setPlaying(b);
+ } }
break;
case 1:
{
- addToSelection( audioView->currentItem() );
- mediaPlayerState->setPlaying(b);
- d->selectedFiles->removeSelected( );
- tabWidget->setCurrentPage(1);
- d->selectedFiles->unSelect();
- insanityBool=FALSE;
-// audioView->clearSelection();
- }
+ addToSelection( audioView->currentItem() );
+ mediaPlayerState->setPlaying(b);
+ d->selectedFiles->removeSelected( );
+ tabWidget->setCurrentPage(1);
+ d->selectedFiles->unSelect();
+ insanityBool=FALSE;
+ }// audioView->clearSelection();
break;
case 2:
{
- addToSelection( videoView->currentItem() );
- mediaPlayerState->setPlaying(b);
- qApp->processEvents();
- d->selectedFiles->removeSelected( );
- tabWidget->setCurrentPage(2);
- d->selectedFiles->unSelect();
- insanityBool=FALSE;
-// videoView->clearSelection();
- }
+ addToSelection( videoView->currentItem() );
+ mediaPlayerState->setPlaying(b);
+ qApp->processEvents();
+ d->selectedFiles->removeSelected( );
+ tabWidget->setCurrentPage(2);
+ d->selectedFiles->unSelect();
+ insanityBool=FALSE;
+ }// videoView->clearSelection();
break;
};
+
}
void PlayListWidget::deletePlaylist() {
switch( QMessageBox::information( this, (tr("Remove Playlist?")),
@@ -1067,11 +1077,14 @@ void PlayListWidget::openFile() {
if( fileDlg->result() == 1 ) {
filename = fileDlg->LineEdit1->text();
// http://205.188.234.129:8030
// http://66.28.68.70:8000
- filename.replace(QRegExp("%20")," ");
-
- qDebug("Selected filename is "+filename);
+// filename.replace(QRegExp("%20")," ");
+ if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) {
+ QMessageBox::message("Note","Spaces in urls are not allowed.");
+ return;
+ } else {
+ qDebug("Selected filename is "+filename);
if(filename.right(3) == "m3u")
readm3u( filename);
else if(filename.right(3) == "pls")
readPls( filename);
@@ -1093,8 +1106,9 @@ void PlayListWidget::openFile() {
// if(fileDlg2)
// delete fileDlg2;
}
}
+ }
if(fileDlg)
delete fileDlg;
}
@@ -1204,9 +1218,12 @@ void PlayListWidget::readm3u(const QString &filename) {
int i=0;
while ( !t.atEnd()) {
// Lview->insertLine(t.readLine(),-1);
s=t.readLine();
- if(s.find("#",0,TRUE) == -1) {
+ if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) {
+ QMessageBox::message("Note","Spaces in urls are not allowed.");
+ }
+ else if(s.find("#",0,TRUE) == -1) {
if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
if(s.left(2) == "E:" || s.left(2) == "P:") {
s=s.right(s.length()-2);
DocLnk lnk( s );
@@ -1219,8 +1236,9 @@ void PlayListWidget::readm3u(const QString &filename) {
// lnk.setIcon(opieplayer/MPEGPlayer);
qDebug("add "+name);
d->selectedFiles->addToSelection( lnk);
} else { // is url
+
s.replace(QRegExp("%20")," ");
DocLnk lnk( s);
QString name = s.right( s.length() - 7);
// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
@@ -1237,8 +1255,9 @@ void PlayListWidget::readm3u(const QString &filename) {
}
}
}
}
+ f.close();
}
void PlayListWidget::writem3u(const QString &filename) {