File indexing completed on 2025-03-09 03:58:43

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-05-07
0007  * Description : QStackedWidget to handle different types of views
0008  *               (icon view, items preview, media view)
0009  *
0010  * SPDX-FileCopyrightText: 2012      by Islam Wazery <wazery at ubuntu dot com>
0011  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_IMPORT_STACKED_VIEW_H
0018 #define DIGIKAM_IMPORT_STACKED_VIEW_H
0019 
0020 // Qt includes
0021 
0022 #include <QStackedWidget>
0023 
0024 // Local includes
0025 
0026 #include "digikam_config.h"
0027 #include "importthumbnailbar.h"
0028 #include "importpreviewview.h"
0029 #include "thumbbardock.h"
0030 #include "camiteminfo.h"
0031 #include "importiconview.h"
0032 #include "digikam_export.h"
0033 
0034 #ifdef HAVE_MEDIAPLAYER
0035 #   include "mediaplayerview.h"
0036 #endif //HAVE_MEDIAPLAYER
0037 
0038 #ifdef HAVE_GEOLOCATION
0039 #   include "mapwidgetview.h"
0040 #endif // HAVE_GEOLOCATION
0041 
0042 namespace Digikam
0043 {
0044 
0045 class DIGIKAM_GUI_EXPORT ImportStackedView : public QStackedWidget
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050 
0051     enum StackedViewMode
0052     {
0053         PreviewCameraMode = 0, ///< previewing the set of items on the camera
0054         PreviewImageMode,
0055 
0056 #ifdef HAVE_GEOLOCATION
0057 
0058         MapWidgetMode,
0059         MediaPlayerMode
0060 
0061 #else
0062 
0063         MediaPlayerMode,
0064         MapWidgetMode
0065 
0066 #endif // HAVE_GEOLOCATION
0067 
0068     };
0069 
0070 public:
0071 
0072     explicit ImportStackedView(QWidget* const parent = nullptr);
0073     ~ImportStackedView() override;
0074 
0075     void setDockArea(QMainWindow*);
0076 
0077     ThumbBarDock*       thumbBarDock()      const;
0078     ImportThumbnailBar* thumbBar()          const;
0079     ImportIconView*     importIconView()    const;
0080     ImportPreviewView*  importPreviewView() const;
0081 
0082 #ifdef HAVE_GEOLOCATION
0083 
0084     MapWidgetView*      mapWidgetView()     const;
0085 
0086 #endif // HAVE_GEOLOCATION
0087 
0088 #ifdef HAVE_MEDIAPLAYER
0089 
0090     MediaPlayerView*    mediaPlayerView()   const;
0091 
0092 #endif //HAVE_MEDIAPLAYER
0093 
0094     bool isInSingleFileMode()               const;
0095     bool isInMultipleFileMode()             const;
0096 /*
0097     FIXME
0098     bool isInAbstractMode() const;
0099 */
0100     void setPreviewItem(const CamItemInfo& info = CamItemInfo(),
0101                         const CamItemInfo& previous = CamItemInfo(),
0102                         const CamItemInfo& next = CamItemInfo());
0103 
0104     StackedViewMode  viewMode()             const;
0105     void setViewMode(const StackedViewMode mode);
0106     void previewLoaded();
0107 
0108     void   increaseZoom();
0109     void   decreaseZoom();
0110     void   fitToWindow();
0111     void   toggleFitToWindowOr100();
0112     void   zoomTo100Percents();
0113     void   setZoomFactor(double z);
0114     void   setZoomFactorSnapped(double z);
0115 
0116     bool   maxZoom()    const;
0117     bool   minZoom()    const;
0118     double zoomFactor() const;
0119     double zoomMin()    const;
0120     double zoomMax()    const;
0121 
0122 Q_SIGNALS:
0123 
0124     void signalNextItem();
0125     void signalPrevItem();
0126     void signalViewModeChanged();
0127     void signalEscapePreview();
0128     void signalZoomFactorChanged(double);
0129 /*
0130     FIXME
0131     void signalGotoAlbumAndItem(const CamItemInfo&);
0132     void signalGotoDateAndItem(const CamItemInfo&);
0133     void signalGotoTagAndItem(int);
0134 */
0135 
0136 private Q_SLOTS:
0137 
0138     void slotPreviewLoaded(bool);
0139     void slotZoomFactorChanged(double);
0140     void slotThumbBarSelectionChanged();
0141     void slotIconViewSelectionChanged();
0142 
0143 private:
0144 
0145     void readSettings();
0146     void syncSelection(ImportCategorizedView* const from, ImportCategorizedView* const to);
0147 
0148     /// Used to return the category for a specified camera item.
0149     QString identifyCategoryforMime(const QString& mime) const;
0150 
0151 private:
0152 
0153     class Private;
0154     Private* const d;
0155 };
0156 
0157 } // namespace Digikam
0158 
0159 #endif // DIGIKAM_IMPORT_STACKED_VIEW_H