summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -152,18 +152,20 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
tbDeletePlaylist->hide();
QPopupMenu *pmPlayList = new QPopupMenu( this );
menu->insertItem( tr( "File" ), pmPlayList );
new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
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 );
menu->insertItem( tr( "View" ), pmView );
fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
fullScreenButton->addTo(pmView);
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0);
@@ -415,36 +417,43 @@ void PlayListWidget::addAllMusicToList() {
void PlayListWidget::addAllVideoToList() {
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit )
d->selectedFiles->addToSelection( **dit );
}
void PlayListWidget::setDocument(const QString& fileref) {
+ qDebug(fileref);
fromSetDocument = TRUE;
if ( fileref.isNull() ) {
QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
return;
}
// 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 ) );
d->setDocumentUsed = TRUE;
mediaPlayerState->setPlaying( FALSE );
qApp->processEvents();
mediaPlayerState->setPlaying( TRUE );
qApp->processEvents();
setCaption(tr("OpiePlayer"));
-
- } else { //is playlist
- clearList();
- loadList(DocLnk(fileref));
- d->selectedFiles->first();
}
}
void PlayListWidget::setActiveWindow() {
// When we get raised we need to ensure that it switches views
char origView = mediaPlayerState->view();
mediaPlayerState->setView( 'l' ); // invalidate
@@ -960,8 +969,37 @@ void PlayListWidget::populateVideoView() {
QListViewItem * newItem;
if ( QFile( Vdit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
}
}
}
+
+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
@@ -71,16 +71,17 @@ protected:
private:
void initializeStates();
void readConfig( Config& cfg );
void writeConfig( Config& cfg ) const;
PlayListWidgetPrivate *d; // Private implementation data
void populateAudioView();
void populateVideoView();
private slots:
+ void openFile();
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
void addToSelection( QListViewItem* ); // Add a media file to the playlist
void setActiveWindow(); // need to handle this to show the right view
void setPlaylist( bool ); // Show/Hide the playlist
void setView( char );
void clearList();
void addAllToList();