2022-10-12 23:51:55 +02:00
|
|
|
/*
|
|
|
|
* validator.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-09-24 22:55:05 +02:00
|
|
|
#pragma once
|
2022-09-18 01:23:17 +02:00
|
|
|
|
|
|
|
#include <QDialog>
|
2024-08-20 00:53:48 +02:00
|
|
|
#include <set>
|
2023-05-24 01:05:59 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class CMap;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
2022-09-18 01:23:17 +02:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class Validator;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Validator : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
struct Issue
|
|
|
|
{
|
|
|
|
QString message;
|
|
|
|
bool critical;
|
|
|
|
|
|
|
|
Issue(const QString & m, bool c): message(m), critical(c) {}
|
2024-08-20 00:53:48 +02:00
|
|
|
|
|
|
|
bool operator <(const Issue & other) const
|
|
|
|
{
|
|
|
|
return message < other.message;
|
|
|
|
}
|
2022-09-18 01:23:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Validator(const CMap * map, QWidget *parent = nullptr);
|
|
|
|
~Validator();
|
|
|
|
|
2024-08-20 00:53:48 +02:00
|
|
|
static std::set<Issue> validate(const CMap * map);
|
2022-09-18 01:23:17 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::Validator *ui;
|
|
|
|
};
|