[vlc-devel] [PATCH] qt: fix file url when converting / opening multiple files

Pierre Lamot pierre at videolabs.io
Fri Jan 12 10:14:04 CET 2018


  fix: #19391, #19413
---
 modules/gui/qt/components/open_panels.cpp | 2 +-
 modules/gui/qt/dialogs/convert.cpp        | 9 +++++----
 2 files changed, 6 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..052cdeb55c 100644
--- a/modules/gui/qt/dialogs/convert.cpp
+++ b/modules/gui/qt/dialogs/convert.cpp
@@ -71,6 +71,7 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
     fileLine = new QLineEdit;
     fileLine->setMinimumWidth( 300 );
     fileLine->setFocus( Qt::ActiveWindowFocusReason );
+    fileLine->setReadOnly(true);
     destLabel->setBuddy( fileLine );
     // You can set a specific name for only one file.
     if(singleFileSelected)
@@ -154,11 +155,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 +199,7 @@ void ConvertDialog::close()
             // Only one file, use the destination provided
             if(singleFileSelected)
             {
-                newFileName = fileLine->text();
+                newFileName = QUrl(fileLine->text()).toLocalFile();
             }
 
             // Multiple, use the convention.
@@ -209,7 +210,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