mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #8487: Persist the datadir after option reset
57acb82
Load choose datadir dialog after options reset (Andrew Chow)15df3c1
Persist the datadir after option reset (Andrew Chow)
This commit is contained in:
commit
d26234a9e2
@ -178,7 +178,7 @@ bool Intro::pickDataDirectory()
|
|||||||
/* 2) Allow QSettings to override default dir */
|
/* 2) Allow QSettings to override default dir */
|
||||||
dataDir = settings.value("strDataDir", dataDir).toString();
|
dataDir = settings.value("strDataDir", dataDir).toString();
|
||||||
|
|
||||||
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR))
|
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || GetBoolArg("-resetguisettings", false))
|
||||||
{
|
{
|
||||||
/* If current default data directory does not exist, let the user choose one */
|
/* If current default data directory does not exist, let the user choose one */
|
||||||
Intro intro;
|
Intro intro;
|
||||||
@ -204,6 +204,7 @@ bool Intro::pickDataDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
settings.setValue("strDataDir", dataDir);
|
settings.setValue("strDataDir", dataDir);
|
||||||
|
settings.setValue("fReset", false);
|
||||||
}
|
}
|
||||||
/* Only override -datadir if different from the default, to make it possible to
|
/* Only override -datadir if different from the default, to make it possible to
|
||||||
* override -datadir in the bitcoin.conf file in the default data directory
|
* override -datadir in the bitcoin.conf file in the default data directory
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "netbase.h"
|
#include "netbase.h"
|
||||||
#include "txdb.h" // for -dbcache defaults
|
#include "txdb.h" // for -dbcache defaults
|
||||||
|
#include "intro.h"
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
#include "wallet/wallet.h"
|
#include "wallet/wallet.h"
|
||||||
@ -99,6 +100,9 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
|
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
|
||||||
addOverriddenOption("-par");
|
addOverriddenOption("-par");
|
||||||
|
|
||||||
|
if (!settings.contains("strDataDir"))
|
||||||
|
settings.setValue("strDataDir", Intro::getDefaultDataDirectory());
|
||||||
|
|
||||||
// Wallet
|
// Wallet
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (!settings.contains("bSpendZeroConfChange"))
|
if (!settings.contains("bSpendZeroConfChange"))
|
||||||
@ -151,9 +155,19 @@ void OptionsModel::Reset()
|
|||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
|
// Save the strDataDir setting
|
||||||
|
QString dataDir = Intro::getDefaultDataDirectory();
|
||||||
|
dataDir = settings.value("strDataDir", dataDir).toString();
|
||||||
|
|
||||||
// Remove all entries from our QSettings object
|
// Remove all entries from our QSettings object
|
||||||
settings.clear();
|
settings.clear();
|
||||||
|
|
||||||
|
// Set strDataDir
|
||||||
|
settings.setValue("strDataDir", dataDir);
|
||||||
|
|
||||||
|
// Set that this was reset
|
||||||
|
settings.setValue("fReset", true);
|
||||||
|
|
||||||
// default setting for OptionsModel::StartAtStartup - disabled
|
// default setting for OptionsModel::StartAtStartup - disabled
|
||||||
if (GUIUtil::GetStartOnSystemStartup())
|
if (GUIUtil::GetStartOnSystemStartup())
|
||||||
GUIUtil::SetStartOnSystemStartup(false);
|
GUIUtil::SetStartOnSystemStartup(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user