diff --git a/src/nostalgia/studio/lib/task.cpp b/src/nostalgia/studio/lib/task.cpp index c2239984..77f0c63b 100644 --- a/src/nostalgia/studio/lib/task.cpp +++ b/src/nostalgia/studio/lib/task.cpp @@ -10,7 +10,11 @@ namespace nostalgia::studio { void TaskRunner::update(core::Context *ctx) noexcept { oxIgnoreError(m_tasks.erase(std::remove_if(m_tasks.begin(), m_tasks.end(), [&](auto &t) { - return t->update(ctx) == TaskState::Done; + const auto done = t->update(ctx) == TaskState::Done; + if (done) { + t->finished.emit(); + } + return done; }))); } diff --git a/src/nostalgia/studio/lib/task.hpp b/src/nostalgia/studio/lib/task.hpp index cd77fc03..6380c9f5 100644 --- a/src/nostalgia/studio/lib/task.hpp +++ b/src/nostalgia/studio/lib/task.hpp @@ -17,6 +17,7 @@ enum class TaskState { class Task: public ox::SignalHandler { public: + ox::Signal finished; ~Task() noexcept override = default; virtual TaskState update(nostalgia::core::Context *ctx) noexcept = 0; }; @@ -29,4 +30,4 @@ class TaskRunner { void add(Task *task) noexcept; }; -} \ No newline at end of file +}