File indexing completed on 2024-04-28 05:46:36

0001 /*
0002     SPDX-FileCopyrightText: 2009-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2014-2020 Andrius Štikonas <andrius@stikonas.eu>
0004     SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
0005 
0006     SPDX-License-Identifier: GPL-3.0-or-later
0007 */
0008 
0009 #if !defined(TREELOG_H)
0010 
0011 #define TREELOG_H
0012 
0013 #include "ui_treelogbase.h"
0014 
0015 #include <util/globallog.h>
0016 
0017 #include <QWidget>
0018 
0019 class QTreeWidget;
0020 
0021 /** A tree for formatted log output.
0022     @author Volker Lanz <vl@fidra.de>
0023 */
0024 class TreeLog: public QWidget, public Ui::TreeLogBase
0025 {
0026     Q_DISABLE_COPY(TreeLog)
0027 
0028 public:
0029     explicit TreeLog(QWidget* parent = nullptr);
0030     ~TreeLog();
0031 
0032 public:
0033     void init();
0034     void onNewLogMessage(Log::Level logLevel, const QString& s);
0035 
0036     void onClearLog();
0037     void onSaveLog();
0038 
0039     QTreeWidget& treeLog() {
0040         Q_ASSERT(m_TreeLog);
0041         return *m_TreeLog;
0042     }
0043 
0044 protected:
0045     void onHeaderContextMenu(const QPoint& pos);
0046 
0047     const QTreeWidget& treeLog() const {
0048         Q_ASSERT(m_TreeLog);
0049         return *m_TreeLog;
0050     }
0051 
0052     void loadConfig();
0053     void saveConfig() const;
0054 
0055 private:
0056 };
0057 
0058 #endif