diff --git a/lib/libimhex/include/hex/api/event_manager.hpp b/lib/libimhex/include/hex/api/event_manager.hpp index 79aa7ff88..3f5898703 100644 --- a/lib/libimhex/include/hex/api/event_manager.hpp +++ b/lib/libimhex/include/hex/api/event_manager.hpp @@ -297,6 +297,7 @@ namespace hex { EVENT_DEF(RequestChangeTheme, std::string); EVENT_DEF(RequestOpenPopup, std::string); EVENT_DEF(RequestAddVirtualFile, std::fs::path, std::vector, Region); + EVENT_DEF(RequestStartMigration); /** * @brief Creates a provider from it's unlocalized name, and add it to the provider list diff --git a/lib/libimhex/source/api/content_registry.cpp b/lib/libimhex/source/api/content_registry.cpp index 87ae13c2f..1fbf3a0b7 100644 --- a/lib/libimhex/source/api/content_registry.cpp +++ b/lib/libimhex/source/api/content_registry.cpp @@ -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. diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 191cb3a07..8de31df6c 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -79,6 +79,7 @@ namespace hex { EventWindowInitialized::post(); EventImHexStartupFinished::post(); + RequestStartMigration::post(); TutorialManager::init(); diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 0e3d204b4..6b9e627e1 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -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("hex.builtin.setting.general", "hex.builtin.setting.general.prev_launch_version", ""); if (prevLaunchVersion == "") { diff --git a/plugins/builtin/source/content/settings_entries.cpp b/plugins/builtin/source/content/settings_entries.cpp index 2c00074e3..22b423720 100644 --- a/plugins/builtin/source/content/settings_entries.cpp +++ b/plugins/builtin/source/content/settings_entries.cpp @@ -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("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()) {