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