digiKam
assignnamewidget.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-12
7  * Description : Widget for assignment and confirmation of names for faces
8  *
9  * Copyright (C) 2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com>
10  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_ASSIGN_NAME_WIDGET_H
27 #define DIGIKAM_ASSIGN_NAME_WIDGET_H
28 
29 // Qt includes
30 
31 #include <QFrame>
32 #include <QVariant>
33 
34 namespace Digikam
35 {
36 
37 class AddTagsComboBox;
38 class AddTagsLineEdit;
40 class FaceTagsIface;
41 class ItemInfo;
42 class TAlbum;
43 class TaggingAction;
44 class TagModel;
46 
47 class AssignNameWidget : public QFrame
48 {
49  Q_OBJECT
50  Q_PROPERTY(Mode mode READ mode WRITE setMode)
52  Q_PROPERTY(LayoutMode layoutMode READ layoutMode WRITE setLayoutMode)
53  Q_PROPERTY(VisualStyle visualStyle READ visualStyle WRITE setVisualStyle)
54 
55 public:
56 
57  enum Mode
58  {
64  };
65  Q_ENUM(Mode)
66 
68  {
72  };
73  Q_ENUM(TagEntryWidgetMode)
74 
76  {
80  Compact
81  };
82  Q_ENUM(LayoutMode)
83 
85  {
90  };
91  Q_ENUM(VisualStyle)
92 
93 public:
94 
98  explicit AssignNameWidget(QWidget* const parent = nullptr);
99  ~AssignNameWidget() override;
100 
104  void setAlbumModels(TagModel* const model,
105  TagPropertiesFilterModel* const filteredModel,
106  CheckableAlbumFilterModel* const filterModel);
107  void setDefaultModel();
108 
109  void setMode(Mode mode);
110  Mode mode() const;
111 
114 
116  LayoutMode layoutMode() const;
117 
118  void setVisualStyle(VisualStyle style);
119  VisualStyle visualStyle() const;
120 
121  ItemInfo info() const;
122  QVariant faceIdentifier() const;
123 
125  AddTagsComboBox* comboBox() const;
126  AddTagsLineEdit* lineEdit() const;
127 
128 public Q_SLOTS:
129 
133  void setUserData(const ItemInfo& info, const QVariant& faceIdentifier = QVariant());
134 
138  void setCurrentTag(int tagId);
139  void setCurrentTag(TAlbum* album);
140  void setCurrentFace(const FaceTagsIface& face);
141 
145  void setParentTag(TAlbum* album);
146 
147 Q_SIGNALS:
148 
154  void assigned(const TaggingAction& action, const ItemInfo& info, const QVariant& faceIdentifier);
155 
160  void rejected(const ItemInfo& info, const QVariant& faceIdentifier);
161 
162  void ignored(const ItemInfo& info, const QVariant& faceIdentifier);
163 
167  void ignoredClicked(const ItemInfo& info, const QVariant& faceIdentifier);
168 
172  void labelClicked(const ItemInfo& info, const QVariant& faceIdentifier);
173 
179  void selected(const TaggingAction& action, const ItemInfo& info, const QVariant& faceIdentifier);
180 
181 protected:
182 
183  void keyPressEvent(QKeyEvent* e) override;
184  void showEvent(QShowEvent* e) override;
185 
186 protected Q_SLOTS:
187 
188  void slotConfirm();
189  void slotReject();
190  void slotIgnore();
191  void slotActionActivated(const TaggingAction& action);
192  void slotActionSelected(const TaggingAction& action);
193  void slotIgnoredClicked();
194  void slotLabelClicked();
195 
196 private:
197 
198  class Private;
199  Private* const d;
200 };
201 
202 } // namespace Digikam
203 
204 #endif // DIGIKAM_ASSIGN_NAME_WIDGET_H
Definition: addtagscombobox.h:49
Definition: addtagslineedit.h:46
Definition: assignnamewidget_p.h:63
Definition: assignnamewidget.h:48
void setCurrentFace(const FaceTagsIface &face)
Definition: assignnamewidget.cpp:222
void slotIgnore()
Definition: assignnamewidget.cpp:273
void labelClicked(const ItemInfo &info, const QVariant &faceIdentifier)
LayoutMode layoutMode
Definition: assignnamewidget.h:52
void slotIgnoredClicked()
Definition: assignnamewidget.cpp:293
void selected(const TaggingAction &action, const ItemInfo &info, const QVariant &faceIdentifier)
AssignNameWidget(QWidget *const parent=nullptr)
Definition: assignnamewidget.cpp:31
AddTagsLineEdit * lineEdit() const
Definition: assignnamewidget.cpp:104
void slotConfirm()
Definition: assignnamewidget.cpp:256
void assigned(const TaggingAction &action, const ItemInfo &info, const QVariant &faceIdentifier)
void setParentTag(TAlbum *album)
Definition: assignnamewidget.cpp:85
void setUserData(const ItemInfo &info, const QVariant &faceIdentifier=QVariant())
Definition: assignnamewidget.cpp:187
Mode
Definition: assignnamewidget.h:58
@ InvalidMode
Definition: assignnamewidget.h:59
@ ConfirmedEditMode
Definition: assignnamewidget.h:62
@ IgnoredMode
Definition: assignnamewidget.h:63
@ ConfirmedMode
Definition: assignnamewidget.h:61
@ UnconfirmedEditMode
Definition: assignnamewidget.h:60
void setMode(Mode mode)
Definition: assignnamewidget.cpp:109
void slotActionSelected(const TaggingAction &action)
Definition: assignnamewidget.cpp:283
void setCurrentTag(int tagId)
Definition: assignnamewidget.cpp:234
void setVisualStyle(VisualStyle style)
Definition: assignnamewidget.cpp:171
TagEntryWidgetMode tagEntryWidgetMode
Definition: assignnamewidget.h:51
LayoutMode
Definition: assignnamewidget.h:76
@ FullLine
Definition: assignnamewidget.h:78
@ InvalidLayout
Definition: assignnamewidget.h:77
@ Compact
Definition: assignnamewidget.h:80
@ TwoLines
Definition: assignnamewidget.h:79
Mode mode
Definition: assignnamewidget.h:50
void ignoredClicked(const ItemInfo &info, const QVariant &faceIdentifier)
void setDefaultModel()
Definition: assignnamewidget.cpp:44
void slotActionActivated(const TaggingAction &action)
Definition: assignnamewidget.cpp:278
void slotReject()
Definition: assignnamewidget.cpp:268
AddTagsComboBox * comboBox() const
The combo box or line edit in use, if any.
Definition: assignnamewidget.cpp:99
void setAlbumModels(TagModel *const model, TagPropertiesFilterModel *const filteredModel, CheckableAlbumFilterModel *const filterModel)
Definition: assignnamewidget.cpp:49
QVariant faceIdentifier() const
Definition: assignnamewidget.cpp:217
void showEvent(QShowEvent *e) override
Definition: assignnamewidget.cpp:323
void ignored(const ItemInfo &info, const QVariant &faceIdentifier)
void slotLabelClicked()
Definition: assignnamewidget.cpp:298
void keyPressEvent(QKeyEvent *e) override
Definition: assignnamewidget.cpp:303
void rejected(const ItemInfo &info, const QVariant &faceIdentifier)
VisualStyle
Definition: assignnamewidget.h:85
@ TranslucentThemedFrameless
Definition: assignnamewidget.h:89
@ InvalidVisualStyle
Definition: assignnamewidget.h:86
@ StyledFrame
Definition: assignnamewidget.h:87
@ TranslucentDarkRound
Definition: assignnamewidget.h:88
void setTagEntryWidgetMode(TagEntryWidgetMode mode)
Definition: assignnamewidget.cpp:137
TagEntryWidgetMode
Definition: assignnamewidget.h:68
@ AddTagsLineEditMode
Definition: assignnamewidget.h:71
@ InvalidTagEntryWidgetMode
Definition: assignnamewidget.h:69
@ AddTagsComboBoxMode
Definition: assignnamewidget.h:70
~AssignNameWidget() override
Definition: assignnamewidget.cpp:39
void setLayoutMode(LayoutMode mode)
Definition: assignnamewidget.cpp:154
VisualStyle visualStyle
Definition: assignnamewidget.h:53
ItemInfo info() const
Definition: assignnamewidget.cpp:212
Definition: albumfiltermodel.h:294
Definition: facetagsiface.h:44
Definition: iteminfo.h:78
Definition: album.h:420
Definition: albummodel.h:63
Definition: albumfiltermodel.h:376
Definition: taggingaction.h:36
Definition: datefolderview.cpp:43