-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 4e31670..4ee784e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -84,9 +84,4 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
84 | this, SLOT( addAllToList() ) ); | 84 | this, SLOT( addAllToList() ) ); |
85 | pmPlayList->insertSeparator(-1); | 85 | pmPlayList->insertSeparator(-1); |
86 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), | ||
87 | // this, SLOT( saveList() ) ); | ||
88 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | ||
89 | this, SLOT(writem3u() ) ); | ||
90 | pmPlayList->insertSeparator(-1); | ||
91 | (void)new MenuItem( pmPlayList, tr( "Add File" ), | 86 | (void)new MenuItem( pmPlayList, tr( "Add File" ), |
92 | this,SLOT( openFile() ) ); | 87 | this,SLOT( openFile() ) ); |
@@ -94,4 +89,7 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
94 | this,SLOT( openURL() ) ); | 89 | this,SLOT( openURL() ) ); |
95 | pmPlayList->insertSeparator(-1); | 90 | pmPlayList->insertSeparator(-1); |
91 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | ||
92 | this, SLOT(writem3u() ) ); | ||
93 | pmPlayList->insertSeparator(-1); | ||
96 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), | 94 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), |
97 | audioView, SLOT( scanFiles() ) ); | 95 | audioView, SLOT( scanFiles() ) ); |
@@ -781,12 +779,38 @@ void PlayListWidget::readListFromFile( const QString &filename ) { | |||
781 | writes current playlist to m3u file */ | 779 | writes current playlist to m3u file */ |
782 | void PlayListWidget::writem3u() { | 780 | void PlayListWidget::writem3u() { |
783 | InputDialog *fileDlg; | 781 | //InputDilog *fileDlg; |
784 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 782 | //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
785 | fileDlg->exec(); | 783 | //fileDlg->exec(); |
784 | |||
785 | Config cfg( "OpiePlayer" ); | ||
786 | cfg.setGroup("Dialog"); | ||
787 | MimeTypes types; | ||
788 | QStringList audio, video, all; | ||
789 | audio << "audio/*"; | ||
790 | audio << "playlist/plain"; | ||
791 | audio << "audio/x-mpegurl"; | ||
792 | |||
793 | video << "video/*"; | ||
794 | video << "playlist/plain"; | ||
795 | |||
796 | all += audio; | ||
797 | all += video; | ||
798 | types.insert("All Media Files", all ); | ||
799 | types.insert("Audio", audio ); | ||
800 | types.insert("Video", video ); | ||
801 | |||
802 | QString str = OFileDialog::getOpenFileName( 1, | ||
803 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | ||
804 | types, 0 ); | ||
805 | if(str.left(2) == "//") str=str.right(str.length()-1); | ||
806 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); | ||
807 | |||
808 | |||
786 | QString name, filename, list; | 809 | QString name, filename, list; |
787 | Om3u *m3uList; | 810 | Om3u *m3uList; |
788 | 811 | ||
789 | if( fileDlg->result() == 1 ) { | 812 | if( !str.isEmpty() ) { |
790 | name = fileDlg->text(); | 813 | name = str; |
814 | // name = fileDlg->text(); | ||
791 | // qDebug( filename ); | 815 | // qDebug( filename ); |
792 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 816 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
@@ -812,5 +836,5 @@ void PlayListWidget::writem3u() { | |||
812 | delete m3uList; | 836 | delete m3uList; |
813 | 837 | ||
814 | delete fileDlg; | 838 | //delete fileDlg; |
815 | 839 | ||
816 | DocLnk lnk; | 840 | DocLnk lnk; |