2017-03-27 02:34:39 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-04 22:59:37 +01:00
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
|
|
|
|
2017-03-27 02:34:39 +01:00
|
|
|
enum class ProblemSeverity
|
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
None,
|
|
|
|
Warning,
|
|
|
|
Error
|
2017-03-27 02:34:39 +01:00
|
|
|
};
|
|
|
|
|
2017-07-29 07:43:34 +01:00
|
|
|
struct PatchProblem
|
2017-03-27 02:34:39 +01:00
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
ProblemSeverity m_severity;
|
|
|
|
QString m_description;
|
2017-03-27 02:34:39 +01:00
|
|
|
};
|
|
|
|
|
2021-07-25 18:11:59 +01:00
|
|
|
class ProblemProvider
|
2017-03-27 02:34:39 +01:00
|
|
|
{
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2021-07-25 18:11:59 +01:00
|
|
|
class ProblemContainer : public ProblemProvider
|
2017-03-30 00:05:58 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 13:51:05 +01:00
|
|
|
const QList<PatchProblem> getProblems() const override
|
|
|
|
{
|
|
|
|
return m_problems;
|
|
|
|
}
|
|
|
|
ProblemSeverity getProblemSeverity() const override
|
|
|
|
{
|
|
|
|
return m_problemSeverity;
|
|
|
|
}
|
|
|
|
virtual void addProblem(ProblemSeverity severity, const QString &description)
|
|
|
|
{
|
|
|
|
if(severity > m_problemSeverity)
|
|
|
|
{
|
|
|
|
m_problemSeverity = severity;
|
|
|
|
}
|
|
|
|
m_problems.append({severity, description});
|
|
|
|
}
|
2017-03-27 02:34:39 +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
|
|
|
};
|