fix: Window title not always updating correctly
This commit is contained in:
parent
683018a9d2
commit
19a0dc80db
@ -211,7 +211,7 @@ namespace hex {
|
||||
|
||||
namespace ImHexApi::Provider {
|
||||
|
||||
static u32 s_currentProvider;
|
||||
static u32 s_currentProvider = std::numeric_limits<u32>::max();
|
||||
static std::vector<prv::Provider *> s_providers;
|
||||
|
||||
namespace impl {
|
||||
@ -302,7 +302,9 @@ namespace hex {
|
||||
|
||||
s_providers.erase(it);
|
||||
|
||||
if (it - s_providers.begin() == s_currentProvider && !s_providers.empty())
|
||||
if (s_providers.empty())
|
||||
EventManager::post<EventProviderChanged>(provider, nullptr);
|
||||
else if (it - s_providers.begin() == s_currentProvider)
|
||||
setCurrentProvider(0);
|
||||
|
||||
delete provider;
|
||||
|
@ -113,10 +113,6 @@ namespace hex {
|
||||
EventManager::post<EventWindowClosing>(this->m_window);
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderDeleted>(this, [](const auto*) {
|
||||
EventManager::post<RequestChangeWindowTitle>("");
|
||||
});
|
||||
|
||||
EventManager::subscribe<RequestChangeWindowTitle>(this, [this](const std::string &windowTitle) {
|
||||
std::string title = "ImHex";
|
||||
|
||||
|
@ -61,6 +61,16 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
|
||||
hex::unused(oldProvider);
|
||||
|
||||
if (newProvider != nullptr) {
|
||||
EventManager::post<RequestChangeWindowTitle>(newProvider->getName());
|
||||
} else {
|
||||
EventManager::post<RequestChangeWindowTitle>("");
|
||||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<RequestOpenFile>(openFile);
|
||||
|
||||
EventManager::subscribe<RequestOpenWindow>([](const std::string &name) {
|
||||
|
@ -140,7 +140,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::getEntries()) {
|
||||
if (ImGui::Hyperlink(LangEntry(unlocalizedProviderName))) {
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
auto *provider = ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
if (!provider->hasLoadInterface())
|
||||
(void)provider->open();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user