pollymc/launcher/InstanceCreationTask.h

47 lines
1.2 KiB
C
Raw Normal View History

2016-10-03 04:25:54 +05:30
#pragma once
#include "BaseVersion.h"
2018-03-19 07:06:12 +05:30
#include "InstanceTask.h"
2016-10-03 04:25:54 +05:30
class InstanceCreationTask : public InstanceTask {
2018-07-15 18:21:05 +05:30
Q_OBJECT
public:
InstanceCreationTask();
virtual ~InstanceCreationTask() = default;
2016-10-03 04:25:54 +05:30
protected:
void executeTask() final override;
2016-10-03 04:25:54 +05:30
/**
* 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;
2016-10-03 04:25:54 +05:30
};