File indexing completed on 2024-05-05 04:40:56

0001 /*
0002     SPDX-FileCopyrightText: 2023 George Florea Bănuș <georgefb899@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef OUTPUTWIDGETCONFIG_H
0008 #define OUTPUTWIDGETCONFIG_H
0009 
0010 #include <QObject>
0011 
0012 #include <optional>
0013 
0014 class KConfigGroup;
0015 class QWidget;
0016 
0017 class OutputWidgetConfig : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     explicit OutputWidgetConfig(const QByteArray& configSubgroupName, const QString& toolViewTitle, QObject* parent);
0022 
0023     /// @return Maximum number of open output views or std::nullopt if unlimited.
0024     std::optional<int> maxViewCount() const;
0025 
0026     void openDialog(QWidget* dialogParent);
0027 
0028 Q_SIGNALS:
0029     void settingsChanged();
0030 
0031 private:
0032     KConfigGroup configSubgroup() const;
0033     int maxViewCount(const KConfigGroup& configSubgroup) const;
0034     bool isViewLimitEnabled(const KConfigGroup& configSubgroup) const;
0035 
0036     const QByteArray m_configSubgroupName;
0037     const QString m_toolViewTitle;
0038 };
0039 
0040 #endif // OUTPUTWIDGETCONFIG_H