digiKam
Loading...
Searching...
No Matches
itemcopyright.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 : 2008-05-12
7 * Description : Access to copy-right info of an item in the database
8 *
9 * SPDX-FileCopyrightText: 2008-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10 * SPDX-FileCopyrightText: 2009-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 <QString>
21#include <QStringList>
22#include <QList>
23
24// Local includes
25
26#include "metaengine.h"
27#include "metadatainfo.h"
28#include "digikam_export.h"
29
30namespace Digikam
31{
32
33class CopyrightInfo;
34class ItemCopyrightCache;
35class Template;
36
37class DIGIKAM_DATABASE_EXPORT ItemCopyright
38{
39public:
40
42 {
45 AddEntryToExisting
46 };
47
48public:
49
50 explicit ItemCopyright(qlonglong imageid);
51
55 ItemCopyright() = default;
56
57 ItemCopyright(const ItemCopyright& other);
59
60 ItemCopyright& operator=(const ItemCopyright& other);
61
77 QStringList creator() const;
78
79 QStringList author() const
80 {
81 return creator();
82 }
83
84 QStringList byLine() const
85 {
86 return creator();
87 }
88
95 void setCreator(const QString& creator, ReplaceMode mode = ReplaceAllEntries);
96
97 void setAuthor(const QString& author, ReplaceMode mode = ReplaceAllEntries)
98 {
99 setCreator(author, mode);
100 }
101
102 void setByLine(const QString& byline, ReplaceMode mode = ReplaceAllEntries)
103 {
104 setCreator(byline, mode);
105 }
106
107 void removeCreators();
108
116 QString provider() const;
117
118 QString credit() const
119 {
120 return provider();
121 }
122
123 void setProvider(const QString& provider);
124
125 void setCredit(const QString& credit)
126 {
127 setProvider(credit);
128 }
129
130 void removeProvider();
131
149 QString copyrightNotice(const QString& languageCode = QString());
150
151 QString rights(const QString& languageCode = QString())
152 {
153 return copyrightNotice(languageCode);
154 }
155
156 MetaEngine::AltLangMap allCopyrightNotices();
157
163 void setCopyrightNotice(const QString& notice,
164 const QString& languageCode = QString(),
165 ReplaceMode mode = ReplaceLanguageEntry);
166
167 void setRights(const QString& notice,
168 const QString& languageCode = QString(),
169 ReplaceMode mode = ReplaceLanguageEntry)
170 {
171 setCopyrightNotice(notice, languageCode, mode);
172 }
173
174 void removeCopyrightNotices();
175
183 QString rightsUsageTerms(const QString& languageCode = QString());
184 MetaEngine::AltLangMap allRightsUsageTerms();
185
186 void setRightsUsageTerms(const QString& term,
187 const QString& languageCode = QString(),
188 ReplaceMode mode = ReplaceLanguageEntry);
189
190 void removeRightsUsageTerms();
191
203 QString source();
204 void setSource(const QString& source);
205
206 void removeSource();
207
217 QString creatorJobTitle() const;
218
219 QString authorsPosition() const
220 {
221 return creatorJobTitle();
222 }
223
224 QString byLineTitle() const
225 {
226 return creatorJobTitle();
227 }
228
229 void setCreatorJobTitle(const QString& title);
230
231 void setAuthorsPosition(const QString& position)
232 {
233 setCreatorJobTitle(position);
234 }
235
236 void setByLineTitle(const QString& title)
237 {
238 setCreatorJobTitle(title);
239 }
240
241 void removeCreatorJobTitle();
242
255 QString instructions();
256 void setInstructions(const QString& instructions);
257 void removeInstructions();
258
265 IptcCoreContactInfo contactInfo();
266 void setContactInfo(const IptcCoreContactInfo& info);
267 void removeContactInfo();
268
273 void fillTemplate(Template& t);
274
279 void setFromTemplate(const Template& t);
280
284 void removeAll();
285
289 void replaceFrom(const ItemCopyright& source);
290
291protected:
292
293 CopyrightInfo copyrightInfo(const QString& property) const;
294 QList<CopyrightInfo> copyrightInfos(const QString& property) const;
295 QString readSimpleProperty(const QString& property) const;
296 int languageMatch(const QList<CopyrightInfo>& infos, const QString& languageCode) const;
297
298 void setSimpleProperty(const QString& property, const QString& value);
299 QString readLanguageProperty(const QString& property, const QString& languageCode);
300 MetaEngine::AltLangMap readLanguageProperties(const QString& property);
301
302 void setLanguageProperty(const QString& property,
303 const QString& value,
304 const QString& languageCode,
305 ReplaceMode mode);
306
307 void removeProperties(const QString& property);
308 void removeLanguageProperty(const QString& property, const QString& languageCode);
309
310protected:
311
312 friend class ItemCopyrightCache;
313
314 qlonglong m_id = 0;
315 ItemCopyrightCache* m_cache = nullptr;
316};
317
318} // namespace Digikam
Definition coredbalbuminfo.h:285
Definition metadatainfo.h:54
Definition itemcopyright.h:38
void setByLine(const QString &byline, ReplaceMode mode=ReplaceAllEntries)
Definition itemcopyright.h:102
void setAuthorsPosition(const QString &position)
Definition itemcopyright.h:231
QStringList author() const
Definition itemcopyright.h:79
QString rights(const QString &languageCode=QString())
Definition itemcopyright.h:151
QStringList byLine() const
Definition itemcopyright.h:84
QString authorsPosition() const
Definition itemcopyright.h:219
QString credit() const
Definition itemcopyright.h:118
void setRights(const QString &notice, const QString &languageCode=QString(), ReplaceMode mode=ReplaceLanguageEntry)
Definition itemcopyright.h:167
ReplaceMode
Definition itemcopyright.h:42
@ ReplaceAllEntries
Remove entries for all languages and add one new entry.
Definition itemcopyright.h:43
@ ReplaceLanguageEntry
Only replace the entry with the given language.
Definition itemcopyright.h:44
QString byLineTitle() const
Definition itemcopyright.h:224
void setCredit(const QString &credit)
Definition itemcopyright.h:125
void setByLineTitle(const QString &title)
Definition itemcopyright.h:236
void setAuthor(const QString &author, ReplaceMode mode=ReplaceAllEntries)
Definition itemcopyright.h:97
QMap< QString, QString > AltLangMap
Definition metaengine.h:135
Definition template.h:36
qulonglong value
Definition itemviewutilities.cpp:585
Definition datefolderview.cpp:34