85 lines
1.9 KiB
C++
Executable File
85 lines
1.9 KiB
C++
Executable File
/*
|
|
* @RDE_HEADER@
|
|
* <short description>
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Malte Schröder, SLSE, 2016-07-14
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QVariant>
|
|
#include <QVector>
|
|
#include <QDateTime>
|
|
#include <QColor>
|
|
#include <NGLLogger/INGLLogger.h>
|
|
|
|
class LogViewTableModel : public QAbstractTableModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
struct logInformation
|
|
{
|
|
QDateTime date;
|
|
QString level;
|
|
QString logger;
|
|
QString data;
|
|
QString location;
|
|
};
|
|
|
|
struct logColors
|
|
{
|
|
QColor date;
|
|
QMap<QString, QColor> level;
|
|
QColor logger;
|
|
QColor data;
|
|
QColor location;
|
|
};
|
|
|
|
enum Columns
|
|
{
|
|
colDate = 0,
|
|
colLevel = 1,
|
|
colLogger = 2,
|
|
colData = 3,
|
|
colLocation = 4,
|
|
colLast = colLocation
|
|
};
|
|
|
|
public:
|
|
explicit LogViewTableModel(QObject *parent = nullptr);
|
|
|
|
void setData(const QVector<logInformation> &logData);
|
|
void addData(const logInformation &logLine);
|
|
bool reset();
|
|
|
|
int rowCount(const QModelIndex &parent) const override final;
|
|
int columnCount(const QModelIndex &parent) const override final;
|
|
QVariant data(const QModelIndex &index, int role) const override final;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override final;
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override final;
|
|
int length() const;
|
|
QString itemAt(int row, int index) const;
|
|
|
|
signals:
|
|
void startTimeSetted(const QDateTime &dtime);
|
|
void endTimeSetted(const QDateTime &dtime);
|
|
|
|
public slots:
|
|
void adjustCellColor(const QColor &color, const QString &str);
|
|
void adjustFontColor(const QColor &color, const QString &str);
|
|
void startDateTime();
|
|
void endDateTime();
|
|
|
|
private:
|
|
void setStdColors();
|
|
|
|
QVector<logInformation> m_logfile;
|
|
logColors m_cellColors;
|
|
logColors m_fontColors;
|
|
NGL::INGLLogger &m_logger;
|
|
};
|