all repos — mgba @ a75c019fab24f045069cb9a923d02795f4d6f564

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
14namespace QGBA {
15
16class LogController;
17
18class LogView : public QWidget {
19Q_OBJECT
20
21public:
22	LogView(LogController* log, QWidget* parent = nullptr);
23
24signals:
25	void levelsEnabled(int levels);
26	void levelsDisabled(int levels);
27
28public slots:
29	void postLog(int level, int category, const QString& log);
30	void setLevels(int levels);
31	void clear();
32
33private slots:
34	void setMaxLines(int);
35
36protected:
37	virtual void paintEvent(QPaintEvent*) override;
38
39private:
40	static const int DEFAULT_LINE_LIMIT = 1000;
41
42	Ui::LogView m_ui;
43	int m_lines;
44	int m_lineLimit;
45	QQueue<QString> m_pendingLines;
46
47	void setLevel(int level, bool);
48
49	void clearLine();
50};
51
52}
53
54#endif