[vlc-devel] [PATCH] qt: fix subtitle open not selecting the current video folder
Pierre Lamot
pierre at videolabs.io
Tue Jun 5 11:30:13 CEST 2018
scheme was prunned
---
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 3061b2dad6..a6e9d240c5 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -794,22 +794,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 ) )
--
2.14.1
More information about the vlc-devel
mailing list