summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-20 18:14:30 (UTC)
committer llornkcor <llornkcor>2002-04-20 18:14:30 (UTC)
commitb37f1e1eec635165da7dbf06e968cd5368d92d4e (patch) (side-by-side diff)
tree4c1c31a976c8222f6a79b5bdfa50cc248a6f7feb
parent0b076b2dcf35142383f6058c9be2968a7dfffca7 (diff)
downloadopie-b37f1e1eec635165da7dbf06e968cd5368d92d4e.zip
opie-b37f1e1eec635165da7dbf06e968cd5368d92d4e.tar.gz
opie-b37f1e1eec635165da7dbf06e968cd5368d92d4e.tar.bz2
added file/url input
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp52
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h1
2 files changed, 46 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index d9a70ce..11f9752 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -158,6 +158,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
+// pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
- // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) );
+ pmPlayList->insertSeparator(-1);
+ new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
QPopupMenu *pmView = new QPopupMenu( this );
@@ -421,4 +423,5 @@ void PlayListWidget::addAllVideoToList() {
void PlayListWidget::setDocument(const QString& fileref) {
+ qDebug(fileref);
fromSetDocument = TRUE;
if ( fileref.isNull() ) {
@@ -427,5 +430,16 @@ void PlayListWidget::setDocument(const QString& fileref) {
}
// qDebug("setDocument "+fileref);
- if(fileref.find("playlist",0,TRUE) == -1) {
+ if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
+ clearList();
+ addToSelection( DocLnk( fileref ) );
+ d->setDocumentUsed = TRUE;
+ d->selectedFiles->first();
+ qApp->processEvents();
+ }
+ else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
+ clearList();
+ loadList(DocLnk(fileref));
+ d->selectedFiles->first();
+ } else {
clearList();
addToSelection( DocLnk( fileref ) );
@@ -436,9 +450,4 @@ void PlayListWidget::setDocument(const QString& fileref) {
qApp->processEvents();
setCaption(tr("OpiePlayer"));
-
- } else { //is playlist
- clearList();
- loadList(DocLnk(fileref));
- d->selectedFiles->first();
}
}
@@ -966,2 +975,31 @@ void PlayListWidget::populateVideoView() {
}
}
+
+void PlayListWidget::openFile() {
+ QString filename;
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
+ fileDlg->exec();
+ if( fileDlg->result() == 1 ) {
+ filename = fileDlg->LineEdit1->text();
+ }
+ qDebug(filename);
+ DocLnk lnk;
+ QString name = filename.right(filename.length()-filename.find("http://")-7);
+ lnk.setName( name); //sets file name
+// lnk.setComment();
+ lnk.setFile(filename); //sets File property
+// problem is, the launcher sees this as a broken link and does not display it :(
+
+ lnk.setType("audio/x-mpegurl");
+ lnk.setExec("opieplayer");
+ lnk.setIcon("opieplayer/MPEGPlayer");
+ QString cmd="touch "+QPEApplication::documentDir()+"audio/x-mpegurl/"+name;
+ system( cmd.latin1());
+// d->selectedFiles->addToSelection( **dit );
+
+ if(!lnk.writeLink())
+ qDebug("Writing doclink did not work");
+ if(fileDlg)
+ delete fileDlg;
+}
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 186ca1b..02cdba6 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -77,4 +77,5 @@ private:
void populateVideoView();
private slots:
+ void openFile();
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist