digiKam
Loading...
Searching...
No Matches
facetagsiface.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 : 2010-09-27
7 * Description : Interface for info stored about a face tag in the database
8 *
9 * SPDX-FileCopyrightText: 2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com>
10 * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QFlags>
21#include <QVariant>
22
23// Local includes
24
25#include "tagregion.h"
26#include "digikam_export.h"
27
28class QDebug;
29
30namespace Digikam
31{
32
33class DIGIKAM_DATABASE_EXPORT FaceTagsIface
34{
35public:
36
37 enum Type
38 {
39 InvalidFace = 0,
40 UnknownName = 1 << 0,
41 UnconfirmedName = 1 << 1,
42 IgnoredName = 1 << 2,
43 ConfirmedName = 1 << 3,
44 FaceForTraining = 1 << 4,
45
46 UnconfirmedTypes = UnknownName | UnconfirmedName,
47 NormalFaces = UnknownName | UnconfirmedName | IgnoredName | ConfirmedName,
48 AllTypes = UnknownName | UnconfirmedName | IgnoredName | ConfirmedName | FaceForTraining,
49 TypeFirst = UnknownName,
50 TypeLast = FaceForTraining
51 };
52 Q_DECLARE_FLAGS(TypeFlags, Type)
53
54public:
55
56 FaceTagsIface() = default;
57 FaceTagsIface(const FaceTagsIface& other);
58 FaceTagsIface(Type type, qlonglong imageId, int tagId, const TagRegion& region);
59 FaceTagsIface(const QString& attribute, qlonglong imageId, int tagId, const TagRegion& region);
60 ~FaceTagsIface() = default;
61
62 FaceTagsIface& operator=(const FaceTagsIface& other);
63
64 bool isNull() const;
65
66 Type type() const;
67 qlonglong imageId() const;
68 int tagId() const;
69 TagRegion region() const;
70
71 bool isInvalidFace() const
72 {
73 return (type() == InvalidFace);
74 }
75
76 bool isUnknownName() const
77 {
78 return (type() == UnknownName);
79 }
80
81 bool isUnconfirmedName() const
82 {
83 return (type() == UnconfirmedName);
84 }
85
86 bool isUnconfirmedType() const
87 {
88 return (type() & UnconfirmedTypes);
89 }
90
91 bool isIgnoredName() const
92 {
93 return (type() == IgnoredName);
94 }
95
96 bool isConfirmedName() const
97 {
98 return (type() == ConfirmedName);
99 }
100
101 bool isForTraining() const
102 {
103 return (type() == FaceForTraining);
104 }
105
106 void setType(Type type);
107 void setTagId(int tagId);
108 void setRegion(const TagRegion& region);
109
110 bool operator==(const FaceTagsIface& other) const;
111
115 static QStringList attributesForFlags(TypeFlags flags);
116
120 static QString attributeForType(Type type);
121
125 static Type typeForId(int tagId);
126
131 static Type typeForAttribute(const QString& attribute, int tagId = 0);
132
136 QString getAutodetectedPersonString() const;
137
143 static FaceTagsIface fromVariant(const QVariant& var);
144 QVariant toVariant() const;
145
149 static FaceTagsIface fromListing(qlonglong imageid, const QList<QVariant>& values);
150
154 void removeFaceTraining() const;
155
159 const QString hash() const;
160
161protected:
162
163 Type m_type = InvalidFace;
164 qlonglong m_imageId = 0;
165 int m_tagId = 0;
167};
168
169DIGIKAM_DATABASE_EXPORT QDebug operator<<(QDebug dbg, const FaceTagsIface& f);
170
171} // namespace Digikam
172
173Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::FaceTagsIface::TypeFlags)
Definition facetagsiface.h:34
bool isConfirmedName() const
Definition facetagsiface.h:96
bool isInvalidFace() const
Definition facetagsiface.h:71
TagRegion m_region
Definition facetagsiface.h:166
bool isForTraining() const
Definition facetagsiface.h:101
bool isUnconfirmedType() const
Definition facetagsiface.h:86
Type
Definition facetagsiface.h:38
bool isUnknownName() const
Definition facetagsiface.h:76
bool isIgnoredName() const
Definition facetagsiface.h:91
bool isUnconfirmedName() const
Definition facetagsiface.h:81
Definition tagregion.h:36
Definition datefolderview.cpp:34
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition dbengineparameters.cpp:930
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
Definition searchtextbar.cpp:40
Type
Definition gpsitemcontainer.h:36