mirror of https://github.com/WerWolv/ImHex.git
ux: Show currently loaded file name in window name
This commit is contained in:
parent
f263685e44
commit
0cc7004d0d
|
@ -110,6 +110,7 @@ namespace hex {
|
|||
EVENT_DEF(RequestSelectionChange, Region);
|
||||
EVENT_DEF(RequestAddBookmark, ImHexApi::Bookmarks::Entry);
|
||||
EVENT_DEF(RequestAppendPatternLanguageCode, std::string);
|
||||
EVENT_DEF(RequestChangeWindowTitle, std::string);
|
||||
EVENT_DEF(RequestCloseImHex);
|
||||
|
||||
}
|
|
@ -14,6 +14,8 @@
|
|||
#undef __STRICT_ANSI__
|
||||
#include <cstdio>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace hex {
|
||||
|
||||
ViewHexEditor::ViewHexEditor(std::vector<lang::PatternData*> &patternData)
|
||||
|
@ -171,6 +173,10 @@ namespace hex {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventFileLoaded>(this, [](std::string path) {
|
||||
EventManager::post<RequestChangeWindowTitle>(std::filesystem::path(path).filename().string());
|
||||
});
|
||||
}
|
||||
|
||||
ViewHexEditor::~ViewHexEditor() {
|
||||
|
|
|
@ -138,6 +138,13 @@ namespace hex {
|
|||
glfwSetWindowShouldClose(this->m_window, true);
|
||||
});
|
||||
|
||||
EventManager::subscribe<RequestChangeWindowTitle>(this, [this](std::string windowTitle) {
|
||||
if (windowTitle.empty())
|
||||
glfwSetWindowTitle(this->m_window, "ImHex");
|
||||
else
|
||||
glfwSetWindowTitle(this->m_window, ("ImHex - " + windowTitle).c_str());
|
||||
});
|
||||
|
||||
this->initPlugins();
|
||||
|
||||
ContentRegistry::Settings::load();
|
||||
|
@ -163,6 +170,7 @@ namespace hex {
|
|||
EventManager::unsubscribe<EventSettingsChanged>(this);
|
||||
EventManager::unsubscribe<EventFileLoaded>(this);
|
||||
EventManager::unsubscribe<RequestCloseImHex>(this);
|
||||
EventManager::unsubscribe<RequestChangeWindowTitle>(this);
|
||||
}
|
||||
|
||||
void Window::loop() {
|
||||
|
|
Loading…
Reference in New Issue