Added shutdownOnClose Insight config param, to trigger a shutdown when the user closes the main Insight window.
This commit is contained in:
@@ -170,6 +170,10 @@ namespace Bloom
|
|||||||
applicationEventListener->registerCallbackForEventType<Events::InsightActivationRequested>(
|
applicationEventListener->registerCallbackForEventType<Events::InsightActivationRequested>(
|
||||||
std::bind(&Application::onInsightActivationRequest, this, std::placeholders::_1)
|
std::bind(&Application::onInsightActivationRequest, this, std::placeholders::_1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
applicationEventListener->registerCallbackForEventType<Events::InsightMainWindowClosed>(
|
||||||
|
std::bind(&Application::onInsightMainWindowClosed, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
this->startTargetController();
|
this->startTargetController();
|
||||||
this->startDebugServer();
|
this->startDebugServer();
|
||||||
@@ -586,6 +590,12 @@ namespace Bloom
|
|||||||
|
|
||||||
this->activateInsight();
|
this->activateInsight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::onInsightMainWindowClosed(const Events::InsightMainWindowClosed& event) {
|
||||||
|
if (this->insightConfig->shutdownOnClose) {
|
||||||
|
this->triggerShutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Application::onShutdownApplicationRequest(const Events::ShutdownApplication&) {
|
void Application::onShutdownApplicationRequest(const Events::ShutdownApplication&) {
|
||||||
|
|||||||
@@ -282,6 +282,13 @@ namespace Bloom
|
|||||||
* Handles requests to start the Insight GUI.
|
* Handles requests to start the Insight GUI.
|
||||||
*/
|
*/
|
||||||
void onInsightActivationRequest(const Events::InsightActivationRequested&);
|
void onInsightActivationRequest(const Events::InsightActivationRequested&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs any post-insight-closed actions.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
void onInsightMainWindowClosed(const Events::InsightMainWindowClosed& event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Bloom::Events
|
|||||||
PROGRAMMING_MODE_ENABLED,
|
PROGRAMMING_MODE_ENABLED,
|
||||||
PROGRAMMING_MODE_DISABLED,
|
PROGRAMMING_MODE_DISABLED,
|
||||||
INSIGHT_ACTIVATION_REQUESTED,
|
INSIGHT_ACTIVATION_REQUESTED,
|
||||||
|
INSIGHT_MAIN_WINDOW_CLOSED,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Event
|
class Event
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#ifndef EXCLUDE_INSIGHT
|
#ifndef EXCLUDE_INSIGHT
|
||||||
#include "InsightActivationRequested.hpp"
|
#include "InsightActivationRequested.hpp"
|
||||||
|
#include "InsightMainWindowClosed.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Bloom::Events
|
namespace Bloom::Events
|
||||||
|
|||||||
23
src/EventManager/Events/InsightMainWindowClosed.hpp
Normal file
23
src/EventManager/Events/InsightMainWindowClosed.hpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "Event.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::Events
|
||||||
|
{
|
||||||
|
class InsightMainWindowClosed: public Event
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static constexpr EventType type = EventType::INSIGHT_MAIN_WINDOW_CLOSED;
|
||||||
|
static const inline std::string name = "InsightMainWindowClosed";
|
||||||
|
|
||||||
|
[[nodiscard]] EventType getType() const override {
|
||||||
|
return InsightMainWindowClosed::type;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] std::string getName() const override {
|
||||||
|
return InsightMainWindowClosed::name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "src/Services/PathService.hpp"
|
#include "src/Services/PathService.hpp"
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
|
#include "src/EventManager/EventManager.hpp"
|
||||||
#include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp"
|
#include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp"
|
||||||
|
|
||||||
#include "src/Application.hpp"
|
#include "src/Application.hpp"
|
||||||
@@ -204,6 +205,7 @@ namespace Bloom
|
|||||||
|
|
||||||
void Insight::onInsightWindowDestroyed() {
|
void Insight::onInsightWindowDestroyed() {
|
||||||
this->mainWindow = nullptr;
|
this->mainWindow = nullptr;
|
||||||
|
EventManager::triggerEvent(std::make_shared<Events::InsightMainWindowClosed>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Insight::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
void Insight::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "src/ProjectConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/ProjectSettings.hpp"
|
#include "src/ProjectSettings.hpp"
|
||||||
|
|
||||||
#include "src/EventManager/EventManager.hpp"
|
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
#include "src/EventManager/Events/Events.hpp"
|
#include "src/EventManager/Events/Events.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ namespace Bloom
|
|||||||
if (insightNode["activateOnStartup"]) {
|
if (insightNode["activateOnStartup"]) {
|
||||||
this->activateOnStartup = insightNode["activateOnStartup"].as<bool>(this->activateOnStartup);
|
this->activateOnStartup = insightNode["activateOnStartup"].as<bool>(this->activateOnStartup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (insightNode["shutdownOnClose"]) {
|
||||||
|
this->shutdownOnClose = insightNode["shutdownOnClose"].as<bool>(this->shutdownOnClose);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EnvironmentConfig::EnvironmentConfig(std::string name, const YAML::Node& environmentNode)
|
EnvironmentConfig::EnvironmentConfig(std::string name, const YAML::Node& environmentNode)
|
||||||
|
|||||||
@@ -126,8 +126,16 @@ namespace Bloom
|
|||||||
|
|
||||||
struct InsightConfig
|
struct InsightConfig
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* If true, the Insight GUI will be activated immediately at startup.
|
||||||
|
*/
|
||||||
bool activateOnStartup = false;
|
bool activateOnStartup = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, Bloom will shutdown when the user closes the Insight GUI.
|
||||||
|
*/
|
||||||
|
bool shutdownOnClose = false;
|
||||||
|
|
||||||
InsightConfig() = default;
|
InsightConfig() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user