File indexing completed on 2025-04-27 03:57:26

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2015-08-17
0007  * Description : Helper class for Image Description Editor Tab
0008  *
0009  * SPDX-FileCopyrightText: 2015 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DISJOINT_METADATA_DATA_FIELDS_H
0016 #define DIGIKAM_DISJOINT_METADATA_DATA_FIELDS_H
0017 
0018 #include "disjointmetadata.h"
0019 
0020 // Qt includes
0021 
0022 #include <QMap>
0023 #include <QList>
0024 #include <QDateTime>
0025 #include <QStringList>
0026 
0027 // Local includes
0028 
0029 #include "captionvalues.h"
0030 #include "template.h"
0031 
0032 namespace Digikam
0033 {
0034 
0035 /**
0036  * This class was split from DisjointMetadata::Private to allow to use the automatic C++ copy constructor
0037  * (DisjointMetadata::Private contains a QMutex and is thus non-copyable)
0038  */
0039 class DisjointMetadataDataFields
0040 {
0041 
0042 public:
0043 
0044     /**
0045      * The status enum describes the result of joining several metadata sets.
0046      * If only one set has been added, the status is always MetadataAvailable.
0047      * If no set has been added, the status is always MetadataInvalid
0048      */
0049     enum Status
0050     {
0051         MetadataInvalid,   ///< Not yet filled with any value
0052         MetadataAvailable, ///< Only one data set has been added, or a common value is available
0053         MetadataDisjoint   ///< No common value is available. For rating and dates, the interval is available.
0054     };
0055 
0056 public:
0057 
0058     DisjointMetadataDataFields()
0059         : dateTimeChanged   (false),
0060           titlesChanged     (false),
0061           commentsChanged   (false),
0062           pickLabelChanged  (false),
0063           colorLabelChanged (false),
0064           ratingChanged     (false),
0065           templateChanged   (false),
0066           tagsChanged       (false),
0067           withoutTags       (false),
0068           pickLabel         (-1),
0069           highestPickLabel  (-1),
0070           colorLabel        (-1),
0071           highestColorLabel (-1),
0072           rating            (-1),
0073           highestRating     (-1),
0074           count             (0),
0075           dateTimeStatus    (MetadataInvalid),
0076           titlesStatus      (MetadataInvalid),
0077           commentsStatus    (MetadataInvalid),
0078           pickLabelStatus   (MetadataInvalid),
0079           colorLabelStatus  (MetadataInvalid),
0080           ratingStatus      (MetadataInvalid),
0081           templateStatus    (MetadataInvalid),
0082           invalid           (false)
0083     {
0084     }
0085 
0086     bool              dateTimeChanged;
0087     bool              titlesChanged;
0088     bool              commentsChanged;
0089     bool              pickLabelChanged;
0090     bool              colorLabelChanged;
0091     bool              ratingChanged;
0092     bool              templateChanged;
0093     bool              tagsChanged;
0094     bool              withoutTags;
0095 
0096     int               pickLabel;
0097     int               highestPickLabel;
0098     int               colorLabel;
0099     int               highestColorLabel;
0100     int               rating;
0101     int               highestRating;
0102     int               count;
0103 
0104     QDateTime         dateTime;
0105     QDateTime         lastDateTime;
0106 
0107     CaptionsMap       titles;
0108     CaptionsMap       comments;
0109 
0110     Template          metadataTemplate;
0111 
0112     QMap<int, Status> tags;
0113 
0114     QStringList       tagList;
0115 
0116     Status            dateTimeStatus;
0117     Status            titlesStatus;
0118     Status            commentsStatus;
0119     Status            pickLabelStatus;
0120     Status            colorLabelStatus;
0121     Status            ratingStatus;
0122     Status            templateStatus;
0123 
0124     QList<int>        tagIds;
0125     bool              invalid;
0126 };
0127 
0128 } // namespace Digikam
0129 
0130 #endif // DIGIKAM_DISJOINT_METADATA_DATA_FIELDS_H