digiKam
disjointmetadata_p.h
Go to the documentation of this file.
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_P_H
25 #define DIGIKAM_DISJOINT_METADATA_P_H
26 
27 #include "disjointmetadata.h"
28 
29 // Qt includes
30 
31 #include <QMutexLocker>
32 #include <QtAlgorithms>
33 
34 // Local includes
35 
36 #include "templatemanager.h"
37 #include "tagscache.h"
38 #include "coredbaccess.h"
39 #include "itemcomments.h"
40 #include "iteminfo.h"
41 #include "coredbwatch.h"
42 #include "metadatahub.h"
43 
44 namespace Digikam
45 {
46 
48 {
49 public:
50 
51  explicit Private();
52 
53  // use the automatic copy constructor
54 
55  explicit Private(const DisjointMetadataDataFields& other);
56  explicit Private(const Private& other);
57 
58 public:
59 
60  void makeConnections(DisjointMetadata* const q);
61 
62  template <class T>
63  void loadSingleValue(const T& data,
64  T& storage,
66  {
67  switch (status)
68  {
70  {
71  storage = data;
73  break;
74  }
75 
77  {
78  // we have two values. If they are equal, status is unchanged
79 
80  if (data == storage)
81  {
82  break;
83  }
84 
85  // they are not equal. We need to enter the disjoint state.
86 
88  break;
89  }
90 
92  {
93  break;
94  }
95  }
96  };
97 
98 public:
99 
100  QMutex mutex;
101 };
102 
103 } // namespace Digikam
104 
105 #endif // DIGIKAM_DISJOINT_METADATA_P_H
Definition: disjointmetadatadatafields.h:49
Status
Definition: disjointmetadatadatafields.h:59
@ MetadataDisjoint
No common value is available. For rating and dates, the interval is available.
Definition: disjointmetadatadatafields.h:62
@ MetadataInvalid
Not yet filled with any value.
Definition: disjointmetadatadatafields.h:60
@ MetadataAvailable
Only one data set has been added, or a common value is available.
Definition: disjointmetadatadatafields.h:61
Definition: disjointmetadata_p.h:48
QMutex mutex
Definition: disjointmetadata_p.h:96
void loadSingleValue(const T &data, T &storage, DisjointMetadataDataFields::Status &status)
Definition: disjointmetadata_p.h:63
Definition: disjointmetadata.h:47
#define T
Definition: datefolderview.cpp:43