diff options
author | flow <flowlnlnln@gmail.com> | 2022-09-26 08:25:12 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 08:25:12 -0300 |
commit | 370c3aa5985698351e706e61c660a3a566a5f09b (patch) | |
tree | 5bd62ceec118396d676cf3799edafdb806e4375d /launcher/InstanceCreationTask.h | |
parent | 58a5331f7bafb149c18f560a0363daab65521262 (diff) | |
parent | dd6f670dec7dfd1a9ad6f4595ad5447ac735c737 (diff) | |
download | PrismLauncher-370c3aa5985698351e706e61c660a3a566a5f09b.tar.gz PrismLauncher-370c3aa5985698351e706e61c660a3a566a5f09b.tar.bz2 PrismLauncher-370c3aa5985698351e706e61c660a3a566a5f09b.zip |
Merge pull request #894 from flowln/update_from_external_source
epic PR
Diffstat (limited to 'launcher/InstanceCreationTask.h')
-rw-r--r-- | launcher/InstanceCreationTask.h | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/launcher/InstanceCreationTask.h b/launcher/InstanceCreationTask.h index 23367c3f..03ee1a7a 100644 --- a/launcher/InstanceCreationTask.h +++ b/launcher/InstanceCreationTask.h @@ -1,26 +1,46 @@ #pragma once -#include "tasks/Task.h" -#include "net/NetJob.h" -#include <QUrl> -#include "settings/SettingsObject.h" #include "BaseVersion.h" #include "InstanceTask.h" -class InstanceCreationTask : public InstanceTask -{ +class InstanceCreationTask : public InstanceTask { Q_OBJECT -public: - explicit InstanceCreationTask(BaseVersionPtr version); - explicit InstanceCreationTask(BaseVersionPtr version, QString loader, BaseVersionPtr loaderVersion); - -protected: - //! Entry point for tasks. - virtual void executeTask() override; - -private: /* data */ - BaseVersionPtr m_version; - bool m_usingLoader; - QString m_loader; - BaseVersionPtr m_loaderVersion; + public: + InstanceCreationTask(); + virtual ~InstanceCreationTask() = default; + + protected: + void executeTask() final override; + + /** + * Tries to update an already existing instance. + * + * This can be implemented by subclasses to provide a way of updating an already existing + * instance, according to that implementation's concept of 'identity' (i.e. instances that + * are updates / downgrades of one another). + * + * If this returns true, createInstance() will not run, so you should do all update steps in here. + * Otherwise, createInstance() is run as normal. + */ + virtual bool updateInstance() { return false; }; + + /** + * Creates a new instance. + * + * Returns whether the instance creation was successful (true) or not (false). + */ + virtual bool createInstance() { return false; }; + + QString getError() const { return m_error_message; } + + protected: + void setError(QString message) { m_error_message = message; }; + + protected: + bool m_abort = false; + + QStringList m_files_to_remove; + + private: + QString m_error_message; }; |