refactor: setAbortStatus -> setAbortable

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-08-21 09:26:27 -03:00
parent 9eb35ea7c8
commit be8c6f218c
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
6 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ InstanceCreationTask::InstanceCreationTask() = default;
void InstanceCreationTask::executeTask() void InstanceCreationTask::executeTask()
{ {
setAbortStatus(true); setAbortable(true);
if (updateInstance()) { if (updateInstance()) {
emitSucceeded(); emitSucceeded();
@ -35,7 +35,7 @@ void InstanceCreationTask::executeTask()
// files scheduled to, and we'd better not let the user abort in the middle of it, since it'd // files scheduled to, and we'd better not let the user abort in the middle of it, since it'd
// put the instance in an invalid state. // put the instance in an invalid state.
if (shouldOverride()) { if (shouldOverride()) {
setAbortStatus(false); setAbortable(false);
setStatus(tr("Removing old conflicting files...")); setStatus(tr("Removing old conflicting files..."));
qDebug() << "Removing old files"; qDebug() << "Removing old files";

View File

@ -75,7 +75,7 @@ bool InstanceImportTask::abort()
void InstanceImportTask::executeTask() void InstanceImportTask::executeTask()
{ {
setAbortStatus(true); setAbortable(true);
if (m_sourceUrl.isLocalFile()) { if (m_sourceUrl.isLocalFile()) {
m_archivePath = m_sourceUrl.toLocalFile(); m_archivePath = m_sourceUrl.toLocalFile();
@ -280,7 +280,7 @@ void InstanceImportTask::processFlame()
connect(this, &Task::aborted, inst_creation_task, &InstanceCreationTask::abort); connect(this, &Task::aborted, inst_creation_task, &InstanceCreationTask::abort);
connect(inst_creation_task, &Task::aborted, this, &Task::abort); connect(inst_creation_task, &Task::aborted, this, &Task::abort);
connect(inst_creation_task, &Task::abortStatusChanged, this, &Task::setAbortStatus); connect(inst_creation_task, &Task::abortStatusChanged, this, &Task::setAbortable);
inst_creation_task->start(); inst_creation_task->start();
} }
@ -344,7 +344,7 @@ void InstanceImportTask::processModrinth()
connect(this, &Task::aborted, inst_creation_task, &InstanceCreationTask::abort); connect(this, &Task::aborted, inst_creation_task, &InstanceCreationTask::abort);
connect(inst_creation_task, &Task::aborted, this, &Task::abort); connect(inst_creation_task, &Task::aborted, this, &Task::abort);
connect(inst_creation_task, &Task::abortStatusChanged, this, &Task::setAbortStatus); connect(inst_creation_task, &Task::abortStatusChanged, this, &Task::setAbortable);
inst_creation_task->start(); inst_creation_task->start();
} }

View File

@ -785,7 +785,7 @@ class InstanceStaging : public Task {
connect(child, &Task::succeeded, this, &InstanceStaging::childSucceded); connect(child, &Task::succeeded, this, &InstanceStaging::childSucceded);
connect(child, &Task::failed, this, &InstanceStaging::childFailed); connect(child, &Task::failed, this, &InstanceStaging::childFailed);
connect(child, &Task::aborted, this, &InstanceStaging::childAborted); connect(child, &Task::aborted, this, &InstanceStaging::childAborted);
connect(child, &Task::abortStatusChanged, this, &InstanceStaging::setAbortStatus); connect(child, &Task::abortStatusChanged, this, &InstanceStaging::setAbortable);
connect(child, &Task::status, this, &InstanceStaging::setStatus); connect(child, &Task::status, this, &InstanceStaging::setStatus);
connect(child, &Task::progress, this, &InstanceStaging::setProgress); connect(child, &Task::progress, this, &InstanceStaging::setProgress);
connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceded); connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceded);

View File

@ -338,7 +338,7 @@ bool FlameCreationTask::createInstance()
bool did_succeed = getError().isEmpty(); bool did_succeed = getError().isEmpty();
if (m_instance && did_succeed) { if (m_instance && did_succeed) {
setAbortStatus(false); setAbortable(false);
auto inst = m_instance.value(); auto inst = m_instance.value();
inst->copyManagedPack(instance); inst->copyManagedPack(instance);

View File

@ -252,7 +252,7 @@ bool ModrinthCreationTask::createInstance()
loop.exec(); loop.exec();
if (m_instance && ended_well) { if (m_instance && ended_well) {
setAbortStatus(false); setAbortable(false);
auto inst = m_instance.value(); auto inst = m_instance.value();
inst->copyManagedPack(instance); inst->copyManagedPack(instance);

View File

@ -107,7 +107,7 @@ class Task : public QObject, public QRunnable {
virtual void start(); virtual void start();
virtual bool abort() { if(canAbort()) emitAborted(); return canAbort(); }; virtual bool abort() { if(canAbort()) emitAborted(); return canAbort(); };
void setAbortStatus(bool can_abort) { m_can_abort = can_abort; emit abortStatusChanged(can_abort); } void setAbortable(bool can_abort) { m_can_abort = can_abort; emit abortStatusChanged(can_abort); }
protected: protected:
virtual void executeTask() = 0; virtual void executeTask() = 0;