|
|
|
#ifndef BASEJSONMODEL_H
|
|
|
|
#define BASEJSONMODEL_H
|
|
|
|
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include "viewmodel/table/ELogColumn.h"
|
|
|
|
#include "viewmodel/displayString/DisplayProviderCreator.h"
|
|
|
|
|
|
|
|
class LogTableModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
LogTableModel();
|
|
|
|
|
|
|
|
~LogTableModel() override;
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
void setDisplayProviderCreator(DisplayProviderCreator_ptr creator);
|
|
|
|
|
|
|
|
//uncrustify off
|
|
|
|
public slots:
|
|
|
|
//uncrustify on
|
|
|
|
void onLogAdded(Log_ptr log);
|
|
|
|
void onLogsChanged(QList<Log_ptr> logs);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QMap<int, QString> _columnMap;
|
|
|
|
QList<Log_ptr> _logs;
|
|
|
|
QMap<ELogColumn, DisplayStringProvider_ptr> _textProviders;
|
|
|
|
|
|
|
|
void initColumnMap();
|
|
|
|
QVariant providerDisplayRepresentation(const Log_ptr& log, ELogColumn column) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //BASEJSONMODEL_H
|