1
0
mirror of synced 2025-01-11 05:42:15 +01:00

fix: Settings not being saved correctly anymore

This commit is contained in:
WerWolv 2025-01-03 14:07:09 +01:00
parent d8fb3f526a
commit 525ab8d945
2 changed files with 2 additions and 9 deletions

View File

@ -154,18 +154,10 @@ namespace hex {
if (!s_settings.isValid()) if (!s_settings.isValid())
return; return;
for (const auto &category : getSettings()) {
for (const auto &subCategory : category.subCategories) {
for (const auto &entry : subCategory.entries) {
(*s_settings)[category.unlocalizedName][entry.unlocalizedName] = entry.widget->store();
}
}
}
const auto &settingsData = *s_settings; const auto &settingsData = *s_settings;
// During a crash settings can be empty, causing them to be overwritten. // During a crash settings can be empty, causing them to be overwritten.
if (settingsData.empty()) { if (s_settings->empty()) {
return; return;
} }

View File

@ -1002,6 +1002,7 @@ namespace hex::plugin::builtin {
for (const auto &entry : subcategory.entries) { for (const auto &entry : subcategory.entries) {
if (auto keybindingWidget = dynamic_cast<KeybindingWidget*>(entry.widget.get())) { if (auto keybindingWidget = dynamic_cast<KeybindingWidget*>(entry.widget.get())) {
keybindingWidget->reset(); keybindingWidget->reset();
ContentRegistry::Settings::write<nlohmann::json>(category.unlocalizedName, entry.unlocalizedName, keybindingWidget->store());
} }
} }
} }