| 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 |
* SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> |
| 10 |
* SPDX-FileCopyrightText: 2012-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 11 |
* |
| 12 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 13 |
* |
| 14 |
* ============================================================ */ |
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include "facegroup.h" |
| 19 |
|
| 20 |
// Qt includes |
| 21 |
|
| 22 |
#include <QGraphicsSceneHoverEvent> |
| 23 |
#include <QTimer> |
| 24 |
|
| 25 |
// Local includes |
| 26 |
|
| 27 |
#include "assignnamewidget_p.h" |
| 28 |
#include "digikam_debug.h" |
| 29 |
#include "addtagscombobox.h" |
| 30 |
#include "albummodel.h" |
| 31 |
#include "albumfiltermodel.h" |
| 32 |
#include "albummanager.h" |
| 33 |
#include "clickdragreleaseitem.h" |
| 34 |
#include "dimgpreviewitem.h" |
| 35 |
#include "faceitem.h" |
| 36 |
#include "facetags.h" |
| 37 |
#include "faceutils.h" |
| 38 |
#include "facetagseditor.h" |
| 39 |
#include "graphicsdimgview.h" |
| 40 |
#include "iteminfo.h" |
| 41 |
#include "taggingaction.h" |
| 42 |
#include "metaenginesettings.h" |
| 43 |
#include "itemvisibilitycontroller.h" |
| 44 |
#include "facepipelineedit.h" |
| 45 |
#include "coredbchangesets.h" |
| 46 |
#include "coredbwatch.h" |
| 47 |
|
| 48 |
namespace Digikam |
| 49 |
{ |
| 50 |
|
| 51 |
enum FaceGroupState |
| 52 |
{ |
| 53 |
NoFaces, |
| 54 |
FacesLoad, |
| 55 |
FacesLoaded |
| 56 |
}; |
| 57 |
|
| 58 |
//------------------------------------------------------------------------------- |
| 59 |
|
| 60 |
class Q_DECL_HIDDEN FaceGroup::Private |
| 61 |
{ |
| 62 |
public: |
| 63 |
|
| 64 |
explicit Private(FaceGroup* const qq); |
| 65 |
|
| 66 |
void applyVisible(); |
| 67 |
void clear(FaceGroupState fs); |
| 68 |
FaceItem* createItem(const FaceTagsIface& face); |
| 69 |
FaceItem* addItem(const FaceTagsIface& face); |
| 70 |
AssignNameWidget* createAssignNameWidget(const FaceTagsIface& face, |
| 71 |
const QVariant& identifier); |
| 72 |
AssignNameWidget::Mode assignWidgetMode(FaceTagsIface::Type type); |
| 73 |
void checkModels(); |
| 74 |
QList<QGraphicsItem*> hotItems(const QPointF& scenePos); |
| 75 |
|
| 76 |
public: |
| 77 |
|
| 78 |
/** |
| 79 |
* The maximum distance of the mouse coordinate, when a face overlay widget is shown or hidden in |
| 80 |
* the image, or whether the input widget moves up or down. |
| 81 |
*/ |
| 82 |
const qreal MaxMouseDistance = 25.0; |
| 83 |
|
| 84 |
/** |
| 85 |
* Maximum size of faces in FaceTagsIface container while processing before to clean up and create again. |
| 86 |
*/ |
| 87 |
const int MaxFaceListSize = 5; |
| 88 |
|
| 89 |
public: |
| 90 |
|
| 91 |
GraphicsDImgView* view = nullptr; |
| 92 |
ItemInfo info; |
| 93 |
bool exifRotate = true; |
| 94 |
bool autoSuggest = false; |
| 95 |
bool showOnHover = false; |
| 96 |
|
| 97 |
QList<FaceItem*> items; |
| 98 |
|
| 99 |
ClickDragReleaseItem* manuallyAddWrapItem = nullptr; |
| 100 |
FaceItem* manuallyAddedItem = nullptr; |
| 101 |
|
| 102 |
FaceGroupState state = NoFaces; |
| 103 |
ItemVisibilityController* visibilityController = nullptr; |
| 104 |
|
| 105 |
TagModel* tagModel = nullptr; |
| 106 |
CheckableAlbumFilterModel* filterModel = nullptr; |
| 107 |
TagPropertiesFilterModel* filteredModel = nullptr; |
| 108 |
|
| 109 |
FacePipelineEdit* newEditPipeline = nullptr; |
| 110 |
|
| 111 |
FaceGroup* const q = nullptr; |
| 112 |
}; |
| 113 |
|
| 114 |
} // namespace Digikam |