summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/ProfilePatch.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-02-21 01:44:27 +0100
committerPetr Mrázek <peterix@gmail.com>2016-02-21 01:44:27 +0100
commit1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae (patch)
tree2c2fbc7a74ea5035fdfd8752272e011852eb1b85 /logic/minecraft/ProfilePatch.h
parent495d320ce267cf6d7c7e4468dbc36d3536bcb401 (diff)
downloadMultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar.gz
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar.lz
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar.xz
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.zip
GH-1453 report version file problems in the version page
Diffstat (limited to 'logic/minecraft/ProfilePatch.h')
-rw-r--r--logic/minecraft/ProfilePatch.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/logic/minecraft/ProfilePatch.h b/logic/minecraft/ProfilePatch.h
index de42cb7a..e4bb1c02 100644
--- a/logic/minecraft/ProfilePatch.h
+++ b/logic/minecraft/ProfilePatch.h
@@ -6,6 +6,35 @@
#include "JarMod.h"
class MinecraftProfile;
+
+enum ProblemSeverity
+{
+ PROBLEM_NONE,
+ PROBLEM_WARNING,
+ PROBLEM_ERROR
+};
+
+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;
+};
+
class ProfilePatch
{
public:
@@ -32,6 +61,31 @@ public:
virtual QString getPatchName() = 0;
virtual QString getPatchVersion() = 0;
virtual QString getPatchFilename() = 0;
+
+ 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;
};
typedef std::shared_ptr<ProfilePatch> ProfilePatchPtr;