2016-10-02 23:55:54 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BaseVersion.h"
|
2018-03-19 01:36:12 +00:00
|
|
|
#include "InstanceTask.h"
|
2016-10-02 23:55:54 +01:00
|
|
|
|
2022-07-08 00:31:24 +01:00
|
|
|
class InstanceCreationTask : public InstanceTask {
|
2018-07-15 13:51:05 +01:00
|
|
|
Q_OBJECT
|
2022-07-08 00:31:24 +01:00
|
|
|
public:
|
|
|
|
InstanceCreationTask();
|
|
|
|
virtual ~InstanceCreationTask() = default;
|
2016-10-02 23:55:54 +01:00
|
|
|
|
2022-07-08 00:31:24 +01:00
|
|
|
protected:
|
|
|
|
void executeTask() final override;
|
2016-10-02 23:55:54 +01:00
|
|
|
|
2022-07-08 00:31:24 +01:00
|
|
|
/**
|
|
|
|
* 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; };
|
|
|
|
|
2022-07-08 22:44:43 +01:00
|
|
|
QString getError() const { return m_error_message; }
|
|
|
|
|
2022-07-08 00:31:24 +01:00
|
|
|
protected:
|
|
|
|
void setError(QString message) { m_error_message = message; };
|
|
|
|
|
2022-08-01 00:29:12 +01:00
|
|
|
protected:
|
|
|
|
bool m_abort = false;
|
|
|
|
|
2022-07-08 00:31:24 +01:00
|
|
|
private:
|
|
|
|
QString m_error_message;
|
2016-10-02 23:55:54 +01:00
|
|
|
};
|