From 8d99e7836c32f024d506cf7f4f9604787f5aa5f5 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 27 Jul 2020 10:33:00 +0300 Subject: [PATCH] Fix `-resetguisettings` (#3624) --- src/qt/dash.cpp | 2 +- src/qt/optionsdialog.cpp | 1 + src/qt/optionsmodel.cpp | 3 --- src/qt/optionsmodel.h | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index 4b86ebbe25..342a950b7a 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -393,7 +393,7 @@ BitcoinApplication::~BitcoinApplication() #endif // Delete Qt-settings if user clicked on "Reset Options" QSettings settings; - if(optionsModel && optionsModel->resetSettings){ + if(optionsModel && optionsModel->resetSettingsOnShutdown){ settings.clear(); settings.sync(); } diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 66cac99ce5..f682fa1104 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -254,6 +254,7 @@ void OptionsDialog::on_resetButton_clicked() /* reset all options and close GUI */ model->Reset(); + model->resetSettingsOnShutdown = true; QApplication::quit(); } } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 440c9d60a9..fc6a273289 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -52,8 +52,6 @@ void OptionsModel::Init(bool resetSettings) checkAndMigrate(); - this->resetSettings = resetSettings; - QSettings settings; // Ensure restart flag is unset on client startup @@ -226,7 +224,6 @@ void OptionsModel::Reset() // Remove all entries from our QSettings object settings.clear(); - resetSettings = true; // Needed in dash.cpp during shotdown to also remove the window positions // default setting for OptionsModel::StartAtStartup - disabled if (GUIUtil::GetStartOnSystemStartup()) diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 01a7181dad..4afd3ab9fa 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -84,7 +84,7 @@ public: /* Restart flag helper */ void setRestartRequired(bool fRequired); bool isRestartRequired() const; - bool resetSettings; + bool resetSettingsOnShutdown{false}; private: /* Qt-only settings */