fix: Window header always displaying (Read Only) after opening a provider
This commit is contained in:
parent
c0a5e2012f
commit
dacb64ae66
@ -114,14 +114,15 @@ namespace hex {
|
|||||||
|
|
||||||
if (ImHexApi::Provider::isValid()) {
|
if (ImHexApi::Provider::isValid()) {
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
if (!windowTitle.empty())
|
if (!windowTitle.empty() && provider != nullptr) {
|
||||||
title += " - " + windowTitle;
|
title += " - " + windowTitle;
|
||||||
|
|
||||||
if (provider->isDirty())
|
if (provider->isDirty())
|
||||||
title += " (*)";
|
title += " (*)";
|
||||||
|
|
||||||
if (!provider->isWritable())
|
if (!provider->isWritable())
|
||||||
title += " (Read Only)";
|
title += " (Read Only)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_windowTitle = title;
|
this->m_windowTitle = title;
|
||||||
|
@ -44,13 +44,18 @@ namespace hex::plugin::builtin {
|
|||||||
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
|
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
|
||||||
hex::unused(oldProvider);
|
hex::unused(oldProvider);
|
||||||
|
|
||||||
if (newProvider != nullptr) {
|
if (newProvider != nullptr && newProvider->isAvailable()) {
|
||||||
EventManager::post<RequestChangeWindowTitle>(newProvider->getName());
|
EventManager::post<RequestChangeWindowTitle>(newProvider->getName());
|
||||||
} else {
|
} else {
|
||||||
EventManager::post<RequestChangeWindowTitle>("");
|
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<RequestOpenFile>(openFile);
|
||||||
|
|
||||||
EventManager::subscribe<RequestOpenWindow>([](const std::string &name) {
|
EventManager::subscribe<RequestOpenWindow>([](const std::string &name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user