From: Clément Stenac Date: Sun, 28 May 2006 12:04:19 +0000 (+0000) Subject: File type filters and implementation in WX. Refs:#24 X-Git-Tag: 0.9.0-test0~11129 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=dfb262bd3dda55953daabdfd0e6069066f941104;p=vlc File type filters and implementation in WX. Refs:#24 Thanks to Steven Sheehy and sorry for the delay :) --- diff --git a/include/vlc_interface.h b/include/vlc_interface.h index 4da3b49909..4a8937c814 100644 --- a/include/vlc_interface.h +++ b/include/vlc_interface.h @@ -176,3 +176,14 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); /* Useful text messages shared by interfaces */ #define INTF_ABOUT_MSG LICENSE_MSG + +#define EXTENSIONS_AUDIO "*.a52;*.aac;*.ac3;*.dts;*.flac;*.m4a;*.m4p;*.mka;" \ + "*.mod;*.mp1;*.mp2;*.mp3;*.ogg;*.spx;*.wav;*.wma;*.xm" + +#define EXTENSIONS_VIDEO "*.asf;*.avi;*.divx;*.dv;*.m1v;*.m2v;*.m4v;*.mkv;" \ + "*.mov;*.mp2;*.mp4;*.mpeg;*.mpeg1;*.mpeg2;*.mpeg4;" \ + "*.mpg;*.ogg;*.ogm;*.ps;*.ts;*.vob;*.wmv" + +#define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.m3u;*.pls;*.vlc;*.xspf" + +#define EXTENSIONS_SUBTITLE "*.idx;*.srt;*.sub;*.utf" diff --git a/modules/gui/wxwidgets/dialogs.cpp b/modules/gui/wxwidgets/dialogs.cpp index d24d7d7199..23ac8f78da 100644 --- a/modules/gui/wxwidgets/dialogs.cpp +++ b/modules/gui/wxwidgets/dialogs.cpp @@ -430,6 +430,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event ) p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")), wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE ); + p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*" + "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO + "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO + "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST + "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE))); + if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK ) { wxArrayString paths; diff --git a/modules/gui/wxwidgets/dialogs/open.cpp b/modules/gui/wxwidgets/dialogs/open.cpp index d22580e198..86e3b6f928 100644 --- a/modules/gui/wxwidgets/dialogs/open.cpp +++ b/modules/gui/wxwidgets/dialogs/open.cpp @@ -1262,6 +1262,12 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) file_dialog = new wxFileDialog( this, wxU(_("Open File")), wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE ); + p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*" + "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO + "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO + "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST + "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE))); + if( file_dialog && file_dialog->ShowModal() == wxID_OK ) { wxArrayString paths; diff --git a/modules/gui/wxwidgets/dialogs/playlist.cpp b/modules/gui/wxwidgets/dialogs/playlist.cpp index c15e050bca..272fdcb63a 100644 --- a/modules/gui/wxwidgets/dialogs/playlist.cpp +++ b/modules/gui/wxwidgets/dialogs/playlist.cpp @@ -971,7 +971,7 @@ void Playlist::OnSave( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) ) { wxFileDialog dialog( this, wxU(_("Open playlist")), wxT(""), wxT(""), - wxT("All playlists|*.pls;*.m3u;*.asx;*.b4s;*.xspf|XSPF playlist|*.xspf|M3U files|*.m3u"), wxOPEN ); + wxT("All playlists|" EXTENSIONS_PLAYLIST "|XSPF playlist|*.xspf|M3U files|*.m3u"), wxOPEN ); if( dialog.ShowModal() == wxID_OK ) {