diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-04-07 00:27:24 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-04-07 00:27:24 +0200 |
commit | 795889d934e8f4ebe89be1a49a3417fd98e89be1 (patch) | |
tree | c5b0d30d425003c4b88e84a2908e63eb5ed797b9 /api/logic/ProblemProvider.h | |
parent | 160b5033a79e6b5ee9f3e2a001b96c677f41ddcb (diff) | |
parent | 8e58d61150b0bdbe9eb91065d36342f3004fe97b (diff) | |
download | MultiMC-795889d934e8f4ebe89be1a49a3417fd98e89be1.tar MultiMC-795889d934e8f4ebe89be1a49a3417fd98e89be1.tar.gz MultiMC-795889d934e8f4ebe89be1a49a3417fd98e89be1.tar.lz MultiMC-795889d934e8f4ebe89be1a49a3417fd98e89be1.tar.xz MultiMC-795889d934e8f4ebe89be1a49a3417fd98e89be1.zip |
Merge branch 'feature/meta' into develop
Diffstat (limited to 'api/logic/ProblemProvider.h')
-rw-r--r-- | api/logic/ProblemProvider.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/api/logic/ProblemProvider.h b/api/logic/ProblemProvider.h new file mode 100644 index 00000000..b30e1776 --- /dev/null +++ b/api/logic/ProblemProvider.h @@ -0,0 +1,61 @@ +#pragma once + +enum class ProblemSeverity +{ + None, + Warning, + 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 ProblemProvider +{ +public: + virtual const QList<PatchProblem> getProblems() = 0; + virtual ProblemSeverity getProblemSeverity() = 0; +}; + +class ProblemContainer : public ProblemProvider +{ +public: + const QList<PatchProblem> getProblems() override + { + return m_problems; + } + ProblemSeverity getProblemSeverity() override + { + return m_problemSeverity; + } + virtual void addProblem(ProblemSeverity severity, const QString &description) + { + if(severity > m_problemSeverity) + { + m_problemSeverity = severity; + } + m_problems.append(PatchProblem(severity, description)); + } + +private: + QList<PatchProblem> m_problems; + ProblemSeverity m_problemSeverity = ProblemSeverity::None; +}; |