File indexing completed on 2025-01-05 03:56:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-06-20 0007 * Description : Template information container. 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_TEMPLATE_H 0016 #define DIGIKAM_TEMPLATE_H 0017 0018 // Qt includes 0019 0020 #include <QMetaType> 0021 #include <QString> 0022 #include <QStringList> 0023 #include <QDebug> 0024 0025 // Local includes 0026 0027 #include "metadatainfo.h" 0028 #include "digikam_export.h" 0029 #include "metaengine.h" 0030 0031 namespace Digikam 0032 { 0033 0034 class TemplatePrivate; 0035 0036 class DIGIKAM_EXPORT Template 0037 { 0038 public: 0039 0040 explicit Template(); 0041 ~Template(); 0042 0043 /** 0044 * Return true if Template title is null 0045 */ 0046 bool isNull() const; 0047 0048 /** 0049 * Return true if Template contents is empty 0050 */ 0051 bool isEmpty() const; 0052 0053 /** 0054 * Merge the metadata from another Template 0055 */ 0056 void merge(const Template& t); 0057 0058 /** 0059 * Compare for metadata equality, not including "templateTitle" value. 0060 */ 0061 bool operator==(const Template& t) const; 0062 0063 void setTemplateTitle(const QString& title); 0064 QString templateTitle() const; 0065 0066 void setAuthors(const QStringList& authors); 0067 void setAuthorsPosition(const QString& authorPosition); 0068 void setCredit(const QString& credit); 0069 void setCopyright(const MetaEngine::AltLangMap& copyright); 0070 void setRightUsageTerms(const MetaEngine::AltLangMap& rightUsageTerms); 0071 void setSource(const QString& source); 0072 void setInstructions(const QString& instructions); 0073 void setLocationInfo(const IptcCoreLocationInfo& inf); 0074 void setContactInfo(const IptcCoreContactInfo& inf); 0075 void setIptcSubjects(const QStringList& subjects); 0076 0077 QStringList authors() const; 0078 QString authorsPosition() const; 0079 QString credit() const; 0080 MetaEngine::AltLangMap copyright() const; 0081 MetaEngine::AltLangMap rightUsageTerms() const; 0082 QString source() const; 0083 QString instructions() const; 0084 IptcCoreLocationInfo locationInfo() const; 0085 IptcCoreContactInfo contactInfo() const; 0086 QStringList IptcSubjects() const; 0087 0088 static QString removeTemplateTitle() 0089 { 0090 return QLatin1String("_REMOVE_TEMPLATE_"); 0091 }; 0092 0093 protected: 0094 0095 /** 0096 * Template title used internally. This value always exist and cannot be empty. 0097 */ 0098 QString m_templateTitle; 0099 0100 /** 0101 * List of author names. 0102 */ 0103 QStringList m_authors; 0104 0105 /** 0106 * Description of authors position. 0107 */ 0108 QString m_authorsPosition; 0109 0110 /** 0111 * Credit description. 0112 */ 0113 QString m_credit; 0114 0115 /** 0116 * Language alternative copyright notices. 0117 */ 0118 MetaEngine::AltLangMap m_copyright; 0119 0120 /** 0121 * Language alternative right term usages. 0122 */ 0123 MetaEngine::AltLangMap m_rightUsageTerms; 0124 0125 /** 0126 * Descriptions of contents source. 0127 */ 0128 QString m_source; 0129 0130 /** 0131 * Special instructions to process with contents. 0132 */ 0133 QString m_instructions; 0134 0135 /** 0136 * IPTC Location Information. 0137 */ 0138 IptcCoreLocationInfo m_locationInfo; 0139 0140 /** 0141 * IPTC Contact Information. 0142 */ 0143 IptcCoreContactInfo m_contactInfo; 0144 0145 /** 0146 * IPTC Subjects Information. 0147 */ 0148 QStringList m_subjects; 0149 }; 0150 0151 //! qDebug() stream operator. Writes property @t to the debug output in a nicely formatted way. 0152 DIGIKAM_EXPORT QDebug operator<<(QDebug dbg, const Template& t); 0153 0154 } // namespace Digikam 0155 0156 Q_DECLARE_METATYPE(Digikam::Template) 0157 0158 #endif // DIGIKAM_TEMPLATE_H