2017-03-27 02:34:39 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-04 22:59:37 +01:00
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
enum class ProblemSeverity { None, Warning, Error };
|
2017-03-27 02:34:39 +01:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
struct PatchProblem {
|
2018-07-15 13:51:05 +01:00
|
|
|
ProblemSeverity m_severity;
|
|
|
|
QString m_description;
|
2017-03-27 02:34:39 +01:00
|
|
|
};
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
class ProblemProvider {
|
|
|
|
public:
|
2023-06-04 22:59:37 +01:00
|
|
|
virtual ~ProblemProvider() {}
|
2018-07-15 13:51:05 +01:00
|
|
|
virtual const QList<PatchProblem> getProblems() const = 0;
|
|
|
|
virtual ProblemSeverity getProblemSeverity() const = 0;
|
2017-03-30 00:05:58 +01:00
|
|
|
};
|
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
class ProblemContainer : public ProblemProvider {
|
|
|
|
public:
|
|
|
|
const QList<PatchProblem> getProblems() const override { return m_problems; }
|
|
|
|
ProblemSeverity getProblemSeverity() const override { return m_problemSeverity; }
|
|
|
|
virtual void addProblem(ProblemSeverity severity, const QString& description)
|
2018-07-15 13:51:05 +01:00
|
|
|
{
|
2023-08-14 17:16:53 +01:00
|
|
|
if (severity > m_problemSeverity) {
|
2018-07-15 13:51:05 +01:00
|
|
|
m_problemSeverity = severity;
|
|
|
|
}
|
2023-08-14 17:16:53 +01:00
|
|
|
m_problems.append({ severity, description });
|
2018-07-15 13:51:05 +01:00
|
|
|
}
|
2017-03-27 02:34:39 +01:00
|
|
|
|
2023-08-14 17:16:53 +01:00
|
|
|
private:
|
2018-07-15 13:51:05 +01:00
|
|
|
QList<PatchProblem> m_problems;
|
|
|
|
ProblemSeverity m_problemSeverity = ProblemSeverity::None;
|
2017-03-27 02:34:39 +01:00
|
|
|
};
|