File indexing completed on 2025-01-19 03:50:43
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-21-12 0007 * Description : a embedded view to show item preview widget. 0008 * 0009 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com> 0011 * SPDX-FileCopyrightText: 2010-2011 by Aditya Bhatt <adityabhatt1991 at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_ITEM_PREVIEW_VIEW_H 0018 #define DIGIKAM_ITEM_PREVIEW_VIEW_H 0019 0020 // Local includes 0021 0022 #include "graphicsdimgview.h" 0023 #include "iteminfo.h" 0024 0025 class QPixmap; 0026 class QDragMoveEvent; 0027 class QDropEvent; 0028 class QDragEnterEvent; 0029 0030 namespace Digikam 0031 { 0032 0033 class Album; 0034 class LoadingDescription; 0035 0036 class ItemPreviewView : public GraphicsDImgView 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 0042 enum Mode 0043 { 0044 IconViewPreview, 0045 LightTablePreview 0046 }; 0047 0048 public: 0049 0050 explicit ItemPreviewView(QWidget* const parent, 0051 Mode mode=IconViewPreview, 0052 Album* const currAlbum = nullptr); 0053 ~ItemPreviewView() override; 0054 0055 void setItemInfo(const ItemInfo& info = ItemInfo(), 0056 const ItemInfo& previous = ItemInfo(), 0057 const ItemInfo& next = ItemInfo()); 0058 0059 ItemInfo getItemInfo() const; 0060 0061 void reload(); 0062 void setImagePath(const QString& path=QString()); 0063 void setPreviousNextPaths(const QString& previous, const QString& next); 0064 0065 Q_SIGNALS: 0066 0067 void signalNextItem(); 0068 void signalPrevItem(); 0069 void signalDeleteItem(); 0070 void signalPreviewLoaded(bool success); 0071 void signalEscapePreview(); 0072 void signalAddToExistingQueue(int); 0073 void signalSlideShowCurrent(); 0074 0075 void signalGotoAlbumAndItem(const ItemInfo&); 0076 void signalGotoDateAndItem(const ItemInfo&); 0077 void signalGotoTagAndItem(int); 0078 void signalPopupTagsView(); 0079 0080 protected: 0081 0082 bool acceptsMouseClick(QMouseEvent* e) override; 0083 void mousePressEvent(QMouseEvent* e) override; 0084 void leaveEvent(QEvent* e) override; 0085 void showEvent(QShowEvent* e) override; 0086 void dropEvent(QDropEvent* e) override; 0087 void dragMoveEvent(QDragMoveEvent* e) override; 0088 void dragEnterEvent(QDragEnterEvent* e) override; 0089 0090 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0091 0092 void enterEvent(QEnterEvent*) override; 0093 0094 #else 0095 0096 void enterEvent(QEvent*) override; 0097 0098 #endif 0099 0100 0101 private Q_SLOTS: 0102 0103 void imageLoaded(); 0104 void imageLoadingFailed(); 0105 0106 void slotAssignTag(int tagID); 0107 void slotRemoveTag(int tagID); 0108 void slotAssignRating(int rating); 0109 void slotAssignPickLabel(int pickId); 0110 void slotAssignColorLabel(int colorId); 0111 0112 void slotThemeChanged(); 0113 void slotSetupChanged(); 0114 0115 void slotRotateLeft(); 0116 void slotRotateRight(); 0117 void slotDeleteItem(); 0118 0119 /** 0120 * @brief slotUpdateFaces - after applying some transformation on 0121 * image, update face tags position 0122 */ 0123 void slotUpdateFaces(); 0124 0125 void slotShowContextMenu(QGraphicsSceneContextMenuEvent* event); 0126 0127 void slotSlideShowCurrent(); 0128 0129 private: 0130 0131 class Private; 0132 Private* const d; 0133 }; 0134 0135 } // namespace Digikam 0136 0137 #endif // DIGIKAM_ITEM_PREVIEW_VIEW_H