digiKam
facegroup.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-17
7  * Description : Managing of face tag region items on a GraphicsDImgView
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FACE_GROUP_H
26 #define DIGIKAM_FACE_GROUP_H
27 
28 // Qt includes
29 
30 #include <QObject>
31 #include <QPointF>
32 
33 class QGraphicsSceneHoverEvent;
34 
35 namespace Digikam
36 {
37 
38 class Album;
39 class ItemInfo;
40 class GraphicsDImgView;
41 class RegionFrameItem;
42 class TaggingAction;
43 
44 class FaceGroup : public QObject
45 {
46  Q_OBJECT
47  Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
48 
49 public:
50 
55  explicit FaceGroup(GraphicsDImgView* const view);
56  ~FaceGroup() override;
57 
58  bool isVisible() const;
59  ItemInfo info() const;
60  bool hasVisibleItems() const;
61 
63 
69  void setAutoSuggest(bool doAutoSuggest);
70  bool autoSuggest() const;
71 
75  void setShowOnHover(bool show);
76  bool showOnHover() const;
77 
84  RegionFrameItem* closestItem(const QPointF& p,
85  qreal* const manhattanLength = nullptr) const;
86 
87  bool acceptsMouseClick(const QPointF& scenePos);
88  void itemHoverEnterEvent(QGraphicsSceneHoverEvent* event);
89  void itemHoverMoveEvent(QGraphicsSceneHoverEvent* event);
90  void itemHoverLeaveEvent(QGraphicsSceneHoverEvent* event);
91  void leaveEvent(QEvent*);
92  void enterEvent(QEvent*);
93 
94 public Q_SLOTS:
95 
99  void setVisible(bool visible);
100  void setVisibleItem(RegionFrameItem* item);
101 
105  void setInfo(const ItemInfo& info);
106 
112  void aboutToSetInfo(const ItemInfo& info);
113 
115 
119  void addFace();
120 
124  void rejectAll();
125 
126 protected:
127 
128  void load();
129  void clear();
131 
132 protected Q_SLOTS:
133 
134  void itemStateChanged(int);
135  void startAutoSuggest();
136  void slotAlbumsUpdated(int type);
137  void slotAlbumRenamed(Album* album);
138  void slotAssigned(const TaggingAction& action, const ItemInfo& info, const QVariant& faceIdentifier);
139  void slotRejected(const ItemInfo& info, const QVariant& faceIdentifier);
140  void slotIgnored(const ItemInfo& info, const QVariant& faceIdentifier);
141  void slotLabelClicked(const ItemInfo& info, const QVariant& faceIdentifier);
142  void slotIgnoredClicked(const ItemInfo& info, const QVariant& faceIdentifier);
143  void slotAddItemStarted(const QPointF& pos);
144  void slotAddItemMoving(const QRectF& rect);
145  void slotAddItemFinished(const QRectF& rect);
146  void cancelAddItem();
147  void focusRandomFace();
148 
149 private:
150 
151  // Disable
152  FaceGroup() = delete;
153  FaceGroup(const FaceGroup&) = delete;
154  FaceGroup& operator=(const FaceGroup&) = delete;
155 
156 private:
157 
158  class Private;
159  Private* const d;
160 };
161 
162 } // namespace Digikam
163 
164 #endif // DIGIKAM_FACE_GROUP_H
Abstract base class for all album types.
Definition: album.h:67
Definition: facegroup_p.h:66
Definition: facegroup.h:45
void focusRandomFace()
Definition: facegroup.cpp:465
bool autoSuggest() const
Definition: facegroup.cpp:120
void aboutToSetInfo(const ItemInfo &info)
Definition: facegroup.cpp:163
bool acceptsMouseClick(const QPointF &scenePos)
Definition: facegroup.cpp:244
void load()
Definition: facegroup.cpp:309
void itemStateChanged(int)
Definition: facegroup.cpp:59
void startAutoSuggest()
Definition: facegroup.cpp:532
void aboutToSetInfoAfterRotate(const ItemInfo &info)
Definition: facegroup.cpp:174
bool hasVisibleItems() const
Definition: facegroup.cpp:88
void slotAssigned(const TaggingAction &action, const ItemInfo &info, const QVariant &faceIdentifier)
Definition: facegroup.cpp:410
void itemHoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Definition: facegroup.cpp:289
void itemHoverEnterEvent(QGraphicsSceneHoverEvent *event)
Definition: facegroup.cpp:293
void setShowOnHover(bool show)
Definition: facegroup.cpp:125
void leaveEvent(QEvent *)
Definition: facegroup.cpp:297
void itemHoverMoveEvent(QGraphicsSceneHoverEvent *event)
Definition: facegroup.cpp:249
void setVisibleItem(RegionFrameItem *item)
Definition: facegroup.cpp:141
bool showOnHover() const
Definition: facegroup.cpp:130
void addFace()
Definition: facegroup.cpp:540
RegionFrameItem * closestItem(const QPointF &p, qreal *const manhattanLength=nullptr) const
Definition: facegroup.cpp:211
void slotAlbumRenamed(Album *album)
Definition: facegroup.cpp:393
void setVisible(bool visible)
Definition: facegroup.cpp:135
void setAutoSuggest(bool doAutoSuggest)
Definition: facegroup.cpp:110
ItemInfo info() const
Definition: facegroup.cpp:93
void slotAddItemFinished(const QRectF &rect)
Definition: facegroup.cpp:581
void rejectAll()
Definition: facegroup.cpp:365
void slotAddItemStarted(const QPointF &pos)
Definition: facegroup.cpp:564
void applyItemGeometryChanges()
Definition: facegroup.cpp:623
~FaceGroup() override
Definition: facegroup.cpp:54
QList< RegionFrameItem * > items() const
Definition: facegroup.cpp:98
bool isVisible() const
Definition: facegroup.cpp:83
void slotAlbumsUpdated(int type)
Definition: facegroup.cpp:377
void clear()
Definition: facegroup.cpp:351
void cancelAddItem()
Definition: facegroup.cpp:610
void slotIgnored(const ItemInfo &info, const QVariant &faceIdentifier)
Definition: facegroup.cpp:494
void slotLabelClicked(const ItemInfo &info, const QVariant &faceIdentifier)
Definition: facegroup.cpp:510
void enterEvent(QEvent *)
Definition: facegroup.cpp:305
void slotRejected(const ItemInfo &info, const QVariant &faceIdentifier)
Definition: facegroup.cpp:480
bool visible
Definition: facegroup.h:47
void slotIgnoredClicked(const ItemInfo &info, const QVariant &faceIdentifier)
Definition: facegroup.cpp:521
void slotAddItemMoving(const QRectF &rect)
Definition: facegroup.cpp:569
void setInfo(const ItemInfo &info)
Definition: facegroup.cpp:147
Definition: graphicsdimgview.h:44
Definition: iteminfo.h:78
Definition: regionframeitem.h:43
Definition: taggingaction.h:36
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43