[vlc-commits] Qt: factorize directory opening

Jean-Baptiste Kempf git at videolan.org
Sun May 18 23:39:18 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May 18 23:37:32 2014 +0200| [4a7e027c7919eef88976e91b4b15a3c0a68b725c] | committer: Jean-Baptiste Kempf

Qt: factorize directory opening

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a7e027c7919eef88976e91b4b15a3c0a68b725c
---

 modules/gui/qt4/dialogs_provider.cpp |   28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index ec6966f..23c336d 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -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 );
 



More information about the vlc-commits mailing list