[nostalgia/studio] Add finished signal to Task
This commit is contained in:
parent
2881a28dc8
commit
96ca0cb686
@ -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;
|
||||
})));
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ enum class TaskState {
|
||||
|
||||
class Task: public ox::SignalHandler {
|
||||
public:
|
||||
ox::Signal<ox::Error()> finished;
|
||||
~Task() noexcept override = default;
|
||||
virtual TaskState update(nostalgia::core::Context *ctx) noexcept = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user