File indexing completed on 2025-01-19 03:50:45
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2002-16-10 0007 * Description : Item icon view interface. 0008 * 0009 * SPDX-FileCopyrightText: 2002-2005 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2002-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2009-2011 by Johannes Wienke <languitar at semipol dot de> 0012 * SPDX-FileCopyrightText: 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com> 0013 * 0014 * SPDX-License-Identifier: GPL-2.0-or-later 0015 * 0016 * ============================================================ */ 0017 0018 #ifndef DIGIKAM_ITEM_ICON_VIEW_H 0019 #define DIGIKAM_ITEM_ICON_VIEW_H 0020 0021 // Qt includes 0022 0023 #include <QStringList> 0024 #include <QUrl> 0025 0026 // Local includes 0027 0028 #include "digikam_config.h" 0029 #include "applicationsettings.h" 0030 #include "metaengine_rotation.h" 0031 #include "searchtextbar.h" 0032 #include "iteminfo.h" 0033 #include "dmodelfactory.h" 0034 #include "sidebarwidget.h" 0035 #include "stackedview.h" 0036 #include "dlayoutbox.h" 0037 0038 namespace Digikam 0039 { 0040 0041 class AlbumIconItem; 0042 class Album; 0043 class PAlbum; 0044 class TAlbum; 0045 class BatchSyncMetadata; 0046 class FilterStatusBar; 0047 class DCategorizedView; 0048 class ItemFilterModel; 0049 0050 class ItemIconView : public DHBox 0051 { 0052 Q_OBJECT 0053 0054 public: 0055 0056 explicit ItemIconView(QWidget* const parent, 0057 DModelFactory* const modelCollection); 0058 ~ItemIconView() override; 0059 0060 void applySettings(); 0061 0062 private: 0063 0064 void setupConnections(); 0065 void loadViewState(); 0066 void saveViewState(); 0067 0068 // ---------------------------------------------------------------------------------------- 0069 0070 //@{ 0071 /// Tools methods (Editor, BQM, Light Table) - itemiconview_tools.cpp. 0072 0073 public Q_SLOTS: 0074 0075 void slotImageEdit(); 0076 void slotEditor(); 0077 void slotLightTable(); 0078 void slotQueueMgr(); 0079 void slotFileWithDefaultApplication(); 0080 void slotImageLightTable(); 0081 void slotImageAddToLightTable(); 0082 void slotImageAddToCurrentQueue(); 0083 void slotImageAddToNewQueue(); 0084 void slotImageAddToExistingQueue(int); 0085 0086 //@} 0087 0088 // ---------------------------------------------------------------------------------------- 0089 0090 //@{ 0091 /// Zoom management methods - itemiconview_zoom.cpp 0092 0093 public: 0094 0095 double zoomMin() const; 0096 double zoomMax() const; 0097 void setThumbSize(int size); 0098 0099 Q_SIGNALS: 0100 0101 void signalZoomChanged(double); 0102 void signalThumbSizeChanged(int); 0103 0104 private: 0105 0106 void toggleZoomActions(); 0107 0108 public Q_SLOTS: 0109 0110 void setZoomFactor(double zoom); 0111 void slotZoomIn(); 0112 void slotZoomOut(); 0113 void slotZoomTo100Percents(); 0114 void slotFitToWindow(); 0115 0116 private Q_SLOTS: 0117 0118 void slotZoomFactorChanged(double); 0119 void slotThumbSizeEffect(); 0120 0121 //@} 0122 0123 // ---------------------------------------------------------------------------------------- 0124 0125 //@{ 0126 /// Side-bars handling methods - itemiconview_sidebars.cpp 0127 0128 // ---------------------------------------------------------------------------------------- 0129 0130 //@{ 0131 /// Tools methods (Editor, BQM, Light Table) - itemiconview_tools.cpp. 0132 0133 public Q_SLOTS: 0134 0135 void slotImageQualitySorter(); 0136 0137 //@} 0138 0139 // ---------------------------------------------------------------------------------------- 0140 0141 public: 0142 0143 QList<SidebarWidget*> leftSidebarWidgets() const; 0144 0145 void showSideBars(); 0146 void hideSideBars(); 0147 void toggleLeftSidebar(); 0148 void toggleRightSidebar(); 0149 void previousLeftSideBarTab(); 0150 void nextLeftSideBarTab(); 0151 void previousRightSideBarTab(); 0152 void nextRightSideBarTab(); 0153 0154 public Q_SLOTS: 0155 0156 void slotNotificationError(const QString& message, int type); 0157 0158 void slotLeftSideBarActivate(QWidget* widget); 0159 void slotLeftSideBarActivate(SidebarWidget* widget); 0160 void slotLeftSideBarActivateAlbums(); 0161 void slotLeftSideBarActivateTags(); 0162 0163 void slotRightSideBarActivateTitles(); 0164 void slotRightSideBarActivateComments(); 0165 void slotRightSideBarActivateAssignedTags(); 0166 0167 Q_SIGNALS: 0168 0169 void signalChangedTab(QWidget*); 0170 void signalFuzzySidebarActive(bool active); 0171 0172 private Q_SLOTS: 0173 0174 void slotLeftSidebarChangedTab(QWidget* w); 0175 void slotSidebarTabTitleStyleChanged(); 0176 void slotPopupFiltersView(); 0177 //@} 0178 0179 // ---------------------------------------------------------------------------------------- 0180 0181 //@{ 0182 /// Item Group methods - itemiconview_groups.cpp 0183 0184 public: 0185 0186 /** 0187 * Query whether the operation to be performed on currently selected or all 0188 * all items in the currently active view should be performed on all 0189 * grouped items or just the first. 0190 */ 0191 bool allNeedGroupResolving(const ApplicationSettings::OperationType type) const; 0192 bool selectedNeedGroupResolving(const ApplicationSettings::OperationType type) const; 0193 void setAllGroupsOpen(bool open); 0194 0195 public Q_SLOTS: 0196 0197 void slotCreateGroupFromSelection(); 0198 void slotCreateGroupByTimeFromSelection(); 0199 void slotCreateGroupByFilenameFromSelection(); 0200 void slotCreateGroupByTimelapseFromSelection(); 0201 void slotRemoveSelectedFromGroup(); 0202 void slotUngroupSelected(); 0203 0204 private Q_SLOTS: 0205 0206 void slotEmptyMessageTimer(); 0207 //@} 0208 0209 // ---------------------------------------------------------------------------------------- 0210 0211 //@{ 0212 /// Album management methods - itemiconview_album.cpp 0213 0214 public: 0215 0216 Album* currentAlbum() const; 0217 void setRecurseAlbums(bool recursive); 0218 void clearHistory(); 0219 void getForwardHistory(QStringList& titles); 0220 void getBackwardHistory(QStringList& titles); 0221 0222 public Q_SLOTS: 0223 0224 void slotRefresh(); 0225 void slotNewAlbum(); 0226 void slotSortAlbums(int role); 0227 void slotDeleteAlbum(); 0228 void slotRenameAlbum(); 0229 void slotAlbumPropsEdit(); 0230 void slotAlbumOpenInFileManager(); 0231 void slotAlbumHistoryBack(int steps = 1); 0232 void slotAlbumHistoryForward(int steps = 1); 0233 void slotAlbumWriteMetadata(); 0234 void slotAlbumReadMetadata(); 0235 void slotAlbumSelected(const QList<Album*>& albums); 0236 0237 void slotGotoAlbumAndItem(const ItemInfo& imageInfo); 0238 void slotGotoDateAndItem(const ItemInfo& imageInfo); 0239 void slotGotoTagAndItem(int tagID); 0240 0241 void slotSelectAlbum(const QUrl& url); 0242 void slotSetCurrentUrlWhenAvailable(const QUrl& url); 0243 void slotSetCurrentWhenAvailable(const qlonglong id); 0244 0245 void slotSetAsAlbumThumbnail(const ItemInfo& info); 0246 void slotMoveSelectionToAlbum(); 0247 void slotCopySelectionTo(); 0248 0249 Q_SIGNALS: 0250 0251 void signalAlbumSelected(Album*); 0252 0253 private: 0254 0255 void changeAlbumFromHistory(const QList<Album*>& album, QWidget* const widget); 0256 0257 private Q_SLOTS: 0258 0259 void slotAllAlbumsLoaded(); 0260 void slotAlbumsCleared(); 0261 void slotAlbumRefreshComplete(); 0262 //@} 0263 0264 // ---------------------------------------------------------------------------------------- 0265 0266 //@{ 0267 /// Search management methods - itemiconview_search.cpp 0268 0269 public Q_SLOTS: 0270 0271 void slotNewKeywordSearch(); 0272 void slotNewAdvancedSearch(); 0273 void slotNewDuplicatesSearch(const QList<PAlbum*>& albums = {}); 0274 void slotNewDuplicatesSearch(const QList<TAlbum*>& albums); 0275 void slotImageFindSimilar(); 0276 void slotImageScanForFaces(); 0277 void slotImageRecognizeFaces(); 0278 void slotImageRemoveAllFaces(); 0279 //@} 0280 0281 // ---------------------------------------------------------------------------------------- 0282 0283 //@{ 0284 /// Tags management methods - itemiconview_tags.cpp 0285 0286 public: 0287 0288 void setRecurseTags(bool recursive); 0289 void toggleTag(int tagID); 0290 0291 public Q_SLOTS: 0292 0293 void slotNewTag(); 0294 void slotDeleteTag(); 0295 void slotEditTag(); 0296 void slotOpenTagsManager(); 0297 void slotAssignTag(); 0298 void slotAssignPickLabel(int pickId); 0299 void slotAssignColorLabel(int colorId); 0300 void slotAssignRating(int rating); 0301 void slotAssignTag(int tagID); 0302 void slotRemoveTag(int tagID); 0303 0304 private Q_SLOTS: 0305 0306 //void slotRatingChanged(const QUrl&, int); 0307 //void slotColorLabelChanged(const QUrl&, int); 0308 //void slotPickLabelChanged(const QUrl&, int); 0309 //void slotToggleTag(const QUrl&, int); 0310 0311 //@} 0312 0313 // ---------------------------------------------------------------------------------------- 0314 0315 //@{ 0316 /// Items management methods - itemiconview_items.cpp 0317 0318 public: 0319 0320 int itemCount() const; 0321 QUrl currentUrl() const; 0322 bool hasCurrentItem() const; 0323 ItemInfo currentInfo() const; 0324 0325 /** 0326 * Get currently selected items. By default only the first images in groups are 0327 * given, while all can be obtained by setting the grouping parameter to true. 0328 * Given an operation, it will be determined from settings/user query whether 0329 * only the first or all items in a group are returned. 0330 * Ideally only the latter (giving an operation) is used. 0331 */ 0332 QList<QUrl> selectedUrls(bool grouping = false) const; 0333 QList<QUrl> selectedUrls(const ApplicationSettings::OperationType type) const; 0334 ItemInfoList selectedInfoList(const bool currentFirst = false, 0335 const bool grouping = false) const; 0336 ItemInfoList selectedInfoList(const ApplicationSettings::OperationType type, 0337 const bool currentFirst = false) const; 0338 /** 0339 * Get all items in the current view. 0340 * Whether only the first or all grouped items are returned is determined 0341 * as described above. 0342 */ 0343 QList<QUrl> allUrls(bool grouping = false) const; 0344 ItemInfoList allInfo(const bool grouping = false) const; 0345 ItemInfoList allInfo(const ApplicationSettings::OperationType type) const; 0346 0347 void imageTransform(MetaEngineRotation::TransformationAction transform); 0348 0349 Q_SIGNALS: 0350 0351 void signalNoCurrentItem(); 0352 void signalSeparationModeChanged(int category); 0353 void signalSelectionChanged(int numberOfSelectedItems); 0354 void signalTrashSelectionChanged(const QString& text); 0355 void signalImageSelected(const ItemInfoList& selectedImage, 0356 const ItemInfoList& allImages); 0357 0358 public Q_SLOTS: 0359 0360 void slotImagePreview(); 0361 void slotMapWidgetView(); 0362 void slotTableView(); 0363 void slotIconView(); 0364 void slotImageExifOrientation(int orientation); 0365 void slotImageRename(); 0366 void slotImageDelete(); 0367 void slotImageDeletePermanently(); 0368 void slotImageDeletePermanentlyDirectly(); 0369 void slotImageTrashDirectly(); 0370 void slotImageWriteMetadata(); 0371 void slotImageReadMetadata(); 0372 void slotSelectAll(); 0373 void slotSelectNone(); 0374 void slotSelectInvert(); 0375 void slotSortImages(int order); 0376 void slotSortImagesOrder(int order); 0377 void slotSeparateImages(int mode); 0378 void slotImageSeparationSortOrder(int order); 0379 void slotImagePaste(); 0380 void slotFocusAndNextImage(); 0381 0382 private Q_SLOTS: 0383 0384 void slotFirstItem(); 0385 void slotPrevItem(); 0386 void slotNextItem(); 0387 void slotLastItem(); 0388 void slotSelectItemByUrl(const QUrl&); 0389 void slotAwayFromSelection(); 0390 void slotImageSelected(); 0391 void slotDispatchImageSelected(); 0392 void slotImageChangeFailed(const QString& message, const QStringList& fileNames); 0393 //@} 0394 0395 // ---------------------------------------------------------------------------------------- 0396 0397 //@{ 0398 /// Views management methods - itemiconview_views.cpp 0399 0400 public: 0401 0402 void setToolsIconView(DCategorizedView* const view); 0403 void toggleShowBar(bool); 0404 void toggleFullScreen(bool set); 0405 void refreshView(); 0406 void connectIconViewFilter(FilterStatusBar* const filter); 0407 StackedView::StackedViewMode viewMode() const; 0408 0409 Q_SIGNALS: 0410 0411 void signalSwitchedToPreview(); 0412 void signalSwitchedToIconView(); 0413 void signalSwitchedToMapView(); 0414 void signalSwitchedToTableView(); 0415 void signalSwitchedToTrashView(); 0416 0417 void signalGotoAlbumAndItem(const ItemInfo&); 0418 void signalGotoDateAndItem(AlbumIconItem*); 0419 void signalGotoTagAndItem(int tagID); 0420 0421 private Q_SLOTS: 0422 0423 void slotTogglePreviewMode(const ItemInfo& info); 0424 void slotEscapePreview(); 0425 void slotRefreshImagePreview(); 0426 void slotViewModeChanged(); 0427 void slotSetupMetadataFilters(int); 0428 void slotSetupExifTool(); 0429 0430 void slotShowContextMenu(QContextMenuEvent* event, 0431 const QList<QAction*>& extraGroupingActions = QList<QAction*>()); 0432 0433 void slotShowContextMenuOnInfo(QContextMenuEvent* event, const ItemInfo& info, 0434 const QList<QAction*>& extraGroupingActions = QList<QAction*>(), 0435 ItemFilterModel* imageFilterModel = nullptr); 0436 0437 void slotShowGroupContextMenu(QContextMenuEvent* event, 0438 const QList<ItemInfo>& selectedInfos, 0439 ItemFilterModel* imageFilterModel = nullptr); 0440 //@} 0441 0442 // ---------------------------------------------------------------------------------------- 0443 0444 private: 0445 0446 class Private; 0447 Private* const d; 0448 }; 0449 0450 } // namespace Digikam 0451 0452 #endif // DIGIKAM_ITEM_ICON_VIEW_H