1
0
mirror of synced 2024-11-24 15:50:16 +01:00

fix: Window header always displaying (Read Only) after opening a provider

This commit is contained in:
WerWolv 2022-08-22 11:00:31 +02:00
parent c0a5e2012f
commit dacb64ae66
2 changed files with 12 additions and 6 deletions

View File

@ -114,14 +114,15 @@ namespace hex {
if (ImHexApi::Provider::isValid()) {
auto provider = ImHexApi::Provider::get();
if (!windowTitle.empty())
if (!windowTitle.empty() && provider != nullptr) {
title += " - " + windowTitle;
if (provider->isDirty())
title += " (*)";
if (provider->isDirty())
title += " (*)";
if (!provider->isWritable())
title += " (Read Only)";
if (!provider->isWritable())
title += " (Read Only)";
}
}
this->m_windowTitle = title;

View File

@ -44,13 +44,18 @@ namespace hex::plugin::builtin {
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
hex::unused(oldProvider);
if (newProvider != nullptr) {
if (newProvider != nullptr && newProvider->isAvailable()) {
EventManager::post<RequestChangeWindowTitle>(newProvider->getName());
} else {
EventManager::post<RequestChangeWindowTitle>("");
}
});
EventManager::subscribe<EventProviderOpened>([](hex::prv::Provider *provider) {
if (provider != nullptr && ImHexApi::Provider::get() == provider)
EventManager::post<RequestChangeWindowTitle>(provider->getName());
});
EventManager::subscribe<RequestOpenFile>(openFile);
EventManager::subscribe<RequestOpenWindow>([](const std::string &name) {