MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / getOption

Method getOption

src/qt/optionsmodel.cpp:401–484  ·  view source on GitHub ↗

NOLINTNEXTLINE(misc-no-recursion)

Source from the content-addressed store, hash-verified

399
400// NOLINTNEXTLINE(misc-no-recursion)
401QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) const
402{
403 auto setting = [&]{ return node().getPersistentSetting(SettingName(option) + suffix); };
404
405 QSettings settings;
406 switch (option) {
407 case StartAtStartup:
408 return GUIUtil::GetStartOnSystemStartup();
409 case ShowTrayIcon:
410 return m_show_tray_icon;
411 case MinimizeToTray:
412 return fMinimizeToTray;
413 case MapPortNatpmp:
414 return SettingToBool(setting(), DEFAULT_NATPMP);
415 case MinimizeOnClose:
416 return fMinimizeOnClose;
417
418 // default proxy
419 case ProxyUse:
420 case ProxyUseTor:
421 return ParseProxyString(SettingToString(setting(), "")).is_set;
422 case ProxyIP:
423 case ProxyIPTor: {
424 ProxySetting proxy = ParseProxyString(SettingToString(setting(), ""));
425 if (proxy.is_set) {
426 return proxy.ip;
427 } else if (suffix.empty()) {
428 return getOption(option, "-prev");
429 } else {
430 return ParseProxyString(GetDefaultProxyAddress().toStdString()).ip;
431 }
432 }
433 case ProxyPort:
434 case ProxyPortTor: {
435 ProxySetting proxy = ParseProxyString(SettingToString(setting(), ""));
436 if (proxy.is_set) {
437 return proxy.port;
438 } else if (suffix.empty()) {
439 return getOption(option, "-prev");
440 } else {
441 return ParseProxyString(GetDefaultProxyAddress().toStdString()).port;
442 }
443 }
444
445#ifdef ENABLE_WALLET
446 case SpendZeroConfChange:
447 return SettingToBool(setting(), wallet::DEFAULT_SPEND_ZEROCONF_CHANGE);
448 case ExternalSignerPath:
449 return QString::fromStdString(SettingToString(setting(), ""));
450 case SubFeeFromAmount:
451 return m_sub_fee_from_amount;
452#endif
453 case DisplayUnit:
454 return QVariant::fromValue(m_display_bitcoin_unit);
455 case ThirdPartyTxUrls:
456 return strThirdPartyTxUrls;
457 case Language:
458 return QString::fromStdString(SettingToString(setting(), ""));

Callers 1

setClientModelMethod · 0.80

Calls 12

GetStartOnSystemStartupFunction · 0.85
SettingToBoolFunction · 0.85
ParseProxyStringFunction · 0.85
SettingToStringFunction · 0.85
GetDefaultProxyAddressFunction · 0.85
PruneEnabledFunction · 0.85
PruneSizeGBFunction · 0.85
GetDefaultDBCacheFunction · 0.85
getPersistentSettingMethod · 0.80
SettingNameFunction · 0.70
emptyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected