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) (unidiff)
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 @@
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
@@ -39,2 +39,5 @@
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/config.h>
41
42#include <opie/ofiledialog.h>
40 43
@@ -87,4 +90,6 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
87 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 91 (void)new MenuItem( pmPlayList, tr( "Add File" ),
89 this,SLOT( openFile() ) ); 92 this,SLOT( openFile() ) );
93 (void)new MenuItem( pmPlayList, tr("Add URL"),
94 this,SLOT( openURL() ) );
90 pmPlayList->insertSeparator(-1); 95 pmPlayList->insertSeparator(-1);
@@ -604,3 +609,3 @@ bool PlayListWidget::inFileListMode() const
604 609
605void PlayListWidget::openFile() { 610void PlayListWidget::openURL() {
606 // http://66.28.164.33:2080 611 // http://66.28.164.33:2080
@@ -609,3 +614,3 @@ void PlayListWidget::openFile() {
609 InputDialog *fileDlg; 614 InputDialog *fileDlg;
610 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 615 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
611 fileDlg->exec(); 616 fileDlg->exec();
@@ -655,2 +660,51 @@ void PlayListWidget::openFile() {
655 660
661
662void PlayListWidget::openFile() {
663
664 QString filename, name;
665
666 Config cfg( "OpiePlayer" );
667 cfg.setGroup("Dialog");
668 MimeTypes types;
669 QStringList audio, video, all;
670 audio << "audio/*";
671 audio << "playlist/plain";
672 audio << "audio/x-mpegurl";
673
674 video << "video/*";
675 video << "playlist/plain";
676
677 all += audio;
678 all += video;
679 types.insert("All Media Files", all );
680 types.insert("Audio", audio );
681 types.insert("Video", video );
682
683 QString str = OFileDialog::getOpenFileName( 1,
684 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
685 types, 0 );
686 if(str.left(2) == "//") str=str.right(str.length()-1);
687 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
688
689
690 if( !str.isEmpty() ) {
691 qDebug( "Selected filename is " + str );
692 filename = str;
693 DocLnk lnk;
694 Config cfg( "OpiePlayer" );
695 cfg.setGroup("PlayList");
696
697 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
698 readListFromFile( filename );
699 } else {
700 lnk.setName( QFileInfo(filename).baseName() ); //sets name
701 lnk.setFile( filename ); //sets file name
702 d->selectedFiles->addToSelection( lnk);
703 writeCurrentM3u();
704 d->selectedFiles->setSelectedItem( lnk.name());
705 }
706 }
707}
708
709
656void PlayListWidget::readListFromFile( const QString &filename ) { 710void PlayListWidget::readListFromFile( const QString &filename ) {