digiKam
itemiconview.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 : 2002-16-10
7  * Description : Item icon view interface.
8  *
9  * Copyright (C) 2002-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2002-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2009-2011 by Johannes Wienke <languitar at semipol dot de>
12  * Copyright (C) 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_ITEM_ICON_VIEW_H
28 #define DIGIKAM_ITEM_ICON_VIEW_H
29 
30 // Qt includes
31 
32 #include <QStringList>
33 #include <QUrl>
34 
35 // Local includes
36 
37 #include "digikam_config.h"
38 #include "applicationsettings.h"
39 #include "metaengine_rotation.h"
40 #include "searchtextbar.h"
41 #include "iteminfo.h"
42 #include "dmodelfactory.h"
43 #include "sidebarwidget.h"
44 #include "stackedview.h"
45 #include "dlayoutbox.h"
46 
47 namespace Digikam
48 {
49 
50 class AlbumIconItem;
51 class Album;
52 class PAlbum;
53 class TAlbum;
54 class BatchSyncMetadata;
55 class FilterStatusBar;
56 class DCategorizedView;
57 class ItemFilterModel;
58 
59 class ItemIconView : public DHBox
60 {
61  Q_OBJECT
62 
63 public:
64 
65  explicit ItemIconView(QWidget* const parent,
66  DModelFactory* const modelCollection);
67  ~ItemIconView() override;
68 
69  void applySettings();
70 
71 private:
72 
73  void setupConnections();
74  void loadViewState();
75  void saveViewState();
76 
77  // ----------------------------------------------------------------------------------------
78 
80 
82 public Q_SLOTS:
83 
84  void slotImageEdit();
85  void slotEditor();
86  void slotLightTable();
87  void slotQueueMgr();
89  void slotImageLightTable();
94 
96 
97  // ----------------------------------------------------------------------------------------
98 
100 
102 public:
103 
104  double zoomMin() const;
105  double zoomMax() const;
106  void setThumbSize(int size);
107 
108 Q_SIGNALS:
109 
110  void signalZoomChanged(double);
112 
113 private:
114 
115  void toggleZoomActions();
116 
117 public Q_SLOTS:
118 
119  void setZoomFactor(double zoom);
120  void slotZoomIn();
121  void slotZoomOut();
122  void slotZoomTo100Percents();
123  void slotFitToWindow();
124 
125 private Q_SLOTS:
126 
127  void slotZoomFactorChanged(double);
128  void slotThumbSizeEffect();
129 
131 
132  // ----------------------------------------------------------------------------------------
133 
135 
137  // ----------------------------------------------------------------------------------------
138 
140 
142 public Q_SLOTS:
143 
144  void slotImageQualitySorter();
145 
147 
148  // ----------------------------------------------------------------------------------------
149 
150 public:
151 
153 
154  void showSideBars();
155  void hideSideBars();
156  void toggleLeftSidebar();
157  void toggleRightSidebar();
158  void previousLeftSideBarTab();
159  void nextLeftSideBarTab();
161  void nextRightSideBarTab();
162 
163 public Q_SLOTS:
164 
165  void slotNotificationError(const QString& message, int type);
166 
167  void slotLeftSideBarActivate(QWidget* widget);
171 
175 
176 Q_SIGNALS:
177 
178  void signalChangedTab(QWidget*);
179  void signalFuzzySidebarActive(bool active);
180 
181 private Q_SLOTS:
182 
183  void slotLeftSidebarChangedTab(QWidget* w);
184  void slotSidebarTabTitleStyleChanged();
185  void slotPopupFiltersView();
187 
188  // ----------------------------------------------------------------------------------------
189 
191 
193 public:
194 
202  void setAllGroupsOpen(bool open);
203 
204 public Q_SLOTS:
205 
211  void slotUngroupSelected();
212 
213 private Q_SLOTS:
214 
215  void slotEmptyMessageTimer();
217 
218  // ----------------------------------------------------------------------------------------
219 
221 
223 public:
224 
225  Album* currentAlbum() const;
226  void setRecurseAlbums(bool recursive);
227  void clearHistory();
228  void getForwardHistory(QStringList& titles);
229  void getBackwardHistory(QStringList& titles);
230 
231 public Q_SLOTS:
232 
233  void slotRefresh();
234  void slotNewAlbum();
235  void slotSortAlbums(int role);
236  void slotDeleteAlbum();
237  void slotRenameAlbum();
238  void slotAlbumPropsEdit();
240  void slotAlbumHistoryBack(int steps = 1);
241  void slotAlbumHistoryForward(int steps = 1);
242  void slotAlbumWriteMetadata();
243  void slotAlbumReadMetadata();
244  void slotAlbumSelected(const QList<Album*>& albums);
245 
246  void slotGotoAlbumAndItem(const ItemInfo& imageInfo);
247  void slotGotoDateAndItem(const ItemInfo& imageInfo);
248  void slotGotoTagAndItem(int tagID);
249 
250  void slotSelectAlbum(const QUrl& url);
251  void slotSetCurrentUrlWhenAvailable(const QUrl& url);
252  void slotSetCurrentWhenAvailable(const qlonglong id);
253 
254  void slotSetAsAlbumThumbnail(const ItemInfo& info);
256  void slotCopySelectionTo();
257 
258 Q_SIGNALS:
259 
261 
262 private:
263 
264  void changeAlbumFromHistory(const QList<Album*>& album, QWidget* const widget);
265 
266 private Q_SLOTS:
267 
268  void slotAllAlbumsLoaded();
269  void slotAlbumsCleared();
270  void slotAlbumRefreshComplete();
272 
273  // ----------------------------------------------------------------------------------------
274 
276 
278 public Q_SLOTS:
279 
280  void slotNewKeywordSearch();
281  void slotNewAdvancedSearch();
282  void slotNewDuplicatesSearch(const QList<PAlbum*>& albums = {});
283  void slotNewDuplicatesSearch(const QList<TAlbum*>& albums);
284  void slotImageFindSimilar();
285  void slotImageScanForFaces();
287 
288  // ----------------------------------------------------------------------------------------
289 
291 
293 public:
294 
295  void setRecurseTags(bool recursive);
296  void toggleTag(int tagID);
297 
298 public Q_SLOTS:
299 
300  void slotNewTag();
301  void slotDeleteTag();
302  void slotEditTag();
303  void slotOpenTagsManager();
304  void slotAssignTag();
305  void slotAssignPickLabel(int pickId);
306  void slotAssignColorLabel(int colorId);
307  void slotAssignRating(int rating);
308  void slotAssignTag(int tagID);
309  void slotRemoveTag(int tagID);
310 
311 private Q_SLOTS:
312 
313  //void slotRatingChanged(const QUrl&, int);
314  //void slotColorLabelChanged(const QUrl&, int);
315  //void slotPickLabelChanged(const QUrl&, int);
316  //void slotToggleTag(const QUrl&, int);
317 
319 
320  // ----------------------------------------------------------------------------------------
321 
323 
325 public:
326 
327  int itemCount() const;
328  QUrl currentUrl() const;
329  bool hasCurrentItem() const;
330  ItemInfo currentInfo() const;
331 
339  QList<QUrl> selectedUrls(bool grouping = false) const;
341  ItemInfoList selectedInfoList(const bool currentFirst = false,
342  const bool grouping = false) const;
344  const bool currentFirst = false) const;
350  QList<QUrl> allUrls(bool grouping = false) const;
351  ItemInfoList allInfo(const bool grouping = false) const;
353 
355 
356 Q_SIGNALS:
357 
359  void signalSeparationModeChanged(int category);
360  void signalSelectionChanged(int numberOfSelectedItems);
361  void signalTrashSelectionChanged(const QString& text);
362  void signalImageSelected(const ItemInfoList& selectedImage,
363  const ItemInfoList& allImages);
364 
365 public Q_SLOTS:
366 
367  void slotImagePreview();
368  void slotMapWidgetView();
369  void slotTableView();
370  void slotIconView();
371  void slotImageExifOrientation(int orientation);
372  void slotImageRename();
373  void slotImageDelete();
376  void slotImageTrashDirectly();
377  void slotImageWriteMetadata();
378  void slotImageReadMetadata();
379  void slotSelectAll();
380  void slotSelectNone();
381  void slotSelectInvert();
382  void slotSortImages(int order);
383  void slotSortImagesOrder(int order);
384  void slotSeparateImages(int mode);
385  void slotImageSeparationSortOrder(int order);
386  void slotImagePaste();
387  void slotFocusAndNextImage();
388 
389 private Q_SLOTS:
390 
391  void slotFirstItem();
392  void slotPrevItem();
393  void slotNextItem();
394  void slotLastItem();
395  void slotSelectItemByUrl(const QUrl&);
396  void slotAwayFromSelection();
397  void slotImageSelected();
398  void slotDispatchImageSelected();
399  void slotImageChangeFailed(const QString& message, const QStringList& fileNames);
401 
402  // ----------------------------------------------------------------------------------------
403 
405 
407 public:
408 
409  void setToolsIconView(DCategorizedView* const view);
410  void toggleShowBar(bool);
411  void toggleFullScreen(bool set);
412  void refreshView();
413  void connectIconViewFilter(FilterStatusBar* const filter);
415 
416 Q_SIGNALS:
417 
423 
425  void signalGotoDateAndItem(AlbumIconItem*);
426  void signalGotoTagAndItem(int tagID);
427 
428 private Q_SLOTS:
429 
430  void slotTogglePreviewMode(const ItemInfo& info);
431  void slotEscapePreview();
432  void slotRefreshImagePreview();
433  void slotViewModeChanged();
434  void slotSetupMetadataFilters(int);
435  void slotSetupExifTool();
436 
437  void slotShowContextMenu(QContextMenuEvent* event,
438  const QList<QAction*>& extraGroupingActions = QList<QAction*>());
439 
440  void slotShowContextMenuOnInfo(QContextMenuEvent* event, const ItemInfo& info,
441  const QList<QAction*>& extraGroupingActions = QList<QAction*>(),
442  ItemFilterModel* imageFilterModel = nullptr);
443 
444  void slotShowGroupContextMenu(QContextMenuEvent* event,
445  const QList<ItemInfo>& selectedInfos,
446  ItemFilterModel* imageFilterModel = nullptr);
448 
449  // ----------------------------------------------------------------------------------------
450 
451 private:
452 
453  class Private;
454  Private* const d;
455 };
456 
457 } // namespace Digikam
458 
459 #endif // DIGIKAM_ITEM_ICON_VIEW_H
Abstract base class for all album types.
Definition: album.h:67
OperationType
Definition: applicationsettings.h:99
Item view for listing items.
Definition: dcategorizedview.h:49
Definition: dlayoutbox.h:45
Definition: dmodelfactory.h:49
Definition: filterstatusbar.h:39
Definition: itemfiltermodel.h:125
Definition: itemiconview_p.h:121
Definition: itemiconview.h:60
void refreshView()
Definition: itemiconview_views.cpp:234
QList< QUrl > allUrls(bool grouping=false) const
Definition: itemiconview_items.cpp:35
void applySettings()
Definition: itemiconview.cpp:255
void nextLeftSideBarTab()
Definition: itemiconview_sidebars.cpp:69
void slotSeparateImages(int mode)
Definition: itemiconview_items.cpp:366
void setToolsIconView(DCategorizedView *const view)
Views management methods - itemiconview_views.cpp.
Definition: itemiconview_views.cpp:227
void slotLeftSideBarActivateAlbums()
Definition: itemiconview_sidebars.cpp:91
void signalSeparationModeChanged(int category)
Album * currentAlbum() const
Album management methods - itemiconview_album.cpp.
Definition: itemiconview_albums.cpp:398
void slotImageWriteMetadata()
Definition: itemiconview_items.cpp:203
void signalGotoTagAndItem(int tagID)
ItemInfo currentInfo() const
Definition: itemiconview_items.cpp:448
void slotFileWithDefaultApplication()
Definition: itemiconview_tools.cpp:49
void setAllGroupsOpen(bool open)
Definition: itemiconview_groups.cpp:75
void slotImageReadMetadata()
Definition: itemiconview_items.cpp:210
void signalChangedTab(QWidget *)
void slotRemoveTag(int tagID)
Definition: itemiconview_tags.cpp:122
void slotCreateGroupByTimeFromSelection()
Definition: itemiconview_groups.cpp:90
void slotImageRename()
Definition: itemiconview_items.cpp:226
void signalFuzzySidebarActive(bool active)
void slotQueueMgr()
Definition: itemiconview_tools.cpp:70
void signalGotoAlbumAndItem(const ItemInfo &)
void slotRightSideBarActivateComments()
Definition: itemiconview_sidebars.cpp:117
void slotImageExifOrientation(int orientation)
Definition: itemiconview_items.cpp:436
void slotImageSeparationSortOrder(int order)
Definition: itemiconview_items.cpp:379
void slotImageAddToNewQueue()
Definition: itemiconview_tools.cpp:130
void slotSelectAlbum(const QUrl &url)
Definition: itemiconview_albums.cpp:149
void slotLeftSideBarActivateTags()
Definition: itemiconview_sidebars.cpp:96
void slotRefresh()
Definition: itemiconview_albums.cpp:429
void nextRightSideBarTab()
Definition: itemiconview_sidebars.cpp:79
void slotAssignRating(int rating)
Definition: itemiconview_tags.cpp:100
void setRecurseAlbums(bool recursive)
Definition: itemiconview_albums.cpp:393
void slotGotoAlbumAndItem(const ItemInfo &imageInfo)
Definition: itemiconview_albums.cpp:235
void slotImagePaste()
Definition: itemiconview_items.cpp:392
void slotSelectInvert()
Definition: itemiconview_items.cpp:324
void slotMapWidgetView()
Definition: itemiconview_views.cpp:69
void slotRightSideBarActivateTitles()
Definition: itemiconview_sidebars.cpp:111
StackedView::StackedViewMode viewMode() const
Definition: itemiconview_views.cpp:207
void slotImageScanForFaces()
Definition: itemiconview_search.cpp:71
void slotZoomTo100Percents()
Definition: itemiconview_zoom.cpp:127
void slotOpenTagsManager()
Definition: itemiconview_tags.cpp:193
void slotAssignPickLabel(int pickId)
Definition: itemiconview_tags.cpp:66
void slotDeleteTag()
Definition: itemiconview_tags.cpp:173
QUrl currentUrl() const
Definition: itemiconview_items.cpp:544
void slotSetCurrentUrlWhenAvailable(const QUrl &url)
Definition: itemiconview_items.cpp:551
void slotAlbumWriteMetadata()
Definition: itemiconview_albums.cpp:366
void slotGotoTagAndItem(int tagID)
Definition: itemiconview_albums.cpp:279
void slotAssignTag()
Definition: itemiconview_tags.cpp:201
void slotEditTag()
Definition: itemiconview_tags.cpp:183
void getForwardHistory(QStringList &titles)
Definition: itemiconview_albums.cpp:497
void slotTableView()
Definition: itemiconview_views.cpp:74
void slotSortImages(int order)
Definition: itemiconview_items.cpp:338
void slotIconView()
Definition: itemiconview_views.cpp:79
void slotAlbumPropsEdit()
Definition: itemiconview_albums.cpp:361
void slotAlbumSelected(const QList< Album * > &albums)
Definition: itemiconview_albums.cpp:163
void slotRightSideBarActivateAssignedTags()
Definition: itemiconview_sidebars.cpp:123
void toggleTag(int tagID)
Definition: itemiconview_tags.cpp:40
void toggleShowBar(bool)
Definition: itemiconview_views.cpp:198
void toggleLeftSidebar()
Definition: itemiconview_sidebars.cpp:52
void signalSelectionChanged(int numberOfSelectedItems)
void slotFocusAndNextImage()
Definition: itemiconview_items.cpp:425
void slotImageTrashDirectly()
Definition: itemiconview_items.cpp:282
void slotAssignColorLabel(int colorId)
Definition: itemiconview_tags.cpp:83
void slotSortAlbums(int role)
Definition: itemiconview_albums.cpp:52
void setZoomFactor(double zoom)
Definition: itemiconview_zoom.cpp:45
void signalSwitchedToTableView()
ItemInfoList allInfo(const bool grouping=false) const
Definition: itemiconview_items.cpp:514
double zoomMin() const
Zoom management methods - itemiconview_zoom.cpp.
Definition: itemiconview_zoom.cpp:35
bool allNeedGroupResolving(const ApplicationSettings::OperationType type) const
Item Group methods - itemiconview_groups.cpp.
Definition: itemiconview_groups.cpp:35
void slotImageLightTable()
Definition: itemiconview_tools.cpp:102
void hideSideBars()
Definition: itemiconview_sidebars.cpp:46
void slotMoveSelectionToAlbum()
Definition: itemiconview_albums.cpp:423
void slotCreateGroupByTimelapseFromSelection()
Definition: itemiconview_groups.cpp:100
void slotNotificationError(const QString &message, int type)
Definition: itemiconview_sidebars.cpp:84
void imageTransform(MetaEngineRotation::TransformationAction transform)
Definition: itemiconview_items.cpp:442
bool selectedNeedGroupResolving(const ApplicationSettings::OperationType type) const
Definition: itemiconview_groups.cpp:55
void slotImageDeletePermanentlyDirectly()
Definition: itemiconview_items.cpp:268
void slotImageFindSimilar()
Definition: itemiconview_search.cpp:60
void slotLightTable()
Definition: itemiconview_tools.cpp:54
int itemCount() const
Items management methods - itemiconview_items.cpp.
Definition: itemiconview_items.cpp:539
ItemInfoList selectedInfoList(const bool currentFirst=false, const bool grouping=false) const
Definition: itemiconview_items.cpp:474
void showSideBars()
Definition: itemiconview_sidebars.cpp:40
void signalAlbumSelected(Album *)
void previousRightSideBarTab()
Definition: itemiconview_sidebars.cpp:74
void getBackwardHistory(QStringList &titles)
Definition: itemiconview_albums.cpp:487
void slotSetAsAlbumThumbnail(const ItemInfo &info)
Definition: itemiconview_albums.cpp:418
void slotImageAddToLightTable()
Definition: itemiconview_tools.cpp:112
void slotImageAddToExistingQueue(int)
Definition: itemiconview_tools.cpp:141
void signalThumbSizeChanged(int)
void slotNewAdvancedSearch()
Definition: itemiconview_search.cpp:41
void slotImageAddToCurrentQueue()
Definition: itemiconview_tools.cpp:122
void slotCopySelectionTo()
Definition: itemiconview_items.cpp:593
void slotImageQualitySorter()
Side-bars handling methods - itemiconview_sidebars.cpp.
Definition: itemiconview_iqs.cpp:35
void toggleFullScreen(bool set)
Definition: itemiconview_views.cpp:222
void slotGotoDateAndItem(const ItemInfo &imageInfo)
Definition: itemiconview_albums.cpp:257
void slotSelectNone()
Definition: itemiconview_items.cpp:310
void signalSwitchedToTrashView()
void slotSetCurrentWhenAvailable(const qlonglong id)
Definition: itemiconview_items.cpp:565
void slotRenameAlbum()
Definition: itemiconview_albums.cpp:92
void slotCreateGroupByFilenameFromSelection()
Definition: itemiconview_groups.cpp:95
void slotFitToWindow()
Definition: itemiconview_zoom.cpp:135
void slotImageDeletePermanently()
Definition: itemiconview_items.cpp:254
void slotEditor()
Definition: itemiconview_tools.cpp:35
void slotSelectAll()
Definition: itemiconview_items.cpp:296
void slotImagePreview()
Definition: itemiconview_views.cpp:95
void clearHistory()
Definition: itemiconview_albums.cpp:480
void previousLeftSideBarTab()
Definition: itemiconview_sidebars.cpp:64
void setThumbSize(int size)
Definition: itemiconview_zoom.cpp:155
void slotZoomIn()
Definition: itemiconview_zoom.cpp:97
void slotSortImagesOrder(int order)
Definition: itemiconview_items.cpp:352
void slotLeftSideBarActivate(QWidget *widget)
Definition: itemiconview_sidebars.cpp:106
QList< QUrl > selectedUrls(bool grouping=false) const
Definition: itemiconview_items.cpp:42
void slotRemoveSelectedFromGroup()
Definition: itemiconview_groups.cpp:105
~ItemIconView() override
Definition: itemiconview.cpp:246
void slotNewTag()
Definition: itemiconview_tags.cpp:163
void signalImageSelected(const ItemInfoList &selectedImage, const ItemInfoList &allImages)
void slotAlbumReadMetadata()
Definition: itemiconview_albums.cpp:379
double zoomMax() const
Definition: itemiconview_zoom.cpp:40
void slotAlbumHistoryForward(int steps=1)
Definition: itemiconview_albums.cpp:112
void slotImageDelete()
Definition: itemiconview_items.cpp:240
void slotAlbumOpenInFileManager()
Definition: itemiconview_albums.cpp:314
void slotZoomOut()
Definition: itemiconview_zoom.cpp:112
void signalTrashSelectionChanged(const QString &text)
void slotNewKeywordSearch()
Search management methods - itemiconview_search.cpp.
Definition: itemiconview_search.cpp:35
void setRecurseTags(bool recursive)
Tags management methods - itemiconview_tags.cpp.
Definition: itemiconview_tags.cpp:35
void slotNewAlbum()
Definition: itemiconview_albums.cpp:80
void slotAlbumHistoryBack(int steps=1)
Definition: itemiconview_albums.cpp:102
void slotCreateGroupFromSelection()
Definition: itemiconview_groups.cpp:85
void slotDeleteAlbum()
Definition: itemiconview_albums.cpp:87
void slotNewDuplicatesSearch(const QList< PAlbum * > &albums={})
Definition: itemiconview_search.cpp:47
void slotImageEdit()
Tools methods (Editor, BQM, Light Table) - itemiconview_tools.cpp.
Definition: itemiconview_tools.cpp:95
void signalZoomChanged(double)
void signalGotoDateAndItem(AlbumIconItem *)
void toggleRightSidebar()
Definition: itemiconview_sidebars.cpp:58
void slotUngroupSelected()
Definition: itemiconview_groups.cpp:110
void connectIconViewFilter(FilterStatusBar *const filter)
Definition: itemiconview_views.cpp:35
QList< SidebarWidget * > leftSidebarWidgets() const
Definition: itemiconview_sidebars.cpp:35
bool hasCurrentItem() const
Definition: itemiconview_items.cpp:420
ItemIconView(QWidget *const parent, DModelFactory *const modelCollection)
Definition: itemiconview.cpp:35
Definition: iteminfolist.h:47
Definition: iteminfo.h:78
TransformationAction
Definition: metaengine_rotation.h:54
Definition: sidebarwidget.h:46
StackedViewMode
Definition: stackedview.h:70
Definition: piwigotalker.h:48
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43