From 167e32a69fc0b4224d10e7a3c7ce13e4cb4334c7 Mon Sep 17 00:00:00 2001 From: flow Date: Thu, 7 Apr 2022 18:56:34 -0300 Subject: [PATCH] fix: allow aborting CF modpack importing --- launcher/InstanceImportTask.cpp | 8 ++++++++ launcher/InstanceImportTask.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index a825e8d4..03e942f1 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -40,6 +40,14 @@ InstanceImportTask::InstanceImportTask(const QUrl sourceUrl) m_sourceUrl = sourceUrl; } +bool InstanceImportTask::abort() +{ + m_filesNetJob->abort(); + m_extractFuture.cancel(); + + return false; +} + void InstanceImportTask::executeTask() { if (m_sourceUrl.isLocalFile()) diff --git a/launcher/InstanceImportTask.h b/launcher/InstanceImportTask.h index a1990647..365c3dc4 100644 --- a/launcher/InstanceImportTask.h +++ b/launcher/InstanceImportTask.h @@ -37,6 +37,9 @@ class InstanceImportTask : public InstanceTask public: explicit InstanceImportTask(const QUrl sourceUrl); + bool canAbort() const override { return true; } + bool abort() override; + protected: //! Entry point for tasks. virtual void executeTask() override;