diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-03-17 10:34:14 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-03-17 10:38:37 +0100 |
commit | 5b6e9811fa64540c8feecc24f11fa867392f262f (patch) | |
tree | d344dc22592208dac438fde4a801f647f5216b2e /src | |
parent | ff0c0dd6a91f654a527da4d96839033922f351cb (diff) | |
parent | b40bdd6532bdba3d157c8a2dd4661ee540a6fbb4 (diff) |
Merge pull request #3867
b40bdd6 qt: Show also value for options overridden on command line (Wladimir J. van der Laan)
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/optionsmodel.cpp | 23 | ||||
-rw-r--r-- | src/qt/optionsmodel.h | 3 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 3b83a5ff62..b61fdd2301 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -30,6 +30,11 @@ OptionsModel::OptionsModel(QObject *parent) : Init(); } +void OptionsModel::addOverriddenOption(const std::string &option) +{ + strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " "; +} + // Writes all missing QSettings with their default values void OptionsModel::Init() { @@ -76,23 +81,23 @@ void OptionsModel::Init() settings.setValue("nTransactionFee", 0); nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp if (mapArgs.count("-paytxfee")) - strOverriddenByCommandLine += "-paytxfee "; + addOverriddenOption("-paytxfee"); if (!settings.contains("bSpendZeroConfChange")) settings.setValue("bSpendZeroConfChange", true); if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool())) - strOverriddenByCommandLine += "-spendzeroconfchange "; + addOverriddenOption("-spendzeroconfchange"); #endif if (!settings.contains("nDatabaseCache")) settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache); if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString())) - strOverriddenByCommandLine += "-dbcache "; + addOverriddenOption("-dbcache"); if (!settings.contains("nThreadsScriptVerif")) settings.setValue("nThreadsScriptVerif", 0); if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString())) - strOverriddenByCommandLine += "-par "; + addOverriddenOption("-par"); // Network if (!settings.contains("fUseUPnP")) @@ -100,9 +105,9 @@ void OptionsModel::Init() settings.setValue("fUseUPnP", true); #else settings.setValue("fUseUPnP", false); -#endif +#endif if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) - strOverriddenByCommandLine += "-upnp "; + addOverriddenOption("-upnp"); if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); @@ -110,18 +115,18 @@ void OptionsModel::Init() settings.setValue("addrProxy", "127.0.0.1:9050"); // Only try to set -proxy, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) - strOverriddenByCommandLine += "-proxy "; + addOverriddenOption("-proxy"); if (!settings.contains("nSocksVersion")) settings.setValue("nSocksVersion", 5); // Only try to set -socks, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString())) - strOverriddenByCommandLine += "-socks "; + addOverriddenOption("-socks"); // Display if (!settings.contains("language")) settings.setValue("language", ""); if (!SoftSetArg("-lang", settings.value("language").toString().toStdString())) - strOverriddenByCommandLine += "-lang"; + addOverriddenOption("-lang"); language = settings.value("language").toString(); } diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index a3487ddd2e..ece5ef78a4 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -75,6 +75,9 @@ private: /* settings that were overriden by command-line */ QString strOverriddenByCommandLine; + /// Add option to list of GUI options overridden through command line/config file + void addOverriddenOption(const std::string &option); + signals: void displayUnitChanged(int unit); void transactionFeeChanged(qint64); |