vlc | branch: master | Pierre Lamot | Fri Mar 2 19:11:34
2018 +0100| [7a6f006d59bfeeff833fedffc2583559444d7f7a] | committer: Hugo
Beauzée-Luyssen
Qt: fix "last folder used" not remembered correctly
On windows last used folder was stored by its URL, which cannot by
used QFileDialog::getXXXFileName.
This patch will store last used folder by its URL systematically and
use QFileDialog::getXXXURL. This allows to store non file location (ie: smb)
Fix #19905
Signed-off-by: Hugo Beauzée-Luyssen
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a6f006d59bfeeff833fedffc2583559444d7f7a
---
modules/gui/qt/components/extended_panels.cpp | 12
modules/gui/qt/components/interface_widgets.cpp | 8 +++-
modules/gui/qt/components/open_panels.cpp | 8 +---
modules/gui/qt/components/open_panels.hpp | 6 --
modules/gui/qt/components/sout/sout_widgets.cpp | 6 --
modules/gui/qt/dialogs_provider.cpp | 24 ++--
modules/gui/qt/dialogs_provider.hpp | 8
modules/gui/qt/qt.hpp | 3 ++-
modules/gui/qt/util/qt_dirs.hpp | 1 -
9 files changed, 44 insertions(+), 32 deletions(-)
diff --git a/modules/gui/qt/components/extended_panels.cpp
b/modules/gui/qt/components/extended_panels.cpp
index d852580c71..e512a40a40 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -358,22 +358,26 @@ void ExtVideo::updateFilters()
void ExtVideo::browseLogo()
{
+const QStringList schemes = QStringList(QStringLiteral("file"));
QString filter = QString( "%1 (*.png *.jpg);;%2 (*)" )
.arg( qtr("Image Files") )
.arg( TITLE_EXTENSIONS_ALL );
-QString file = QFileDialog::getOpenFileName( NULL, qtr( "Logo filenames" ),
- p_intf->p_sys->filepath, filter );
+QString file = QFileDialog::getOpenFileUrl( NULL, qtr( "Logo filenames" ),
+ p_intf->p_sys->filepath, filter,
+ NULL, QFileDialog::Options(), schemes ).toLocalFile();
UPDATE_AND_APPLY_TEXT( logoFileText, file );
}
void ExtVideo::browseEraseFile()
{
+const QStringList schemes = QStringList(QStringLiteral("file"));
QString filter = QString( "%1 (*.png *.jpg);;%2 (*)" )
.arg( qtr("Image Files") )
.arg( TITLE_EXTENSIONS_ALL );
-QString file = QFileDialog::getOpenFileName( NULL, qtr( "Image mask" ),
- p_intf->p_sys->filepath, filter );
+QString file = QFileDialog::getOpenFileUrl( NULL, qtr( "Image mask" ),
+ p_intf->p_sys->filepath, filter,
+ NULL, QFileDialog::Options(), schemes ).toLocalFile();
UPDATE_AND_APPLY_TEXT( eraseMaskText, file );
}
diff --git a/modules/gui/qt/components/interface_widgets.cpp
b/modules/gui/qt/components/interface_widgets.cpp
index 9f67e30ebe..575970c1b8 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -885,15 +885,13 @@ void CoverArtLabel::setArtFromFile()
if( !p_item )
return;
-QString filePath = QFileDialog::getOpenFileName( this, qtr( "Choose Cover
Art" ),
+QUrl fileUrl = QFileDialog::getOpenFileUrl( this, qtr( "Choose Cover Art"
),
p_intf->p_sys->filepath, qtr( "Image Files (*.gif *.jpg *.jpeg *.png)"
) );
-if( filePath.isEmpty() )
+if( fileUrl.isEmpty() )
return;
-QString fileUrl = QUrl::fromLocalFile( filePath ).toString();
-
-THEMIM->getIM()->setArt( p_item, fileUrl );
+THEMIM->getIM()->setArt( p_item, fileUrl.toString() );
}
void CoverArtLabel::clear()
diff --git a/modules/gui/qt/components/open_panels.cpp
b/modules/gui/qt/components/open_panels.cpp
index ad3d015bf9..322bde9a89 100644
--- a/modules/gui/qt/components/open_panels.cpp
+++ b/modules/gui/qt/components/open_panels.cpp
@@ -233,7 +233,7 @@ void FileOpenPanel::browseFile()
);
item->setFlags( Qt::ItemIsEnabled );
ui.fileListWidg->addItem( item );
-savedirpathFromFile( file );
+p_intf->p_sys->filepath = url;
}
updateButtons();
updateMRL();
@@ -634,8 +634,10 @@ void DiscOpenPanel::updateMRL()
void DiscOpenPanel::browseDevice()
{
-QString dir = QFileDialog::getExistingDirectory( this,
-qtr( I_DEVICE_TOOLTIP ), p_intf->p_sys->filepath );
+const QStringList schemes = QStringList(QStringLiteral("file"));
+QString dir = QFileDialog::getExistingDirectoryUrl( this,
+qtr( I_DEVICE_TOOLTIP ), p_intf->p_sys->filepath,
+QFileDialog::ShowDirsOnly, schemes ).toLocalFile();
if( !dir.isEmpty() )
{
ui.deviceCombo->addItem( toNativeSepNoSlash( dir ) );
diff --git a/modules/gui/qt/components/open_panels.hpp
b/modules/gui/qt/components/open_panels.hpp
index 71a983141d..48044383a5 1