File indexing completed on 2025-01-19 03:59:16
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2004-02-12 0007 * Description : digiKam image editor GUI 0008 * 0009 * SPDX-FileCopyrightText: 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2004-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_IMAGE_WINDOW_H 0017 #define DIGIKAM_IMAGE_WINDOW_H 0018 0019 // Qt includes 0020 0021 #include <QCloseEvent> 0022 #include <QString> 0023 #include <QUrl> 0024 0025 // Local includes 0026 0027 #include "editorwindow.h" 0028 #include "iteminfo.h" 0029 0030 class QDragMoveEvent; 0031 class QDropEvent; 0032 0033 namespace Digikam 0034 { 0035 0036 class CollectionImageChangeset; 0037 0038 class ImageWindow : public EditorWindow 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 0044 ~ImageWindow() override; 0045 0046 static ImageWindow* imageWindow(); 0047 static bool imageWindowCreated(); 0048 0049 bool queryClose() override; 0050 void toggleTag(int tagID); 0051 0052 public: 0053 0054 DInfoInterface* infoIface(DPluginAction* const ac) override; 0055 0056 VersionManager* versionManager() const override; 0057 0058 public Q_SLOTS: 0059 0060 void loadItemInfos(const ItemInfoList& imageInfoList, 0061 const ItemInfo& imageInfoCurrent, 0062 const QString& caption); 0063 void openImage(const ItemInfo& info); 0064 0065 void slotAssignPickLabel(int pickId); 0066 void slotAssignColorLabel(int colorId); 0067 void slotAssignRating(int rating); 0068 0069 Q_SIGNALS: 0070 0071 void signalURLChanged(const QUrl& url); 0072 void signalSavingDialogProgress(float value); 0073 0074 protected: 0075 0076 void showEvent(QShowEvent* e) override; 0077 void dropEvent(QDropEvent* e) override; 0078 void closeEvent(QCloseEvent* e) override; 0079 void dragMoveEvent(QDragMoveEvent* e) override; 0080 0081 private: 0082 0083 // Disable 0084 ImageWindow(); 0085 ImageWindow(QWidget*); 0086 0087 void loadIndex(const QModelIndex& index); 0088 0089 bool save() override; 0090 bool saveAs() override; 0091 bool saveNewVersion() override; 0092 bool saveCurrentVersion() override; 0093 bool saveNewVersionAs() override; 0094 bool saveNewVersionInFormat(const QString& format) override; 0095 0096 QUrl saveDestinationUrl() override; 0097 bool hasOriginalToRestore() override; 0098 DImageHistory resolvedImageHistory(const DImageHistory& history) override; 0099 0100 void prepareImageToSave(); 0101 void saveFaceTagsToImage(const ItemInfo& info); 0102 0103 void saveIsComplete() override; 0104 void saveAsIsComplete() override; 0105 void saveVersionIsComplete() override; 0106 0107 void setViewToURL(const QUrl& url); 0108 void deleteCurrentItem(bool ask, bool permanently); 0109 void removeCurrent(); 0110 0111 void assignPickLabel(const ItemInfo& info, int pickId); 0112 void assignColorLabel(const ItemInfo& info, int colorId); 0113 void assignRating(const ItemInfo& info, int rating); 0114 void toggleTag(const ItemInfo& info, int tagID); 0115 0116 ThumbBarDock* thumbBar() const override; 0117 Sidebar* rightSideBar() const override; 0118 0119 Q_SIGNALS: // private signals 0120 0121 void loadCurrentLater(); 0122 0123 private Q_SLOTS: 0124 0125 void slotLoadItemInfosStage2(); 0126 void slotThumbBarModelReady(); 0127 0128 void slotForward() override; 0129 void slotBackward() override; 0130 void slotFirst() override; 0131 void slotLast() override; 0132 void slotFileWithDefaultApplication() override; 0133 0134 void slotToMainWindow(); 0135 0136 void slotThumbBarImageSelected(const ItemInfo&); 0137 void slotLoadCurrent(); 0138 void slotDeleteCurrentItem() override; 0139 void slotDeleteCurrentItemPermanently(); 0140 void slotDeleteCurrentItemPermanentlyDirectly(); 0141 void slotTrashCurrentItemDirectly(); 0142 0143 void slotChanged() override; 0144 void slotUpdateItemInfo() override; 0145 void slotFileOriginChanged(const QString&) override; 0146 0147 void slotRevert() override; 0148 void slotOpenOriginal() override; 0149 0150 void slotAssignTag(int tagID); 0151 void slotRemoveTag(int tagID); 0152 0153 void slotRatingChanged(const QUrl&, int); 0154 void slotColorLabelChanged(const QUrl&, int); 0155 void slotPickLabelChanged(const QUrl&, int); 0156 void slotToggleTag(const QUrl&, int); 0157 0158 void slotFileMetadataChanged(const QUrl&); 0159 /* 0160 void slotCollectionImageChange(const CollectionImageChangeset&); 0161 void slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end); 0162 */ 0163 void slotDroppedOnThumbbar(const QList<ItemInfo>& infos); 0164 0165 void slotComponentsInfo() override; 0166 void slotDBStat() override; 0167 void slotOnlineVersionCheck() override; 0168 0169 void slotAddedDropedItems(QDropEvent*) override; 0170 void slotOpenWith(QAction* action = nullptr) override; 0171 0172 void slotRightSideBarActivateTitles(); 0173 void slotRightSideBarActivateComments(); 0174 void slotRightSideBarActivateAssignedTags(); 0175 0176 // -- Internal setup methods implemented in imagewindow_config.cpp ---------------------------------------- 0177 0178 public Q_SLOTS: 0179 0180 void slotSetup() override; 0181 void slotSetupICC() override; 0182 0183 void slotSetupChanged(); 0184 0185 // -- Internal setup methods implemented in imagewindow_setup.cpp ---------------------------------------- 0186 0187 private: 0188 0189 void setupActions() override; 0190 void setupConnections() override; 0191 void setupUserArea() override; 0192 0193 void addServicesMenu() override; 0194 0195 private Q_SLOTS: 0196 0197 void slotContextMenu() override; 0198 0199 // -- Import tools methods implemented in imagewindow_import.cpp ------------------------------------- 0200 0201 private Q_SLOTS: 0202 0203 void slotImportedImagefromScanner(const QUrl& url); 0204 0205 // -- Internal private container -------------------------------------------------------------------- 0206 0207 private: 0208 0209 static ImageWindow* m_instance; 0210 0211 class Private; 0212 Private* const d; 0213 }; 0214 0215 } // namespace Digikam 0216 0217 #endif // DIGIKAM_IMAGE_WINDOW_H