File indexing completed on 2025-01-19 03:57:57
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-09-12 0007 * Description : Widget for assignment and confirmation of names for faces 0008 * 0009 * SPDX-FileCopyrightText: 2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com> 0010 * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * SPDX-FileCopyrightText: 2012-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_WIDGET_P_H 0018 #define DIGIKAM_ASSIGN_NAME_WIDGET_P_H 0019 0020 #include "assignnamewidget.h" 0021 0022 // Qt includes 0023 0024 #include <QGridLayout> 0025 #include <QKeyEvent> 0026 #include <QToolButton> 0027 #include <QApplication> 0028 #include <QIcon> 0029 0030 // KDE includes 0031 0032 #include <klocalizedstring.h> 0033 0034 // Local includes 0035 0036 #include "dexpanderbox.h" 0037 #include "digikam_debug.h" 0038 #include "addtagscombobox.h" 0039 #include "addtagslineedit.h" 0040 #include "album.h" 0041 #include "albummanager.h" 0042 #include "albumtreeview.h" 0043 #include "facetagsiface.h" 0044 #include "facetags.h" 0045 #include "dimg.h" 0046 #include "iteminfo.h" 0047 #include "thememanager.h" 0048 #include "applicationsettings.h" 0049 0050 namespace Digikam 0051 { 0052 0053 class Q_DECL_HIDDEN AssignNameWidget::Private 0054 { 0055 public: 0056 0057 explicit Private(AssignNameWidget* const q); 0058 0059 bool isValid() const; 0060 0061 void updateModes(); 0062 void updateContents(); 0063 0064 /** 0065 * Reject button shows different Tooltips and icons for 0066 * Unconfirmed and Unknown faces, however both 0067 * are of type UnconfirmedEditMode. 0068 * This method is responsible for the Tooltip updates. 0069 */ 0070 void updateRejectButton(); 0071 0072 void updateIgnoreButton(); 0073 0074 private: 0075 0076 void clearWidgets(); 0077 void checkWidgets(); 0078 void updateLayout(); 0079 void updateVisualStyle(); 0080 0081 QToolButton* createToolButton(const QIcon& icon, 0082 const QString& text, 0083 const QString& tip = QString()) const; 0084 0085 QWidget* addTagsWidget() const; 0086 0087 template <class T> void setupAddTagsWidget(T* const widget); 0088 template <class T> void setAddTagsWidgetContents(T* const widget); 0089 0090 void layoutAddTagsWidget(bool exceedBounds, int minimumContentsLength); 0091 void setSizePolicies(QSizePolicy::Policy h, QSizePolicy::Policy v); 0092 void setToolButtonStyles(Qt::ToolButtonStyle style); 0093 QString styleSheetFontDescriptor(const QFont& font) const; 0094 0095 public: 0096 0097 ItemInfo info; 0098 QVariant faceIdentifier; 0099 AlbumPointer<TAlbum> currentTag; 0100 0101 Mode mode; 0102 LayoutMode layoutMode; 0103 VisualStyle visualStyle; 0104 TagEntryWidgetMode widgetMode; 0105 0106 AddTagsComboBox* comboBox; 0107 AddTagsLineEdit* lineEdit; 0108 QToolButton* confirmButton; 0109 QToolButton* rejectButton; 0110 QToolButton* ignoreButton; 0111 DClickLabel* clickLabel; 0112 0113 bool modelsGiven; 0114 TagModel* tagModel; 0115 CheckableAlbumFilterModel* tagFilterModel; 0116 TagPropertiesFilterModel* tagFilteredModel; 0117 AlbumPointer<TAlbum> parentTag; 0118 0119 QGridLayout* layout; 0120 0121 AssignNameWidget* const q; 0122 }; 0123 0124 } // namespace Digikam 0125 0126 #endif // DIGIKAM_ASSIGN_NAME_WIDGET_P_H