fort/src/ui/log/logmanager.h

70 lines
1.7 KiB
C
Raw Normal View History

2017-11-10 13:36:29 +00:00
#ifndef LOGMANAGER_H
#define LOGMANAGER_H
#include <QObject>
2017-12-06 02:51:40 +00:00
QT_FORWARD_DECLARE_CLASS(AppBlockedModel)
QT_FORWARD_DECLARE_CLASS(AppStatModel)
QT_FORWARD_DECLARE_CLASS(DatabaseManager)
QT_FORWARD_DECLARE_CLASS(DriverWorker)
QT_FORWARD_DECLARE_CLASS(LogBuffer)
QT_FORWARD_DECLARE_CLASS(LogEntry)
2017-11-10 13:36:29 +00:00
class LogManager : public QObject
{
Q_OBJECT
2017-11-17 11:44:33 +00:00
Q_PROPERTY(AppBlockedModel *appBlockedModel READ appBlockedModel CONSTANT)
2017-12-05 05:06:15 +00:00
Q_PROPERTY(AppStatModel *appStatModel READ appStatModel CONSTANT)
2017-11-10 13:36:29 +00:00
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
public:
2017-12-01 14:13:06 +00:00
explicit LogManager(DatabaseManager *databaseManager,
DriverWorker *driverWorker,
2017-11-10 13:36:29 +00:00
QObject *parent = nullptr);
2017-11-17 11:44:33 +00:00
AppBlockedModel *appBlockedModel() const { return m_appBlockedModel; }
2017-12-05 05:06:15 +00:00
AppStatModel *appStatModel() const { return m_appStatModel; }
2017-11-17 11:44:33 +00:00
2017-12-08 02:38:02 +00:00
void setActive(bool active);
2017-11-10 13:36:29 +00:00
QString errorMessage() const { return m_errorMessage; }
2017-12-05 05:06:15 +00:00
void initialize();
2017-11-10 13:36:29 +00:00
signals:
2017-12-08 02:38:02 +00:00
void activeChanged();
2017-11-10 13:36:29 +00:00
void errorMessageChanged();
public slots:
private slots:
void processLogBuffer(LogBuffer *logBuffer, bool success,
const QString &errorMessage);
private:
void setErrorMessage(const QString &errorMessage);
void setupDriverWorker();
2018-02-23 10:33:28 +00:00
void readLogAsync();
2017-11-10 13:36:29 +00:00
void cancelAsyncIo();
2017-11-17 03:46:35 +00:00
LogBuffer *getFreeBuffer();
2018-02-23 09:56:52 +00:00
void addFreeBuffer(LogBuffer *logBuffer);
2017-11-17 03:46:35 +00:00
void readLogEntries(LogBuffer *logBuffer);
2017-11-10 13:36:29 +00:00
private:
2017-12-08 02:38:02 +00:00
bool m_active;
2017-11-10 13:36:29 +00:00
DriverWorker *m_driverWorker;
2017-11-17 03:46:35 +00:00
QList<LogBuffer *> m_freeBuffers;
AppBlockedModel *m_appBlockedModel;
2017-12-05 05:06:15 +00:00
AppStatModel *m_appStatModel;
2017-11-10 13:36:29 +00:00
QString m_errorMessage;
};
#endif // LOGMANAGER_H