File indexing completed on 2025-01-19 03:53:38
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2007-05-01 0007 * Description : ItemInfo common data 0008 * 0009 * SPDX-FileCopyrightText: 2007-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2013 by Michael G. Hansen <mike at mghansen dot de> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_ITEM_INFO_DATA_H 0018 #define DIGIKAM_ITEM_INFO_DATA_H 0019 0020 // Qt includes 0021 0022 #include <QList> 0023 #include <QSize> 0024 #include <QDateTime> 0025 #include <QSharedData> 0026 #include <QReadWriteLock> 0027 #include <QWriteLocker> 0028 #include <QReadLocker> 0029 0030 // Local includes 0031 0032 #include "coredburl.h" 0033 #include "coredbalbuminfo.h" 0034 #include "iteminfocache.h" 0035 0036 namespace Digikam 0037 { 0038 0039 class ItemInfoStatic 0040 { 0041 public: 0042 0043 static void create(); 0044 static void destroy(); 0045 0046 static ItemInfoCache* cache(); 0047 0048 public: 0049 0050 ItemInfoCache m_cache; 0051 QReadWriteLock m_lock; 0052 0053 static ItemInfoStatic* m_instance; 0054 }; 0055 0056 // ----------------------------------------------------------------------------------- 0057 0058 class ItemInfoReadLocker : public QReadLocker 0059 { 0060 public: 0061 0062 explicit ItemInfoReadLocker() 0063 : QReadLocker(&ItemInfoStatic::m_instance->m_lock) 0064 { 0065 } 0066 }; 0067 0068 // ----------------------------------------------------------------------------------- 0069 0070 class ItemInfoWriteLocker : public QWriteLocker 0071 { 0072 public: 0073 0074 explicit ItemInfoWriteLocker() 0075 : QWriteLocker(&ItemInfoStatic::m_instance->m_lock) 0076 { 0077 } 0078 }; 0079 0080 // ----------------------------------------------------------------------------------- 0081 0082 class ItemInfoData : public QSharedData 0083 { 0084 public: 0085 0086 explicit ItemInfoData(); 0087 ~ItemInfoData(); 0088 0089 public: 0090 0091 qlonglong id; 0092 qlonglong currentReferenceImage; 0093 int albumId; 0094 int albumRootId; 0095 QString name; 0096 0097 QString defaultComment; 0098 QString defaultTitle; 0099 quint8 pickLabel; 0100 quint8 colorLabel; 0101 qint8 rating; 0102 DatabaseItem::Category category; 0103 QString format; 0104 QDateTime creationDate; 0105 QDateTime modificationDate; 0106 int orientation; 0107 qlonglong fileSize; 0108 qlonglong manualOrder; 0109 QString uniqueHash; 0110 QSize imageSize; 0111 QList<int> tagIds; 0112 int faceCount; 0113 int unconfirmedFaceCount; 0114 QMap<QString, QString> faceSuggestions; 0115 0116 double longitude; 0117 double latitude; 0118 double altitude; 0119 double currentSimilarity; 0120 0121 //! group leader, if the image is grouped 0122 qlonglong groupImage; 0123 0124 bool hasCoordinates : 1; 0125 bool hasAltitude : 1; 0126 0127 bool defaultTitleCached : 1; 0128 bool defaultCommentCached : 1; 0129 bool pickLabelCached : 1; 0130 bool colorLabelCached : 1; 0131 bool ratingCached : 1; 0132 bool categoryCached : 1; 0133 bool formatCached : 1; 0134 bool creationDateCached : 1; 0135 bool modificationDateCached : 1; 0136 bool orientationCached : 1; 0137 bool fileSizeCached : 1; 0138 bool manualOrderCached : 1; 0139 bool uniqueHashCached : 1; 0140 bool imageSizeCached : 1; 0141 bool tagIdsCached : 1; 0142 bool positionsCached : 1; 0143 bool groupImageCached : 1; 0144 bool unconfirmedFaceCountCached : 1; 0145 bool faceSuggestionsCached : 1; 0146 bool faceCountCached : 1; 0147 0148 bool invalid : 1; 0149 0150 // These two are initially true because we assume the data is there. 0151 // Once we query the data and find out it is missing, we set them to false. 0152 bool hasVideoMetadata : 1; 0153 bool hasImageMetadata : 1; 0154 0155 0156 DatabaseFields::VideoMetadataMinSizeType videoMetadataCached; 0157 DatabaseFields::ImageMetadataMinSizeType imageMetadataCached; 0158 0159 typedef DatabaseFields::Hash<QVariant> DatabaseFieldsHashRaw; 0160 DatabaseFieldsHashRaw databaseFieldsHashRaw; 0161 }; 0162 0163 } // namespace Digikam 0164 0165 #endif // DIGIKAM_ITEM_INFO_DATA_H