summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/ProfilePatch.h
blob: 808253427ee9a9fd5e0569ce219bf7ada2de0ae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once

#include <memory>
#include <QList>
#include <QJsonDocument>
#include <QDateTime>
#include "ProblemProvider.h"

class ComponentList;
class LaunchProfile;
namespace Meta
{
	class Version;
	class VersionList;
}
class VersionFile;

class ProfilePatch : public ProblemProvider
{
public:
	ProfilePatch(std::shared_ptr<Meta::Version> version);
	ProfilePatch(std::shared_ptr<VersionFile> file, const QString &filename = QString());

	virtual ~ProfilePatch(){};
	virtual void applyTo(LaunchProfile *profile);

	virtual bool isMoveable();
	virtual bool isCustomizable();
	virtual bool isRevertible();
	virtual bool isRemovable();
	virtual bool isCustom();
	virtual bool isVersionChangeable();

	virtual void setOrder(int order);
	virtual int getOrder();

	virtual QString getID();
	virtual QString getName();
	virtual QString getVersion();
	virtual std::shared_ptr<Meta::Version> getMeta();
	virtual QDateTime getReleaseDateTime();

	virtual QString getFilename();

	virtual std::shared_ptr<class VersionFile> getVersionFile() const;
	virtual std::shared_ptr<class Meta::VersionList> getVersionList() const;

	void setVanilla (bool state);
	void setRemovable (bool state);
	void setRevertible (bool state);
	void setMovable (bool state);

	const QList<PatchProblem> getProblems() const override;
	ProblemSeverity getProblemSeverity() const override;

protected:
	// Properties for UI and version manipulation from UI in general
	bool m_isMovable = false;
	bool m_isRevertible = false;
	bool m_isRemovable = false;
	bool m_isVanilla = false;

	bool m_orderOverride = false;
	int m_order = 0;

	std::shared_ptr<Meta::Version> m_metaVersion;
	std::shared_ptr<VersionFile> m_file;
	QString m_filename;
};

typedef std::shared_ptr<ProfilePatch> ProfilePatchPtr;