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 LogView : public QWidget {
20Q_OBJECT
21
22public:
23 LogView(QWidget* parent = nullptr);
24
25signals:
26 void levelsSet(int levels);
27 void levelsEnabled(int levels);
28 void levelsDisabled(int levels);
29
30public slots:
31 void postLog(int level, const QString& log);
32 void setLevels(int levels);
33 void clear();
34
35 void setLevelDebug(bool);
36 void setLevelStub(bool);
37 void setLevelInfo(bool);
38 void setLevelWarn(bool);
39 void setLevelError(bool);
40 void setLevelFatal(bool);
41 void setLevelGameError(bool);
42 void setLevelSWI(bool);
43 void setLevelStatus(bool);
44
45 void setMaxLines(int);
46
47private:
48 static const int DEFAULT_LINE_LIMIT = 1000;
49
50 Ui::LogView m_ui;
51 int m_logLevel;
52 int m_lines;
53 int m_lineLimit;
54
55 static QString toString(int level);
56 void setLevel(int level);
57 void clearLevel(int level);
58
59 void clearLine();
60};
61
62}
63
64#endif