2017-03-27 01:34:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
enum class ProblemSeverity
|
|
|
|
{
|
2018-07-15 12:51:05 +00:00
|
|
|
None,
|
|
|
|
Warning,
|
|
|
|
Error
|
2017-03-27 01:34:39 +00:00
|
|
|
};
|
|
|
|
|
2017-07-29 06:43:34 +00:00
|
|
|
struct PatchProblem
|
2017-03-27 01:34:39 +00:00
|
|
|
{
|
2018-07-15 12:51:05 +00:00
|
|
|
ProblemSeverity m_severity;
|
|
|
|
QString m_description;
|
2017-03-27 01:34:39 +00:00
|
|
|
};
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class ProblemProvider
|
2017-03-27 01:34:39 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 12:51:05 +00:00
|
|
|
virtual ~ProblemProvider() {};
|
|
|
|
virtual const QList<PatchProblem> getProblems() const = 0;
|
|
|
|
virtual ProblemSeverity getProblemSeverity() const = 0;
|
2017-03-29 23:05:58 +00:00
|
|
|
};
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class ProblemContainer : public ProblemProvider
|
2017-03-29 23:05:58 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 12:51:05 +00: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 01:34:39 +00:00
|
|
|
|
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
QList<PatchProblem> m_problems;
|
|
|
|
ProblemSeverity m_problemSeverity = ProblemSeverity::None;
|
2017-03-27 01:34:39 +00:00
|
|
|
};
|