File indexing completed on 2025-01-05 03:51:10
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-10-14 0007 * Description : overlay for assigning names to faces 0008 * 0009 * SPDX-FileCopyrightText: 2010 by Aditya Bhatt <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_ASSIGN_NAME_OVERLAY_H 0018 #define DIGIKAM_ASSIGN_NAME_OVERLAY_H 0019 0020 // Qt includes 0021 0022 #include <QAbstractItemView> 0023 0024 // Local includes 0025 0026 #include "itemdelegateoverlay.h" 0027 #include "itemviewdelegate.h" 0028 0029 namespace Digikam 0030 { 0031 0032 class AssignNameWidget; 0033 class FaceTagsIface; 0034 class ItemInfo; 0035 class TaggingAction; 0036 0037 class AssignNameOverlay : public PersistentWidgetDelegateOverlay 0038 { 0039 Q_OBJECT 0040 REQUIRE_DELEGATE(ItemViewDelegate) 0041 0042 public: 0043 0044 explicit AssignNameOverlay(QObject* const parent); 0045 ~AssignNameOverlay() override; 0046 0047 AssignNameWidget* assignNameWidget() const; 0048 0049 Q_SIGNALS: 0050 0051 void confirmFaces(const QList<QModelIndex>& indexes, int tagId); 0052 void unknownFaces(const QList<QModelIndex>& indexes); 0053 void removeFaces(const QList<QModelIndex>& indexes); 0054 void ignoreFaces(const QList<QModelIndex>& indexes); 0055 0056 protected Q_SLOTS: 0057 0058 void slotAssigned(const TaggingAction& action, const ItemInfo&, const QVariant& faceIdentifier); 0059 void slotRejected(const ItemInfo&, const QVariant& faceIdentifier); 0060 void slotIgnored(const ItemInfo&, const QVariant& faceIdentifier); 0061 void slotUnknown(const ItemInfo&, const QVariant& faceIdentifier); 0062 0063 protected: 0064 0065 QWidget* createWidget() override; 0066 void setActive(bool) override; 0067 void visualChange() override; 0068 void showOnIndex(const QModelIndex& index) override; 0069 void hide() override; 0070 bool checkIndex(const QModelIndex& index) const override; 0071 void viewportLeaveEvent(QObject* obj, QEvent* event) override; 0072 void widgetEnterEvent() override; 0073 void widgetLeaveEvent() override; 0074 void setFocusOnWidget() override; 0075 bool eventFilter(QObject* o, QEvent* e) override; 0076 0077 void updatePosition(); 0078 void updateFace(); 0079 0080 private: 0081 0082 // Disable 0083 AssignNameOverlay() = delete; 0084 0085 private: 0086 0087 class Private; 0088 Private* const d; 0089 }; 0090 0091 } // namespace Digikam 0092 0093 #endif // DIGIKAM_ASSIGN_NAME_OVERLAY_H