File indexing completed on 2025-01-19 03:59:24

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-09-16
0007  * Description : Camera interface
0008  *
0009  * SPDX-FileCopyrightText: 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_IMPORTUI_PRIVATE_H
0018 #define DIGIKAM_IMPORTUI_PRIVATE_H
0019 
0020 #include "importui.h"
0021 
0022 // Qt includes
0023 
0024 #include <QCheckBox>
0025 #include <QCloseEvent>
0026 #include <QDir>
0027 #include <QFile>
0028 #include <QFileInfo>
0029 #include <QFrame>
0030 #include <QGridLayout>
0031 #include <QGroupBox>
0032 #include <QHBoxLayout>
0033 #include <QKeyEvent>
0034 #include <QLabel>
0035 #include <QLineEdit>
0036 #include <QPixmap>
0037 #include <QPointer>
0038 #include <QPushButton>
0039 #include <QRadioButton>
0040 #include <QScrollArea>
0041 #include <QSplitter>
0042 #include <QTimer>
0043 #include <QToolButton>
0044 #include <QVBoxLayout>
0045 #include <QWidget>
0046 #include <QKeySequence>
0047 #include <QInputDialog>
0048 #include <QMenuBar>
0049 #include <QMenu>
0050 #include <QIcon>
0051 #include <QMessageBox>
0052 #include <QStatusBar>
0053 #include <QApplication>
0054 #include <QActionGroup>
0055 #include <QLocale>
0056 #include <QDateTime>
0057 #include <QString>
0058 #include <QUrl>
0059 
0060 // KDE includes
0061 
0062 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
0063 #   pragma GCC diagnostic push
0064 #   pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0065 #endif
0066 
0067 #if defined(Q_CC_CLANG)
0068 #   pragma clang diagnostic push
0069 #   pragma clang diagnostic ignored "-Wdeprecated-declarations"
0070 #endif
0071 
0072 #include <klocalizedstring.h>
0073 #include <kactioncollection.h>
0074 #include <kconfiggroup.h>
0075 #include <ksharedconfig.h>
0076 #include <kselectaction.h>
0077 
0078 // Restore warnings
0079 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
0080 #   pragma GCC diagnostic pop
0081 #endif
0082 
0083 #if defined(Q_CC_CLANG)
0084 #   pragma clang diagnostic pop
0085 #endif
0086 
0087 // Local includes
0088 
0089 #include "digikam_config.h"
0090 #include "digikam_debug.h"
0091 #include "digikam_globals.h"
0092 #include "drawdecoder.h"
0093 #include "dlayoutbox.h"
0094 #include "dexpanderbox.h"
0095 #include "dfileselector.h"
0096 #include "cameramessagebox.h"
0097 #include "advancedrenamemanager.h"
0098 #include "album.h"
0099 #include "albummanager.h"
0100 #include "applicationsettings.h"
0101 #include "albumselectdialog.h"
0102 #include "cameracontroller.h"
0103 #include "camerafolderdialog.h"
0104 #include "camerainfodialog.h"
0105 #include "cameralist.h"
0106 #include "cameranamehelper.h"
0107 #include "cameratype.h"
0108 #include "capturedlg.h"
0109 #include "collectionlocation.h"
0110 #include "collectionmanager.h"
0111 #include "collectionscanner.h"
0112 #include "componentsinfodlg.h"
0113 #include "dlogoaction.h"
0114 #include "coredbdownloadhistory.h"
0115 #include "dzoombar.h"
0116 #include "fileactionmngr.h"
0117 #include "freespacewidget.h"
0118 #include "iccsettings.h"
0119 #include "importitempropertiessidebar.h"
0120 #include "importsettings.h"
0121 #include "importview.h"
0122 #include "imagedialog.h"
0123 #include "dnotificationwrapper.h"
0124 #include "newitemsfinder.h"
0125 #include "parsesettings.h"
0126 #include "renamecustomizer.h"
0127 #include "scancontroller.h"
0128 #include "setup.h"
0129 #include "sidebar.h"
0130 #include "statusprogressbar.h"
0131 #include "thememanager.h"
0132 #include "thumbnailsize.h"
0133 #include "importthumbnailmodel.h"
0134 #include "itempropertiestab.h"
0135 #include "camerathumbsctrl.h"
0136 #include "importfiltercombobox.h"
0137 #include "albumcustomizer.h"
0138 #include "advancedsettings.h"
0139 #include "dngconvertsettings.h"
0140 #include "scriptingsettings.h"
0141 #include "filterstatusbar.h"
0142 #include "dnotificationwidget.h"
0143 #include "dfileoperations.h"
0144 #include "setupcamera.h"
0145 
0146 namespace Digikam
0147 {
0148 
0149 class Q_DECL_HIDDEN ImportUI::Private
0150 {
0151 public:
0152 
0153     Private()
0154       : waitAutoRotate                  (false),
0155         deleteAfter                     (false),
0156         busy                            (false),
0157         closed                          (false),
0158         downloadMenu                    (nullptr),
0159         deleteMenu                      (nullptr),
0160         imageMenu                       (nullptr),
0161         cameraCancelAction              (nullptr),
0162         cameraCaptureAction             (nullptr),
0163         cameraInfoAction                (nullptr),
0164         increaseThumbsAction            (nullptr),
0165         decreaseThumbsAction            (nullptr),
0166         zoomFitToWindowAction           (nullptr),
0167         zoomTo100percents               (nullptr),
0168         deleteAction                    (nullptr),
0169         deleteNewAction                 (nullptr),
0170         deleteAllAction                 (nullptr),
0171         deleteSelectedAction            (nullptr),
0172         downloadAction                  (nullptr),
0173         downloadNewAction               (nullptr),
0174         downloadAllAction               (nullptr),
0175         downloadSelectedAction          (nullptr),
0176         downloadDelNewAction            (nullptr),
0177         downloadDelAllAction            (nullptr),
0178         downloadDelSelectedAction       (nullptr),
0179         lockAction                      (nullptr),
0180         selectAllAction                 (nullptr),
0181         selectInvertAction              (nullptr),
0182         selectLockedItemsAction         (nullptr),
0183         selectNewItemsAction            (nullptr),
0184         selectNoneAction                (nullptr),
0185         uploadAction                    (nullptr),
0186         markAsDownloadedAction          (nullptr),
0187         resumeAction                    (nullptr),
0188         pauseAction                     (nullptr),
0189         connectAction                   (nullptr),
0190         itemSortAction                  (nullptr),
0191         itemSortOrderAction             (nullptr),
0192         itemsGroupAction                (nullptr),
0193         showPreferencesAction           (nullptr),
0194         showLogAction                   (nullptr),
0195         showBarAction                   (nullptr),
0196         imageViewSelectionAction        (nullptr),
0197         iconViewAction                  (nullptr),
0198         camItemPreviewAction            (nullptr),
0199 
0200 #ifdef HAVE_GEOLOCATION
0201 
0202         mapViewAction                   (nullptr),
0203 
0204 #endif // HAVE_GEOLOCATION
0205 
0206         viewCMViewAction                (nullptr),
0207         cameraActions                   (nullptr),
0208         advBox                          (nullptr),
0209         splitter                        (nullptr),
0210         camThumbsCtrl                   (nullptr),
0211         controller                      (nullptr),
0212 /*
0213         //historyUpdater                (0),
0214 */
0215         view                            (nullptr),
0216         renameCustomizer                (nullptr),
0217         albumCustomizer                 (nullptr),
0218         advancedSettings                (nullptr),
0219         dngConvertSettings              (nullptr),
0220         scriptingSettings               (nullptr),
0221         filterStatusBar                 (nullptr),
0222         rightSideBar                    (nullptr),
0223         zoomBar                         (nullptr),
0224         statusProgressBar               (nullptr),
0225         albumLibraryFreeSpace           (nullptr),
0226         cameraFreeSpace                 (nullptr),
0227         progressTimer                   (nullptr),
0228         progressValue                   (0),
0229         historyView                     (nullptr),
0230         filterComboBox                  (nullptr),
0231         errorWidget                     (nullptr)
0232     {
0233     }
0234 
0235     static const QString                     configGroupName;
0236     static const QString                     configUseFileMetadata;
0237     static const QString                     configUseDefaultTargetAlbum;
0238     static const QString                     configLastTargetAlbum;
0239     static const QString                     configDefaultTargetAlbumId;
0240     static const QString                     configFileSaveConflictRule;
0241     static const QString                     importFiltersConfigGroupName;
0242 
0243     bool                                     waitAutoRotate;
0244     bool                                     deleteAfter;
0245     bool                                     busy;
0246     bool                                     closed;
0247 
0248     QString                                  cameraTitle;
0249 
0250     QHash<QString, QPair<QString, QString> > downloadedInfoHash;
0251     QHash<QString, QDateTime>                downloadedDateHash;
0252     QStringList                              downloadedItemList;
0253     QStringList                              currentlyDeleting;
0254     QStringList                              foldersToScan;
0255 
0256     QMenu*                                   downloadMenu;
0257     QMenu*                                   deleteMenu;
0258     QMenu*                                   imageMenu;
0259 
0260     QAction*                                 cameraCancelAction;
0261     QAction*                                 cameraCaptureAction;
0262     QAction*                                 cameraInfoAction;
0263     QAction*                                 increaseThumbsAction;
0264     QAction*                                 decreaseThumbsAction;
0265     QAction*                                 zoomFitToWindowAction;
0266     QAction*                                 zoomTo100percents;
0267     QMenu*                                   deleteAction;
0268     QAction*                                 deleteNewAction;
0269     QAction*                                 deleteAllAction;
0270     QAction*                                 deleteSelectedAction;
0271     QMenu*                                   downloadAction;
0272     QAction*                                 downloadNewAction;
0273     QAction*                                 downloadAllAction;
0274     QAction*                                 downloadSelectedAction;
0275     QAction*                                 downloadDelNewAction;
0276     QAction*                                 downloadDelAllAction;
0277     QAction*                                 downloadDelSelectedAction;
0278     QAction*                                 lockAction;
0279     QAction*                                 selectAllAction;
0280     QAction*                                 selectInvertAction;
0281     QAction*                                 selectLockedItemsAction;
0282     QAction*                                 selectNewItemsAction;
0283     QAction*                                 selectNoneAction;
0284     QAction*                                 uploadAction;
0285     QAction*                                 markAsDownloadedAction;
0286     QAction*                                 resumeAction;
0287     QAction*                                 pauseAction;
0288     QAction*                                 connectAction;
0289     KSelectAction*                           itemSortAction;
0290     KSelectAction*                           itemSortOrderAction;
0291     KSelectAction*                           itemsGroupAction;
0292     QAction*                                 showPreferencesAction;
0293     QAction*                                 showLogAction;
0294     QAction*                                 showBarAction;
0295     KSelectAction*                           imageViewSelectionAction;
0296     QAction*                                 iconViewAction;
0297     QAction*                                 camItemPreviewAction;
0298 
0299 #ifdef HAVE_GEOLOCATION
0300 
0301     QAction*                                 mapViewAction;
0302 
0303 #endif // HAVE_GEOLOCATION
0304 
0305     QAction*                                 viewCMViewAction;
0306 
0307     QActionGroup*                            cameraActions;
0308 
0309     QUrl                                     lastDestURL;
0310 
0311     DExpanderBox*                            advBox;
0312 
0313     SidebarSplitter*                         splitter;
0314 
0315     CameraThumbsCtrl*                        camThumbsCtrl;
0316     CameraController*                        controller;
0317 /*
0318     CameraHistoryUpdater*                    historyUpdater;
0319 */
0320     ImportView*                              view;
0321 
0322     RenameCustomizer*                        renameCustomizer;
0323     AlbumCustomizer*                         albumCustomizer;
0324     AdvancedSettings*                        advancedSettings;
0325     DNGConvertSettings*                      dngConvertSettings;
0326     ScriptingSettings*                       scriptingSettings;
0327 
0328     FilterStatusBar*                         filterStatusBar;
0329     ImportItemPropertiesSideBarImport*       rightSideBar;
0330 
0331     DZoomBar*                                zoomBar;
0332     StatusProgressBar*                       statusProgressBar;
0333 
0334     FreeSpaceWidget*                         albumLibraryFreeSpace;
0335     FreeSpaceWidget*                         cameraFreeSpace;
0336 
0337     QTimer*                                  progressTimer;
0338 
0339     float                                    progressValue;
0340 
0341     DHistoryView*                            historyView;
0342     ImportFilterComboBox*                    filterComboBox;
0343 /*
0344     CHUpdateItemMap                          map;
0345 */
0346     DNotificationWidget*                     errorWidget;
0347 };
0348 
0349 const QString ImportUI::Private::configGroupName(QLatin1String("Camera Settings"));
0350 const QString ImportUI::Private::configUseFileMetadata(QLatin1String("UseFileMetadata"));
0351 const QString ImportUI::Private::configUseDefaultTargetAlbum(QLatin1String("UseDefaultTargetAlbum"));
0352 const QString ImportUI::Private::configLastTargetAlbum(QLatin1String("LastTargetAlbum"));
0353 const QString ImportUI::Private::configDefaultTargetAlbumId(QLatin1String("DefaultTargetAlbumId"));
0354 const QString ImportUI::Private::configFileSaveConflictRule(QLatin1String("FileSaveConflictRule"));
0355 const QString ImportUI::Private::importFiltersConfigGroupName(QLatin1String("Import Filters"));
0356 
0357 } // namespace Digikam
0358 
0359 #endif // DIGIKAM_IMPORTUI_PRIVATE_H