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