From 959988a670f87e5ddd358ccccaabbcfd25f897a6 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 12 Apr 2021 21:08:36 +0200 Subject: [PATCH] fix: Stop all views from opening automatically on launch --- plugins/libimhex/include/hex/views/view.hpp | 2 +- source/window.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/libimhex/include/hex/views/view.hpp b/plugins/libimhex/include/hex/views/view.hpp index 5c282cff9..93e96fb9e 100644 --- a/plugins/libimhex/include/hex/views/view.hpp +++ b/plugins/libimhex/include/hex/views/view.hpp @@ -63,7 +63,7 @@ namespace hex { private: std::string m_unlocalizedViewName; - bool m_windowOpen = this->hasViewMenuItemEntry(); + bool m_windowOpen = false; }; } \ No newline at end of file diff --git a/source/window.cpp b/source/window.cpp index 433c9342a..c93da1f23 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -47,7 +47,7 @@ namespace hex { buf->appendf("[%s][General]\n", handler->TypeName); for (auto &view : ContentRegistry::Views::getEntries()) { - buf->appendf("%s=%d\n", typeid(*view).name(), view->getWindowOpenState()); + buf->appendf("%s=%d\n", view->getUnlocalizedName().data(), view->getWindowOpenState()); } buf->append("\n"); @@ -102,6 +102,13 @@ namespace hex { if (targetFps.is_number()) this->m_targetFps = targetFps; } + + { + if (ContentRegistry::Settings::read("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.launched", 0) == 1) + this->m_layoutConfigured = true; + else + ContentRegistry::Settings::write("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.launched", 1); + } }); EventManager::subscribe(this, [this](const std::string &path){ @@ -370,10 +377,7 @@ namespace hex { ImGui::End(); } else if (!this->m_layoutConfigured) { this->m_layoutConfigured = true; - if (ContentRegistry::Settings::read("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.launched", 0) == 0) { - ContentRegistry::Settings::write("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.launched", 1); - this->resetLayout(); - } + this->resetLayout(); } }