author | harlekin <harlekin> | 2003-06-18 21:01:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-06-18 21:01:43 (UTC) |
commit | eff530015d448c27d060824c8ed58bbd7a4b40b9 (patch) (side-by-side diff) | |
tree | a5672a3ac374c5c501dbf93482692bcd4565bdb0 | |
parent | 9bfda722eeba2f5861393e9f5f41170fab502da8 (diff) | |
download | opie-eff530015d448c27d060824c8ed58bbd7a4b40b9.zip opie-eff530015d448c27d060824c8ed58bbd7a4b40b9.tar.gz opie-eff530015d448c27d060824c8ed58bbd7a4b40b9.tar.bz2 |
give save playlist the normal ofileselector too
-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 @@ -78,26 +78,24 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); pmPlayList->insertSeparator(-1); -// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), -// this, SLOT( saveList() ) ); - (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), - this, SLOT(writem3u() ) ); - pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Add File" ), this,SLOT( openFile() ) ); (void)new MenuItem( pmPlayList, tr("Add URL"), this,SLOT( openURL() ) ); pmPlayList->insertSeparator(-1); + (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), + this, SLOT(writem3u() ) ); + pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), audioView, SLOT( scanFiles() ) ); (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), videoView, SLOT( scanFiles() ) ); pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), &mediaPlayerState, SLOT( toggleFullscreen() ) ); @@ -775,24 +773,50 @@ void PlayListWidget::readListFromFile( const QString &filename ) { } delete m3uList; } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { - InputDialog *fileDlg; - fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); - fileDlg->exec(); + //InputDilog *fileDlg; + //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); + //fileDlg->exec(); + + 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()); + + QString name, filename, list; Om3u *m3uList; - if( fileDlg->result() == 1 ) { - name = fileDlg->text(); + if( !str.isEmpty() ) { + name = str; + // name = fileDlg->text(); // qDebug( filename ); if( name.find("/",0,true) != -1) {// assume they specify a file path filename = name; name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); } else //otherwise dump it somewhere noticable filename = QPEApplication::documentDir() + "/" + name; @@ -806,17 +830,17 @@ void PlayListWidget::writem3u() { m3uList->add( d->selectedFiles->current()->file()); } while ( d->selectedFiles->next() ); // qDebug( list ); m3uList->write(); m3uList->close(); delete m3uList; - delete fileDlg; + //delete fileDlg; DocLnk lnk; lnk.setFile( filename); lnk.setIcon("opieplayer2/playlist2"); lnk.setName( name); //sets file name // qDebug(filename); Config config( "OpiePlayer" ); |