NOLINTNEXTLINE(misc-no-recursion)
| 399 | |
| 400 | // NOLINTNEXTLINE(misc-no-recursion) |
| 401 | QVariant 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(), "")); |
no test coverage detected