fix: simplify abort handling and add missing emits
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -90,6 +90,7 @@ void PackInstallTask::executeTask()
|
||||
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onDownloadFailed);
|
||||
QObject::connect(netJob, &NetJob::aborted, this, &PackInstallTask::onDownloadAborted);
|
||||
}
|
||||
|
||||
void PackInstallTask::onDownloadSucceeded()
|
||||
@ -169,6 +170,12 @@ void PackInstallTask::onDownloadFailed(QString reason)
|
||||
emitFailed(reason);
|
||||
}
|
||||
|
||||
void PackInstallTask::onDownloadAborted()
|
||||
{
|
||||
jobPtr.reset();
|
||||
emitAborted();
|
||||
}
|
||||
|
||||
void PackInstallTask::deleteExistingFiles()
|
||||
{
|
||||
setStatus(tr("Deleting existing files..."));
|
||||
@ -675,6 +682,11 @@ void PackInstallTask::installConfigs()
|
||||
abortable = true;
|
||||
setProgress(current, total);
|
||||
});
|
||||
connect(jobPtr.get(), &NetJob::aborted, [&]{
|
||||
abortable = false;
|
||||
jobPtr.reset();
|
||||
emitAborted();
|
||||
});
|
||||
|
||||
jobPtr->start();
|
||||
}
|
||||
@ -831,6 +843,12 @@ void PackInstallTask::downloadMods()
|
||||
abortable = true;
|
||||
setProgress(current, total);
|
||||
});
|
||||
connect(jobPtr.get(), &NetJob::aborted, [&]
|
||||
{
|
||||
abortable = false;
|
||||
jobPtr.reset();
|
||||
emitAborted();
|
||||
});
|
||||
|
||||
jobPtr->start();
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ protected:
|
||||
private slots:
|
||||
void onDownloadSucceeded();
|
||||
void onDownloadFailed(QString reason);
|
||||
void onDownloadAborted();
|
||||
|
||||
void onModsDownloaded();
|
||||
void onModsExtracted();
|
||||
|
Reference in New Issue
Block a user