mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
settings: Add update/getPersistent/isIgnored methods
Add interfaces::Node methods to give GUI finer grained control over settings.json file. Update method is used to write settings to the file, getPersistent and isIgnored methods are used to find out about settings file and command line option interactions.
This commit is contained in:
@@ -112,6 +112,38 @@ public:
|
||||
}
|
||||
}
|
||||
bool shutdownRequested() override { return ShutdownRequested(); }
|
||||
bool isSettingIgnored(const std::string& name) override
|
||||
{
|
||||
bool ignored = false;
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
if (auto* options = util::FindKey(settings.command_line_options, name)) {
|
||||
ignored = !options->empty();
|
||||
}
|
||||
});
|
||||
return ignored;
|
||||
}
|
||||
util::SettingsValue getPersistentSetting(const std::string& name) override { return gArgs.GetPersistentSetting(name); }
|
||||
void updateRwSetting(const std::string& name, const util::SettingsValue& value) override
|
||||
{
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
if (value.isNull()) {
|
||||
settings.rw_settings.erase(name);
|
||||
} else {
|
||||
settings.rw_settings[name] = value;
|
||||
}
|
||||
});
|
||||
gArgs.WriteSettingsFile();
|
||||
}
|
||||
void forceSetting(const std::string& name, const util::SettingsValue& value) override
|
||||
{
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
if (value.isNull()) {
|
||||
settings.forced_settings.erase(name);
|
||||
} else {
|
||||
settings.forced_settings[name] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
void mapPort(bool use_upnp, bool use_natpmp) override { StartMapPort(use_upnp, use_natpmp); }
|
||||
bool getProxy(Network net, Proxy& proxy_info) override { return GetProxy(net, proxy_info); }
|
||||
size_t getNodeCount(ConnectionDirection flags) override
|
||||
|
||||
Reference in New Issue
Block a user