]> git.sesse.net Git - vlc/commitdiff
* Use subtitles file extension filter for the "Open subtitles file" dialog.
authorYoann Peronneau <yoann@videolan.org>
Sun, 25 Mar 2007 22:21:30 +0000 (22:21 +0000)
committerYoann Peronneau <yoann@videolan.org>
Sun, 25 Mar 2007 22:21:30 +0000 (22:21 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp

index 4a485f304c8fc01abae8d332bf425c1544b19dd8..c29c30924dd6785b4ee563c2b6b174b441a340b6 100644 (file)
@@ -111,7 +111,7 @@ QStringList FileOpenPanel::browse(QString help)
 void FileOpenPanel::browseFile()
 {
     QString fileString = "";
-    foreach( QString file, dialogBox->selectedFiles() ) { 
+    foreach( QString file, dialogBox->selectedFiles() ) {
          fileString += "\"" + file + "\" ";
     }
     ui.fileInput->setEditText( fileString );
@@ -120,7 +120,11 @@ void FileOpenPanel::browseFile()
 
 void FileOpenPanel::browseFileSub()
 {
-    ui.subInput->setEditText( browse( qtr("Open subtitles file") ).join(" ") );
+    // FIXME We shouldn't allow the user to select more than one subtitles file
+    QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
+                                               false, false, false,
+                                               true, false );
+    ui.subInput->setEditText( files.join(" ") );
     updateMRL();
 }
 
index 85b85b52b957dd002152ee0b1888e6106b669288..46badc53da938f11947188ae738fc694a024c511 100644 (file)
@@ -213,12 +213,15 @@ QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
     if( pls ) {
         ADD_FILTER_PLAYLIST( fileTypes );
     }
+    if( subs ) {
+        ADD_FILTER_SUBTITLE( fileTypes );
+    }
     ADD_FILTER_ALL( fileTypes );
     fileTypes.replace(QString(";*"), QString(" *"));
     return QFileDialog::getOpenFileNames( NULL,
                                           help.isNull() ?
                                               qfu(I_OP_SEL_FILES ) : help,
-                                          qfu( p_intf->p_libvlc->psz_homedir ), 
+                                          qfu( p_intf->p_libvlc->psz_homedir ),
                                           fileTypes );
 }
 
index 8f6d2b8d52bf557cb228f7cfa8b3bc3c7bcfe580..269a2886ba69e47bee8d78380d5b0ed004305608 100644 (file)
     string += " ( ";                 \
     string += EXTENSIONS_PLAYLIST;   \
     string += ");;";
+#define ADD_FILTER_SUBTITLE( string )\
+    string += _("Subtitles Files");   \
+    string += " ( ";                 \
+    string += EXTENSIONS_SUBTITLE;   \
+    string += ");;";
 #define ADD_FILTER_ALL( string )     \
     string += _("All Files");        \
     string += " (*.*)";
@@ -87,7 +92,7 @@ public:
 
     QStringList showSimpleOpen( QString help = QString(), bool all = true,
                                 bool video = true, bool audio = true,
-                                bool subs = true, bool pls = true );
+                                bool subs = false, bool pls = true );
 protected:
     friend class QVLCMenu;
     QSignalMapper *menusMapper;