all repos — mgba @ 3d4faa41e281ff042451032190b3191af2737d5a

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#pragma once
 7
 8#include <QQueue>
 9#include <QWidget>
10
11#include "ui_LogView.h"
12
13namespace QGBA {
14
15class LogController;
16class Window;
17
18class LogView : public QWidget {
19Q_OBJECT
20
21public:
22	LogView(LogController* log, Window* window, 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 = 0;
44	int m_lineLimit = DEFAULT_LINE_LIMIT;
45	QQueue<QString> m_pendingLines;
46
47	void setLevel(int level, bool);
48
49	void clearLine();
50};
51
52}