Manage InsightWorkerTask pointers via QSharedPointer, in preparation for task indicator widget and task window.

This commit is contained in:
Nav
2023-03-12 23:31:19 +00:00
parent db9cddf12c
commit 57eaa989f5
5 changed files with 28 additions and 17 deletions

View File

@@ -6,6 +6,10 @@ namespace Bloom
{
using Services::TargetControllerService;
InsightWorkerTask::InsightWorkerTask()
: QObject(nullptr)
{}
void InsightWorkerTask::execute(TargetControllerService& targetControllerService) {
try {
this->state = InsightWorkerTaskState::STARTED;

View File

@@ -1,5 +1,7 @@
#pragma once
#include <cstdint>
#include <atomic>
#include <QObject>
#include <QString>
@@ -21,9 +23,11 @@ namespace Bloom
Q_OBJECT
public:
using IdType = std::uint64_t;
const InsightWorkerTask::IdType id = ++(InsightWorkerTask::lastId);
InsightWorkerTaskState state = InsightWorkerTaskState::CREATED;
InsightWorkerTask(): QObject(nullptr) {};
InsightWorkerTask();
virtual TaskGroups getTaskGroups() const {
return TaskGroups();
@@ -57,5 +61,8 @@ namespace Bloom
protected:
virtual void run(Services::TargetControllerService& targetControllerService) = 0;
private:
static inline std::atomic<InsightWorkerTask::IdType> lastId = 0;
};
}