]> git.sesse.net Git - vlc/commitdiff
* use an int to select extension filters
authorYoann Peronneau <yoann@videolan.org>
Mon, 26 Mar 2007 21:33:00 +0000 (21:33 +0000)
committerYoann Peronneau <yoann@videolan.org>
Mon, 26 Mar 2007 21:33:00 +0000 (21:33 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp

index c29c30924dd6785b4ee563c2b6b174b441a340b6..d71feaf49f76ac0ece4dbf56a68182457d70047f 100644 (file)
@@ -55,7 +55,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     fileTypes.replace(QString(";*"), QString(" *"));
 
     // Make this QFileDialog a child of tempWidget from the ui.
-    dialogBox = new QFileDialog( ui.tempWidget, NULL, 
+    dialogBox = new QFileDialog( ui.tempWidget, NULL,
             qfu( p_intf->p_libvlc->psz_homedir ), fileTypes );
     dialogBox->setFileMode( QFileDialog::ExistingFiles );
     /* We don't want to see a grip in the middle of the window, do we? */
@@ -120,10 +120,9 @@ void FileOpenPanel::browseFile()
 
 void FileOpenPanel::browseFileSub()
 {
-    // FIXME We shouldn't allow the user to select more than one subtitles file
+    // FIXME Handle selection of more than one subtitles file
     QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
-                                               false, false, false,
-                                               true, false );
+                                               EXT_FILTER_SUBTITLE );
     ui.subInput->setEditText( files.join(" ") );
     updateMRL();
 }
index 46badc53da938f11947188ae738fc694a024c511..e64481d23b873c07e8cdeb5bb1ba3982743d02b6 100644 (file)
@@ -195,25 +195,22 @@ void DialogsProvider::MLAppendDialog()
 }
 
 /**** Simple open ****/
-
-QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
-                                            bool audio, bool video,
-                                            bool subs, bool pls)
+QStringList DialogsProvider::showSimpleOpen( QString help, int filters )
 {
     QString fileTypes = "";
-    if( all ) {
+    if( filters & EXT_FILTER_MEDIA ) {
         ADD_FILTER_MEDIA( fileTypes );
     }
-    if( video ) {
+    if( filters & EXT_FILTER_VIDEO ) {
         ADD_FILTER_VIDEO( fileTypes );
     }
-    if( audio ) {
+    if( filters & EXT_FILTER_AUDIO ) {
         ADD_FILTER_AUDIO( fileTypes );
     }
-    if( pls ) {
+    if( filters & EXT_FILTER_PLAYLIST ) {
         ADD_FILTER_PLAYLIST( fileTypes );
     }
-    if( subs ) {
+    if( filters & EXT_FILTER_SUBTITLE ) {
         ADD_FILTER_SUBTITLE( fileTypes );
     }
     ADD_FILTER_ALL( fileTypes );
@@ -259,8 +256,8 @@ void DialogsProvider::simpleOpenDialog()
 
 void DialogsProvider::openPlaylist()
 {
-    QStringList files = showSimpleOpen( qtr( "Open playlist file" ), false,
-                                        false, false, false );
+    QStringList files = showSimpleOpen( qtr( "Open playlist file" ),
+                                        EXT_FILTER_PLAYLIST );
     foreach( QString file, files )
     {
         playlist_Import( THEPL, qtu(file) );
index 269a2886ba69e47bee8d78380d5b0ed004305608..a11c93590d3f6fdd189428893e88d9b2cc3e970d 100644 (file)
 #include <vlc/vlc.h>
 #include <vlc_interface.h>
 
+#define EXT_FILTER_MEDIA        0x01
+#define EXT_FILTER_VIDEO        0x02
+#define EXT_FILTER_AUDIO        0x04
+#define EXT_FILTER_PLAYLIST     0x08
+#define EXT_FILTER_SUBTITLE     0x10
+
 #define ADD_FILTER_MEDIA( string )   \
     string += _("Media Files");      \
     string += " ( ";                 \
@@ -90,9 +96,10 @@ public:
     virtual ~DialogsProvider();
     QTimer *fixed_timer;
 
-    QStringList showSimpleOpen( QString help = QString(), bool all = true,
-                                bool video = true, bool audio = true,
-                                bool subs = false, bool pls = true );
+    QStringList showSimpleOpen( QString help = QString(),
+                                int filters = EXT_FILTER_MEDIA |
+                                EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
+                                EXT_FILTER_PLAYLIST );
 protected:
     friend class QVLCMenu;
     QSignalMapper *menusMapper;