summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp57
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h2
2 files changed, 45 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index eeaed33..ae25fe3 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -179,4 +179,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
-// pmPlayList->insertSeparator(-1);
+ pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
+ new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
pmPlayList->insertSeparator(-1);
@@ -854,11 +855,9 @@ void PlayListWidget::btnPlay(bool b) {
{
- qDebug("here we are");
- if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
- || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
+// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
+// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
QMessageBox::message("Note","You are trying to play\na malformed url.");
-
- } else {
-
+// } else {
mediaPlayerState->setPlaying(b);
- } }
+// }
+ }
break;
@@ -1271,4 +1270,32 @@ void PlayListWidget::readm3u(const QString &filename) {
-void PlayListWidget::writem3u(const QString &filename) {
+void PlayListWidget::writem3u() {
+
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0);
+ fileDlg->exec();
+ QString filename,list;
+ if( fileDlg->result() == 1 ) {
+ filename = fileDlg->LineEdit1->text();
+ qDebug(filename);
+ int noOfFiles = 0;
+ d->selectedFiles->first();
+ do {
+// we dont check for existance because of url's
+// qDebug(d->selectedFiles->current()->file());
+ list += d->selectedFiles->current()->file()+"\n";
+ noOfFiles++;
+ }
+ while ( d->selectedFiles->next() );
+ qDebug(list);
+ if(filename.left(1) != "/")
+ filename=QPEApplication::documentDir()+"/"+filename;
+ if(filename.right(3) != "m3u")
+ filename=filename+".m3u";
+ QFile f(filename);
+ f.open(IO_WriteOnly);
+ f.writeBlock(list, list.length());
+ f.close();
+ }
+ if(fileDlg) delete fileDlg;
}
@@ -1298,5 +1325,2 @@ void PlayListWidget::readPls(const QString &filename) {
s=s.replace( QRegExp("\\"),"/");
-// Lview->insertLine(t.readLine(),-1);
-// s=t.readLine();
-// s=s.right(s.length()-2);
DocLnk lnk( s );
@@ -1304,2 +1328,6 @@ void PlayListWidget::readPls(const QString &filename) {
QString name = f.baseName();
+ if(name.left(4)=="http")
+ name = s.right( s.length() - 7);
+ else
+ name=s;
name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
@@ -1307,5 +1335,8 @@ void PlayListWidget::readPls(const QString &filename) {
// QString name = f.baseName();
-// // name = name.left(name.length()-4);
+// name = name.left(name.length()-4);
// name = name.right(name.findRev("/",0,TRUE));
lnk.setName( name);
+ if(s.at(s.length()-4) == '.')
+ lnk.setFile( s);
+ else
lnk.setFile( s+"/");
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 5837ed3..7718a8c 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -77,3 +77,2 @@ private:
void readm3u(const QString &);
- void writem3u(const QString &);
void readPls(const QString &);
@@ -88,2 +87,3 @@ private:
private slots:
+ void writem3u();
void scanForAudio();