Added single-shot delay times for emitting target stopped events to Insight components, when stepping through code
This commit is contained in:
@@ -12,7 +12,11 @@ namespace Bloom::Events
|
|||||||
static constexpr EventType type = EventType::TARGET_EXECUTION_RESUMED;
|
static constexpr EventType type = EventType::TARGET_EXECUTION_RESUMED;
|
||||||
static inline const std::string name = "TargetExecutionResumed";
|
static inline const std::string name = "TargetExecutionResumed";
|
||||||
|
|
||||||
TargetExecutionResumed() = default;
|
bool stepping = false;
|
||||||
|
|
||||||
|
explicit TargetExecutionResumed(bool stepping)
|
||||||
|
: stepping(stepping)
|
||||||
|
{};
|
||||||
|
|
||||||
[[nodiscard]] EventType getType() const override {
|
[[nodiscard]] EventType getType() const override {
|
||||||
return TargetExecutionResumed::type;
|
return TargetExecutionResumed::type;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
@@ -275,10 +276,35 @@ namespace Bloom
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->lastTargetState = TargetState::STOPPED;
|
this->lastTargetState = TargetState::STOPPED;
|
||||||
|
|
||||||
|
if (this->targetStepping) {
|
||||||
|
if (this->targetResumeTimer == nullptr) {
|
||||||
|
this->targetResumeTimer = new QTimer(this);
|
||||||
|
this->targetResumeTimer->setSingleShot(true);
|
||||||
|
|
||||||
|
this->targetResumeTimer->callOnTimeout(this, [this] {
|
||||||
|
if (this->lastTargetState != TargetState::STOPPED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this->targetResumeTimer->start(750);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->targetResumeTimer != nullptr && this->targetResumeTimer->isActive()) {
|
||||||
|
this->targetResumeTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Insight::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
|
void Insight::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
|
||||||
|
this->targetStepping = event.stepping;
|
||||||
|
|
||||||
if (this->lastTargetState != TargetState::RUNNING) {
|
if (this->lastTargetState != TargetState::RUNNING) {
|
||||||
this->lastTargetState = TargetState::RUNNING;
|
this->lastTargetState = TargetState::RUNNING;
|
||||||
emit this->insightSignals->targetStateUpdated(TargetState::RUNNING);
|
emit this->insightSignals->targetStateUpdated(TargetState::RUNNING);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "src/Helpers/Thread.hpp"
|
#include "src/Helpers/Thread.hpp"
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
@@ -90,7 +91,11 @@ namespace Bloom
|
|||||||
);
|
);
|
||||||
|
|
||||||
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
||||||
|
|
||||||
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
||||||
|
bool targetStepping = false;
|
||||||
|
QTimer* targetResumeTimer = nullptr;
|
||||||
|
|
||||||
InsightSignals* insightSignals = InsightSignals::instance();
|
InsightSignals* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
void startup();
|
void startup();
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ namespace Bloom::TargetController
|
|||||||
|
|
||||||
if (newTargetState == TargetState::RUNNING) {
|
if (newTargetState == TargetState::RUNNING) {
|
||||||
Logger::debug("Target state changed - RUNNING");
|
Logger::debug("Target state changed - RUNNING");
|
||||||
EventManager::triggerEvent(std::make_shared<TargetExecutionResumed>());
|
EventManager::triggerEvent(std::make_shared<TargetExecutionResumed>(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -827,7 +827,7 @@ namespace Bloom::TargetController
|
|||||||
this->lastTargetState = TargetState::RUNNING;
|
this->lastTargetState = TargetState::RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventManager::triggerEvent(std::make_shared<Events::TargetExecutionResumed>());
|
EventManager::triggerEvent(std::make_shared<Events::TargetExecutionResumed>(false));
|
||||||
|
|
||||||
return std::make_unique<Response>();
|
return std::make_unique<Response>();
|
||||||
}
|
}
|
||||||
@@ -928,7 +928,7 @@ namespace Bloom::TargetController
|
|||||||
|
|
||||||
this->target->step();
|
this->target->step();
|
||||||
this->lastTargetState = TargetState::RUNNING;
|
this->lastTargetState = TargetState::RUNNING;
|
||||||
EventManager::triggerEvent(std::make_shared<Events::TargetExecutionResumed>());
|
EventManager::triggerEvent(std::make_shared<Events::TargetExecutionResumed>(true));
|
||||||
|
|
||||||
return std::make_unique<Response>();
|
return std::make_unique<Response>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user