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
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
Warning,
|
|
|
|
Error
|
|
|
|
};
|
|
|
|
|
2017-07-29 12:13:34 +05:30
|
|
|
struct PatchProblem
|
2017-03-27 07:04:39 +05:30
|
|
|
{
|
|
|
|
ProblemSeverity m_severity;
|
|
|
|
QString m_description;
|
|
|
|
};
|
|
|
|
|
2017-11-11 06:08:31 +05:30
|
|
|
class MULTIMC_LOGIC_EXPORT ProblemProvider
|
2017-03-27 07:04:39 +05:30
|
|
|
{
|
|
|
|
public:
|
2017-11-05 03:25:25 +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:
|
2017-11-05 03:25:25 +05:30
|
|
|
const QList<PatchProblem> getProblems() const override
|
2017-03-27 07:04:39 +05:30
|
|
|
{
|
|
|
|
return m_problems;
|
|
|
|
}
|
2017-11-05 03:25:25 +05:30
|
|
|
ProblemSeverity getProblemSeverity() const override
|
2017-03-30 04:35:58 +05:30
|
|
|
{
|
|
|
|
return m_problemSeverity;
|
|
|
|
}
|
2017-03-27 07:04:39 +05:30
|
|
|
virtual void addProblem(ProblemSeverity severity, const QString &description)
|
|
|
|
{
|
|
|
|
if(severity > m_problemSeverity)
|
|
|
|
{
|
|
|
|
m_problemSeverity = severity;
|
|
|
|
}
|
2017-07-29 12:13:34 +05:30
|
|
|
m_problems.append({severity, description});
|
2017-03-27 07:04:39 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<PatchProblem> m_problems;
|
|
|
|
ProblemSeverity m_problemSeverity = ProblemSeverity::None;
|
|
|
|
};
|