fix: Shortcut migration not working correctly in some cases
Fixes #2045
This commit is contained in:
parent
a55df1d111
commit
d8fb3f526a
@ -297,6 +297,7 @@ namespace hex {
|
||||
EVENT_DEF(RequestChangeTheme, std::string);
|
||||
EVENT_DEF(RequestOpenPopup, std::string);
|
||||
EVENT_DEF(RequestAddVirtualFile, std::fs::path, std::vector<u8>, Region);
|
||||
EVENT_DEF(RequestStartMigration);
|
||||
|
||||
/**
|
||||
* @brief Creates a provider from it's unlocalized name, and add it to the provider list
|
||||
|
@ -154,6 +154,14 @@ namespace hex {
|
||||
if (!s_settings.isValid())
|
||||
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;
|
||||
|
||||
// During a crash settings can be empty, causing them to be overwritten.
|
||||
|
@ -79,6 +79,7 @@ namespace hex {
|
||||
|
||||
EventWindowInitialized::post();
|
||||
EventImHexStartupFinished::post();
|
||||
RequestStartMigration::post();
|
||||
|
||||
TutorialManager::init();
|
||||
|
||||
|
@ -225,7 +225,7 @@ namespace hex::plugin::builtin {
|
||||
RequestOpenFile::post(path);
|
||||
});
|
||||
|
||||
EventWindowInitialized::subscribe([] {
|
||||
RequestStartMigration::subscribe([] {
|
||||
const auto currVersion = ImHexApi::System::getImHexVersion();
|
||||
const auto prevLaunchVersion = ContentRegistry::Settings::read<std::string>("hex.builtin.setting.general", "hex.builtin.setting.general.prev_launch_version", "");
|
||||
if (prevLaunchVersion == "") {
|
||||
|
@ -359,6 +359,7 @@ namespace hex::plugin::builtin {
|
||||
m_hasDuplicate = !ShortcutManager::updateShortcut(m_shortcut, m_defaultShortcut, m_view);
|
||||
|
||||
m_drawShortcut = m_defaultShortcut;
|
||||
m_shortcut = m_defaultShortcut;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -993,7 +994,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Settings::add<ToolbarIconsWidget>("hex.builtin.setting.toolbar", "", "hex.builtin.setting.toolbar.icons");
|
||||
}
|
||||
|
||||
ImHexApi::System::addMigrationRoutine("v1.36.1", [] {
|
||||
ImHexApi::System::addMigrationRoutine("v1.36.3", [] {
|
||||
log::warn("Resetting shortcut key settings for them to work with this version of ImHex");
|
||||
|
||||
for (const auto &category : ContentRegistry::Settings::impl::getSettings()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user