remove UI objects when a task is deleted

This commit is contained in:
itsmattkc
2019-06-29 02:30:42 -07:00
parent 84720b39cb
commit 2e6b36b2ae
3 changed files with 52 additions and 2 deletions
+16
View File
@@ -30,6 +30,11 @@ TaskManager::TaskManager()
maximum_task_count_ = QThread::idealThreadCount();
}
TaskManager::~TaskManager()
{
Clear();
}
void TaskManager::AddTask(Task* t)
{
// Connect Task's status signal to the Callback
@@ -45,6 +50,17 @@ void TaskManager::AddTask(Task* t)
StartNextWaiting();
}
void TaskManager::Clear()
{
// TODO Cancelling tasks
// Delete Tasks from memory
for (int i=0;i<tasks_.size();i++) {
delete tasks_.at(i);
}
tasks_.clear();
}
void TaskManager::StartNextWaiting()
{
// Count the tasks that are currently active