summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/playlistwidget.cpp
authorharlekin <harlekin>2003-06-18 20:19:16 (UTC)
committer harlekin <harlekin>2003-06-18 20:19:16 (UTC)
commit9bfda722eeba2f5861393e9f5f41170fab502da8 (patch) (side-by-side diff)
treeeb01205e55bfe4f59d48d4c45b60013f1bd434ee /noncore/multimedia/opieplayer2/playlistwidget.cpp
parentdb7c5730e22188f365eb9d52aed961066fbda026 (diff)
downloadopie-9bfda722eeba2f5861393e9f5f41170fab502da8.zip
opie-9bfda722eeba2f5861393e9f5f41170fab502da8.tar.gz
opie-9bfda722eeba2f5861393e9f5f41170fab502da8.tar.bz2
separate Add URL from Add file
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp62
1 files changed, 58 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index c91a565..4e31670 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -3,3 +3,3 @@
-              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
@@ -39,2 +39,5 @@
#include <qpe/resource.h>
+#include <qpe/config.h>
+
+#include <opie/ofiledialog.h>
@@ -87,4 +90,6 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
pmPlayList->insertSeparator(-1);
- (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
+ (void)new MenuItem( pmPlayList, tr( "Add File" ),
this,SLOT( openFile() ) );
+ (void)new MenuItem( pmPlayList, tr("Add URL"),
+ this,SLOT( openURL() ) );
pmPlayList->insertSeparator(-1);
@@ -604,3 +609,3 @@ bool PlayListWidget::inFileListMode() const
-void PlayListWidget::openFile() {
+void PlayListWidget::openURL() {
// http://66.28.164.33:2080
@@ -609,3 +614,3 @@ void PlayListWidget::openFile() {
InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
+ fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
fileDlg->exec();
@@ -655,2 +660,51 @@ void PlayListWidget::openFile() {
+
+void PlayListWidget::openFile() {
+
+ QString filename, name;
+
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup("Dialog");
+ MimeTypes types;
+ QStringList audio, video, all;
+ audio << "audio/*";
+ audio << "playlist/plain";
+ audio << "audio/x-mpegurl";
+
+ video << "video/*";
+ video << "playlist/plain";
+
+ all += audio;
+ all += video;
+ types.insert("All Media Files", all );
+ types.insert("Audio", audio );
+ types.insert("Video", video );
+
+ QString str = OFileDialog::getOpenFileName( 1,
+ cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
+ types, 0 );
+ if(str.left(2) == "//") str=str.right(str.length()-1);
+ cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
+
+
+ if( !str.isEmpty() ) {
+ qDebug( "Selected filename is " + str );
+ filename = str;
+ DocLnk lnk;
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup("PlayList");
+
+ if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
+ readListFromFile( filename );
+ } else {
+ lnk.setName( QFileInfo(filename).baseName() ); //sets name
+ lnk.setFile( filename ); //sets file name
+ d->selectedFiles->addToSelection( lnk);
+ writeCurrentM3u();
+ d->selectedFiles->setSelectedItem( lnk.name());
+ }
+ }
+}
+
+
void PlayListWidget::readListFromFile( const QString &filename ) {