[vlc-commits] qt: fix subtitle open not selecting the current video folder

Pierre Lamot git at videolan.org
Sun Jun 17 23:36:28 CEST 2018


vlc/vlc-3.0 | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Jun  5 11:30:13 2018 +0200| [bede4ea7c3d61f07d794b02151e518906c56d306] | committer: Jean-Baptiste Kempf

qt: fix subtitle open not selecting the current video folder

scheme was prunned

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit bc02f60c248efc97aa2557ac0291788ba868f097)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt/dialogs_provider.cpp | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
index d6edaa06d5..b816d29ae6 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -807,22 +807,20 @@ void DialogsProvider::loadSubtitlesFile()
     if( !p_item ) return;
 
     char *path = input_item_GetURI( p_item );
-    char *path2 = NULL;
+    QUrl url;
     if( path )
     {
-        path2 = vlc_uri2path( path );
-        free( path );
-        if( path2 )
-        {
-            char *sep = strrchr( path2, DIR_SEP_CHAR );
-            if( sep ) *sep = '\0';
-        }
+        url.setUrl( qfu(path) );
+        url = url.adjusted(QUrl::RemoveFilename);
+        if (url.scheme() != "file")
+            url.clear();
+        free(path);
     }
 
     QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
                                       EXT_FILTER_SUBTITLE,
-                                      qfu( path2 ) );
-    free( path2 );
+                                      url );
+
     foreach( const QString &qsUrl, qsl )
     {
         if( input_AddSlave( p_input, SLAVE_TYPE_SPU, qtu( qsUrl ), true, true, false ) )



More information about the vlc-commits mailing list