This commit is contained in:
Nav
2022-02-09 17:49:25 +00:00
parent 56dc870b8e
commit 8d0dc68da0
3 changed files with 19 additions and 18 deletions

View File

@@ -87,7 +87,7 @@ namespace Bloom
}
void Application::startup() {
auto applicationEventListener = this->applicationEventListener;
auto& applicationEventListener = this->applicationEventListener;
this->eventManager.registerListener(applicationEventListener);
applicationEventListener->registerCallbackForEventType<Events::ShutdownApplication>(
std::bind(&Application::onShutdownApplicationRequest, this, std::placeholders::_1)
@@ -151,10 +151,11 @@ namespace Bloom
throw Exception("Failed to open settings file.");
}
const auto jsonObject = QJsonDocument::fromJson(jsonSettingsFile.readAll()).object();
this->projectSettings = ProjectSettings(
QJsonDocument::fromJson(jsonSettingsFile.readAll()).object()
);
jsonSettingsFile.close();
this->projectSettings = ProjectSettings(jsonObject);
return;
} catch (const std::exception& exception) {
@@ -430,6 +431,11 @@ namespace Bloom
}
}
void Application::onShutdownApplicationRequest(const Events::ShutdownApplication&) {
Logger::debug("ShutdownApplication event received.");
this->shutdown();
}
void Application::onTargetControllerThreadStateChanged(const Events::TargetControllerThreadStateChanged& event) {
if (event.getState() == ThreadState::STOPPED || event.getState() == ThreadState::SHUTDOWN_INITIATED) {
// TargetController has unexpectedly shutdown - it must have encountered a fatal error.
@@ -437,11 +443,6 @@ namespace Bloom
}
}
void Application::onShutdownApplicationRequest(const Events::ShutdownApplication&) {
Logger::debug("ShutdownApplication event received.");
this->shutdown();
}
void Application::onDebugServerThreadStateChanged(const Events::DebugServerThreadStateChanged& event) {
if (event.getState() == ThreadState::STOPPED || event.getState() == ThreadState::SHUTDOWN_INITIATED) {
// DebugServer has unexpectedly shutdown - it must have encountered a fatal error.