File indexing completed on 2025-01-19 03:50:41

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-31-01
0007  * Description : main digiKam interface implementation
0008  *
0009  * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2014      by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_APP_PRIVATE_H
0017 #define DIGIKAM_APP_PRIVATE_H
0018 
0019 #include "digikamapp.h"
0020 
0021 // Qt includes
0022 
0023 #include <QEventLoop>
0024 #include <QMap>
0025 #include <QPointer>
0026 #include <QScopedPointer>
0027 #include <QString>
0028 #include <QAction>
0029 #include <QActionGroup>
0030 #include <QMenu>
0031 #include <QApplication>
0032 #include <QStringList>
0033 #include <QDomDocument>
0034 #include <QStandardPaths>
0035 #include <QKeySequence>
0036 #include <QMenuBar>
0037 #include <QTimer>
0038 #include <QIcon>
0039 #include <QMessageBox>
0040 #include <QStatusBar>
0041 #include <QDir>
0042 #include <QMetaType>
0043 
0044 // KDE includes
0045 
0046 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
0047 #   pragma GCC diagnostic push
0048 #   pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0049 #endif
0050 
0051 #if defined(Q_CC_CLANG)
0052 #   pragma clang diagnostic push
0053 #   pragma clang diagnostic ignored "-Wdeprecated-declarations"
0054 #endif
0055 
0056 #include <kconfiggroup.h>
0057 #include <klocalizedstring.h>
0058 #include <kactioncollection.h>
0059 #include <ktoolbar.h>
0060 #include <ktoolbarpopupaction.h>
0061 #include <kselectaction.h>
0062 #include <ksharedconfig.h>
0063 
0064 // Restore warnings
0065 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
0066 #   pragma GCC diagnostic pop
0067 #endif
0068 
0069 #if defined(Q_CC_CLANG)
0070 #   pragma clang diagnostic pop
0071 #endif
0072 
0073 // Local includes
0074 
0075 #include "digikam_config.h"
0076 #include "digikam_debug.h"
0077 #include "albummanager.h"
0078 #include "applicationsettings.h"
0079 #include "cameralist.h"
0080 #include "cameratype.h"
0081 #include "cameranamehelper.h"
0082 #include "dsplashscreen.h"
0083 #include "dzoombar.h"
0084 #include "itemiconview.h"
0085 #include "metadatastatusbar.h"
0086 #include "itempropertiestab.h"
0087 #include "importui.h"
0088 #include "setup.h"
0089 #include "actioncategorizedview.h"
0090 #include "drawdecoder.h"
0091 #include "dlayoutbox.h"
0092 #include "album.h"
0093 #include "coredb.h"
0094 #include "albummodel.h"
0095 #include "albumselectdialog.h"
0096 #include "albumthumbnailloader.h"
0097 #include "dbinfoiface.h"
0098 #include "categorizeditemmodel.h"
0099 #include "collectionscanner.h"
0100 #include "collectionmanager.h"
0101 #include "componentsinfodlg.h"
0102 #include "coredbthumbinfoprovider.h"
0103 #include "dio.h"
0104 #include "dlogoaction.h"
0105 #include "fileactionmngr.h"
0106 #include "filterstatusbar.h"
0107 #include "iccsettings.h"
0108 #include "itemattributeswatch.h"
0109 #include "iteminfo.h"
0110 #include "imagewindow.h"
0111 #include "lighttablewindow.h"
0112 #include "queuemgrwindow.h"
0113 #include "loadingcache.h"
0114 #include "loadingcacheinterface.h"
0115 #include "loadsavethread.h"
0116 #include "metaengine_rotation.h"
0117 #include "scancontroller.h"
0118 #include "setupeditor.h"
0119 #include "setupicc.h"
0120 #include "thememanager.h"
0121 #include "thumbnailloadthread.h"
0122 #include "thumbnailsize.h"
0123 #include "dmetadata.h"
0124 #include "tagscache.h"
0125 #include "tagsactionmngr.h"
0126 #include "databaseserverstarter.h"
0127 #include "metaenginesettings.h"
0128 #include "statusbarprogresswidget.h"
0129 #include "dbmigrationdlg.h"
0130 #include "progressmanager.h"
0131 #include "progressview.h"
0132 #include "maintenancedlg.h"
0133 #include "maintenancemngr.h"
0134 #include "newitemsfinder.h"
0135 #include "dbcleaner.h"
0136 #include "tagsmanager.h"
0137 #include "itemsortsettings.h"
0138 #include "metadatahubmngr.h"
0139 #include "dfiledialog.h"
0140 #include "dpluginloader.h"
0141 #include "exiftoolparser.h"
0142 #include "exiftoolthread.h"
0143 #include "facesdetector.h"
0144 #include "localizesettings.h"
0145 #include "networkmanager.h"
0146 
0147 #ifdef HAVE_GEOLOCATION
0148 #   include "geolocationsettings.h"
0149 #endif
0150 
0151 #ifdef HAVE_DBUS
0152 #   include "digikamadaptor.h"
0153 #endif
0154 
0155 #ifdef HAVE_KFILEMETADATA
0156 #   include "baloowrap.h"
0157 #endif
0158 
0159 class KToolBarPopupAction;
0160 
0161 namespace Digikam
0162 {
0163 
0164 class SearchTextBar;
0165 class FilterStatusBar;
0166 class TagsActionMngr;
0167 class DAdjustableLabel;
0168 
0169 class Q_DECL_HIDDEN ProgressEntry
0170 {
0171 public:
0172 
0173     explicit ProgressEntry()
0174       : progress (0),
0175         canCancel(false)
0176     {
0177     }
0178 
0179     QString message;
0180     float   progress;
0181     bool    canCancel;
0182 };
0183 
0184 // ------------------------------------------------------------------------------
0185 
0186 class Q_DECL_HIDDEN DigikamApp::Private
0187 {
0188 public:
0189 
0190     explicit Private()
0191       : autoShowZoomToolTip                 (false),
0192         validIccPath                        (true),
0193         cameraMenu                          (nullptr),
0194         usbMediaMenu                        (nullptr),
0195         cardReaderMenu                      (nullptr),
0196         quickImportMenu                     (nullptr),
0197         config                              (nullptr),
0198         newAction                           (nullptr),
0199         moveSelectionToAlbumAction          (nullptr),
0200         copySelectionToAction               (nullptr),
0201         deleteAction                        (nullptr),
0202         renameAction                        (nullptr),
0203         imageDeletePermanentlyAction        (nullptr),
0204         imageDeletePermanentlyDirectlyAction(nullptr),
0205         imageTrashDirectlyAction            (nullptr),
0206         backwardActionMenu                  (nullptr),
0207         forwardActionMenu                   (nullptr),
0208         addImagesAction                     (nullptr),
0209         propsEditAction                     (nullptr),
0210         addFoldersAction                    (nullptr),
0211         openInFileManagerAction             (nullptr),
0212         refreshAction                       (nullptr),
0213         writeAlbumMetadataAction            (nullptr),
0214         readAlbumMetadataAction             (nullptr),
0215         browseTagsAction                    (nullptr),
0216         openTagMngrAction                   (nullptr),
0217         newTagAction                        (nullptr),
0218         deleteTagAction                     (nullptr),
0219         editTagAction                       (nullptr),
0220         assignTagAction                     (nullptr),
0221         imageViewSelectionAction            (nullptr),
0222         imagePreviewAction                  (nullptr),
0223 
0224 #ifdef HAVE_GEOLOCATION
0225 
0226         imageMapViewAction                  (nullptr),
0227 
0228 #endif // HAVE_GEOLOCATION
0229 
0230         imageTableViewAction                (nullptr),
0231         imageIconViewAction                 (nullptr),
0232         imageLightTableAction               (nullptr),
0233         imageAddLightTableAction            (nullptr),
0234         imageAddCurrentQueueAction          (nullptr),
0235         imageAddNewQueueAction              (nullptr),
0236         imageViewAction                     (nullptr),
0237         imageWriteMetadataAction            (nullptr),
0238         imageReadMetadataAction             (nullptr),
0239         imageScanForFacesAction             (nullptr),
0240         imageRecognizeFacesAction           (nullptr),
0241         imageRemoveAllFacesAction           (nullptr),
0242         imageFindSimilarAction              (nullptr),
0243         imageSetExifOrientation1Action      (nullptr),
0244         imageSetExifOrientation2Action      (nullptr),
0245         imageSetExifOrientation3Action      (nullptr),
0246         imageSetExifOrientation4Action      (nullptr),
0247         imageSetExifOrientation5Action      (nullptr),
0248         imageSetExifOrientation6Action      (nullptr),
0249         imageSetExifOrientation7Action      (nullptr),
0250         imageSetExifOrientation8Action      (nullptr),
0251         imageRenameAction                   (nullptr),
0252         imageRotateActionMenu               (nullptr),
0253         imageFlipActionMenu                 (nullptr),
0254         imageAutoExifActionMenu             (nullptr),
0255         imageDeleteAction                   (nullptr),
0256         imageExifOrientationActionMenu      (nullptr),
0257         openWithAction                      (nullptr),
0258         ieAction                            (nullptr),
0259         ltAction                            (nullptr),
0260         cutItemsAction                      (nullptr),
0261         copyItemsAction                     (nullptr),
0262         pasteItemsAction                    (nullptr),
0263         selectAllAction                     (nullptr),
0264         selectNoneAction                    (nullptr),
0265         selectInvertAction                  (nullptr),
0266         zoomPlusAction                      (nullptr),
0267         zoomMinusAction                     (nullptr),
0268         zoomFitToWindowAction               (nullptr),
0269         zoomTo100percents                   (nullptr),
0270         imageSortAction                     (nullptr),
0271         imageSortOrderAction                (nullptr),
0272         imageSeparationAction               (nullptr),
0273         imageSeparationSortOrderAction      (nullptr),
0274         albumSortAction                     (nullptr),
0275         allGroupsOpenAction                 (nullptr),
0276         recurseAlbumsAction                 (nullptr),
0277         recurseTagsAction                   (nullptr),
0278         showBarAction                       (nullptr),
0279         viewCMViewAction                    (nullptr),
0280         bqmAction                           (nullptr),
0281         maintenanceAction                   (nullptr),
0282         scanNewItemsAction                  (nullptr),
0283         qualityAction                       (nullptr),
0284         advSearchAction                     (nullptr),
0285         addCameraSeparatorAction            (nullptr),
0286         quitAction                          (nullptr),
0287         tipAction                           (nullptr),
0288         manualCameraActionGroup             (nullptr),
0289         solidCameraActionGroup              (nullptr),
0290         solidUsmActionGroup                 (nullptr),
0291         exifOrientationActionGroup          (nullptr),
0292         eventLoop                           (nullptr),
0293         metadataStatusBar                   (nullptr),
0294         filterStatusBar                     (nullptr),
0295         splashScreen                        (nullptr),
0296         view                                (nullptr),
0297         cameraList                          (nullptr),
0298         tagsActionManager                   (nullptr),
0299         zoomBar                             (nullptr),
0300         statusLabel                         (nullptr),
0301         modelCollection                     (nullptr)
0302     {
0303     }
0304 
0305     bool                                autoShowZoomToolTip;
0306     bool                                validIccPath;
0307 
0308     QMenu*                              cameraMenu;
0309     QMenu*                              usbMediaMenu;
0310     QMenu*                              cardReaderMenu;
0311     QMenu*                              quickImportMenu;
0312     QHash<QString, QDateTime>           cameraAppearanceTimes;
0313 
0314     KSharedConfig::Ptr                  config;
0315 
0316     /// Album Actions
0317     QAction*                            newAction;
0318     QAction*                            moveSelectionToAlbumAction;
0319     QAction*                            copySelectionToAction;
0320     QAction*                            deleteAction;
0321     QAction*                            renameAction;
0322     QAction*                            imageDeletePermanentlyAction;
0323     QAction*                            imageDeletePermanentlyDirectlyAction;
0324     QAction*                            imageTrashDirectlyAction;
0325     KToolBarPopupAction*                backwardActionMenu;
0326     KToolBarPopupAction*                forwardActionMenu;
0327 
0328     QAction*                            addImagesAction;
0329     QAction*                            propsEditAction;
0330     QAction*                            addFoldersAction;
0331     QAction*                            openInFileManagerAction;
0332     QAction*                            refreshAction;
0333     QAction*                            writeAlbumMetadataAction;
0334     QAction*                            readAlbumMetadataAction;
0335 
0336     /// Tag Actions
0337     QAction*                            browseTagsAction;
0338     QAction*                            openTagMngrAction;
0339     QAction*                            newTagAction;
0340     QAction*                            deleteTagAction;
0341     QAction*                            editTagAction;
0342     QAction*                            assignTagAction;
0343 
0344     /// Image Actions
0345     KSelectAction*                      imageViewSelectionAction;
0346     QAction*                            imagePreviewAction;
0347 
0348 #ifdef HAVE_GEOLOCATION
0349 
0350     QAction*                            imageMapViewAction;
0351 
0352 #endif // HAVE_GEOLOCATION
0353 
0354     QAction*                            imageTableViewAction;
0355     QAction*                            imageIconViewAction;
0356     QAction*                            imageLightTableAction;
0357     QAction*                            imageAddLightTableAction;
0358     QAction*                            imageAddCurrentQueueAction;
0359     QAction*                            imageAddNewQueueAction;
0360     QAction*                            imageViewAction;
0361     QAction*                            imageWriteMetadataAction;
0362     QAction*                            imageReadMetadataAction;
0363     QAction*                            imageScanForFacesAction;
0364     QAction*                            imageRecognizeFacesAction;
0365     QAction*                            imageRemoveAllFacesAction;
0366     QAction*                            imageFindSimilarAction;
0367     QAction*                            imageSetExifOrientation1Action;
0368     QAction*                            imageSetExifOrientation2Action;
0369     QAction*                            imageSetExifOrientation3Action;
0370     QAction*                            imageSetExifOrientation4Action;
0371     QAction*                            imageSetExifOrientation5Action;
0372     QAction*                            imageSetExifOrientation6Action;
0373     QAction*                            imageSetExifOrientation7Action;
0374     QAction*                            imageSetExifOrientation8Action;
0375     QAction*                            imageRenameAction;
0376     QMenu*                              imageRotateActionMenu;
0377     QMenu*                              imageFlipActionMenu;
0378     QAction*                            imageAutoExifActionMenu;
0379     QAction*                            imageDeleteAction;
0380     QMenu*                              imageExifOrientationActionMenu;
0381     QAction*                            openWithAction;
0382     QAction*                            ieAction;
0383     QAction*                            ltAction;
0384 
0385     /// Edit Actions
0386     QAction*                            cutItemsAction;
0387     QAction*                            copyItemsAction;
0388     QAction*                            pasteItemsAction;
0389     QAction*                            selectAllAction;
0390     QAction*                            selectNoneAction;
0391     QAction*                            selectInvertAction;
0392 
0393     /// View Actions
0394     QAction*                            zoomPlusAction;
0395     QAction*                            zoomMinusAction;
0396     QAction*                            zoomFitToWindowAction;
0397     QAction*                            zoomTo100percents;
0398     KSelectAction*                      imageSortAction;
0399     KSelectAction*                      imageSortOrderAction;
0400     KSelectAction*                      imageSeparationAction;
0401     KSelectAction*                      imageSeparationSortOrderAction;
0402     KSelectAction*                      albumSortAction;
0403     QAction*                            allGroupsOpenAction;
0404     QAction*                            recurseAlbumsAction;
0405     QAction*                            recurseTagsAction;
0406     QAction*                            showBarAction;
0407     QAction*                            viewCMViewAction;
0408 
0409     /// Tools Actions
0410     QAction*                            bqmAction;
0411     QAction*                            maintenanceAction;
0412     QAction*                            scanNewItemsAction;
0413     QAction*                            qualityAction;
0414     QAction*                            advSearchAction;
0415 
0416     /// Application Actions
0417     QAction*                            addCameraSeparatorAction;
0418     QAction*                            quitAction;
0419     QAction*                            tipAction;
0420 
0421     QActionGroup*                       manualCameraActionGroup;
0422     QActionGroup*                       solidCameraActionGroup;
0423     QActionGroup*                       solidUsmActionGroup;
0424     QActionGroup*                       exifOrientationActionGroup;
0425 
0426     QMap<QString, QPointer<ImportUI> >  cameraUIMap;
0427 
0428     QEventLoop*                         eventLoop;
0429     QString                             solidErrorMessage;
0430 
0431     MetadataStatusBar*                  metadataStatusBar;
0432     FilterStatusBar*                    filterStatusBar;
0433     DSplashScreen*                      splashScreen;
0434     ItemIconView*                       view;
0435     CameraList*                         cameraList;
0436     TagsActionMngr*                     tagsActionManager;
0437     DZoomBar*                           zoomBar;
0438     DAdjustableLabel*                   statusLabel;
0439 
0440     DModelFactory*                      modelCollection;
0441 };
0442 
0443 } // namespace Digikam
0444 
0445 #endif // DIGIKAM_APP_PRIVATE_H