-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.hpp
51 lines (38 loc) · 1.23 KB
/
Logger.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef LOGGER_HPP
#define LOGGER_HPP
#include <QObject>
#include <QDateTime>
#include <QTimer>
#include <qlogging.h>
#include <QFile>
#include <QDir>
#include <QTextStream>
class Logger : public QObject
{
public:
private:
Q_OBJECT
QString _messageBuffer {""};
QTime _digitalClock = QTime::currentTime();
QDateTime _digitalDateTime = QDateTime::currentDateTime();
QTimer _digitalDateTimeTimer;
Q_PROPERTY(QString messageBuffer READ messageBuffer NOTIFY messageBufferChanged)
Q_PROPERTY(QDateTime digitalDateTime READ digitalDateTime NOTIFY digitalDateTimeChanged)
public:
explicit Logger(QObject *parent = nullptr);
QString messageBuffer() const;
void setMessageBuffer(const QString &newMessageBuffer);
QDateTime digitalDateTime() const;
void setDigitalDateTime(const QDateTime &newDigitalDateTime);
signals:
void messageBufferChanged();
void digitalDateTimeChanged();
void logMessageOutput(QString message); // connect via QML Connection
public slots:
void outputLogMessage(const QString& message);
void digitalDateTimeDisplay();
void loadUpMessageBuffer(const QString& message); //HMMMMMMMM
void clearMessageBuffer();
};
Q_DECLARE_METATYPE(Logger);
#endif // LOGGER_HPP