digiKam
imagewindow.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2004-02-12
7  * Description : digiKam image editor GUI
8  *
9  * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2004-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_IMAGE_WINDOW_H
26 #define DIGIKAM_IMAGE_WINDOW_H
27 
28 // Qt includes
29 
30 #include <QCloseEvent>
31 #include <QString>
32 #include <QUrl>
33 
34 // Local includes
35 
36 #include "editorwindow.h"
37 #include "iteminfo.h"
38 
39 class QDragMoveEvent;
40 class QDropEvent;
41 
42 namespace Digikam
43 {
44 
45 class CollectionImageChangeset;
46 
47 class ImageWindow : public EditorWindow
48 {
49  Q_OBJECT
50 
51 public:
52 
53  ~ImageWindow() override;
54 
55  static ImageWindow* imageWindow();
56  static bool imageWindowCreated();
57 
58  bool queryClose() override;
59  void toggleTag(int tagID);
60 
61 public:
62 
63  DInfoInterface* infoIface(DPluginAction* const ac) override;
64 
65  VersionManager* versionManager() const override;
66 
67 public Q_SLOTS:
68 
69  void loadItemInfos(const ItemInfoList& imageInfoList,
70  const ItemInfo& imageInfoCurrent,
71  const QString& caption);
72  void openImage(const ItemInfo& info);
73 
74  void slotAssignPickLabel(int pickId);
75  void slotAssignColorLabel(int colorId);
76  void slotAssignRating(int rating);
77 
78 Q_SIGNALS:
79 
80  void signalURLChanged(const QUrl& url);
82 
83 protected:
84 
85  void showEvent(QShowEvent*) override;
86  void dropEvent(QDropEvent* e) override;
87  void closeEvent(QCloseEvent* e) override;
88  void dragMoveEvent(QDragMoveEvent* e) override;
89 
90 private:
91 
92  // Disable
93  ImageWindow();
94  ImageWindow(QWidget*);
95 
96  void loadIndex(const QModelIndex& index);
97 
98  bool save() override;
99  bool saveAs() override;
100  bool saveNewVersion() override;
101  bool saveCurrentVersion() override;
102  bool saveNewVersionAs() override;
103  bool saveNewVersionInFormat(const QString& format) override;
104 
105  QUrl saveDestinationUrl() override;
106  bool hasOriginalToRestore() override;
107  DImageHistory resolvedImageHistory(const DImageHistory& history) override;
108 
109  void prepareImageToSave();
110  void saveFaceTagsToImage(const ItemInfo& info);
111 
112  void saveIsComplete() override;
113  void saveAsIsComplete() override;
114  void saveVersionIsComplete() override;
115 
116  void setViewToURL(const QUrl& url);
117  void deleteCurrentItem(bool ask, bool permanently);
118  void removeCurrent();
119 
120  void assignPickLabel(const ItemInfo& info, int pickId);
121  void assignColorLabel(const ItemInfo& info, int colorId);
122  void assignRating(const ItemInfo& info, int rating);
123  void toggleTag(const ItemInfo& info, int tagID);
124 
125  ThumbBarDock* thumbBar() const override;
126  Sidebar* rightSideBar() const override;
127 
128 Q_SIGNALS: // private signals
129 
131 
132 private Q_SLOTS:
133 
134  void slotLoadItemInfosStage2();
135  void slotThumbBarModelReady();
136 
137  void slotForward() override;
138  void slotBackward() override;
139  void slotFirst() override;
140  void slotLast() override;
141  void slotFileWithDefaultApplication() override;
142 
143  void slotToMainWindow();
144 
145  void slotThumbBarImageSelected(const ItemInfo&);
146  void slotLoadCurrent();
147  void slotDeleteCurrentItem() override;
148  void slotDeleteCurrentItemPermanently();
149  void slotDeleteCurrentItemPermanentlyDirectly();
150  void slotTrashCurrentItemDirectly();
151 
152  void slotChanged() override;
153  void slotUpdateItemInfo() override;
154  void slotFileOriginChanged(const QString&) override;
155 
156  void slotRevert() override;
157  void slotOpenOriginal() override;
158 
159  void slotAssignTag(int tagID);
160  void slotRemoveTag(int tagID);
161 
162  void slotRatingChanged(const QUrl&, int);
163  void slotColorLabelChanged(const QUrl&, int);
164  void slotPickLabelChanged(const QUrl&, int);
165  void slotToggleTag(const QUrl&, int);
166 
167  void slotFileMetadataChanged(const QUrl&);
168 /*
169  void slotCollectionImageChange(const CollectionImageChangeset&);
170  void slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
171 */
172  void slotDroppedOnThumbbar(const QList<ItemInfo>& infos);
173 
174  void slotComponentsInfo() override;
175  void slotDBStat() override;
176  void slotOnlineVersionCheck() override;
177 
178  void slotAddedDropedItems(QDropEvent*) override;
179  void slotOpenWith(QAction* action = nullptr) override;
180 
181  void slotRightSideBarActivateTitles();
182  void slotRightSideBarActivateComments();
183  void slotRightSideBarActivateAssignedTags();
184 
185 // -- Internal setup methods implemented in imagewindow_config.cpp ----------------------------------------
186 
187 public Q_SLOTS:
188 
189  void slotSetup() override;
190  void slotSetupICC() override;
191 
192  void slotSetupChanged();
193 
194 // -- Internal setup methods implemented in imagewindow_setup.cpp ----------------------------------------
195 
196 private:
197 
198  void setupActions() override;
199  void setupConnections() override;
200  void setupUserArea() override;
201 
202  void addServicesMenu() override;
203 
204 private Q_SLOTS:
205 
206  void slotContextMenu() override;
207 
208 // -- Import tools methods implemented in imagewindow_import.cpp -------------------------------------
209 
210 private Q_SLOTS:
211 
212  void slotImportedImagefromScanner(const QUrl& url);
213 
214 // -- Internal private container --------------------------------------------------------------------
215 
216 private:
217 
218  static ImageWindow* m_instance;
219 
220  class Private;
221  Private* const d;
222 };
223 
224 } // namespace Digikam
225 
226 #endif // DIGIKAM_IMAGE_WINDOW_H
Definition: dimagehistory.h:49
Definition: dinfointerface.h:56
Definition: dpluginaction.h:40
Definition: editorwindow.h:78
Definition: imagewindow_p.h:176
Definition: imagewindow.h:48
void slotAssignColorLabel(int colorId)
Definition: imagewindow.cpp:446
DInfoInterface * infoIface(DPluginAction *const ac) override
Definition: imagewindow.cpp:1362
void dropEvent(QDropEvent *e) override
Definition: imagewindow.cpp:1104
void showEvent(QShowEvent *) override
Definition: imagewindow.cpp:148
void openImage(const ItemInfo &info)
Definition: imagewindow.cpp:221
void toggleTag(int tagID)
Definition: imagewindow.cpp:405
static ImageWindow * imageWindow()
Definition: imagewindow.cpp:32
void signalSavingDialogProgress(float value)
bool queryClose() override
Definition: imagewindow.cpp:155
void slotSetupChanged()
Definition: imagewindow_config.cpp:39
void loadItemInfos(const ItemInfoList &imageInfoList, const ItemInfo &imageInfoCurrent, const QString &caption)
Definition: imagewindow.cpp:170
void slotAssignPickLabel(int pickId)
Definition: imagewindow.cpp:441
static bool imageWindowCreated()
Definition: imagewindow.cpp:42
~ImageWindow() override
Definition: imagewindow.cpp:103
void slotSetup() override
Definition: imagewindow_config.cpp:29
void dragMoveEvent(QDragMoveEvent *e) override
Definition: imagewindow.cpp:1086
void slotSetupICC() override
Definition: imagewindow_config.cpp:34
void closeEvent(QCloseEvent *e) override
Definition: imagewindow.cpp:112
void signalURLChanged(const QUrl &url)
void slotAssignRating(int rating)
Definition: imagewindow.cpp:467
VersionManager * versionManager() const override
Definition: imagewindow.cpp:818
Definition: iteminfolist.h:47
Definition: iteminfo.h:78
Definition: sidebar.h:333
Definition: thumbbardock.h:84
Definition: versionmanager.h:46
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43