all repos — mgba @ d25ba2ec59b940940950aa1330fe563bced278bd

mGBA Game Boy Advance Emulator

src/platform/qt/LogView.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef QGBA_LOG_VIEW
 7#define QGBA_LOG_VIEW
 8
 9#include <QQueue>
10#include <QWidget>
11
12#include "ui_LogView.h"
13
14extern "C" {
15#include "gba/supervisor/thread.h"
16}
17
18namespace QGBA {
19
20class LogController;
21
22class LogView : public QWidget {
23Q_OBJECT
24
25public:
26	LogView(LogController* log, QWidget* parent = nullptr);
27
28signals:
29	void levelsEnabled(int levels);
30	void levelsDisabled(int levels);
31
32public slots:
33	void postLog(int level, int category, const QString& log);
34	void setLevels(int levels);
35	void clear();
36
37private slots:
38	void setMaxLines(int);
39
40protected:
41	virtual void paintEvent(QPaintEvent*) override;
42
43private:
44	static const int DEFAULT_LINE_LIMIT = 1000;
45
46	Ui::LogView m_ui;
47	int m_lines;
48	int m_lineLimit;
49	QQueue<QString> m_pendingLines;
50
51	void setLevel(int level, bool);
52
53	void clearLine();
54};
55
56}
57
58#endif