Added single-shot delay times for emitting target stopped events to Insight components, when stepping through code

This commit is contained in:
Nav
2022-09-17 20:55:17 +01:00
parent 4b7054070d
commit 238819eb42
4 changed files with 39 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
#include <QTimer>
#include <QFontDatabase>
#include <chrono>
#include "src/Helpers/Paths.hpp"
#include "src/Logger/Logger.hpp"
@@ -275,10 +276,35 @@ namespace Bloom
}
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);
}
void Insight::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
this->targetStepping = event.stepping;
if (this->lastTargetState != TargetState::RUNNING) {
this->lastTargetState = TargetState::RUNNING;
emit this->insightSignals->targetStateUpdated(TargetState::RUNNING);

View File

@@ -6,6 +6,7 @@
#include <map>
#include <utility>
#include <QThread>
#include <QTimer>
#include "src/Helpers/Thread.hpp"
#include "src/Helpers/Paths.hpp"
@@ -90,7 +91,11 @@ namespace Bloom
);
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
bool targetStepping = false;
QTimer* targetResumeTimer = nullptr;
InsightSignals* insightSignals = InsightSignals::instance();
void startup();