From e61d651a24fec947a9d87ee05ea8c75e6923b90a Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 24 Apr 2022 15:31:38 +0100 Subject: [PATCH] Defined new finished() signal in InsightWorkerTask --- .../InsightWorker/Tasks/InsightWorkerTask.cpp | 2 ++ .../InsightWorker/Tasks/InsightWorkerTask.hpp | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp index 07aa5dae..721cba89 100644 --- a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp +++ b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.cpp @@ -19,5 +19,7 @@ namespace Bloom Logger::debug("InsightWorker task failed - " + std::string(exception.what())); emit this->failed(QString::fromStdString(exception.what())); } + + emit this->finished(); } } diff --git a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp index 0288a92a..e06ea988 100644 --- a/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp +++ b/src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp @@ -27,10 +27,29 @@ namespace Bloom void execute(TargetController::TargetControllerConsole& targetControllerConsole); signals: + /** + * The InsightWorkerTask::started() signal will be emitted once the task has started (InsightWorker::run() is + * called) + */ void started(); - void failed(QString errorMessage); + + /** + * The InsightWorkerTask::completed() signal will be emitted once the task has successfully completed. + */ void completed(); + /** + * The InsightWorkerTask::failed() signal will be emitted when the task fails (InsightWorkerTask::run() throws + * an exception). + */ + void failed(QString errorMessage); + + /** + * The InsightWorkerTask::finished() signal will be emitted at the end of the task, regardless to whether it + * completed successfully or failed. + */ + void finished(); + protected: virtual void run(TargetController::TargetControllerConsole& targetControllerConsole) = 0; };