1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2015-08-17
7  * Description : Helper class for Image Description Editor Tab
8  *
9  * Copyright (C) 2015 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_DISJOINT_METADATA_DATA_FIELDS_H
25 #define DIGIKAM_DISJOINT_METADATA_DATA_FIELDS_H
26 
27 #include "disjointmetadata.h"
28 
29 // Qt includes
30 
31 #include <QMap>
32 #include <QList>
33 #include <QDateTime>
34 #include <QStringList>
35 
36 // Local includes
37 
38 #include "captionvalues.h"
39 #include "template.h"
40 
41 namespace Digikam
42 {
43 
44 /**
45  * This class was split from DisjointMetadata::Private to allow to use the automatic C++ copy constructor
46  * (DisjointMetadata::Private contains a QMutex and is thus non-copyable)
47  */
48 class DisjointMetadataDataFields
49 {
50 
51 public:
52 
53     /**
54      * The status enum describes the result of joining several metadata sets.
55      * If only one set has been added, the status is always MetadataAvailable.
56      * If no set has been added, the status is always MetadataInvalid
57      */
58     enum Status
59     {
60         MetadataInvalid,   ///< Not yet filled with any value
61         MetadataAvailable, ///< Only one data set has been added, or a common value is available
62         MetadataDisjoint   ///< No common value is available. For rating and dates, the interval is available.
63     };
64 
65 public:
66 
DisjointMetadataDataFields()67     DisjointMetadataDataFields()
68         : dateTimeChanged   (false),
69           titlesChanged     (false),
70           commentsChanged   (false),
71           pickLabelChanged  (false),
72           colorLabelChanged (false),
73           ratingChanged     (false),
74           templateChanged   (false),
75           tagsChanged       (false),
76           withoutTags       (false),
77           pickLabel         (-1),
78           highestPickLabel  (-1),
79           colorLabel        (-1),
80           highestColorLabel (-1),
81           rating            (-1),
82           highestRating     (-1),
83           count             (0),
84           dateTimeStatus    (MetadataInvalid),
85           titlesStatus      (MetadataInvalid),
86           commentsStatus    (MetadataInvalid),
87           pickLabelStatus   (MetadataInvalid),
88           colorLabelStatus  (MetadataInvalid),
89           ratingStatus      (MetadataInvalid),
90           templateStatus    (MetadataInvalid),
91           invalid           (false)
92     {
93     }
94 
95     bool              dateTimeChanged;
96     bool              titlesChanged;
97     bool              commentsChanged;
98     bool              pickLabelChanged;
99     bool              colorLabelChanged;
100     bool              ratingChanged;
101     bool              templateChanged;
102     bool              tagsChanged;
103     bool              withoutTags;
104 
105     int               pickLabel;
106     int               highestPickLabel;
107     int               colorLabel;
108     int               highestColorLabel;
109     int               rating;
110     int               highestRating;
111     int               count;
112 
113     QDateTime         dateTime;
114     QDateTime         lastDateTime;
115 
116     CaptionsMap       titles;
117     CaptionsMap       comments;
118 
119     Template          metadataTemplate;
120 
121     QMap<int, Status> tags;
122 
123     QStringList       tagList;
124 
125     Status            dateTimeStatus;
126     Status            titlesStatus;
127     Status            commentsStatus;
128     Status            pickLabelStatus;
129     Status            colorLabelStatus;
130     Status            ratingStatus;
131     Status            templateStatus;
132 
133     QList<int>        tagIds;
134     bool              invalid;
135 };
136 
137 } // namespace Digikam
138 
139 #endif // DIGIKAM_DISJOINT_METADATA_DATA_FIELDS_H
140