aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101@gmail.com>2016-08-08 14:17:23 -0400
committerAndrew Chow <achow101@gmail.com>2016-08-10 15:09:19 -0400
commit15df3c196b2359505980a2b0217133e0bb550565 (patch)
tree54861d3b283110c51395c29e29a4738fd67e8488
parentedebf425a2df2cf3bd537d26a1c0797f7298a5bc (diff)
Persist the datadir after option reset
After a reset is performed, the datadir setting is saved and readded to the settings so that it is persisted across option resets.
-rw-r--r--src/qt/optionsmodel.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index 684db71a8c..7987d8e7ea 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -16,6 +16,7 @@
#include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS
#include "net.h"
#include "txdb.h" // for -dbcache defaults
+#include "intro.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
@@ -98,6 +99,9 @@ void OptionsModel::Init(bool resetSettings)
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
addOverriddenOption("-par");
+ if (!settings.contains("strDataDir"))
+ settings.setValue("strDataDir", Intro::getDefaultDataDirectory());
+
// Wallet
#ifdef ENABLE_WALLET
if (!settings.contains("bSpendZeroConfChange"))
@@ -150,9 +154,16 @@ void OptionsModel::Reset()
{
QSettings settings;
+ // Save the strDataDir setting
+ QString dataDir = Intro::getDefaultDataDirectory();
+ dataDir = settings.value("strDataDir", dataDir).toString();
+
// Remove all entries from our QSettings object
settings.clear();
+ // Set strDataDir
+ settings.setValue("strDataDir", dataDir);
+
// default setting for OptionsModel::StartAtStartup - disabled
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(false);