src/platform/qt/LogView.h (view raw)
1#ifndef QGBA_LOG_VIEW
2#define QGBA_LOG_VIEW
3
4#include <QWidget>
5
6#include "ui_LogView.h"
7
8extern "C" {
9#include "gba-thread.h"
10}
11
12namespace QGBA {
13
14class LogView : public QWidget {
15Q_OBJECT
16
17public:
18 LogView(QWidget* parent = nullptr);
19
20signals:
21 void levelsSet(int levels);
22 void levelsEnabled(int levels);
23 void levelsDisabled(int levels);
24
25public slots:
26 void postLog(int level, const QString& log);
27 void setLevels(int levels);
28 void clear();
29
30 void setLevelDebug(bool);
31 void setLevelStub(bool);
32 void setLevelInfo(bool);
33 void setLevelWarn(bool);
34 void setLevelError(bool);
35 void setLevelFatal(bool);
36 void setLevelGameError(bool);
37 void setLevelSWI(bool);
38
39 void setMaxLines(int);
40
41private:
42 static const int DEFAULT_LINE_LIMIT = 1000;
43
44 Ui::LogView m_ui;
45 int m_logLevel;
46 int m_lines;
47 int m_lineLimit;
48
49 static QString toString(int level);
50 void setLevel(int level);
51 void clearLevel(int level);
52
53 void clearLine();
54};
55
56}
57
58#endif