2014-05-09 20:46:25 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2014-05-10 05:23:32 +05:30
|
|
|
#include <QList>
|
2015-05-18 03:08:28 +05:30
|
|
|
#include <QJsonDocument>
|
2016-03-19 07:36:32 +05:30
|
|
|
#include <QDateTime>
|
2014-05-10 05:23:32 +05:30
|
|
|
#include "JarMod.h"
|
2014-05-09 20:46:25 +05:30
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
class MinecraftProfile;
|
2016-02-21 06:14:27 +05:30
|
|
|
|
|
|
|
enum ProblemSeverity
|
|
|
|
{
|
|
|
|
PROBLEM_NONE,
|
|
|
|
PROBLEM_WARNING,
|
|
|
|
PROBLEM_ERROR
|
|
|
|
};
|
|
|
|
|
2016-03-13 04:53:45 +05:30
|
|
|
/// where is a version from?
|
|
|
|
enum VersionSource
|
|
|
|
{
|
|
|
|
Builtin, //!< version loaded from the internal resources.
|
|
|
|
Local, //!< version loaded from a file in the cache.
|
|
|
|
Remote, //!< incomplete version on a remote server.
|
|
|
|
};
|
|
|
|
|
2016-02-21 06:14:27 +05:30
|
|
|
class PatchProblem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PatchProblem(ProblemSeverity severity, const QString & description)
|
|
|
|
{
|
|
|
|
m_severity = severity;
|
|
|
|
m_description = description;
|
|
|
|
}
|
|
|
|
const QString & getDescription() const
|
|
|
|
{
|
|
|
|
return m_description;
|
|
|
|
}
|
|
|
|
const ProblemSeverity getSeverity() const
|
|
|
|
{
|
|
|
|
return m_severity;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
ProblemSeverity m_severity;
|
|
|
|
QString m_description;
|
|
|
|
};
|
|
|
|
|
2016-03-19 07:36:32 +05:30
|
|
|
class ProfilePatch : public std::enable_shared_from_this<ProfilePatch>
|
2014-05-09 20:46:25 +05:30
|
|
|
{
|
|
|
|
public:
|
2015-01-28 03:01:07 +05:30
|
|
|
virtual ~ProfilePatch(){};
|
2016-03-14 01:27:01 +05:30
|
|
|
virtual void applyTo(MinecraftProfile *profile) = 0;
|
2015-01-28 03:01:07 +05:30
|
|
|
|
2014-05-11 16:07:21 +05:30
|
|
|
virtual bool isMinecraftVersion() = 0;
|
2014-05-09 20:46:25 +05:30
|
|
|
virtual bool hasJarMods() = 0;
|
2014-05-10 05:23:32 +05:30
|
|
|
virtual QList<JarmodPtr> getJarMods() = 0;
|
2015-01-28 03:01:07 +05:30
|
|
|
|
2015-05-18 03:08:28 +05:30
|
|
|
virtual bool isMoveable() = 0;
|
|
|
|
virtual bool isCustomizable() = 0;
|
|
|
|
virtual bool isRevertible() = 0;
|
|
|
|
virtual bool isRemovable() = 0;
|
|
|
|
virtual bool isCustom() = 0;
|
|
|
|
virtual bool isEditable() = 0;
|
|
|
|
virtual bool isVersionChangeable() = 0;
|
|
|
|
|
2014-05-10 05:23:32 +05:30
|
|
|
virtual void setOrder(int order) = 0;
|
|
|
|
virtual int getOrder() = 0;
|
2015-01-28 03:01:07 +05:30
|
|
|
|
2016-03-13 04:53:45 +05:30
|
|
|
virtual QString getID() = 0;
|
|
|
|
virtual QString getName() = 0;
|
|
|
|
virtual QString getVersion() = 0;
|
|
|
|
virtual QDateTime getReleaseDateTime() = 0;
|
|
|
|
|
|
|
|
virtual QString getFilename() = 0;
|
|
|
|
|
|
|
|
virtual VersionSource getVersionSource() = 0;
|
2016-02-21 06:14:27 +05:30
|
|
|
|
2016-03-19 07:36:32 +05:30
|
|
|
virtual std::shared_ptr<class VersionFile> getVersionFile() = 0;
|
|
|
|
|
2016-02-21 06:14:27 +05:30
|
|
|
virtual const QList<PatchProblem>& getProblems()
|
|
|
|
{
|
|
|
|
return m_problems;
|
|
|
|
}
|
|
|
|
virtual void addProblem(ProblemSeverity severity, const QString &description)
|
|
|
|
{
|
|
|
|
if(severity > m_problemSeverity)
|
|
|
|
{
|
|
|
|
m_problemSeverity = severity;
|
|
|
|
}
|
|
|
|
m_problems.append(PatchProblem(severity, description));
|
|
|
|
}
|
|
|
|
virtual ProblemSeverity getProblemSeverity()
|
|
|
|
{
|
|
|
|
return m_problemSeverity;
|
|
|
|
}
|
|
|
|
virtual bool hasFailed()
|
|
|
|
{
|
|
|
|
return getProblemSeverity() == PROBLEM_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QList<PatchProblem> m_problems;
|
|
|
|
ProblemSeverity m_problemSeverity = PROBLEM_NONE;
|
2014-05-09 20:46:25 +05:30
|
|
|
};
|
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
typedef std::shared_ptr<ProfilePatch> ProfilePatchPtr;
|