mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02: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:
parent
0de36941ec
commit
0e55bc6e7f
7 changed files with 101 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue