sys: Clear project context when closing all providers, Display project name in window title (#860)

* clear project context when closing all providers

* Show project name on window title

* refactor RequestChangeWindowTitle to RequestUpdateWindowTitle

* add spaces
This commit is contained in:
Thomas
2023-01-07 17:31:22 +01:00
committed by GitHub
parent ed831c6fc9
commit ab29303c2e
6 changed files with 35 additions and 13 deletions

View File

@@ -126,7 +126,7 @@ namespace hex {
EVENT_DEF(RequestSelectionChange, Region);
EVENT_DEF(RequestAddBookmark, Region, std::string, std::string, color_t);
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
EVENT_DEF(RequestChangeWindowTitle, std::string);
EVENT_DEF(RequestUpdateWindowTitle);
EVENT_DEF(RequestCloseImHex, bool);
EVENT_DEF(RequestRestartImHex);
EVENT_DEF(RequestOpenFile, std::fs::path);

View File

@@ -34,6 +34,8 @@ namespace hex {
static bool store(std::optional<std::fs::path> filePath = std::nullopt);
static bool hasPath();
static void clearPath();
static std::fs::path getPath();
static void registerHandler(const Handler &handler) {
getHandlers().push_back(handler);

View File

@@ -73,7 +73,7 @@ namespace hex {
}
ProjectFile::s_currProjectPath = filePath;
EventManager::post<RequestUpdateWindowTitle>();
return true;
}
@@ -124,4 +124,12 @@ namespace hex {
return !ProjectFile::s_currProjectPath.empty();
}
void ProjectFile::clearPath() {
ProjectFile::s_currProjectPath.clear();
}
std::fs::path ProjectFile::getPath() {
return ProjectFile::s_currProjectPath;
}
}