Writes all missing QSettings with their default values
| 42 | |
| 43 | // Writes all missing QSettings with their default values |
| 44 | void OptionsModel::Init(bool resetSettings) |
| 45 | { |
| 46 | if (resetSettings) |
| 47 | Reset(); |
| 48 | |
| 49 | checkAndMigrate(); |
| 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(); |
| 63 | Q_EMIT showTrayIconChanged(m_show_tray_icon); |
| 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 = false; |
| 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); |
nothing calls this directly
no test coverage detected