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 : implementation of 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  * SPDX-FileCopyrightText: 2011-2013 by Michael G. Hansen <mike at mghansen dot de>
0014  * SPDX-FileCopyrightText: 2014-2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0015  * SPDX-FileCopyrightText: 2017      by Simon Frei <freisim93 at gmail dot com>
0016  *
0017  * SPDX-License-Identifier: GPL-2.0-or-later
0018  *
0019  * ============================================================ */
0020 
0021 #ifndef DIGIKAM_ITEM_ICON_VIEW_P_H
0022 #define DIGIKAM_ITEM_ICON_VIEW_P_H
0023 
0024 #include "itemiconview.h"
0025 
0026 // Qt includes
0027 
0028 #include <QTimer>
0029 #include <QShortcut>
0030 #include <QApplication>
0031 
0032 // KDE includes
0033 
0034 #include <klocalizedstring.h>
0035 #include <kconfiggroup.h>
0036 #include <ksharedconfig.h>
0037 
0038 // Local includes
0039 
0040 #include "digikam_config.h"
0041 #include "digikam_debug.h"
0042 #include "digikam_globals.h"
0043 #include "albumhistory.h"
0044 #include "labelstreeview.h"
0045 #include "albumpointer.h"
0046 #include "coredbsearchxml.h"
0047 #include "dbinfoiface.h"
0048 #include "digikamapp.h"
0049 #include "digikamitemview.h"
0050 #include "dfileoperations.h"
0051 #include "dmessagebox.h"
0052 #include "dzoombar.h"
0053 #include "dtrashitemmodel.h"
0054 #include "facescansettings.h"
0055 #include "facesdetector.h"
0056 #include "fileactionmngr.h"
0057 #include "fileactionprogress.h"
0058 #include "filtersidebarwidget.h"
0059 #include "filterstatusbar.h"
0060 #include "itemalbummodel.h"
0061 #include "itemdescedittab.h"
0062 #include "itempreviewview.h"
0063 #include "itempropertiessidebardb.h"
0064 #include "itempropertiesversionstab.h"
0065 #include "itemthumbnailbar.h"
0066 #include "itemviewutilities.h"
0067 #include "albumfolderviewsidebarwidget.h"
0068 #include "datefolderviewsidebarwidget.h"
0069 #include "timelinesidebarwidget.h"
0070 #include "searchsidebarwidget.h"
0071 #include "fuzzysearchsidebarwidget.h"
0072 #include "labelssidebarwidget.h"
0073 #include "peoplesidebarwidget.h"
0074 #include "tagviewsidebarwidget.h"
0075 #include "loadingcacheinterface.h"
0076 #include "metadatahub.h"
0077 #include "metaenginesettings.h"
0078 #include "metadatasynchronizer.h"
0079 #include "metadataremover.h"
0080 #include "newitemsfinder.h"
0081 #include "queuemgrwindow.h"
0082 #include "scancontroller.h"
0083 #include "setup.h"
0084 #include "sidebar.h"
0085 #include "statusprogressbar.h"
0086 #include "tableview.h"
0087 #include "tagmodificationhelper.h"
0088 #include "tagsactionmngr.h"
0089 #include "tagscache.h"
0090 #include "tagsmanager.h"
0091 #include "thumbsgenerator.h"
0092 #include "trashview.h"
0093 #include "versionmanagersettings.h"
0094 #include "contextmenuhelper.h"
0095 #include "albumlabelssearchhandler.h"
0096 #include "dnotificationwidget.h"
0097 #include "coredb.h"
0098 #include "coredbaccess.h"
0099 #include "addtagslineedit.h"
0100 
0101 #ifdef HAVE_MEDIAPLAYER
0102 #   include "mediaplayerview.h"
0103 #endif //HAVE_MEDIAPLAYER
0104 
0105 #ifdef HAVE_GEOLOCATION
0106 #include "gpssearchsidebarwidget.h"
0107 #   include "mapwidgetview.h"
0108 #endif // HAVE_GEOLOCATION
0109 
0110 namespace Digikam
0111 {
0112 
0113 class Q_DECL_HIDDEN ItemIconView::Private
0114 {
0115 public:
0116 
0117     explicit Private()
0118       : useAlbumHistory         (false),
0119         initialAlbumID          (0),
0120         thumbSize               (ThumbnailSize::Medium),
0121         dockArea                (nullptr),
0122         splitter                (nullptr),
0123         selectionTimer          (nullptr),
0124         thumbSizeTimer          (nullptr),
0125         msgNotifyTimer          (nullptr),
0126         albumFolderSideBar      (nullptr),
0127         tagViewSideBar          (nullptr),
0128         labelsSideBar           (nullptr),
0129         dateViewSideBar         (nullptr),
0130         timelineSideBar         (nullptr),
0131         searchSideBar           (nullptr),
0132         fuzzySearchSideBar      (nullptr),
0133 
0134 #ifdef HAVE_GEOLOCATION
0135 
0136         gpsSearchSideBar        (nullptr),
0137         mapView                 (nullptr),
0138 
0139 #endif // HAVE_GEOLOCATION
0140 
0141         peopleSideBar           (nullptr),
0142         parent                  (nullptr),
0143         iconView                (nullptr),
0144         tableView               (nullptr),
0145         trashView               (nullptr),
0146         utilities               (nullptr),
0147         albumManager            (nullptr),
0148         albumHistory            (nullptr),
0149         stackedView             (nullptr),
0150         lastViewMode            (StackedView::IconViewMode),
0151         albumModificationHelper (nullptr),
0152         tagModificationHelper   (nullptr),
0153         searchModificationHelper(nullptr),
0154         leftSideBar             (nullptr),
0155         rightSideBar            (nullptr),
0156         filterWidget            (nullptr),
0157         modelCollection         (nullptr),
0158         labelsSearchHandler     (nullptr),
0159         errorWidget             (nullptr)
0160     {
0161     }
0162 
0163 public:
0164 
0165     QString userPresentableAlbumTitle(const QString& title) const
0166     {
0167         if      (title == SAlbum::getTemporaryHaarTitle(DatabaseSearch::HaarSketchSearch))
0168         {
0169             return i18n("Fuzzy Sketch Search");
0170         }
0171         else if (title == SAlbum::getTemporaryHaarTitle(DatabaseSearch::HaarImageSearch))
0172         {
0173             return i18n("Fuzzy Image Search");
0174         }
0175         else if (title == SAlbum::getTemporaryTitle(DatabaseSearch::MapSearch))
0176         {
0177             return i18n("Map Search");
0178         }
0179         else if ((title == SAlbum::getTemporaryTitle(DatabaseSearch::AdvancedSearch)) ||
0180                  (title == SAlbum::getTemporaryTitle(DatabaseSearch::KeywordSearch)))
0181         {
0182             return i18n("Last Search");
0183         }
0184         else if (title == SAlbum::getTemporaryTitle(DatabaseSearch::TimeLineSearch))
0185         {
0186             return i18n("Timeline");
0187         }
0188 
0189         return title;
0190     }
0191 
0192     void addPageUpDownActions(ItemIconView* const q, QWidget* const w)
0193     {
0194         defineShortcut(w, Qt::Key_PageDown, q, SLOT(slotNextItem()));
0195         defineShortcut(w, Qt::Key_Down,     q, SLOT(slotNextItem()));
0196         defineShortcut(w, Qt::Key_Right,    q, SLOT(slotNextItem()));
0197 
0198         defineShortcut(w, Qt::Key_PageUp,   q, SLOT(slotPrevItem()));
0199         defineShortcut(w, Qt::Key_Up,       q, SLOT(slotPrevItem()));
0200         defineShortcut(w, Qt::Key_Left,     q, SLOT(slotPrevItem()));
0201     }
0202 
0203 public:
0204 
0205     bool                          useAlbumHistory;
0206 
0207     int                           initialAlbumID;
0208     int                           thumbSize;
0209 
0210     QMainWindow*                  dockArea;
0211 
0212     SidebarSplitter*              splitter;
0213 
0214     QTimer*                       selectionTimer;
0215     QTimer*                       thumbSizeTimer;
0216     QTimer*                       msgNotifyTimer;
0217 
0218     // left side bar
0219 
0220     AlbumFolderViewSideBarWidget* albumFolderSideBar;
0221     TagViewSideBarWidget*         tagViewSideBar;
0222     LabelsSideBarWidget*          labelsSideBar;
0223     DateFolderViewSideBarWidget*  dateViewSideBar;
0224     TimelineSideBarWidget*        timelineSideBar;
0225     SearchSideBarWidget*          searchSideBar;
0226     FuzzySearchSideBarWidget*     fuzzySearchSideBar;
0227 
0228 #ifdef HAVE_GEOLOCATION
0229 
0230     GPSSearchSideBarWidget*       gpsSearchSideBar;
0231     MapWidgetView*                mapView;
0232 
0233 #endif // HAVE_GEOLOCATION
0234 
0235     PeopleSideBarWidget*          peopleSideBar;
0236     DigikamApp*                   parent;
0237     DigikamItemView*              iconView;
0238     TableView*                    tableView;
0239     TrashView*                    trashView;
0240     ItemViewUtilities*            utilities;
0241     AlbumManager*                 albumManager;
0242     AlbumHistory*                 albumHistory;
0243     StackedView*                  stackedView;
0244     StackedView::StackedViewMode  lastViewMode;
0245 
0246     AlbumModificationHelper*      albumModificationHelper;
0247     TagModificationHelper*        tagModificationHelper;
0248     SearchModificationHelper*     searchModificationHelper;
0249 
0250     Sidebar*                      leftSideBar;
0251     ItemPropertiesSideBarDB*      rightSideBar;
0252 
0253     FilterSideBarWidget*          filterWidget;
0254 
0255     QList<SidebarWidget*>         leftSideBarWidgets;
0256 
0257     DModelFactory*                modelCollection;
0258     AlbumLabelsSearchHandler*     labelsSearchHandler;
0259     DNotificationWidget*          errorWidget;
0260 };
0261 
0262 } // namespace Digikam
0263 
0264 #endif // DIGIKAM_ITEM_ICON_VIEW_P_H