summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/onesix/OneSixUpdate.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-08-14 02:33:31 +0200
committerPetr Mrázek <peterix@gmail.com>2016-08-14 23:22:54 +0200
commit042f3ef55c0b469f438542152c4eb02b0789ea3c (patch)
tree03e0c15b200786558babd0fe58edac88ed1bfd1e /api/logic/minecraft/onesix/OneSixUpdate.h
parent2f0441b3c1cd9fc3bcb176d2852da8f92a6e6777 (diff)
downloadMultiMC-042f3ef55c0b469f438542152c4eb02b0789ea3c.tar
MultiMC-042f3ef55c0b469f438542152c4eb02b0789ea3c.tar.gz
MultiMC-042f3ef55c0b469f438542152c4eb02b0789ea3c.tar.lz
MultiMC-042f3ef55c0b469f438542152c4eb02b0789ea3c.tar.xz
MultiMC-042f3ef55c0b469f438542152c4eb02b0789ea3c.zip
GH-352 Make OneSix instance update downloads cancellable
Diffstat (limited to 'api/logic/minecraft/onesix/OneSixUpdate.h')
-rw-r--r--api/logic/minecraft/onesix/OneSixUpdate.h36
1 files changed, 11 insertions, 25 deletions
diff --git a/api/logic/minecraft/onesix/OneSixUpdate.h b/api/logic/minecraft/onesix/OneSixUpdate.h
index b5195364..3780ef2e 100644
--- a/api/logic/minecraft/onesix/OneSixUpdate.h
+++ b/api/logic/minecraft/onesix/OneSixUpdate.h
@@ -32,36 +32,22 @@ class OneSixUpdate : public Task
Q_OBJECT
public:
explicit OneSixUpdate(OneSixInstance *inst, QObject *parent = 0);
- virtual void executeTask();
+ void executeTask() override;
+ bool canAbort() const override;
private
slots:
- void versionUpdateFailed(QString reason);
-
- void jarlibStart();
- void jarlibFinished();
- void jarlibFailed(QString reason);
-
- void fmllibsStart();
- void fmllibsFinished();
- void fmllibsFailed(QString reason);
-
- void assetIndexStart();
- void assetIndexFinished();
- void assetIndexFailed(QString reason);
-
- void assetsFinished();
- void assetsFailed(QString reason);
+ bool abort() override;
+ void subtaskSucceeded();
+ void subtaskFailed(QString error);
private:
- NetJobPtr jarlibDownloadJob;
- NetJobPtr legacyDownloadJob;
-
- /// target version, determined during this task
- std::shared_ptr<MinecraftVersion> targetVersion;
- /// the task that is spawned for version updates
- std::shared_ptr<Task> versionUpdateTask;
+ void next();
+private:
OneSixInstance *m_inst = nullptr;
- QList<FMLlib> fmlLibsToProcess;
+ QList<std::shared_ptr<Task>> m_tasks;
+ QString m_preFailure;
+ int m_currentTask = -1;
+ bool m_abort = false;
};