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 clear();
23
24private slots:
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
33private:
34 static const int LINE_LIMIT = 1000;
35
36 Ui::LogView m_ui;
37 int m_logLevel;
38 int m_lines;
39
40 static QString toString(int level);
41 void setLevel(int level) { m_logLevel |= level; }
42 void clearLevel(int level) { m_logLevel &= ~level; }
43
44 void clearLine();
45};
46
47}
48
49#endif