[vlc-devel] [PATCH] qt: fix file url when converting / opening multiple files
Pierre Lamot
pierre at videolabs.io
Wed Jan 10 16:09:00 CET 2018
fix: #19391, #19413
---
modules/gui/qt/components/open_panels.cpp | 2 +-
modules/gui/qt/dialogs/convert.cpp | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt/components/open_panels.cpp b/modules/gui/qt/components/open_panels.cpp
index 9b154322e5..3c7adc6f2a 100644
--- a/modules/gui/qt/components/open_panels.cpp
+++ b/modules/gui/qt/components/open_panels.cpp
@@ -224,7 +224,7 @@ void FileOpenPanel::browseFile()
foreach( const QString &file, files )
{
QListWidgetItem *item =
- new QListWidgetItem( toNativeSeparators( file ), ui.fileListWidg );
+ new QListWidgetItem( file, ui.fileListWidg );
item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled );
ui.fileListWidg->addItem( item );
savedirpathFromFile( file );
diff --git a/modules/gui/qt/dialogs/convert.cpp b/modules/gui/qt/dialogs/convert.cpp
index 1c7b1a85ed..92d3e8b8ac 100644
--- a/modules/gui/qt/dialogs/convert.cpp
+++ b/modules/gui/qt/dialogs/convert.cpp
@@ -154,11 +154,11 @@ void ConvertDialog::fileBrowse()
{
QString fileExtension = ( ! profile->isEnabled() ) ? ".*" : "." + profile->getMux();
- QString fileName = QFileDialog::getSaveFileName( this, qtr( "Save file..." ),
+ QUrl fileName = QFileDialog::getSaveFileUrl( this, qtr( "Save file..." ),
p_intf->p_sys->filepath,
QString( "%1 (*%2);;%3 (*.*)" ).arg( qtr( "Containers" ) )
.arg( fileExtension ).arg( qtr("All") ), 0, QFileDialog::DontConfirmOverwrite );
- fileLine->setText( toNativeSeparators( fileName ) );
+ fileLine->setText( fileName.toEncoded() );
setDestinationFileExtension();
}
@@ -198,7 +198,11 @@ void ConvertDialog::close()
// Only one file, use the destination provided
if(singleFileSelected)
{
- newFileName = fileLine->text();
+ if( fileLine->text().startsWith("file://") )
+ newFileName = QUrl(fileLine->text()).toLocalFile();
+ else
+ //user have set up a path manually
+ newFileName = fileLine->text();
}
// Multiple, use the convention.
@@ -209,7 +213,7 @@ void ConvertDialog::close()
newFileName = incomingMRLs->at(i);
// Remove the file:// from the front of our MRL
- newFileName = newFileName.remove(0,7);
+ newFileName = QUrl(newFileName).toLocalFile();
// Remote the existing extention (if any)
int extentionPos = newFileName.lastIndexOf('.');
--
2.14.1
More information about the vlc-devel
mailing list