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
20public slots:
21 void postLog(int level, const QString& log);
22 void setLevels(int levels);
23 void clear();
24
25 void setLevelDebug(bool);
26 void setLevelStub(bool);
27 void setLevelInfo(bool);
28 void setLevelWarn(bool);
29 void setLevelError(bool);
30 void setLevelFatal(bool);
31 void setLevelGameError(bool);
32 void setLevelSWI(bool);
33
34 void setMaxLines(int);
35
36private:
37 static const int DEFAULT_LINE_LIMIT = 1000;
38
39 Ui::LogView m_ui;
40 int m_logLevel;
41 int m_lines;
42 int m_lineLimit;
43
44 static QString toString(int level);
45 void setLevel(int level) { m_logLevel |= level; }
46 void clearLevel(int level) { m_logLevel &= ~level; }
47
48 void clearLine();
49};
50
51}
52
53#endif