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