2012-12-11 15:35:47 +01:00
|
|
|
#ifndef CSM_TOOLS_REPORTMODEL_H
|
|
|
|
#define CSM_TOOLS_REPORTMODEL_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
2022-10-19 19:02:00 +02:00
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QVariant>
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2015-06-20 16:55:34 +02:00
|
|
|
#include "../doc/messages.hpp"
|
|
|
|
|
2022-10-19 19:02:00 +02:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class UniversalId;
|
|
|
|
}
|
2012-12-11 15:35:47 +01:00
|
|
|
|
|
|
|
namespace CSMTools
|
|
|
|
{
|
|
|
|
class ReportModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2016-01-21 16:08:04 +01:00
|
|
|
std::vector<CSMDoc::Message> mRows;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2015-03-29 15:28:31 +02:00
|
|
|
// Fixed columns
|
2015-03-29 13:55:31 +02:00
|
|
|
enum Columns
|
2022-09-22 21:26:05 +03:00
|
|
|
{
|
2015-03-29 15:28:31 +02:00
|
|
|
Column_Type = 0,
|
|
|
|
Column_Id = 1,
|
|
|
|
Column_Hint = 2
|
2022-09-22 21:26:05 +03:00
|
|
|
};
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2015-03-29 15:28:31 +02:00
|
|
|
// Configurable columns
|
2016-01-21 16:08:04 +01:00
|
|
|
int mColumnDescription;
|
2015-03-29 15:28:31 +02:00
|
|
|
int mColumnField;
|
2016-01-21 16:08:04 +01:00
|
|
|
int mColumnSeverity;
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
public:
|
2015-03-29 15:28:31 +02:00
|
|
|
ReportModel(bool fieldColumn = false, bool severityColumn = true);
|
2015-03-29 13:55:31 +02:00
|
|
|
|
2015-03-29 15:28:31 +02:00
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
|
2012-12-11 15:35:47 +01:00
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void add(const CSMDoc::Message& message);
|
2012-12-11 15:35:47 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void flagAsReplaced(int index);
|
2012-12-12 22:36:20 +01:00
|
|
|
|
|
|
|
const CSMWorld::UniversalId& getUniversalId(int row) const;
|
2014-12-06 13:45:47 +01:00
|
|
|
|
|
|
|
std::string getHint(int row) const;
|
2015-03-28 12:53:01 +01:00
|
|
|
|
|
|
|
void clear();
|
2015-06-20 19:04:19 +02:00
|
|
|
|
|
|
|
// Return number of messages with Error or SeriousError severity.
|
|
|
|
int countErrors() const;
|
2012-12-11 15:35:47 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|