Bitcoin ABC  0.26.3
P2P Digital Currency
optionsmodel.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #if defined(HAVE_CONFIG_H)
6 #include <config/bitcoin-config.h>
7 #endif
8 
9 #include <qt/optionsmodel.h>
10 
11 #include <interfaces/node.h>
12 #include <mapport.h>
13 #include <net.h>
14 #include <netbase.h>
15 #include <qt/bitcoinunits.h>
16 #include <qt/guiconstants.h>
17 #include <qt/guiutil.h>
18 #include <txdb.h> // for -dbcache defaults
19 #include <util/string.h>
20 #include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
21 
22 #include <QNetworkProxy>
23 #include <QSettings>
24 #include <QStringList>
25 
26 const char *DEFAULT_GUI_PROXY_HOST = "127.0.0.1";
27 
28 static const QString GetDefaultProxyAddress();
29 
30 OptionsModel::OptionsModel(QObject *parent, bool resetSettings)
31  : QAbstractListModel(parent) {
32  Init(resetSettings);
33 }
34 
35 void OptionsModel::addOverriddenOption(const std::string &option) {
37  QString::fromStdString(option) + "=" +
38  QString::fromStdString(gArgs.GetArg(option, "")) + " ";
39 }
40 
41 // Writes all missing QSettings with their default values
42 void OptionsModel::Init(bool resetSettings) {
43  if (resetSettings) {
44  Reset();
45  }
46 
48 
49  QSettings settings;
50 
51  // Ensure restart flag is unset on client startup
52  setRestartRequired(false);
53 
54  // These are Qt-only settings:
55 
56  // Window
57  if (!settings.contains("fHideTrayIcon")) {
58  settings.setValue("fHideTrayIcon", false);
59  }
60  fHideTrayIcon = settings.value("fHideTrayIcon").toBool();
62 
63  if (!settings.contains("fMinimizeToTray")) {
64  settings.setValue("fMinimizeToTray", false);
65  }
67  settings.value("fMinimizeToTray").toBool() && !fHideTrayIcon;
68 
69  if (!settings.contains("fMinimizeOnClose")) {
70  settings.setValue("fMinimizeOnClose", false);
71  }
72  fMinimizeOnClose = settings.value("fMinimizeOnClose").toBool();
73 
74  // Display
75  if (!settings.contains("nDisplayUnit")) {
76  settings.setValue("nDisplayUnit", BitcoinUnits::base);
77  }
78  nDisplayUnit = settings.value("nDisplayUnit").toInt();
79 
80  if (!settings.contains("strThirdPartyTxUrls")) {
81  settings.setValue("strThirdPartyTxUrls", "");
82  }
83  strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString();
84 
85  if (!settings.contains("fCoinControlFeatures")) {
86  settings.setValue("fCoinControlFeatures", false);
87  }
89  settings.value("fCoinControlFeatures", false).toBool();
90 
91  // These are shared with the core or have a command-line parameter
92  // and we want command-line parameters to overwrite the GUI settings.
93  //
94  // If setting doesn't exist create it with defaults.
95  //
96  // If gArgs.SoftSetArg() or gArgs.SoftSetBoolArg() return false we were
97  // overridden
98  // by command-line and show this in the UI.
99 
100  // Main
101  if (!settings.contains("bPrune")) {
102  settings.setValue("bPrune", false);
103  }
104  if (!settings.contains("nPruneSize")) {
105  settings.setValue("nPruneSize", DEFAULT_PRUNE_TARGET_GB);
106  }
107  SetPruneEnabled(settings.value("bPrune").toBool());
108 
109  if (!settings.contains("nDatabaseCache")) {
110  settings.setValue("nDatabaseCache", (qint64)DEFAULT_DB_CACHE_MB);
111  }
112  if (!gArgs.SoftSetArg(
113  "-dbcache",
114  settings.value("nDatabaseCache").toString().toStdString())) {
115  addOverriddenOption("-dbcache");
116  }
117 
118  if (!settings.contains("nThreadsScriptVerif")) {
119  settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS);
120  }
121  if (!gArgs.SoftSetArg(
122  "-par",
123  settings.value("nThreadsScriptVerif").toString().toStdString())) {
124  addOverriddenOption("-par");
125  }
126 
127  if (!settings.contains("strDataDir")) {
128  settings.setValue("strDataDir", GUIUtil::getDefaultDataDirectory());
129  }
130 
131 // Wallet
132 #ifdef ENABLE_WALLET
133  if (!settings.contains("bSpendZeroConfChange")) {
134  settings.setValue("bSpendZeroConfChange", true);
135  }
136  if (!gArgs.SoftSetBoolArg(
137  "-spendzeroconfchange",
138  settings.value("bSpendZeroConfChange").toBool())) {
139  addOverriddenOption("-spendzeroconfchange");
140  }
141 #endif
142 
143  // Network
144  if (!settings.contains("fUseUPnP")) {
145  settings.setValue("fUseUPnP", DEFAULT_UPNP);
146  }
147  if (!gArgs.SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) {
148  addOverriddenOption("-upnp");
149  }
150 
151  if (!settings.contains("fUseNatpmp")) {
152  settings.setValue("fUseNatpmp", DEFAULT_NATPMP);
153  }
154  if (!gArgs.SoftSetBoolArg("-natpmp",
155  settings.value("fUseNatpmp").toBool())) {
156  addOverriddenOption("-natpmp");
157  }
158 
159  if (!settings.contains("fListen")) {
160  settings.setValue("fListen", DEFAULT_LISTEN);
161  }
162  if (!gArgs.SoftSetBoolArg("-listen", settings.value("fListen").toBool())) {
163  addOverriddenOption("-listen");
164  }
165 
166  if (!settings.contains("fUseProxy")) {
167  settings.setValue("fUseProxy", false);
168  }
169  if (!settings.contains("addrProxy")) {
170  settings.setValue("addrProxy", GetDefaultProxyAddress());
171  }
172  // Only try to set -proxy, if user has enabled fUseProxy
173  if (settings.value("fUseProxy").toBool() &&
174  !gArgs.SoftSetArg(
175  "-proxy", settings.value("addrProxy").toString().toStdString())) {
176  addOverriddenOption("-proxy");
177  } else if (!settings.value("fUseProxy").toBool() &&
178  !gArgs.GetArg("-proxy", "").empty()) {
179  addOverriddenOption("-proxy");
180  }
181 
182  if (!settings.contains("fUseSeparateProxyTor")) {
183  settings.setValue("fUseSeparateProxyTor", false);
184  }
185  if (!settings.contains("addrSeparateProxyTor")) {
186  settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
187  }
188  // Only try to set -onion, if user has enabled fUseSeparateProxyTor
189  if (settings.value("fUseSeparateProxyTor").toBool() &&
190  !gArgs.SoftSetArg(
191  "-onion",
192  settings.value("addrSeparateProxyTor").toString().toStdString())) {
193  addOverriddenOption("-onion");
194  } else if (!settings.value("fUseSeparateProxyTor").toBool() &&
195  !gArgs.GetArg("-onion", "").empty()) {
196  addOverriddenOption("-onion");
197  }
198 
199  // Display
200  if (!settings.contains("language")) {
201  settings.setValue("language", "");
202  }
203  if (!gArgs.SoftSetArg(
204  "-lang", settings.value("language").toString().toStdString())) {
205  addOverriddenOption("-lang");
206  }
207 
208  language = settings.value("language").toString();
209 }
210 
215 static void CopySettings(QSettings &dst, const QSettings &src) {
216  for (const QString &key : src.allKeys()) {
217  dst.setValue(key, src.value(key));
218  }
219 }
220 
222 static void BackupSettings(const fs::path &filename, const QSettings &src) {
223  qInfo() << "Backing up GUI settings to"
224  << GUIUtil::boostPathToQString(filename);
225  QSettings dst(GUIUtil::boostPathToQString(filename), QSettings::IniFormat);
226  dst.clear();
227  CopySettings(dst, src);
228 }
229 
231  QSettings settings;
232 
233  // Backup old settings to chain-specific datadir for troubleshooting
234  BackupSettings(gArgs.GetDataDirNet() / "guisettings.ini.bak", settings);
235 
236  // Save the strDataDir setting
237  QString dataDir = GUIUtil::getDefaultDataDirectory();
238  dataDir = settings.value("strDataDir", dataDir).toString();
239 
240  // Remove all entries from our QSettings object
241  settings.clear();
242 
243  // Set strDataDir
244  settings.setValue("strDataDir", dataDir);
245 
246  // Set that this was reset
247  settings.setValue("fReset", true);
248 
249  // default setting for OptionsModel::StartAtStartup - disabled
252  }
253 }
254 
255 int OptionsModel::rowCount(const QModelIndex &parent) const {
256  return OptionIDRowCount;
257 }
258 
259 struct ProxySetting {
260  bool is_set;
261  QString ip;
262  QString port;
263 };
264 
265 static ProxySetting GetProxySetting(QSettings &settings, const QString &name) {
266  static const ProxySetting default_val = {
267  false, DEFAULT_GUI_PROXY_HOST,
268  QString("%1").arg(DEFAULT_GUI_PROXY_PORT)};
269  // Handle the case that the setting is not set at all
270  if (!settings.contains(name)) {
271  return default_val;
272  }
273  // contains IP at index 0 and port at index 1
274  QStringList ip_port =
275  GUIUtil::splitSkipEmptyParts(settings.value(name).toString(), ":");
276  if (ip_port.size() == 2) {
277  return {true, ip_port.at(0), ip_port.at(1)};
278  } else { // Invalid: return default
279  return default_val;
280  }
281 }
282 
283 static void SetProxySetting(QSettings &settings, const QString &name,
284  const ProxySetting &ip_port) {
285  settings.setValue(name, ip_port.ip + ":" + ip_port.port);
286 }
287 
288 static const QString GetDefaultProxyAddress() {
289  return QString("%1:%2")
292 }
293 
294 void OptionsModel::SetPruneEnabled(bool prune, bool force) {
295  QSettings settings;
296  settings.setValue("bPrune", prune);
297  const int64_t prune_target_mib =
298  PruneGBtoMiB(settings.value("nPruneSize").toInt());
299  std::string prune_val = prune ? ToString(prune_target_mib) : "0";
300  if (force) {
301  gArgs.ForceSetArg("-prune", prune_val);
302  return;
303  }
304  if (!gArgs.SoftSetArg("-prune", prune_val)) {
305  addOverriddenOption("-prune");
306  }
307 }
308 
309 void OptionsModel::SetPruneTargetGB(int prune_target_gb, bool force) {
310  const bool prune = prune_target_gb > 0;
311  if (prune) {
312  QSettings settings;
313  settings.setValue("nPruneSize", prune_target_gb);
314  }
315  SetPruneEnabled(prune, force);
316 }
317 
318 // read QSettings values and return them
319 QVariant OptionsModel::data(const QModelIndex &index, int role) const {
320  if (role == Qt::EditRole) {
321  QSettings settings;
322  switch (index.row()) {
323  case StartAtStartup:
325  case HideTrayIcon:
326  return fHideTrayIcon;
327  case MinimizeToTray:
328  return fMinimizeToTray;
329  case MapPortUPnP:
330 #ifdef USE_UPNP
331  return settings.value("fUseUPnP");
332 #else
333  return false;
334 #endif // USE_UPNP
335  case MapPortNatpmp:
336 #ifdef USE_NATPMP
337  return settings.value("fUseNatpmp");
338 #else
339  return false;
340 #endif // USE_NATPMP
341  case MinimizeOnClose:
342  return fMinimizeOnClose;
343 
344  // default proxy
345  case ProxyUse:
346  return settings.value("fUseProxy", false);
347  case ProxyIP:
348  return GetProxySetting(settings, "addrProxy").ip;
349  case ProxyPort:
350  return GetProxySetting(settings, "addrProxy").port;
351 
352  // separate Tor proxy
353  case ProxyUseTor:
354  return settings.value("fUseSeparateProxyTor", false);
355  case ProxyIPTor:
356  return GetProxySetting(settings, "addrSeparateProxyTor").ip;
357  case ProxyPortTor:
358  return GetProxySetting(settings, "addrSeparateProxyTor").port;
359 
360 #ifdef ENABLE_WALLET
361  case SpendZeroConfChange:
362  return settings.value("bSpendZeroConfChange");
363 #endif
364  case DisplayUnit:
365  return nDisplayUnit;
366  case ThirdPartyTxUrls:
367  return strThirdPartyTxUrls;
368  case Language:
369  return settings.value("language");
370  case CoinControlFeatures:
371  return fCoinControlFeatures;
372  case Prune:
373  return settings.value("bPrune");
374  case PruneSize:
375  return settings.value("nPruneSize");
376  case DatabaseCache:
377  return settings.value("nDatabaseCache");
378  case ThreadsScriptVerif:
379  return settings.value("nThreadsScriptVerif");
380  case Listen:
381  return settings.value("fListen");
382  default:
383  return QVariant();
384  }
385  }
386  return QVariant();
387 }
388 
389 // write QSettings values
390 bool OptionsModel::setData(const QModelIndex &index, const QVariant &value,
391  int role) {
392  bool successful = true; /* set to false on parse error */
393  if (role == Qt::EditRole) {
394  QSettings settings;
395  switch (index.row()) {
396  case StartAtStartup:
397  successful = GUIUtil::SetStartOnSystemStartup(value.toBool());
398  break;
399  case HideTrayIcon:
400  fHideTrayIcon = value.toBool();
401  settings.setValue("fHideTrayIcon", fHideTrayIcon);
403  break;
404  case MinimizeToTray:
405  fMinimizeToTray = value.toBool();
406  settings.setValue("fMinimizeToTray", fMinimizeToTray);
407  break;
408  case MapPortUPnP: // core option - can be changed on-the-fly
409  settings.setValue("fUseUPnP", value.toBool());
410  break;
411  case MapPortNatpmp: // core option - can be changed on-the-fly
412  settings.setValue("fUseNatpmp", value.toBool());
413  break;
414  case MinimizeOnClose:
415  fMinimizeOnClose = value.toBool();
416  settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
417  break;
418 
419  // default proxy
420  case ProxyUse:
421  if (settings.value("fUseProxy") != value) {
422  settings.setValue("fUseProxy", value.toBool());
423  setRestartRequired(true);
424  }
425  break;
426  case ProxyIP: {
427  auto ip_port = GetProxySetting(settings, "addrProxy");
428  if (!ip_port.is_set || ip_port.ip != value.toString()) {
429  ip_port.ip = value.toString();
430  SetProxySetting(settings, "addrProxy", ip_port);
431  setRestartRequired(true);
432  }
433  } break;
434  case ProxyPort: {
435  auto ip_port = GetProxySetting(settings, "addrProxy");
436  if (!ip_port.is_set || ip_port.port != value.toString()) {
437  ip_port.port = value.toString();
438  SetProxySetting(settings, "addrProxy", ip_port);
439  setRestartRequired(true);
440  }
441  } break;
442 
443  // separate Tor proxy
444  case ProxyUseTor:
445  if (settings.value("fUseSeparateProxyTor") != value) {
446  settings.setValue("fUseSeparateProxyTor", value.toBool());
447  setRestartRequired(true);
448  }
449  break;
450  case ProxyIPTor: {
451  auto ip_port =
452  GetProxySetting(settings, "addrSeparateProxyTor");
453  if (!ip_port.is_set || ip_port.ip != value.toString()) {
454  ip_port.ip = value.toString();
455  SetProxySetting(settings, "addrSeparateProxyTor", ip_port);
456  setRestartRequired(true);
457  }
458  } break;
459  case ProxyPortTor: {
460  auto ip_port =
461  GetProxySetting(settings, "addrSeparateProxyTor");
462  if (!ip_port.is_set || ip_port.port != value.toString()) {
463  ip_port.port = value.toString();
464  SetProxySetting(settings, "addrSeparateProxyTor", ip_port);
465  setRestartRequired(true);
466  }
467  } break;
468 
469 #ifdef ENABLE_WALLET
470  case SpendZeroConfChange:
471  if (settings.value("bSpendZeroConfChange") != value) {
472  settings.setValue("bSpendZeroConfChange", value);
473  setRestartRequired(true);
474  }
475  break;
476 #endif
477  case DisplayUnit:
478  setDisplayUnit(value);
479  break;
480  case ThirdPartyTxUrls:
481  if (strThirdPartyTxUrls != value.toString()) {
482  strThirdPartyTxUrls = value.toString();
483  settings.setValue("strThirdPartyTxUrls",
485  setRestartRequired(true);
486  }
487  break;
488  case Language:
489  if (settings.value("language") != value) {
490  settings.setValue("language", value);
491  setRestartRequired(true);
492  }
493  break;
494  case CoinControlFeatures:
495  fCoinControlFeatures = value.toBool();
496  settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
498  break;
499  case Prune:
500  if (settings.value("bPrune") != value) {
501  settings.setValue("bPrune", value);
502  setRestartRequired(true);
503  }
504  break;
505  case PruneSize:
506  if (settings.value("nPruneSize") != value) {
507  settings.setValue("nPruneSize", value);
508  setRestartRequired(true);
509  }
510  break;
511  case DatabaseCache:
512  if (settings.value("nDatabaseCache") != value) {
513  settings.setValue("nDatabaseCache", value);
514  setRestartRequired(true);
515  }
516  break;
517  case ThreadsScriptVerif:
518  if (settings.value("nThreadsScriptVerif") != value) {
519  settings.setValue("nThreadsScriptVerif", value);
520  setRestartRequired(true);
521  }
522  break;
523  case Listen:
524  if (settings.value("fListen") != value) {
525  settings.setValue("fListen", value);
526  setRestartRequired(true);
527  }
528  break;
529  default:
530  break;
531  }
532  }
533 
534  Q_EMIT dataChanged(index, index);
535 
536  return successful;
537 }
538 
541 void OptionsModel::setDisplayUnit(const QVariant &value) {
542  if (!value.isNull()) {
543  QSettings settings;
544  nDisplayUnit = value.toInt();
545  settings.setValue("nDisplayUnit", nDisplayUnit);
547  }
548 }
549 
550 bool OptionsModel::getProxySettings(QNetworkProxy &proxy) const {
551  // Directly query current base proxy, because
552  // GUI settings can be overridden with -proxy.
553  proxyType curProxy;
554  if (node().getProxy(NET_IPV4, curProxy)) {
555  proxy.setType(QNetworkProxy::Socks5Proxy);
556  proxy.setHostName(QString::fromStdString(curProxy.proxy.ToStringIP()));
557  proxy.setPort(curProxy.proxy.GetPort());
558 
559  return true;
560  } else {
561  proxy.setType(QNetworkProxy::NoProxy);
562  }
563 
564  return false;
565 }
566 
567 void OptionsModel::setRestartRequired(bool fRequired) {
568  QSettings settings;
569  return settings.setValue("fRestartRequired", fRequired);
570 }
571 
573  QSettings settings;
574  return settings.value("fRestartRequired", false).toBool();
575 }
576 
578  // Migration of default values
579  // Check if the QSettings container was already loaded with this client
580  // version
581  QSettings settings;
582  static const char strSettingsVersionKey[] = "nSettingsVersion";
583  int settingsVersion = settings.contains(strSettingsVersionKey)
584  ? settings.value(strSettingsVersionKey).toInt()
585  : 0;
586  if (settingsVersion < CLIENT_VERSION) {
587  // -dbcache was bumped from 100 to 300 in 0.13
588  // see https://github.com/bitcoin/bitcoin/pull/8273
589  // force people to upgrade to the new value if they are using 100MB
590  if (settingsVersion < 130000 && settings.contains("nDatabaseCache") &&
591  settings.value("nDatabaseCache").toLongLong() == 100) {
592  settings.setValue("nDatabaseCache", (qint64)DEFAULT_DB_CACHE_MB);
593  }
594 
595  settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
596  }
597 
598  // Overwrite the 'addrProxy' setting in case it has been set to an illegal
599  // default value (see issue #12623; PR #12650).
600  if (settings.contains("addrProxy") &&
601  settings.value("addrProxy").toString().endsWith("%2")) {
602  settings.setValue("addrProxy", GetDefaultProxyAddress());
603  }
604 
605  // Overwrite the 'addrSeparateProxyTor' setting in case it has been set to
606  // an illegal default value (see issue #12623; PR #12650).
607  if (settings.contains("addrSeparateProxyTor") &&
608  settings.value("addrSeparateProxyTor").toString().endsWith("%2")) {
609  settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
610  }
611 }
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:628
bool SoftSetArg(const std::string &strArg, const std::string &strValue)
Set an argument if it doesn't already have a value.
Definition: system.cpp:610
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Definition: system.h:260
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:584
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
Definition: system.cpp:620
std::string ToStringIP() const
Definition: netaddress.cpp:578
uint16_t GetPort() const
Definition: netaddress.cpp:975
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QString strOverriddenByCommandLine
Definition: optionsmodel.h:133
bool getProxySettings(QNetworkProxy &proxy) const
bool isRestartRequired() const
void Init(bool resetSettings=false)
bool fCoinControlFeatures
Definition: optionsmodel.h:131
void setDisplayUnit(const QVariant &value)
Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal.
void coinControlFeaturesChanged(bool)
QString strThirdPartyTxUrls
Definition: optionsmodel.h:130
OptionsModel(QObject *parent=nullptr, bool resetSettings=false)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void SetPruneTargetGB(int prune_target_gb, bool force=false)
void SetPruneEnabled(bool prune, bool force=false)
void displayUnitChanged(int unit)
bool fHideTrayIcon
Definition: optionsmodel.h:125
bool fMinimizeToTray
Definition: optionsmodel.h:126
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
interfaces::Node & node() const
Definition: optionsmodel.h:113
void checkAndMigrate()
QString language
Definition: optionsmodel.h:128
void addOverriddenOption(const std::string &option)
bool fMinimizeOnClose
Definition: optionsmodel.h:127
void setRestartRequired(bool fRequired)
void hideTrayIconChanged(bool)
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
Definition: fs.h:33
CService proxy
Definition: netbase.h:40
static constexpr int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
Definition: clientversion.h:38
static constexpr int DEFAULT_PRUNE_TARGET_GB
Definition: guiconstants.h:53
static constexpr bool DEFAULT_NATPMP
Definition: mapport.h:17
static constexpr bool DEFAULT_UPNP
Definition: mapport.h:11
QString getDefaultDataDirectory()
Determine default data directory for operating system.
Definition: guiutil.cpp:282
QString boostPathToQString(const fs::path &path)
Convert OS specific boost path to QString through UTF-8.
Definition: guiutil.cpp:778
bool SetStartOnSystemStartup(bool fAutoStart)
Definition: guiutil.cpp:763
bool GetStartOnSystemStartup()
Definition: guiutil.cpp:760
QStringList splitSkipEmptyParts(const QString &s, const QString &separator)
Definition: guiutil.cpp:441
static const bool DEFAULT_LISTEN
-listen default
Definition: net.h:85
@ NET_IPV4
IPv4.
Definition: netaddress.h:51
static void CopySettings(QSettings &dst, const QSettings &src)
Helper function to copy contents from one QSettings to another.
static const QString GetDefaultProxyAddress()
static ProxySetting GetProxySetting(QSettings &settings, const QString &name)
static void SetProxySetting(QSettings &settings, const QString &name, const ProxySetting &ip_port)
static void BackupSettings(const fs::path &filename, const QSettings &src)
Back up a QSettings to an ini-formatted file.
const char * DEFAULT_GUI_PROXY_HOST
static int64_t PruneGBtoMiB(int gb)
Convert displayed prune target GB to configured MiB.
Definition: optionsmodel.h:38
static constexpr uint16_t DEFAULT_GUI_PROXY_PORT
Definition: optionsmodel.h:24
const char * name
Definition: rest.cpp:49
std::string ToString(const T &t)
Locale-independent version of std::to_string.
Definition: string.h:77
ArgsManager gArgs
Definition: system.cpp:77
static constexpr int64_t DEFAULT_DB_CACHE_MB
-dbcache default (MiB)
Definition: txdb.h:34
static const int DEFAULT_SCRIPTCHECK_THREADS
-par default (number of script-checking threads, 0 = auto)
Definition: validation.h:83