File indexing completed on 2025-01-19 03:50:46
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-06-13 0007 * Description : A widget stack to embedded album content view 0008 * or the current image preview. 0009 * 0010 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2013 by Michael G. Hansen <mike at mghansen dot de> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_STACKED_VIEW_H 0018 #define DIGIKAM_STACKED_VIEW_H 0019 0020 // Qt includes 0021 0022 #include <QMainWindow> 0023 #include <QStackedWidget> 0024 0025 // Local includes 0026 0027 #include "digikam_config.h" 0028 #include "digikam_export.h" 0029 #include "iteminfo.h" 0030 #include "thumbbardock.h" 0031 0032 namespace Digikam 0033 { 0034 0035 class DigikamItemView; 0036 class ItemCategorizedView; 0037 class ItemPreviewView; 0038 class ItemThumbnailBar; 0039 class TableView; 0040 class TrashView; 0041 0042 #ifdef HAVE_MEDIAPLAYER 0043 0044 class MediaPlayerView; 0045 0046 #endif //HAVE_MEDIAPLAYER 0047 0048 #ifdef HAVE_GEOLOCATION 0049 0050 class MapWidgetView; 0051 0052 #endif // HAVE_GEOLOCATION 0053 0054 class StackedView : public QStackedWidget 0055 { 0056 Q_OBJECT 0057 0058 public: 0059 0060 enum StackedViewMode 0061 { 0062 StackedViewModeFirst = 0, 0063 IconViewMode = 0, 0064 PreviewImageMode = 1, 0065 WelcomePageMode = 2, 0066 TableViewMode = 3, 0067 TrashViewMode = 4, 0068 MapWidgetMode = 5, 0069 MediaPlayerMode = 6, 0070 StackedViewModeLast = 6 0071 }; 0072 0073 public: 0074 0075 explicit StackedView(QWidget* const parent = nullptr); 0076 ~StackedView() override; 0077 0078 /* Attach the thumbnail dock widget to the specified QMainWindow. */ 0079 void setDockArea(QMainWindow*); 0080 0081 ThumbBarDock* thumbBarDock() const; 0082 ItemThumbnailBar* thumbBar() const; 0083 DigikamItemView* imageIconView() const; 0084 ItemPreviewView* imagePreviewView() const; 0085 TableView* tableView() const; 0086 TrashView* trashView() const; 0087 0088 #ifdef HAVE_MEDIAPLAYER 0089 0090 MediaPlayerView* mediaPlayerView() const; 0091 0092 #endif //HAVE_MEDIAPLAYER 0093 0094 #ifdef HAVE_GEOLOCATION 0095 0096 MapWidgetView* mapWidgetView() const; 0097 0098 #endif // HAVE_GEOLOCATION 0099 0100 /** 0101 * Single-file mode is image preview or media player, 0102 * multi-file is icon view or map, 0103 * abstract modes do not handle files (welcome page) 0104 */ 0105 bool isInSingleFileMode() const; 0106 bool isInMultipleFileMode() const; 0107 bool isInAbstractMode() const; 0108 0109 void setPreviewItem(const ItemInfo& info = ItemInfo(), 0110 const ItemInfo& previous = ItemInfo(), 0111 const ItemInfo& next = ItemInfo()); 0112 StackedViewMode viewMode() const; 0113 void setViewMode(const StackedViewMode mode); 0114 void previewLoaded(); 0115 0116 void increaseZoom(); 0117 void decreaseZoom(); 0118 void fitToWindow(); 0119 void toggleFitToWindowOr100(); 0120 void zoomTo100Percents(); 0121 bool maxZoom(); 0122 bool minZoom(); 0123 void setZoomFactor(double z); 0124 void setZoomFactorSnapped(double z); 0125 double zoomFactor(); 0126 double zoomMin(); 0127 double zoomMax(); 0128 0129 Q_SIGNALS: 0130 0131 void signalNextItem(); 0132 void signalPrevItem(); 0133 void signalDeleteItem(); 0134 void signalViewModeChanged(); 0135 void signalEscapePreview(); 0136 void signalZoomFactorChanged(double); 0137 void signalPopupTagsView(); 0138 void signalAddToExistingQueue(int); 0139 0140 void signalGotoAlbumAndItem(const ItemInfo&); 0141 void signalGotoDateAndItem(const ItemInfo&); 0142 void signalGotoTagAndItem(int); 0143 0144 private Q_SLOTS: 0145 0146 void slotPreviewLoaded(bool); 0147 void slotZoomFactorChanged(double); 0148 void slotThumbBarSelectionChanged(); 0149 void slotIconViewSelectionChanged(); 0150 0151 private: 0152 0153 void readSettings(); 0154 void syncSelection(ItemCategorizedView* const from, ItemCategorizedView* const to); 0155 0156 private: 0157 0158 class Private; 0159 Private* const d; 0160 }; 0161 0162 } // namespace Digikam 0163 0164 #endif // DIGIKAM_STACKED_VIEW_H