all repos — mgba @ 422e2e2f62fb536ab8c9a2155999287cef5454ea

mGBA Game Boy Advance Emulator

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