2018-03-19 07:06:12 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "settings/SettingsObject.h"
|
2022-07-15 00:43:23 +05:30
|
|
|
#include "tasks/Task.h"
|
|
|
|
|
2022-09-11 21:46:25 +05:30
|
|
|
/* Helpers */
|
|
|
|
enum class InstanceNameChange { ShouldChange, ShouldKeep };
|
2022-09-26 15:20:31 +05:30
|
|
|
[[nodiscard]] InstanceNameChange askForChangingInstanceName(QWidget* parent, const QString& old_name, const QString& new_name);
|
2022-09-11 21:46:25 +05:30
|
|
|
|
2022-07-15 00:43:23 +05:30
|
|
|
struct InstanceName {
|
|
|
|
public:
|
|
|
|
InstanceName() = default;
|
|
|
|
InstanceName(QString name, QString version) : m_original_name(std::move(name)), m_original_version(std::move(version)) {}
|
|
|
|
|
|
|
|
[[nodiscard]] QString modifiedName() const;
|
|
|
|
[[nodiscard]] QString originalName() const;
|
|
|
|
[[nodiscard]] QString name() const;
|
|
|
|
[[nodiscard]] QString version() const;
|
|
|
|
|
|
|
|
void setName(QString name) { m_modified_name = name; }
|
|
|
|
void setName(InstanceName& other);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QString m_original_name;
|
|
|
|
QString m_original_version;
|
2018-03-19 07:06:12 +05:30
|
|
|
|
2022-07-15 00:43:23 +05:30
|
|
|
QString m_modified_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
class InstanceTask : public Task, public InstanceName {
|
2018-07-15 18:21:05 +05:30
|
|
|
Q_OBJECT
|
2022-07-15 00:43:23 +05:30
|
|
|
public:
|
|
|
|
InstanceTask();
|
|
|
|
~InstanceTask() override = default;
|
|
|
|
|
|
|
|
void setParentSettings(SettingsObjectPtr settings) { m_globalSettings = settings; }
|
|
|
|
|
|
|
|
void setStagingPath(const QString& stagingPath) { m_stagingPath = stagingPath; }
|
|
|
|
|
|
|
|
void setIcon(const QString& icon) { m_instIcon = icon; }
|
|
|
|
|
|
|
|
void setGroup(const QString& group) { m_instGroup = group; }
|
|
|
|
QString group() const { return m_instGroup; }
|
2018-03-19 07:06:12 +05:30
|
|
|
|
2022-07-08 21:30:44 +05:30
|
|
|
bool shouldOverride() const { return m_override_existing; }
|
|
|
|
|
2022-07-15 00:43:23 +05:30
|
|
|
protected:
|
2022-07-08 21:30:44 +05:30
|
|
|
void setOverride(bool override) { m_override_existing = override; }
|
|
|
|
|
2022-07-15 00:43:23 +05:30
|
|
|
protected: /* data */
|
2018-07-15 18:21:05 +05:30
|
|
|
SettingsObjectPtr m_globalSettings;
|
|
|
|
QString m_instIcon;
|
|
|
|
QString m_instGroup;
|
|
|
|
QString m_stagingPath;
|
2022-07-08 21:30:44 +05:30
|
|
|
|
|
|
|
bool m_override_existing = false;
|
2018-03-19 07:06:12 +05:30
|
|
|
};
|