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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-14-07
0007  * Description : An embedded view to show the cam item preview widget.
0008  *
0009  * SPDX-FileCopyrightText: 2012 by Islam Wazery  <wazery at ubuntu dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_IMPORT_PREVIEW_VIEW_H
0016 #define DIGIKAM_IMPORT_PREVIEW_VIEW_H
0017 
0018 // Local includes
0019 
0020 #include "graphicsdimgview.h"
0021 #include "camiteminfo.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 class ImportPreviewView : public GraphicsDImgView
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031 
0032     enum Mode
0033     {
0034         IconViewPreview
0035     };
0036 
0037 public:
0038 
0039     explicit ImportPreviewView(QWidget* const parent, Mode mode = IconViewPreview);
0040     ~ImportPreviewView()                   override;
0041 
0042     void setCamItemInfo(const CamItemInfo& info     = CamItemInfo(),
0043                         const CamItemInfo& previous = CamItemInfo(),
0044                         const CamItemInfo& next     = CamItemInfo());
0045 
0046     CamItemInfo getCamItemInfo()     const;
0047 
0048     void reload();
0049     void setCamItemPath(const QString& path = QString());
0050     void setPreviousNextPaths(const QString& previous, const QString& next);
0051 
0052     void showContextMenu(const CamItemInfo& info, QGraphicsSceneContextMenuEvent* event);
0053 
0054 private:
0055 
0056     QString identifyCategoryforMime(const QString& mime);
0057 
0058 Q_SIGNALS:
0059 
0060     void signalNextItem();
0061     void signalPrevItem();
0062     void signalDeleteItem();
0063     void signalPreviewLoaded(bool success);
0064     void signalEscapePreview();
0065 /*
0066     FIXME
0067     void signalAddToExistingQueue(int);
0068     void signalGotoFolderAndItem(const CamItemInfo&);
0069     void signalGotoDateAndItem(const CamItemInfo&);
0070     void signalGotoTagAndItem(int);
0071     void signalPopupTagsView();
0072 */
0073     void signalAssignPickLabel(int);
0074     void signalAssignColorLabel(int);
0075     void signalAssignRating(int);
0076 
0077 
0078 protected:
0079 
0080     bool acceptsMouseClick(QMouseEvent* e) override;
0081     void leaveEvent(QEvent* e)             override;
0082     void showEvent(QShowEvent* e)          override;
0083 
0084 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
0085 
0086     void enterEvent(QEnterEvent*)          override;
0087 
0088 #else
0089 
0090     void enterEvent(QEvent*)               override;
0091 
0092 #endif
0093 
0094 private Q_SLOTS:
0095 
0096     void camItemLoaded();
0097     void camItemLoadingFailed();
0098 /*
0099     TODO: Implement Tags and Labels in Import Tool
0100     void slotAssignTag(int tagID);
0101     void slotRemoveTag(int tagID);
0102     void slotAssignPickLabel(int pickId);
0103     void slotAssignColorLabel(int colorId);
0104 */
0105     void slotThemeChanged();
0106     void slotSetupChanged();
0107 
0108     void slotRotateLeft();
0109     void slotRotateRight();
0110     void slotDeleteItem();
0111 
0112 private:
0113 
0114     class Private;
0115     Private* const d;
0116 };
0117 
0118 } // namespace Digikam
0119 
0120 #endif // DIGIKAM_IMPORT_PREVIEW_VIEW_H