sys: Replace the terrible event manager with a much better one

This commit is contained in:
WerWolv
2021-03-27 11:36:36 +01:00
parent 688ca01b1b
commit d805d976a6
27 changed files with 206 additions and 227 deletions

View File

@@ -17,7 +17,7 @@ namespace hex {
io.link_detach_with_modifier_click.modifier = &always;
}
View::subscribeEvent(Events::SettingsChanged, [](auto) {
EventManager::subscribe<EventSettingsChanged>(this, [] {
auto theme = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color");
if (theme.is_number()) {
@@ -38,7 +38,7 @@ namespace hex {
}
});
View::subscribeEvent(Events::FileLoaded, [this](auto) {
EventManager::subscribe<EventFileLoaded>(this, [this](const std::string &path){
for (auto &node : this->m_nodes) {
node->setCurrentOverlay(nullptr);
}
@@ -50,6 +50,9 @@ namespace hex {
for (auto &node : this->m_nodes)
delete node;
EventManager::unsubscribe<EventSettingsChanged>(this);
EventManager::unsubscribe<EventFileLoaded>(this);
imnodes::PopAttributeFlag();
imnodes::PopAttributeFlag();
imnodes::Shutdown();