worked on thread safety with tasks

This commit is contained in:
itsmattkc
2019-08-09 12:31:02 +10:00
parent c0f6ee534a
commit 1616166fbc
9 changed files with 137 additions and 27 deletions
+6 -5
View File
@@ -41,11 +41,13 @@ ImportTask::ImportTask(ProjectViewModel *model, Folder *parent, const QStringLis
urls_(urls),
parent_(parent)
{
set_text(tr("Importing %1 files").arg (urls.size()));
set_text(tr("Importing %1 files").arg(urls.size()));
}
bool ImportTask::Action()
{
parent_->LockDeletes();
QUndoCommand* command = new QUndoCommand();
Import(urls_, parent_, command);
@@ -54,12 +56,11 @@ bool ImportTask::Action()
// the undo command executes the final import anyway)
if (cancelled()) {
delete command;
return true;
} else {
olive::undo_stack.push(command);
}
// FIXME: This should be run in the main thread somehow
olive::undo_stack.push(command);
parent_->UnlockDeletes();
return true;
}