Persist a default browse directory for file dialogs, if none is provided

* This provides a slightly more sensible default than the application working
  directory.
* The default is shared across all dialogs and open/save.
This commit is contained in:
baldurk
2018-06-15 12:10:23 +01:00
parent efd11bb7f2
commit 4561b55464
4 changed files with 40 additions and 3 deletions
@@ -287,6 +287,8 @@ bool PersistantConfig::Load(const rdcstr &filename)
RENDERDOC_SetConfigSetting("Disassembly_FriendlyNaming", ShaderViewer_FriendlyNaming ? "1" : "0");
RDDialog::DefaultBrowsePath = LastFileBrowsePath;
// localhost should always be available as a remote host
bool foundLocalhost = false;
@@ -396,6 +398,8 @@ bool PersistantConfig::Save()
RENDERDOC_SetConfigSetting("Disassembly_FriendlyNaming", ShaderViewer_FriendlyNaming ? "1" : "0");
LastFileBrowsePath = RDDialog::DefaultBrowsePath;
return Serialize(m_Filename);
}
@@ -167,6 +167,8 @@ DECLARE_REFLECTION_STRUCT(BugReport);
\
CONFIG_SETTING_VAL(public, QString, rdcstr, LastCaptureFilePath, "") \
\
CONFIG_SETTING_VAL(public, QString, rdcstr, LastFileBrowsePath, "") \
\
CONFIG_SETTING(public, QVariantList, rdcarray<rdcstr>, RecentCaptureFiles) \
\
CONFIG_SETTING_VAL(public, QString, rdcstr, LastCapturePath, "") \
@@ -332,6 +334,12 @@ For more information about some of these settings that are user-facing see
The path to the last capture to be opened, which is useful as a default location for browsing.
.. data:: LastFileBrowsePath
The path to the last file browsed to in any dialog. Used as a default location for all file
browsers without another explicit default directory (such as opening capture files - see
:data:`LastCaptureFilePath`).
.. data:: RecentCaptureFiles
A ``list`` of ``str`` with the recently opened capture files.