2016-10-03 04:25:54 +05:30
|
|
|
#include "InstanceCreationTask.h"
|
|
|
|
|
2022-07-08 05:01:24 +05:30
|
|
|
#include <QDebug>
|
2016-10-03 04:25:54 +05:30
|
|
|
|
2022-08-01 02:51:59 +05:30
|
|
|
InstanceCreationTask::InstanceCreationTask() = default;
|
2016-10-03 04:25:54 +05:30
|
|
|
|
|
|
|
void InstanceCreationTask::executeTask()
|
|
|
|
{
|
2022-08-01 02:51:59 +05:30
|
|
|
if (updateInstance()) {
|
|
|
|
emitSucceeded();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If this is set, it means we're updating an instance. Since the previous step likely
|
|
|
|
// removed some old files, we'd better not let the user abort the next task, since it'd
|
|
|
|
// put the instance in an invalid state.
|
|
|
|
// TODO: Figure out an unexpensive way of making such file removal a recoverable transaction.
|
|
|
|
setAbortStatus(!shouldOverride());
|
|
|
|
|
|
|
|
if (createInstance()) {
|
2022-07-08 05:01:24 +05:30
|
|
|
emitSucceeded();
|
|
|
|
return;
|
2018-07-15 18:21:05 +05:30
|
|
|
}
|
2022-07-08 05:01:24 +05:30
|
|
|
|
|
|
|
qWarning() << "Instance creation failed!";
|
|
|
|
if (!m_error_message.isEmpty())
|
|
|
|
qWarning() << "Reason: " << m_error_message;
|
|
|
|
emitFailed(tr("Error while creating new instance."));
|
2016-10-03 04:25:54 +05:30
|
|
|
}
|