mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-13 17:05:37 -04:00
Use new settings API in recon and scanner (#1394)
* Use new settings in recon * Trim on string value read, remove dupe entry * Check update_range flag when setting values * Add a few saved settings to scanner * Add copywrite note
This commit is contained in:
parent
c6424f1623
commit
564f76b47d
6 changed files with 72 additions and 128 deletions
|
@ -2,6 +2,7 @@
|
|||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
* Copyright (C) 2022 Arjan Onwezen
|
||||
* Copyright (C) 2023 Kyle Reed
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
|
@ -58,7 +59,7 @@ void BoundSetting::parse(std::string_view value) {
|
|||
parse_int(value, as<uint8_t>());
|
||||
break;
|
||||
case SettingType::String:
|
||||
as<std::string>() = std::string{value};
|
||||
as<std::string>() = trim(value);
|
||||
break;
|
||||
case SettingType::Bool: {
|
||||
int parsed = 0;
|
||||
|
@ -106,10 +107,18 @@ void BoundSetting::write(File& file) const {
|
|||
|
||||
SettingsStore::SettingsStore(std::string_view store_name, SettingBindings bindings)
|
||||
: store_name_{store_name}, bindings_{bindings} {
|
||||
load_settings(store_name_, bindings_);
|
||||
reload();
|
||||
}
|
||||
|
||||
SettingsStore::~SettingsStore() {
|
||||
save();
|
||||
}
|
||||
|
||||
void SettingsStore::reload() {
|
||||
load_settings(store_name_, bindings_);
|
||||
}
|
||||
|
||||
void SettingsStore::save() const {
|
||||
save_settings(store_name_, bindings_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue