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 <QWidget>
10
11#include "ui_LogView.h"
12
13extern "C" {
14#include "gba/supervisor/thread.h"
15}
16
17namespace QGBA {
18
19class LogController;
20
21class LogView : public QWidget {
22Q_OBJECT
23
24public:
25 LogView(LogController* log, QWidget* parent = nullptr);
26
27signals:
28 void levelsEnabled(int levels);
29 void levelsDisabled(int levels);
30
31public slots:
32 void postLog(int level, const QString& log);
33 void setLevels(int levels);
34 void clear();
35
36private slots:
37 void setMaxLines(int);
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
46 void setLevel(int level, bool);
47
48 void clearLine();
49};
50
51}
52
53#endif