mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #11338: qt: Backup former GUI settings on -resetguisettings
723aa1b
qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan)
Pull request description:
Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where `-resetguisettings` solves the problem.
(as discussed in yesterday's IRC meeting)
Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586
This commit is contained in:
parent
3b0df3422e
commit
6ab6809598
@ -20,3 +20,4 @@
|
|||||||
* wallet.dat: personal wallet (BDB) with keys and transactions
|
* wallet.dat: personal wallet (BDB) with keys and transactions
|
||||||
* .cookie: session RPC authentication cookie (written at start when cookie authentication is used, deleted on shutdown)
|
* .cookie: session RPC authentication cookie (written at start when cookie authentication is used, deleted on shutdown)
|
||||||
* onion_private_key: cached Tor hidden service private key for `-listenonion`
|
* onion_private_key: cached Tor hidden service private key for `-listenonion`
|
||||||
|
* guisettings.ini.bak: backup of former GUI settings after `-resetguisettings` is used
|
||||||
|
@ -195,10 +195,32 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
language = settings.value("language").toString();
|
language = settings.value("language").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Helper function to copy contents from one QSettings to another.
|
||||||
|
* By using allKeys this also covers nested settings in a hierarchy.
|
||||||
|
*/
|
||||||
|
static void CopySettings(QSettings& dst, const QSettings& src)
|
||||||
|
{
|
||||||
|
for (const QString& key : src.allKeys()) {
|
||||||
|
dst.setValue(key, src.value(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Back up a QSettings to an ini-formatted file. */
|
||||||
|
static void BackupSettings(const fs::path& filename, const QSettings& src)
|
||||||
|
{
|
||||||
|
qWarning() << "Backing up GUI settings to" << GUIUtil::boostPathToQString(filename);
|
||||||
|
QSettings dst(GUIUtil::boostPathToQString(filename), QSettings::IniFormat);
|
||||||
|
dst.clear();
|
||||||
|
CopySettings(dst, src);
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsModel::Reset()
|
void OptionsModel::Reset()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
|
// Backup old settings to chain-specific datadir for troubleshooting
|
||||||
|
BackupSettings(GetDataDir(true) / "guisettings.ini.bak", settings);
|
||||||
|
|
||||||
// Remove all entries from our QSettings object
|
// Remove all entries from our QSettings object
|
||||||
settings.clear();
|
settings.clear();
|
||||||
resetSettings = true; // Needed in dash.cpp during shotdown to also remove the window positions
|
resetSettings = true; // Needed in dash.cpp during shotdown to also remove the window positions
|
||||||
|
Loading…
Reference in New Issue
Block a user