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

Rémi Denis-Courmont remi at remlab.net
Thu Jan 11 06:15:53 CET 2018


Le keskiviikkona 10. tammikuuta 2018, 17.09.00 EET Pierre Lamot a écrit :
>   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();

This cannot be right. You can´t (unambiguously) mix URLs and file paths.

>              }
> 
>              // 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('.');


-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list