1 #ifndef CSM_TOOLS_REPORTMODEL_H 2 #define CSM_TOOLS_REPORTMODEL_H 3 4 #include <vector> 5 #include <string> 6 7 #include <QAbstractTableModel> 8 9 #include "../doc/messages.hpp" 10 11 #include "../world/universalid.hpp" 12 13 namespace CSMTools 14 { 15 class ReportModel : public QAbstractTableModel 16 { 17 Q_OBJECT 18 19 std::vector<CSMDoc::Message> mRows; 20 21 // Fixed columns 22 enum Columns 23 { 24 Column_Type = 0, Column_Id = 1, Column_Hint = 2 25 }; 26 27 // Configurable columns 28 int mColumnDescription; 29 int mColumnField; 30 int mColumnSeverity; 31 32 public: 33 34 ReportModel (bool fieldColumn = false, bool severityColumn = true); 35 36 int rowCount (const QModelIndex & parent = QModelIndex()) const override; 37 38 int columnCount (const QModelIndex & parent = QModelIndex()) const override; 39 40 QVariant data (const QModelIndex & index, int role = Qt::DisplayRole) const override; 41 42 QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; 43 44 bool removeRows (int row, int count, const QModelIndex& parent = QModelIndex()) override; 45 46 void add (const CSMDoc::Message& message); 47 48 void flagAsReplaced (int index); 49 50 const CSMWorld::UniversalId& getUniversalId (int row) const; 51 52 std::string getHint (int row) const; 53 54 void clear(); 55 56 // Return number of messages with Error or SeriousError severity. 57 int countErrors() const; 58 }; 59 } 60 61 #endif 62