changed items to shared ptrs

This commit is contained in:
itsmattkc
2019-07-06 12:50:00 -05:00
parent a6971b3fde
commit b62ec30015
12 changed files with 98 additions and 42 deletions
+21 -1
View File
@@ -23,7 +23,8 @@
Task::Task() :
status_(kWaiting),
thread_(this),
text_(tr("Task"))
text_(tr("Task")),
cancelled_(false)
{
connect(&thread_, SIGNAL(finished()), this, SLOT(ThreadComplete()));
}
@@ -55,6 +56,8 @@ bool Task::Start()
}
}
cancelled_ = false;
set_status(kWorking);
thread_.start();
@@ -90,6 +93,18 @@ void Task::AddDependency(Task *dependency)
dependencies_.append(dependency);
}
void Task::Cancel()
{
if (status_ != kWorking) {
return;
}
cancelled_ = true;
// FIXME: Should we limit the wait time?
thread_.wait();
}
void Task::set_error(const QString &s)
{
error_ = s;
@@ -100,6 +115,11 @@ void Task::set_text(const QString &s)
text_ = s;
}
bool Task::cancelled()
{
return cancelled_;
}
void Task::set_status(const Task::Status &status)
{
status_ = status;