-
Notifications
You must be signed in to change notification settings - Fork 10
/
consolelog.h
76 lines (68 loc) · 2.16 KB
/
consolelog.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef CONSOLELOG_H
#define CONSOLELOG_H
#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QPlainTextEdit>
#include <QLineEdit>
#include <QString>
#include <QDateTime>
#include <QDir>
#include <fstream>
#include <iostream>
#include <sys/utsname.h>
#include <stdlib.h>
class consoleLog : public QWidget
{
Q_OBJECT
public:
explicit consoleLog(QWidget *parent = nullptr);
explicit consoleLog(QString logFileName, bool enableFlightMode, QWidget *parent = nullptr);
~consoleLog();
public slots:
void insertText(QString text);
void insertTextNoTagging(QString text);
signals:
void haveLogText(QString completeLogText);
private slots:
void onClearBtnPushed();
void onAnnotateBtnPushed();
private:
void createUI();
void destroyUI();
void makeConnections();
void writeToFile(QString textOut);
void openFile(QString filename);
void closeFile();
void makeDirectory(QString directory);
void logSystemConfig();
bool fileIsOpen = false;
bool enableLogToFile = false;
bool flightMode = false;
std::ofstream outfile;
QString logFileName = "";
QString createTimeStamp();
QString createFilenameFromDirectory(QString directoryName);
QPlainTextEdit logView;
QPushButton clearBtn;
QPushButton annotateBtn;
QLineEdit annotateText;
QVBoxLayout layout;
QHBoxLayout hLayout;
void handleOwnText(QString message);
void handleError(QString errorText);
void handleNote(QString noteText);
void handleWarning(QString warningText);
const char msgInitSequence[4] = {0x4a,0x50,0x4c,0x00};
const char msgReplySequence[37] = {0x48,0x65,0x6c,0x6c,
0x6f,0x20,0x66,0x72,
0x6f,0x6d,0x20,0x74,
0x68,0x65,0x20,0x41,
0x56,0x49,0x52,0x49,
0x53,0x20,0x4c,0x61,
0x62,0x20,0x61,0x74,
0x20,0x4a,0x50,0x4c,
0x21,0x00,0x00,0x00};
};
#endif // CONSOLELOG_H