aboutsummaryrefslogtreecommitdiff
path: root/api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@users.noreply.github.com>2021-07-06 22:01:33 +0200
committerGitHub <noreply@github.com>2021-07-06 22:01:33 +0200
commitdf1d3dbae2d11557e5b4d2ab9c5c1333a8af799e (patch)
tree5ce39c5d8689a32c04340c3e9af5a18ae8c350d0 /api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp
parent417994735a4823782f0f2304695347a13eed9a1d (diff)
parent220971fadd8cc2def071818c17cda14bad0f6f45 (diff)
downloadPrismLauncher-df1d3dbae2d11557e5b4d2ab9c5c1333a8af799e.tar.gz
PrismLauncher-df1d3dbae2d11557e5b4d2ab9c5c1333a8af799e.tar.bz2
PrismLauncher-df1d3dbae2d11557e5b4d2ab9c5c1333a8af799e.zip
Merge pull request #3925 from jamierocks/fix-1949
GH-1949 Allow modpack downloads to be aborted
Diffstat (limited to 'api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp')
-rw-r--r--api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp b/api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp
index 6067c56a..f22373bc 100644
--- a/api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp
+++ b/api/logic/modplatform/modpacksch/FTBPackInstallTask.cpp
@@ -19,7 +19,11 @@ PackInstallTask::PackInstallTask(Modpack pack, QString version)
bool PackInstallTask::abort()
{
- return true;
+ if(abortable)
+ {
+ return jobPtr->abort();
+ }
+ return false;
}
void PackInstallTask::executeTask()
@@ -117,16 +121,19 @@ void PackInstallTask::downloadPack()
connect(jobPtr.get(), &NetJob::succeeded, this, [&]()
{
+ abortable = false;
jobPtr.reset();
install();
});
connect(jobPtr.get(), &NetJob::failed, [&](QString reason)
{
+ abortable = false;
jobPtr.reset();
emitFailed(reason);
});
connect(jobPtr.get(), &NetJob::progress, [&](qint64 current, qint64 total)
{
+ abortable = true;
setProgress(current, total);
});