2017-03-27 07:04:39 +05:30
|
|
|
#pragma once
|
|
|
|
|
2017-11-11 06:08:31 +05:30
|
|
|
#include "multimc_logic_export.h"
|
|
|
|
|
2017-03-27 07:04:39 +05:30
|
|
|
enum class ProblemSeverity
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
None,
|
|
|
|
Warning,
|
|
|
|
Error
|
2017-03-27 07:04:39 +05:30
|
|
|
};
|
|
|
|
|
2017-07-29 12:13:34 +05:30
|
|
|
struct PatchProblem
|
2017-03-27 07:04:39 +05:30
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
ProblemSeverity m_severity;
|
|
|
|
QString m_description;
|
2017-03-27 07:04:39 +05:30
|
|
|
};
|
|
|
|
|
2017-11-11 06:08:31 +05:30
|
|
|
class MULTIMC_LOGIC_EXPORT ProblemProvider
|
2017-03-27 07:04:39 +05:30
|
|
|
{
|
|
|
|
public:
|
2018-07-15 18:21:05 +05:30
|
|
|
virtual ~ProblemProvider() {};
|
|
|
|
virtual const QList<PatchProblem> getProblems() const = 0;
|
|
|
|
virtual ProblemSeverity getProblemSeverity() const = 0;
|
2017-03-30 04:35:58 +05:30
|
|
|
};
|
|
|
|
|
2017-11-11 06:08:31 +05:30
|
|
|
class MULTIMC_LOGIC_EXPORT ProblemContainer : public ProblemProvider
|
2017-03-30 04:35:58 +05:30
|
|
|
{
|
|
|
|
public:
|
2018-07-15 18:21:05 +05:30
|
|
|
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 07:04:39 +05:30
|
|
|
|
|
|
|
private:
|
2018-07-15 18:21:05 +05:30
|
|
|
QList<PatchProblem> m_problems;
|
|
|
|
ProblemSeverity m_problemSeverity = ProblemSeverity::None;
|
2017-03-27 07:04:39 +05:30
|
|
|
};
|