File indexing completed on 2022-12-06 21:10:31

0001 /*
0002     SPDX-FileCopyrightText: 2015-2022 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 
0008 #pragma once
0009 
0010 #include "libkdebugsettings_private_export.h"
0011 #include "loggingcategory.h"
0012 #include <QTreeWidget>
0013 class CategoryTypeComboBox;
0014 class LIBKDEBUGSETTINGS_EXPORT_TEST_EXPORT KDEApplicationTreeListWidgetItem : public QTreeWidgetItem
0015 {
0016 public:
0017     enum ColumnType { Description = 0, CategoryType = 1, LogName = 2, IdentifierName = 3 };
0018 
0019     explicit KDEApplicationTreeListWidgetItem(const QString &logName, QTreeWidget *parent);
0020     ~KDEApplicationTreeListWidgetItem() override;
0021 
0022     Q_REQUIRED_RESULT QString logName() const;
0023     void setLogName(const QString &category);
0024     void setType(LoggingCategory::LoggingType type);
0025     void setDefaultCategory(LoggingCategory::LoggingType type);
0026 
0027     Q_REQUIRED_RESULT LoggingCategory rule(bool forceSavingAllRules) const;
0028     void restoreToDefault();
0029 
0030 private:
0031     QString mCategory;
0032     CategoryTypeComboBox *const mCategoryTypeCombobox;
0033 };
0034 
0035 class LIBKDEBUGSETTINGS_EXPORT_TEST_EXPORT KDEApplicationTreeListWidget : public QTreeWidget
0036 {
0037     Q_OBJECT
0038 public:
0039     explicit KDEApplicationTreeListWidget(QWidget *parent = nullptr);
0040     ~KDEApplicationTreeListWidget() override;
0041 
0042     void deSelectAllDebugCategories();
0043     void selectAllDebugCategories();
0044     void deSelectAllMessagesCategories();
0045 
0046     void fillList(const LoggingCategory::List &list);
0047     void insertCategories(const LoggingCategory::List &list);
0048     Q_REQUIRED_RESULT LoggingCategory::List rules(bool forceSavingAllRules) const;
0049 
0050     void restoreToDefault();
0051 
0052     QList<int> searchColumns() const;
0053 
0054 private:
0055     void addListItems(const LoggingCategory::List &list, bool clearList);
0056     QString generateToolTip(const LoggingCategory &cat);
0057 };