31 #ifndef DIGIKAM_META_ENGINE_H
32 #define DIGIKAM_META_ENGINE_H
40 #include <QSharedDataPointer>
41 #include <QStringList>
43 #include <QRegularExpression>
69 WRITE_TO_FILE_ONLY = 0,
72 WRITE_TO_SIDECAR_ONLY = 1,
75 WRITE_TO_SIDECAR_AND_FILE = 2,
78 WRITE_TO_SIDECAR_ONLY_FOR_READ_ONLY_FILES = 3
86 WORKSPACE_UNSPECIFIED = 0,
88 WORKSPACE_ADOBERGB = 2,
89 WORKSPACE_UNCALIBRATED = 65535
97 ORIENTATION_UNSPECIFIED = 0,
98 ORIENTATION_NORMAL = 1,
99 ORIENTATION_HFLIP = 2,
100 ORIENTATION_ROT_180 = 3,
101 ORIENTATION_VFLIP = 4,
102 ORIENTATION_ROT_90_HFLIP = 5,
103 ORIENTATION_ROT_90 = 6,
104 ORIENTATION_ROT_90_VFLIP = 7,
105 ORIENTATION_ROT_270 = 8
188 static bool initializeExiv2();
193 static bool supportXmp();
200 static bool supportBmff();
205 static bool supportMetadataWriting(
const QString& typeMime);
210 static QString Exiv2Version();
225 bool loadFromData(
const QByteArray& imgData);
230 bool isEmpty()
const;
242 QSize getPixelSize()
const;
248 QString getMimeType()
const;
254 void setWriteRawFiles(
const bool on);
260 bool writeRawFiles()
const;
265 void setWriteDngFiles(
const bool on);
270 bool writeDngFiles()
const;
275 void setUseXMPSidecar4Reading(
const bool on);
280 bool useXMPSidecar4Reading()
const;
285 void setUseCompatibleFileName(
const bool on);
290 bool useCompatibleFileName()
const;
297 void setMetadataWritingMode(
const int mode);
304 int metadataWritingMode()
const;
310 void setUpdateFileTimeStamp(
bool on);
315 bool updateFileTimeStamp()
const;
326 void setFilePath(
const QString& path);
331 QString getFilePath()
const;
337 static QString sidecarFilePathForFile(
const QString& path,
bool useLR =
false);
342 static QString sidecarPath(
const QString& path);
347 static QUrl sidecarUrl(
const QUrl& url);
352 static QUrl sidecarUrl(
const QString& path);
357 static bool hasSidecar(
const QString& path);
363 static QString backendName(
Backend t);
371 bool load(
const QString& filePath,
Backend* backend =
nullptr);
377 bool loadFromSidecarAndMerge(
const QString& filePath);
383 bool save(
const QString& filePath,
bool setVersion =
false)
const;
389 bool applyChanges(
bool setVersion =
false)
const;
397 bool exportChanges(
const QString& exvTmpFile, QStringList& removedTags)
const;
409 bool setItemProgramId(
const QString& program,
const QString& version)
const;
415 QSize getItemDimensions()
const;
421 bool setItemDimensions(
const QSize& size)
const;
451 QDateTime getItemDateTime()
const;
457 bool setImageDateTime(
const QDateTime& dateTime,
bool setDateTimeDigitized =
false)
const;
464 QDateTime getDigitizationDateTime(
bool fallbackToCreationTime =
false)
const;
470 bool getItemPreview(QImage& preview)
const;
479 bool setItemPreview(
const QImage& preview)
const;
490 static bool canWriteComment(
const QString& filePath);
495 bool hasComments()
const;
500 bool clearComments()
const;
507 QByteArray getComments()
const;
514 QString getCommentsDecoded()
const;
520 bool setComments(
const QByteArray& data)
const;
527 static QString detectLanguageAlt(
const QString&
value, QString& lang);
538 TagsMap getStdExifTagsList()
const;
543 TagsMap getMakernoteTagsList()
const;
548 static bool canWriteExif(
const QString& filePath);
553 bool hasExif()
const;
558 bool clearExif()
const;
568 QByteArray getExifEncoded(
bool addExifHeader =
false)
const;
574 bool setExif(
const QByteArray& data)
const;
581 QImage getExifThumbnail(
bool fixOrientation)
const;
593 bool setExifThumbnail(
const QImage& thumb)
const;
598 bool removeExifThumbnail()
const;
603 bool setTiffThumbnail(
const QImage& thumb)
const;
609 QString getExifComment(
bool readDescription =
true)
const;
615 bool setExifComment(
const QString& comment,
bool writeDescription =
true)
const;
621 QString getExifTagString(
const char* exifTagName,
bool escapeCR =
true)
const;
626 bool setExifTagString(
const char* exifTagName,
const QString&
value)
const;
631 bool getExifTagLong(
const char* exifTagName,
long &val)
const;
636 bool getExifTagLong(
const char* exifTagName,
long &val,
int component)
const;
641 bool setExifTagLong(
const char* exifTagName,
long val)
const;
648 bool getExifTagRational(
const char* exifTagName,
long int& num,
long int& den,
int component = 0)
const;
655 bool setExifTagRational(
const char* exifTagName,
long int num,
long int den)
const;
661 QByteArray getExifTagData(
const char* exifTagName)
const;
666 bool setExifTagData(
const char* exifTagName,
const QByteArray& data)
const;
677 QVariant getExifTagVariant(
const char* exifTagName,
bool rationalAsListOfInts =
true,
678 bool escapeCR =
true,
int component = 0)
const;
687 bool setExifTagVariant(
const char* exifTagName,
const QVariant& data,
688 bool rationalWantSmallDenominator =
true)
const;
694 bool removeExifTag(
const char* exifTagName)
const;
699 QString getExifTagTitle(
const char* exifTagName);
704 QString getExifTagDescription(
const char* exifTagName);
712 QString createExifUserStringFromValue(
const char* exifTagName,
const QVariant& val,
bool escapeCR =
true);
739 bool invertSelection =
false,
740 bool extractBinary =
true)
const;
756 static bool canWriteIptc(
const QString& filePath);
761 bool hasIptc()
const;
766 bool clearIptc()
const;
773 QByteArray getIptc(
bool addIrbHeader =
false)
const;
779 bool setIptc(
const QByteArray& data)
const;
785 QString getIptcTagString(
const char* iptcTagName,
bool escapeCR =
true)
const;
790 bool setIptcTagString(
const char* iptcTagName,
const QString&
value)
const;
800 QStringList getIptcTagsStringList(
const char* iptcTagName,
bool escapeCR =
true)
const;
806 bool setIptcTagsStringList(
const char* iptcTagName,
int maxSize,
807 const QStringList& oldValues,
const QStringList& newValues)
const;
813 QByteArray getIptcTagData(
const char* iptcTagName)
const;
818 bool setIptcTagData(
const char* iptcTagName,
const QByteArray& data)
const;
824 bool removeIptcTag(
const char* iptcTagName)
const;
829 QString getIptcTagTitle(
const char* iptcTagName);
834 QString getIptcTagDescription(
const char* iptcTagName);
856 bool invertSelection =
false)
const;
861 QStringList getIptcKeywords()
const;
869 bool setIptcKeywords(
const QStringList& oldKeywords,
const QStringList& newKeywords)
const;
874 QStringList getIptcSubjects()
const;
882 bool setIptcSubjects(
const QStringList& oldSubjects,
const QStringList& newSubjects)
const;
888 QStringList getIptcSubCategories()
const;
896 bool setIptcSubCategories(
const QStringList& oldSubCategories,
const QStringList& newSubCategories)
const;
912 static bool canWriteXmp(
const QString& filePath);
922 bool clearXmp()
const;
928 QByteArray getXmp()
const;
934 bool setXmp(
const QByteArray& data)
const;
940 QString getXmpTagString(
const char* xmpTagName,
bool escapeCR =
true)
const;
945 bool setXmpTagString(
const char* xmpTagName,
const QString&
value)
const;
952 bool setXmpTagString(
const char* xmpTagName,
const QString&
value,
958 QString getXmpTagTitle(
const char* xmpTagName);
963 QString getXmpTagDescription(
const char* xmpTagName);
985 bool invertSelection =
false)
const;
994 bool escapeCR =
true)
const;
1009 QString getXmpTagStringLangAlt(
const char* xmpTagName,
const QString& langAlt,
bool escapeCR)
const;
1017 bool setXmpTagStringLangAlt(
const char* xmpTagName,
const QString&
value,
1018 const QString& langAlt)
const;
1024 QStringList getXmpTagStringSeq(
const char* xmpTagName,
bool escapeCR =
true)
const;
1030 bool setXmpTagStringSeq(
const char* xmpTagName,
const QStringList& seq)
const;
1036 QStringList getXmpTagStringBag(
const char* xmpTagName,
bool escapeCR)
const;
1042 bool setXmpTagStringBag(
const char* xmpTagName,
const QStringList& bag)
const;
1050 bool addToXmpTagStringBag(
const char* xmpTagName,
const QStringList& entriesToAdd)
const;
1057 bool removeFromXmpTagStringBag(
const char* xmpTagName,
const QStringList& entriesToRemove)
const;
1070 QVariant getXmpTagVariant(
const char* xmpTagName,
bool rationalAsListOfInts =
true,
bool stringEscapeCR =
true)
const;
1075 QStringList getXmpKeywords()
const;
1083 bool setXmpKeywords(
const QStringList& newKeywords)
const;
1089 bool removeXmpKeywords(
const QStringList& keywordsToRemove);
1094 QStringList getXmpSubjects()
const;
1102 bool setXmpSubjects(
const QStringList& newSubjects)
const;
1108 bool removeXmpSubjects(
const QStringList& subjectsToRemove);
1114 QStringList getXmpSubCategories()
const;
1122 bool setXmpSubCategories(
const QStringList& newSubCategories)
const;
1128 bool removeXmpSubCategories(
const QStringList& categoriesToRemove);
1134 bool removeXmpTag(
const char* xmpTagName,
bool family =
false)
const;
1143 static bool registerXmpNameSpace(
const QString& uri,
const QString&
prefix);
1148 static bool unregisterXmpNameSpace(
const QString& uri);
1159 bool initializeGPSInfo();
1164 bool getGPSInfo(
double& altitude,
double& latitude,
double& longitude)
const;
1170 QString getGPSLatitudeString()
const;
1171 QString getGPSLongitudeString()
const;
1178 bool getGPSLatitudeNumber(
double*
const latitude)
const;
1179 bool getGPSLongitudeNumber(
double*
const longitude)
const;
1184 bool getGPSAltitude(
double*
const altitude)
const;
1190 bool setGPSInfo(
const double altitude,
const double latitude,
const double longitude);
1196 bool setGPSInfo(
const double*
const altitude,
const double latitude,
const double longitude);
1202 bool setGPSInfo(
const double altitude,
const QString& latitude,
const QString& longitude);
1208 bool removeGPSInfo();
1216 static void convertToRational(
const double number,
1217 long int*
const numerator,
1218 long int*
const denominator,
1219 const int rounding);
1229 static void convertToRationalSmallDenominator(
const double number,
1230 long int*
const numerator,
1231 long int*
const denominator);
1236 static double convertDegreeAngleToDouble(
double degrees,
double minutes,
double seconds);
1243 static QString convertToGPSCoordinateString(
const long int numeratorDegrees,
1244 const long int denominatorDegrees,
1245 const long int numeratorMinutes,
1246 const long int denominatorMinutes,
1247 const long int numeratorSeconds,
1248 const long int denominatorSeconds,
1249 const char directionReference);
1255 static QString convertToGPSCoordinateString(
const bool isLatitude,
1263 static bool convertFromGPSCoordinateString(
const QString& coordinate,
1264 long int*
const numeratorDegrees,
1265 long int*
const denominatorDegrees,
1266 long int*
const numeratorMinutes,
1267 long int*
const denominatorMinutes,
1268 long int*
const numeratorSeconds,
1269 long int*
const denominatorSeconds,
1270 char*
const directionReference);
1277 static bool convertFromGPSCoordinateString(
const QString& gpsString,
1278 double*
const coordinate);
1284 static bool convertToUserPresentableNumbers(
const QString& coordinate,
1287 double*
const seconds,
1288 char*
const directionReference);
1296 static void convertToUserPresentableNumbers(
const bool isLatitude,
1300 double*
const seconds,
1301 char*
const directionReference);
1311 bool setProgramId()
const;
QStringView prefix
Definition: itemviewutilities.cpp:593
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43