digiKam
Loading...
Searching...
No Matches
dmetadatasettingscontainer.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 : 2010-08-20
7 * Description : metadata Settings Container.
8 *
9 * SPDX-FileCopyrightText: 2015 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
10 * SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QFlags>
21#include <QString>
22#include <QMap>
23#include <QDebug>
24
25// Local includes
26
27#include "digikam_export.h"
28
29class KConfigGroup;
30
31namespace Digikam
32{
33
40class DIGIKAM_EXPORT NamespaceEntry
41{
42
43public:
44
46 {
47 EXIF = 0,
48 IPTC = 1,
49 XMP = 2
50 };
51
53 {
54 TAG = 0,
55 TAGPATH = 1
56 };
57
59 {
60 NO_OPTS = 0,
61 COMMENT_ALTLANG = 1,
62 COMMENT_ATLLANGLIST = 2,
63 COMMENT_XMP = 3,
64 COMMENT_JPEG = 4,
65 TAG_XMPBAG = 5,
66 TAG_XMPSEQ = 6,
67 TAG_ACDSEE = 7
68 };
69
71 {
72 TAGS = 0,
73 TITLE = 1,
74 RATING = 2,
75 COMMENT = 3,
76 PICKLABEL = 4,
77 COLORLABEL = 5
78 };
79
80public:
81
82 NamespaceEntry() = default;
83
85 : nsType (other.nsType),
86 subspace (other.subspace),
87 isDefault (other.isDefault),
88 isDisabled (other.isDisabled),
89 index (other.index),
90 namespaceName (other.namespaceName),
91 alternativeName (other.alternativeName),
92 tagPaths (other.tagPaths),
93 separator (other.separator),
94 convertRatio (QList<int>(other.convertRatio)),
95 specialOpts (other.specialOpts),
96 secondNameOpts (other.secondNameOpts)
97 {
98 }
99
100 ~NamespaceEntry() = default;
101
102public:
103
104 static QString DM_TAG_CONTAINER();
105 static QString DM_TITLE_CONTAINER();
106 static QString DM_RATING_CONTAINER();
107 static QString DM_COMMENT_CONTAINER();
108 static QString DM_PICKLABEL_CONTAINER();
109 static QString DM_COLORLABEL_CONTAINER();
110
111public:
112
114 NsSubspace subspace = XMP;
115 bool isDefault = true;
116 bool isDisabled = false;
117 int index = -1;
118
124 TagType tagPaths = TAGPATH;
125 QString separator;
126
130 QList<int> convertRatio;
131
132 SpecialOptions specialOpts = NO_OPTS;
133 SpecialOptions secondNameOpts = NO_OPTS;
134};
135
137DIGIKAM_EXPORT QDebug operator<<(QDebug dbg, const NamespaceEntry& inf);
138
142class DIGIKAM_EXPORT DMetadataSettingsContainer
143{
144public:
145
149
151
152public:
153
154 void readFromConfig(KConfigGroup& group);
155 void writeToConfig(KConfigGroup& group) const;
156
160 void defaultValues();
161
162 bool unifyReadWrite() const;
163 void setUnifyReadWrite(bool b);
164
165 bool readingAllTags() const;
166 void setReadingAllTags(bool b);
167
168 void addMapping(const QString& key);
169
170 QList<NamespaceEntry>& getReadMapping(const QString& key) const;
171
172 QList<NamespaceEntry>& getWriteMapping(const QString& key) const;
173
174 QList<QString> mappingKeys() const;
175
176 QString translateMappingKey(const QString& key) const;
177
178private:
179
180 void defaultTagValues();
181 void defaultTitleValues();
182 void defaultRatingValues();
183 void defaultCommentValues();
184 void defaultPickLabelValues();
185 void defaultColorLabelValues();
186 void readOneGroup(KConfigGroup& group, const QString& name, QList<NamespaceEntry>& container);
187 void writeOneGroup(KConfigGroup& group, const QString& name, QList<NamespaceEntry>& container) const;
188
189private:
190
191 class Private;
192 Private* const d = nullptr;
193};
194
196DIGIKAM_EXPORT QDebug operator<<(QDebug dbg, const DMetadataSettingsContainer& inf);
197
198} // namespace Digikam
Definition dmetadatasettingscontainer.h:143
The NamespaceEntry class provide a simple container for dmetadata namespaces variables,...
Definition dmetadatasettingscontainer.h:41
QList< int > convertRatio
Definition dmetadatasettingscontainer.h:130
QString alternativeName
Definition dmetadatasettingscontainer.h:123
SpecialOptions
Definition dmetadatasettingscontainer.h:59
NamespaceEntry(const NamespaceEntry &other)
Definition dmetadatasettingscontainer.h:84
TagType
Definition dmetadatasettingscontainer.h:53
QString namespaceName
Definition dmetadatasettingscontainer.h:122
NamespaceType
Definition dmetadatasettingscontainer.h:71
QString separator
Definition dmetadatasettingscontainer.h:125
NsSubspace
Definition dmetadatasettingscontainer.h:46
Definition datefolderview.cpp:34
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition dbengineparameters.cpp:930
@ TAGS
Definition filtersidebarwidget.h:40
@ RATING
Definition itemquerybuilder_p.h:73
@ TAG
Definition itemquerybuilder_p.h:67