mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-17 18:40:09 +00:00
[Qt] Add dbcache migration path
This commit is contained in:
parent
618c9dd8c6
commit
893f379ba0
@ -43,6 +43,8 @@ void OptionsModel::Init(bool resetSettings)
|
|||||||
if (resetSettings)
|
if (resetSettings)
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
|
checkAndMigrate();
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
// Ensure restart flag is unset on client startup
|
// Ensure restart flag is unset on client startup
|
||||||
@ -429,3 +431,22 @@ bool OptionsModel::isRestartRequired()
|
|||||||
QSettings settings;
|
QSettings settings;
|
||||||
return settings.value("fRestartRequired", false).toBool();
|
return settings.value("fRestartRequired", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsModel::checkAndMigrate()
|
||||||
|
{
|
||||||
|
// Migration of default values
|
||||||
|
// Check if the QSettings container was already loaded with this client version
|
||||||
|
QSettings settings;
|
||||||
|
static const char strSettingsVersionKey[] = "nSettingsVersion";
|
||||||
|
int settingsVersion = settings.contains(strSettingsVersionKey) ? settings.value(strSettingsVersionKey).toInt() : 0;
|
||||||
|
if (settingsVersion < CLIENT_VERSION)
|
||||||
|
{
|
||||||
|
// -dbcache was bumped from 100 to 300 in 0.13
|
||||||
|
// see https://github.com/bitcoin/bitcoin/pull/8273
|
||||||
|
// force people to upgrade to the new value if they are using 100MB
|
||||||
|
if (settingsVersion < 130000 && settings.contains("nDatabaseCache") && settings.value("nDatabaseCache").toLongLong() == 100)
|
||||||
|
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
|
||||||
|
|
||||||
|
settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
|
||||||
|
}
|
||||||
|
}
|
@ -84,9 +84,11 @@ private:
|
|||||||
/* settings that were overriden by command-line */
|
/* settings that were overriden by command-line */
|
||||||
QString strOverriddenByCommandLine;
|
QString strOverriddenByCommandLine;
|
||||||
|
|
||||||
/// Add option to list of GUI options overridden through command line/config file
|
// Add option to list of GUI options overridden through command line/config file
|
||||||
void addOverriddenOption(const std::string &option);
|
void addOverriddenOption(const std::string &option);
|
||||||
|
|
||||||
|
// Check settings version and upgrade default values if required
|
||||||
|
void checkAndMigrate();
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void displayUnitChanged(int unit);
|
void displayUnitChanged(int unit);
|
||||||
void coinControlFeaturesChanged(bool);
|
void coinControlFeaturesChanged(bool);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user