1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2009-04-24 7 * Description : Qt model-view for items 8 * 9 * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 10 * Copyright (C) 2009-2021 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_DIGIKAMITEM_VIEW_H 26 #define DIGIKAM_DIGIKAMITEM_VIEW_H 27 28 // Local includes 29 30 #include "applicationsettings.h" 31 #include "itemcategorizedview.h" 32 #include "itemviewutilities.h" 33 #include "groupingviewimplementation.h" 34 35 namespace Digikam 36 { 37 38 class ItemViewUtilities; 39 class ItemInfoList; 40 41 class DigikamItemView : public ItemCategorizedView, 42 public GroupingViewImplementation 43 { 44 Q_OBJECT 45 46 public: 47 48 explicit DigikamItemView(QWidget* const parent = nullptr); 49 ~DigikamItemView() override; 50 51 ItemViewUtilities* utilities() const; 52 53 int fitToWidthIcons(); 54 bool getFaceMode() const; 55 56 void setThumbnailSize(const ThumbnailSize& size) override; 57 58 ItemInfoList allItemInfos(bool grouping = false) const; 59 ItemInfoList selectedItemInfos(bool grouping = false) const; 60 ItemInfoList selectedItemInfosCurrentFirst(bool grouping = false) const; 61 bool allNeedGroupResolving(const ApplicationSettings::OperationType type) const; 62 bool selectedNeedGroupResolving(const ApplicationSettings::OperationType type) const; 63 64 public Q_SLOTS: 65 66 void openFile(const ItemInfo& info); 67 68 void deleteSelected(const ItemViewUtilities::DeleteMode deleteMode = ItemViewUtilities::DeleteUseTrash); 69 void deleteSelectedDirectly(const ItemViewUtilities::DeleteMode deleteMode = ItemViewUtilities::DeleteUseTrash); 70 71 void rename(); 72 73 void assignRating(const QList<QModelIndex>& index, int rating); 74 75 void setFaceMode(bool on); 76 void confirmFaces(const QList<QModelIndex>& indexes, int tagId); 77 78 /** 79 * Removes the face from the database. 80 * You will have to run face detection again, 81 * to recover the face. 82 */ 83 void removeFaces(const QList<QModelIndex>& indexes); 84 85 /** 86 * Ignored Face back to Unknown face. 87 */ 88 void unknownFaces(const QList<QModelIndex>& indexes); 89 90 /** 91 * This slot is connected to the reject signal of 92 * AssignNameOverlay, and handles two cases. 93 * 94 * If reject is done on an Unknown Face, 95 * it will mark the face as Ignored. 96 * 97 * If reject is done on Unconfirmed suggestions, 98 * the suggestion is rejected and the face is 99 * marked as Unknown. 100 */ 101 void rejectFaces(const QList<QModelIndex>& indexes); 102 103 void dragDropSort(const ItemInfo& pick, const QList<ItemInfo>& infos); 104 105 Q_SIGNALS: 106 107 void previewRequested(const ItemInfo& info); 108 void signalSeparationModeChanged(int category); 109 void signalShowContextMenu(QContextMenuEvent* event, 110 const QList<QAction*>& actions = QList<QAction*>()); 111 112 void signalShowContextMenuOnInfo(QContextMenuEvent* event, const ItemInfo& info, 113 const QList<QAction*>& actions, 114 ItemFilterModel* filterModel); 115 116 void signalShowGroupContextMenu(QContextMenuEvent* event, 117 const QList<ItemInfo>& selectedInfos, 118 ItemFilterModel* filterModel); 119 120 protected Q_SLOTS: 121 122 void groupIndicatorClicked(const QModelIndex& index); 123 void showGroupContextMenu(const QModelIndex& index, QContextMenuEvent* event); 124 125 protected: 126 127 void addRejectionOverlay(ItemDelegate* delegate = nullptr); 128 void addAssignNameOverlay(ItemDelegate* delegate = nullptr); 129 130 void activated(const ItemInfo& info, Qt::KeyboardModifiers modifiers) override; 131 void showContextMenuOnInfo(QContextMenuEvent* event, const ItemInfo& info) override; 132 void showContextMenu(QContextMenuEvent* event) override; 133 void slotSetupChanged() override; 134 135 bool hasHiddenGroupedImages(const ItemInfo& info) const override; 136 137 ItemInfoList imageInfos(const QList<QModelIndex>& indexes, 138 ApplicationSettings::OperationType type) const; 139 140 private Q_SLOTS: 141 142 void slotRotateLeft(const QList<QModelIndex>&); 143 void slotRotateRight(const QList<QModelIndex>&); 144 void slotFullscreen(const QList<QModelIndex>&); 145 void slotInitProgressIndicator(); 146 147 private: 148 149 class Private; 150 Private* const d; 151 }; 152 153 } // namespace Digikam 154 155 #endif // DIGIKAM_DIGIKAMITEM_VIEW_H 156