digiKam
dconfigdlgmngr.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2003-11-03
7  * Description : Automatic retrieving, saving and resetting skeleton based settings in a dialog.
8  *
9  * Copyright (C) 2019-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2003 by Benjamin C Meyer <ben plus kdelibs at meyerhome dot net>
11  * Copyright (C) 2003 by Waldo Bastian <bastian at kde dot org>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DCONFIG_DLG_MNGR_H
27 #define DIGIKAM_DCONFIG_DLG_MNGR_H
28 
29 // Qt includes
30 
31 #include <QObject>
32 #include <QHash>
33 #include <QWidget>
34 #include <QByteArray>
35 
36 // Local includes
37 
38 #include "digikam_export.h"
39 
40 class KConfigSkeleton;
41 class KConfigSkeletonItem;
42 
43 namespace Digikam
44 {
45 
64 class DIGIKAM_EXPORT DConfigDlgMngr : public QObject
65 {
66  Q_OBJECT
67 
68 public:
69 
75  DConfigDlgMngr(QWidget* const parent, KConfigSkeleton* const conf);
76 
80  ~DConfigDlgMngr() override;
81 
86  void addWidget(QWidget* const widget);
87 
92  bool hasChanged() const;
93 
98  bool isDefault() const;
99 
100 public:
101 
106  static QHash<QString, QByteArray>* propertyMap();
107 
112  static QHash<QString, QByteArray>* changedMap();
113 
114 Q_SIGNALS:
115 
122 
129  void settingsChanged(QWidget* widget);
130 
139 
140 public Q_SLOTS:
141 
148  void updateSettings();
149 
157  void updateWidgets();
158 
165  void updateWidgetsDefault();
166 
167 protected:
168 
174  void init(bool trackChanges);
175 
186  bool parseChildren(const QWidget* widget, bool trackChanges);
187 
192  QByteArray getUserProperty(const QWidget* widget) const;
193 
199  QByteArray getCustomProperty(const QWidget* widget) const;
200 
204  QByteArray getUserPropertyChangedSignal(const QWidget* widget) const;
205 
211  QByteArray getCustomPropertyChangedSignal(const QWidget* widget) const;
212 
216  void setProperty(QWidget* w, const QVariant& v);
217 
221  QVariant property(QWidget* w) const;
222 
226  void setupWidget(QWidget* widget, KConfigSkeletonItem* item);
227 
231  static void initMaps();
232 
233 private:
234 
235  class Private;
236  Private* const d;
237 
238  Q_DISABLE_COPY(DConfigDlgMngr)
239 };
240 
241 } // namespace Digikam
242 
243 #endif // DIGIKAM_DCONFIG_DLG_MNGR_H
Definition: dconfigdlgmngr.h:65
void settingsChanged(QWidget *widget)
Definition: datefolderview.cpp:43