ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
Loading...
Searching...
No Matches
LogDock.h
Go to the documentation of this file.
1/*$!{
2* Aurora Clang AST Viewer (ACAV)
3*
4* Copyright (c) 2026 Min Liu
5* Copyright (c) 2026 Michael David Adams
6*
7* SPDX-License-Identifier: GPL-2.0-or-later
8*
9* This program is free software; you can redistribute it and/or modify
10* it under the terms of the GNU General Public License as published by
11* the Free Software Foundation; either version 2 of the License, or
12* (at your option) any later version.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License along
20* with this program; if not, see <https://www.gnu.org/licenses/>.
21}$!*/
22
25#pragma once
26
27#include "core/LogEntry.h"
28#include <QDockWidget>
29#include <QMutex>
30#include <QTimer>
31#include <QVector>
32
33class QPlainTextEdit;
34class QTabWidget;
35
36namespace acav {
37
38class LogDock : public QDockWidget {
39 Q_OBJECT
40
41public:
42 explicit LogDock(QWidget *parent = nullptr);
43
44public slots:
45 void enqueue(const LogEntry &entry);
46
48 void focusAllTab();
49
50private slots:
51 void flushPending();
52 void clearAll();
53
54private:
55 // For safety print log to avoid log flood
56 void appendBatch(const QVector<LogEntry> &batch);
57 void appendText(QPlainTextEdit *view, const QString &text);
58 static QString formatEntry(const LogEntry &entry);
59
60 QTabWidget *tabs_;
61 QPlainTextEdit *allView_;
62 QPlainTextEdit *errorView_;
63 QPlainTextEdit *infoView_;
64 QPlainTextEdit *debugView_;
65 bool autoScroll_ = true;
66
67 QMutex mutex_;
68 QVector<LogEntry> pending_;
69 QTimer *flushTimer_;
70 int maxBatchSize_ = 500;
71 int maxPendingSize_ = 20000;
72};
73
74} // namespace acav
void focusAllTab()
Switch to All tab and set focus.
Definition LogDock.cpp:201