File indexing completed on 2025-01-05 03:56:30
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-08-20 0007 * Description : MetaEngine Settings Container. 0008 * 0009 * SPDX-FileCopyrightText: 2010-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_META_ENGINE_SETTINGS_CONTAINER_H 0016 #define DIGIKAM_META_ENGINE_SETTINGS_CONTAINER_H 0017 0018 // Qt includes 0019 0020 #include <QFlags> 0021 #include <QDebug> 0022 #include <QStringList> 0023 0024 // Local includes 0025 0026 #include "digikam_export.h" 0027 #include "metaengine.h" 0028 0029 class KConfigGroup; 0030 0031 namespace Digikam 0032 { 0033 0034 /** 0035 * The class MetaEngineSettingsContainer encapsulates all metadata related settings. 0036 * NOTE: this allows supply changed arguments to MetadataHub without changing the global settings. 0037 */ 0038 class DIGIKAM_EXPORT MetaEngineSettingsContainer 0039 { 0040 public: 0041 0042 /** 0043 * Describes the allowed and desired operation when rotating a picture. 0044 * The modes are in escalating order and describe if an operation is allowed. 0045 * What is actually done will be governed by what is possible: 0046 * 1) RAW files cannot by rotated by content, setting the metadata may be problematic 0047 * 2) Read-Only files cannot edited, neither content nor metadata 0048 * 3) Writable files will have lossy compression 0049 * 4) Only JPEG and PGF offer lossless rotation 0050 * Using a contents-based rotation always implies resetting the flag. 0051 */ 0052 enum RotationBehaviorFlag 0053 { 0054 NoRotation = 0, 0055 RotateByInternalFlag = 1 << 0, 0056 RotateByMetadataFlag = 1 << 1, 0057 RotateByLosslessRotation = 1 << 2, 0058 RotateByLossyRotation = 1 << 3, 0059 0060 RotatingFlags = RotateByInternalFlag | RotateByMetadataFlag, 0061 RotatingPixels = RotateByLosslessRotation | RotateByLossyRotation 0062 }; 0063 Q_DECLARE_FLAGS(RotationBehaviorFlags, RotationBehaviorFlag) 0064 0065 enum AlbumDateSource 0066 { 0067 NewestItemDate = 0, 0068 OldestItemDate, 0069 AverageDate, 0070 FolderDate, 0071 IgnoreDate 0072 }; 0073 0074 public: 0075 0076 explicit MetaEngineSettingsContainer(); 0077 ~MetaEngineSettingsContainer(); 0078 0079 public: 0080 0081 void readFromConfig(KConfigGroup& group); 0082 void writeToConfig(KConfigGroup& group) const; 0083 0084 QStringList defaultExifToolSearchPaths() const; 0085 0086 public: 0087 0088 bool exifRotate; 0089 bool exifSetOrientation; 0090 0091 bool saveComments; 0092 bool saveDateTime; 0093 bool savePickLabel; 0094 bool saveColorLabel; 0095 bool saveRating; 0096 0097 bool saveTemplate; 0098 bool saveTags; 0099 bool saveFaceTags; 0100 bool savePosition; 0101 0102 bool writeWithExifTool; 0103 bool writeRawFiles; 0104 bool writeDngFiles; 0105 bool updateFileTimeStamp; 0106 bool rescanImageIfModified; 0107 bool useXMPSidecar4Reading; 0108 bool useCompatibleFileName; 0109 bool useLazySync; 0110 bool useFastScan; 0111 0112 MetaEngine::MetadataWritingMode metadataWritingMode; 0113 0114 RotationBehaviorFlags rotationBehavior; 0115 0116 AlbumDateSource albumDateFrom; 0117 0118 QStringList sidecarExtensions; 0119 0120 QString exifToolPath; 0121 }; 0122 0123 //! qDebug() stream operator. Writes property @a inf to the debug output in a nicely formatted way. 0124 DIGIKAM_EXPORT QDebug operator<<(QDebug dbg, const MetaEngineSettingsContainer& inf); 0125 0126 } // namespace Digikam 0127 0128 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::MetaEngineSettingsContainer::RotationBehaviorFlags) 0129 0130 #endif // DIGIKAM_META_ENGINE_SETTINGS_CONTAINER_H