Progress update signal for time-expensive tasks

This commit is contained in:
Nav
2023-03-15 20:36:53 +00:00
parent c8bf1c5e8a
commit 5b04c5397a
3 changed files with 19 additions and 0 deletions

View File

@@ -68,6 +68,9 @@ namespace Bloom
);
std::move(dataSegment.begin(), dataSegment.end(), std::back_inserter(*this->data));
emit this->progressUpdate(static_cast<int>(
(static_cast<float>(i) + 1) / (static_cast<float>(readsRequired + 1) / 100)
));
}
}

View File

@@ -44,6 +44,19 @@ namespace Bloom
*/
void started();
/**
* Some tasks will emit an InsightWorkerTask::progressUpdate() signal to provide an update on their progress.
*
* This is used for progress bar widgets.
*
* NOTE: A task doesn't have to emit this signal. Currently, the time-expensive tasks (like ReadTargetMemory)
* emit this signal.
*
* @param progressPercentage
* The task's current progress.
*/
void progressUpdate(int progressPercentage);
/**
* The InsightWorkerTask::completed() signal will be emitted once the task has successfully completed.
*/

View File

@@ -49,6 +49,9 @@ namespace Bloom
);
std::move(dataSegment.begin(), dataSegment.end(), std::back_inserter(data));
emit this->progressUpdate(static_cast<int>(
(static_cast<float>(i) + 1) / (static_cast<float>(readsRequired) / 100)
));
}
emit this->targetMemoryRead(data);