File indexing completed on 2024-05-12 05:52:35
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 */ 0007 #pragma once 0008 #include "kdebugsettingsloadingcategories.h" 0009 #include "libkdebugsettingscore_export.h" 0010 #include "model/categorytypemodel.h" 0011 #include "model/customloggingcategorymodel.h" 0012 #include "model/kdeapplicationloggingcategorymodel.h" 0013 #include <QObject> 0014 class LIBKDEBUGSETTINGSCORE_EXPORT LoggingManager : public QObject 0015 { 0016 Q_OBJECT 0017 Q_PROPERTY(CustomLoggingCategoryModel *customCategoryModel READ customCategoryModel CONSTANT) 0018 Q_PROPERTY(KDEApplicationLoggingCategoryModel *qtKdeCategoryModel READ qtKdeCategoryModel CONSTANT) 0019 Q_PROPERTY(CategoryTypeModel *categoryTypeModel READ categoryTypeModel CONSTANT) 0020 Q_PROPERTY(bool foundOverrideRule READ foundOverrideRule CONSTANT) 0021 0022 public: 0023 static LoggingManager &self(); 0024 0025 ~LoggingManager() override; 0026 0027 [[nodiscard]] CustomLoggingCategoryModel *customCategoryModel() const; 0028 0029 [[nodiscard]] KDEApplicationLoggingCategoryModel *qtKdeCategoryModel() const; 0030 0031 [[nodiscard]] CategoryTypeModel *categoryTypeModel() const; 0032 0033 Q_INVOKABLE [[nodiscard]] QString environmentrules() const; 0034 0035 [[nodiscard]] bool foundOverrideRule() const; 0036 0037 // Remove it when we will port kdebugsettings to models. 0038 [[nodiscard]] KDebugSettingsLoadingCategories loggings() const; 0039 0040 void readCategoriesFiles(const QString &path); 0041 0042 [[nodiscard]] KdeLoggingCategory::List categoriesList() const; 0043 0044 void readQtLoggingFile(); 0045 void updateLoggingCategories(); 0046 0047 private: 0048 LIBKDEBUGSETTINGSCORE_NO_EXPORT explicit LoggingManager(QObject *parent = nullptr); 0049 CustomLoggingCategoryModel *const mCustomCategoryModel; 0050 KDEApplicationLoggingCategoryModel *const mQtKdeCategoryModel; 0051 CategoryTypeModel *const mCategoryTypeModel; 0052 KDebugSettingsLoadingCategories mLoggings; 0053 };