1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2015-06-22
7  * Description : central place for metadata settings
8  *
9  * Copyright (C) 2015      by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
10  * Copyright (C) 2015-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DMETADATA_SETTINGS_H
26 #define DIGIKAM_DMETADATA_SETTINGS_H
27 
28 // Qt includes
29 
30 #include <QObject>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "dmetadatasettingscontainer.h"
36 
37 namespace Digikam
38 {
39 
40 class DIGIKAM_EXPORT DMetadataSettings : public QObject
41 {
42     Q_OBJECT
43 
44 public:
45 
46     /**
47      * Global container for Metadata settings. All accessor methods are thread-safe.
48      */
49     static DMetadataSettings* instance();
50 
51     /**
52      * Returns the current Metadata settings.
53      */
54     DMetadataSettingsContainer settings() const;
55 
56     /**
57      * Sets the current Metadata settings and writes them to config.
58      */
59     void setSettings(const DMetadataSettingsContainer& settings);
60 
61 Q_SIGNALS:
62 
63     void signalSettingsChanged();
64     void signalDMetadataSettingsChanged(const DMetadataSettingsContainer& current,
65                                         const DMetadataSettingsContainer& previous);
66 
67 private:
68 
69     DMetadataSettings();
70     explicit DMetadataSettings(QObject*);
71     ~DMetadataSettings() override;
72 
73     void readFromConfig();
74 
75 private:
76 
77     class Private;
78     Private* const d;
79 
80     friend class DMetadataSettingsCreator;
81 };
82 
83 } // namespace Digikam
84 
85 #endif // DIGIKAM_DMETADATA_SETTINGS_H
86