]> git.sesse.net Git - vlc/commitdiff
Qt: factorize directory opening
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 18 May 2014 21:37:32 +0000 (23:37 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 18 May 2014 21:37:32 +0000 (23:37 +0200)
modules/gui/qt4/dialogs_provider.cpp

index ec6966f8cf02f6da7fb4be220a3d71b43b70b475..23c336dc5d321402362ac0af4d364f5234415e1a 100644 (file)
@@ -491,27 +491,9 @@ void DialogsProvider::openUrlDialog()
  **/
 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
 {
-    QString dir = QFileDialog::getExistingDirectory( NULL, qtr( I_OP_DIR_WINTITLE ), p_intf->p_sys->filepath );
-
-    if( dir.isEmpty() )
-        return;
-
-    p_intf->p_sys->filepath = dir;
-
-    const char *scheme = "directory";
-    if( dir.endsWith( DIR_SEP "VIDEO_TS", Qt::CaseInsensitive ) )
-        scheme = "dvd";
-    else if( dir.endsWith( DIR_SEP "BDMV", Qt::CaseInsensitive ) )
-    {
-        scheme = "bluray";
-        dir.remove( "BDMV" );
-    }
-
-    char *uri = vlc_path2uri( qtu( toNativeSeparators( dir ) ), scheme );
-    if( unlikely(uri == NULL) )
-        return;
-
-    Open::openMRL( p_intf, uri, go, pl );
+    QString uri = DialogsProvider::getDirectoryDialog( p_intf );
+    if( !uri.isEmpty() )
+        Open::openMRL( p_intf, uri, go, pl );
 }
 
 QString DialogsProvider::getDirectoryDialog( intf_thread_t *p_intf )
@@ -533,7 +515,9 @@ QString DialogsProvider::getDirectoryDialog( intf_thread_t *p_intf )
     }
 
     char *uri = vlc_path2uri( qtu( toNativeSeparators( dir ) ), scheme );
-    if( unlikely(uri == NULL) ) return QString();
+    if( unlikely(uri == NULL) )
+        return QString();
+
     dir = qfu( uri );
     free( uri );