aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/optionsmodel.cpp')
-rw-r--r--src/qt/optionsmodel.cpp81
1 files changed, 16 insertions, 65 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index c1dbd916b3..3b83a5ff62 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2011-2013 The Bitcoin developers
+// Copyright (c) 2011-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -14,6 +14,7 @@
#include "init.h"
#include "main.h"
#include "net.h"
+#include "txdb.h" // for -dbcache defaults
#ifdef ENABLE_WALLET
#include "wallet.h"
#include "walletdb.h"
@@ -76,10 +77,15 @@ void OptionsModel::Init()
nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp
if (mapArgs.count("-paytxfee"))
strOverriddenByCommandLine += "-paytxfee ";
+
+ if (!settings.contains("bSpendZeroConfChange"))
+ settings.setValue("bSpendZeroConfChange", true);
+ if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
+ strOverriddenByCommandLine += "-spendzeroconfchange ";
#endif
if (!settings.contains("nDatabaseCache"))
- settings.setValue("nDatabaseCache", 25);
+ settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
strOverriddenByCommandLine += "-dbcache ";
@@ -130,69 +136,6 @@ void OptionsModel::Reset()
// default setting for OptionsModel::StartAtStartup - disabled
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(false);
-
- // Ensure Upgrade() is not running again by setting the bImportFinished flag
- settings.setValue("bImportFinished", true);
-}
-
-void OptionsModel::Upgrade()
-{
- QSettings settings;
-
- // Already upgraded
- if (settings.contains("bImportFinished"))
- return;
-
- settings.setValue("bImportFinished", true);
-
-#ifdef ENABLE_WALLET
- // Move settings from old wallet.dat (if any):
- CWalletDB walletdb(strWalletFile);
-
- QList<QString> intOptions;
- intOptions << "nDisplayUnit" << "nTransactionFee";
- foreach(QString key, intOptions)
- {
- int value = 0;
- if (walletdb.ReadSetting(key.toStdString(), value))
- {
- settings.setValue(key, value);
- walletdb.EraseSetting(key.toStdString());
- }
- }
- QList<QString> boolOptions;
- boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fMinimizeOnClose" << "fUseProxy" << "fUseUPnP";
- foreach(QString key, boolOptions)
- {
- bool value = false;
- if (walletdb.ReadSetting(key.toStdString(), value))
- {
- settings.setValue(key, value);
- walletdb.EraseSetting(key.toStdString());
- }
- }
- try
- {
- CAddress addrProxyAddress;
- if (walletdb.ReadSetting("addrProxy", addrProxyAddress))
- {
- settings.setValue("addrProxy", addrProxyAddress.ToStringIPPort().c_str());
- walletdb.EraseSetting("addrProxy");
- }
- }
- catch (std::ios_base::failure &e)
- {
- // 0.6.0rc1 saved this as a CService, which causes failure when parsing as a CAddress
- CService addrProxy;
- if (walletdb.ReadSetting("addrProxy", addrProxy))
- {
- settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
- walletdb.EraseSetting("addrProxy");
- }
- }
-#endif
-
- Init();
}
int OptionsModel::rowCount(const QModelIndex & parent) const
@@ -247,6 +190,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
// Todo: Consider to revert back to use just nTransactionFee here, if we don't want
// -paytxfee to update our QSettings!
return settings.value("nTransactionFee");
+ case SpendZeroConfChange:
+ return settings.value("bSpendZeroConfChange");
#endif
case DisplayUnit:
return nDisplayUnit;
@@ -337,6 +282,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
settings.setValue("nTransactionFee", (qint64)nTransactionFee);
emit transactionFeeChanged(nTransactionFee);
break;
+ case SpendZeroConfChange:
+ if (settings.value("bSpendZeroConfChange") != value) {
+ settings.setValue("bSpendZeroConfChange", value);
+ setRestartRequired(true);
+ }
+ break;
#endif
case DisplayUnit:
nDisplayUnit = value.toInt();