File indexing completed on 2025-03-09 03:52:55

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-09-19
0007  * Description : Scanning a single item - private containers.
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  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_ITEM_SCANNER_P_H
0017 #define DIGIKAM_ITEM_SCANNER_P_H
0018 
0019 #include "itemscanner.h"
0020 
0021 // Qt includes
0022 
0023 #include <QImageReader>
0024 #include <QElapsedTimer>
0025 
0026 // KDE includes
0027 
0028 #include <klocalizedstring.h>
0029 
0030 // Local includes
0031 
0032 #include "digikam_debug.h"
0033 #include "coredburl.h"
0034 #include "coredbaccess.h"
0035 #include "coredb.h"
0036 #include "similaritydbaccess.h"
0037 #include "similaritydb.h"
0038 #include "collectionlocation.h"
0039 #include "collectionmanager.h"
0040 #include "facetagseditor.h"
0041 #include "itemcomments.h"
0042 #include "itemcopyright.h"
0043 #include "itemextendedproperties.h"
0044 #include "itemhistorygraph.h"
0045 #include "metaenginesettings.h"
0046 #include "tagregion.h"
0047 #include "tagscache.h"
0048 #include "iostream"
0049 #include "dimagehistory.h"
0050 #include "itemhistorygraphdata.h"
0051 
0052 namespace Digikam
0053 {
0054 
0055 class Q_DECL_HIDDEN ItemScannerCommit
0056 {
0057 
0058 public:
0059 
0060     enum Operation
0061     {
0062         NoOp,
0063         AddItem,
0064         UpdateItem
0065     };
0066 
0067 public:
0068 
0069     ItemScannerCommit();
0070 
0071 public:
0072 
0073     Operation                        operation;
0074 
0075     qlonglong                        copyImageAttributesId;
0076 
0077     bool                             commitItemInformation;
0078     bool                             commitImageMetadata;
0079     bool                             commitVideoMetadata;
0080     bool                             commitItemPosition;
0081     bool                             commitItemComments;
0082     bool                             commitItemCopyright;
0083     bool                             commitFaces;
0084     bool                             commitIPTCCore;
0085     bool                             hasColorTag;
0086     bool                             hasPickTag;
0087 
0088     DatabaseFields::ItemInformation  imageInformationFields;
0089     QVariantList                     imageInformationInfos;
0090 
0091     QVariantList                     imageMetadataInfos;
0092     QVariantList                     imagePositionInfos;
0093 
0094     CaptionsMap                      captions;
0095     QString                          headline;
0096     CaptionsMap                      titles;
0097 
0098     Template                         copyrightTemplate;
0099     QMultiMap<QString, QVariant>     metadataFacesMap;
0100 
0101     QVariantList                     iptcCoreMetadataInfos;
0102 
0103     QList<int>                       tagIds;
0104     QString                          historyXml;
0105     QString                          uuid;
0106 };
0107 
0108 // ---------------------------------------------------------------------------------------
0109 
0110 class Q_DECL_HIDDEN LessThanByProximityToSubject
0111 {
0112 public:
0113 
0114     explicit LessThanByProximityToSubject(const ItemInfo& subject);
0115 
0116     bool operator()(const ItemInfo& a, const ItemInfo& b);
0117 
0118 public:
0119 
0120     ItemInfo subject;
0121 };
0122 
0123 // ---------------------------------------------------------------------------
0124 
0125 class Q_DECL_HIDDEN ItemScanner::Private
0126 {
0127 public:
0128 
0129     explicit Private();
0130     ~Private();
0131 
0132 public:
0133 
0134     bool                   hasImage;
0135     bool                   hasMetadata;
0136     bool                   loadedFromDisk;
0137 
0138     QFileInfo              fileInfo;
0139 
0140     DMetadata*             metadata;
0141     DImg                   img;
0142     ItemScanInfo           scanInfo;
0143     ItemScanner::ScanMode  scanMode;
0144 
0145     bool                   hasHistoryToResolve;
0146 
0147     ItemScannerCommit      commit;
0148 
0149     QElapsedTimer          timer;
0150 };
0151 
0152 } // namespace Digikam
0153 
0154 #endif // DIGIKAM_ITEM_SCANNER_P_H