cache: reimplemented auto-caching
Implemented a smarter auto-cache that's context sensitive. Caching will automatically pause when playback begins or values are being changed and resume when inactive.
This commit is contained in:
@@ -72,6 +72,17 @@ Task *TaskManager::GetFirstTask() const
|
||||
return tasks_.begin().value();
|
||||
}
|
||||
|
||||
void TaskManager::CancelTaskAndWait(Task* t)
|
||||
{
|
||||
t->Cancel();
|
||||
|
||||
QFutureWatcher<bool>* w = tasks_.key(t);
|
||||
|
||||
if (w) {
|
||||
w->waitForFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskManager::AddTask(Task* t)
|
||||
{
|
||||
// Create a watcher for signalling
|
||||
@@ -89,6 +100,17 @@ void TaskManager::AddTask(Task* t)
|
||||
emit TaskListChanged();
|
||||
}
|
||||
|
||||
void TaskManager::CancelTask(Task *t)
|
||||
{
|
||||
if (failed_tasks_.contains(t)) {
|
||||
failed_tasks_.removeOne(t);
|
||||
emit TaskRemoved(t);
|
||||
t->deleteLater();
|
||||
} else {
|
||||
t->Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskManager::TaskFinished()
|
||||
{
|
||||
QFutureWatcher<bool>* watcher = static_cast<QFutureWatcher<bool>*>(sender());
|
||||
|
||||
Reference in New Issue
Block a user