File indexing completed on 2025-01-19 03:56:58

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-04-19
0007  * Description : time adjust settings container.
0008  *
0009  * SPDX-FileCopyrightText: 2012-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_TIME_ADJUST_CONTAINER_H
0016 #define DIGIKAM_TIME_ADJUST_CONTAINER_H
0017 
0018 // Qt includes
0019 
0020 #include <QUrl>
0021 #include <QMap>
0022 #include <QDateTime>
0023 
0024 // Local includes
0025 
0026 #include "digikam_export.h"
0027 
0028 namespace Digikam
0029 {
0030 
0031 /**
0032  * Container that store all timestamp adjustments.
0033  */
0034 class DIGIKAM_EXPORT TimeAdjustContainer
0035 {
0036 
0037 public:
0038 
0039     enum UseDateSource
0040     {
0041         APPDATE = 0,
0042         FILENAME,
0043         FILEDATE,
0044         METADATADATE,
0045         CUSTOMDATE
0046     };
0047 
0048     enum UseMetaDateType
0049     {
0050         EXIFIPTCXMP = 0,
0051         EXIFCREATED,
0052         EXIFORIGINAL,
0053         EXIFDIGITIZED,
0054         IPTCCREATED,
0055         XMPCREATED,
0056         FUZZYCREATED,
0057         FUZZYORIGINAL,
0058         FUZZYDIGITIZED
0059     };
0060 
0061     enum UseFileDateType
0062     {
0063         FILELASTMOD = 0,
0064         FILECREATED
0065     };
0066 
0067     enum AdjType
0068     {
0069         COPYVALUE = 0,
0070         ADDVALUE,
0071         SUBVALUE,
0072         INTERVAL
0073     };
0074 
0075 public:
0076 
0077     TimeAdjustContainer();
0078     ~TimeAdjustContainer();
0079 
0080     /// Check if at least one option is selected
0081     bool atLeastOneUpdateToProcess()                                const;
0082 
0083     QDateTime calculateAdjustedDate(const QDateTime& originalTime, int index = 0);
0084     QDateTime getDateTimeFromString(const QString& dateStr)         const;
0085     QMap<QString, bool> getDateTimeTagsMap()                        const;
0086 
0087 public:
0088 
0089     QDateTime customDate;
0090     QDateTime customTime;
0091     QDateTime adjustmentTime;
0092 
0093     bool      updIfAvailable;
0094     bool      updEXIFModDate;
0095     bool      updEXIFOriDate;
0096     bool      updEXIFDigDate;
0097     bool      updEXIFThmDate;
0098     bool      updIPTCDate;
0099     bool      updXMPVideo;
0100     bool      updXMPDate;
0101     bool      updFileModDate;
0102 
0103     int       dateSource;
0104     int       metadataSource;
0105     int       fileDateSource;
0106     int       adjustmentType;
0107     int       adjustmentDays;
0108 };
0109 
0110 // -------------------------------------------------------------------
0111 
0112 /**
0113  * Container that hold the time difference for clock photo dialog.
0114  */
0115 class DeltaTime
0116 {
0117 
0118 public:
0119 
0120     explicit DeltaTime();
0121 
0122     ~DeltaTime();
0123 
0124     /// Check if at least one option is selected
0125     bool isNull() const;
0126 
0127 public:
0128 
0129     bool deltaNegative;
0130 
0131     int  deltaDays;
0132     int  deltaHours;
0133     int  deltaMinutes;
0134     int  deltaSeconds;
0135 };
0136 
0137 } // namespace Digikam
0138 
0139 #endif // DIGIKAM_TIME_ADJUST_CONTAINER_H