refactor: [gui] Use SettingTo<int64_t> over deprecated SettingToInt

This refactor does not change any behavior.

Also, remove the now-unused deprecated aliases.
This commit is contained in:
MarcoFalke
2026-02-16 16:21:11 +01:00
parent fac3ecaf69
commit fa5672dcaf
2 changed files with 4 additions and 7 deletions

View File

@@ -96,9 +96,6 @@ Int SettingTo(const common::SettingsValue&, Int);
template <std::integral Int> template <std::integral Int>
std::optional<Int> SettingTo(const common::SettingsValue&); std::optional<Int> SettingTo(const common::SettingsValue&);
inline int64_t SettingToInt(const common::SettingsValue& value, int64_t nDefault) { return SettingTo<int64_t>(value, nDefault); }
inline std::optional<int64_t> SettingToInt(const common::SettingsValue& value) { return SettingTo<int64_t>(value); }
bool SettingToBool(const common::SettingsValue&, bool); bool SettingToBool(const common::SettingsValue&, bool);
std::optional<bool> SettingToBool(const common::SettingsValue&); std::optional<bool> SettingToBool(const common::SettingsValue&);

View File

@@ -88,14 +88,14 @@ static common::SettingsValue PruneSetting(bool prune_enabled, int prune_size_gb)
static bool PruneEnabled(const common::SettingsValue& prune_setting) static bool PruneEnabled(const common::SettingsValue& prune_setting)
{ {
// -prune=1 setting is manual pruning mode, so disabled for purposes of the gui // -prune=1 setting is manual pruning mode, so disabled for purposes of the gui
return SettingToInt(prune_setting, 0) > 1; return SettingTo<int64_t>(prune_setting, 0) > 1;
} }
//! Get pruning size value to show in GUI from bitcoin -prune setting. If //! Get pruning size value to show in GUI from bitcoin -prune setting. If
//! pruning is not enabled, just show default recommended pruning size (2GB). //! pruning is not enabled, just show default recommended pruning size (2GB).
static int PruneSizeGB(const common::SettingsValue& prune_setting) static int PruneSizeGB(const common::SettingsValue& prune_setting)
{ {
int value = SettingToInt(prune_setting, 0); int value = SettingTo<int64_t>(prune_setting, 0);
return value > 1 ? PruneMiBtoGB(value) : DEFAULT_PRUNE_TARGET_GB; return value > 1 ? PruneMiBtoGB(value) : DEFAULT_PRUNE_TARGET_GB;
} }
@@ -469,9 +469,9 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
suffix.empty() ? getOption(option, "-prev") : suffix.empty() ? getOption(option, "-prev") :
DEFAULT_PRUNE_TARGET_GB; DEFAULT_PRUNE_TARGET_GB;
case DatabaseCache: case DatabaseCache:
return qlonglong(SettingToInt(setting(), DEFAULT_DB_CACHE >> 20)); return qlonglong(SettingTo<int64_t>(setting(), DEFAULT_DB_CACHE >> 20));
case ThreadsScriptVerif: case ThreadsScriptVerif:
return qlonglong(SettingToInt(setting(), DEFAULT_SCRIPTCHECK_THREADS)); return qlonglong(SettingTo<int64_t>(setting(), DEFAULT_SCRIPTCHECK_THREADS));
case Listen: case Listen:
return SettingToBool(setting(), DEFAULT_LISTEN); return SettingToBool(setting(), DEFAULT_LISTEN);
case Server: case Server: