digiKam
Loading...
Searching...
No Matches
imagewindow_p.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 * SPDX-FileCopyrightText: 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10 * SPDX-FileCopyrightText: 2004-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18#include "imagewindow.h"
19
20// C++ includes
21
22#include <cstdio>
23#include <vector>
24#include <algorithm>
25
26// Qt includes
27
28#include <QKeySequence>
29#include <QCloseEvent>
30#include <QDragMoveEvent>
31#include <QDropEvent>
32#include <QFrame>
33#include <QHBoxLayout>
34#include <QImage>
35#include <QLabel>
36#include <QPainter>
37#include <QPersistentModelIndex>
38#include <QPixmap>
39#include <QProgressBar>
40#include <QSplitter>
41#include <QTimer>
42#include <QAction>
43#include <QMenu>
44#include <QMenuBar>
45#include <QMessageBox>
46#include <QApplication>
47#include <QScopedPointer>
48
49// KDE includes
50
51#if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
52# pragma GCC diagnostic push
53# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
54#endif
55
56#if defined(Q_CC_CLANG)
57# pragma clang diagnostic push
58# pragma clang diagnostic ignored "-Wdeprecated-declarations"
59#endif
60
61#include <kactioncollection.h>
62#include <klocalizedstring.h>
63#include <kconfiggroup.h>
64#include <ksharedconfig.h>
65#include <kxmlgui_version.h>
66
67// Restore warnings
68#if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
69# pragma GCC diagnostic pop
70#endif
71
72#if defined(Q_CC_CLANG)
73# pragma clang diagnostic pop
74#endif
75
76// Local includes
77
78#include "versionmanager.h"
79#include "dlayoutbox.h"
80#include "album.h"
81#include "coredb.h"
82#include "albummanager.h"
83#include "albummodel.h"
84#include "albumfiltermodel.h"
85#include "applicationsettings.h"
86#include "canvas.h"
87#include "collectionlocation.h"
88#include "collectionmanager.h"
89#include "collectionscanner.h"
90#include "componentsinfodlg.h"
91#include "coredbaccess.h"
92#include "coredbwatch.h"
93#include "coredbchangesets.h"
94#include "ddragobjects.h"
95#include "deletedialog.h"
96#include "dimg.h"
97#include "editorcore.h"
98#include "dimagehistory.h"
99#include "digikamapp.h"
100#include "dio.h"
101#include "dmetadata.h"
102#include "editorstackview.h"
103#include "fileactionmngr.h"
104#include "dfileoperations.h"
105#include "digikam_globals.h"
106#include "digikam_debug.h"
107#include "iccsettingscontainer.h"
108#include "itemattributeswatch.h"
109#include "itemfiltermodel.h"
110#include "itemdragdrop.h"
111#include "itemdescedittab.h"
112#include "iteminfo.h"
113#include "itemlistmodel.h"
116#include "itemscanner.h"
117#include "itemthumbnailbar.h"
118#include "iofilesettings.h"
119#include "dnotificationwrapper.h"
121#include "metadatahub.h"
122#include "metaenginesettings.h"
123#include "colorlabelwidget.h"
124#include "picklabelwidget.h"
125#include "ratingwidget.h"
126#include "savingcontext.h"
127#include "scancontroller.h"
128#include "setup.h"
129#include "statusprogressbar.h"
130#include "syncjob.h"
131#include "tagsactionmngr.h"
132#include "tagscache.h"
133#include "tagspopupmenu.h"
134#include "tagregion.h"
135#include "thememanager.h"
136#include "thumbbardock.h"
137#include "thumbnailloadthread.h"
138#include "undostate.h"
139#include "dexpanderbox.h"
140#include "dbinfoiface.h"
141#include "facetagseditor.h"
142
143namespace Digikam
144{
145
146class Q_DECL_HIDDEN DatabaseVersionManager : public VersionManager
147{
148public:
149
150 QString toplevelDirectory(const QString& path) override
151 {
152 CollectionLocation loc = CollectionManager::instance()->locationForPath(path);
153
154 if (!loc.isNull())
155 {
156 return loc.albumRootPath();
157 }
158
159 return QLatin1String("/");
160 }
161};
162
163// -----------------------------------------------------------------------------------------
164
165class Q_DECL_HIDDEN ImageWindow::Private
166{
167
168public:
169
170 Private() = default;
171
172 QModelIndex currentIndex() const
173 {
174 return imageFilterModel->indexForItemInfo(currentItemInfo);
175 }
176
177 QModelIndex currentSourceIndex() const
178 {
179 return imageInfoModel->indexForItemInfo(currentItemInfo);
180 }
181
182 bool currentIsValid() const
183 {
184 return !currentItemInfo.isNull();
185 }
186
187 QUrl currentUrl() const
188 {
189 return currentItemInfo.fileUrl();
190 }
191
192 QModelIndex nextIndex() const
193 {
194 return imageFilterModel->index(currentIndex().row() + 1, 0);
195 }
196
197 QModelIndex previousIndex() const
198 {
199 return imageFilterModel->index(currentIndex().row() - 1, 0);
200 }
201
202 QModelIndex firstIndex() const
203 {
204 return imageFilterModel->index(0, 0);
205 }
206
207 QModelIndex lastIndex() const
208 {
209 return imageFilterModel->index(imageFilterModel->rowCount() - 1, 0);
210 }
211
212 ItemInfo imageInfo(const QModelIndex& index) const
213 {
214 return imageFilterModel->imageInfo(index);
215 }
216
218 {
219 QModelIndex index = imageFilterModel->indexForItemInfo(currentItemInfo);
220
221 if (index.isValid())
222 {
223 thumbBar->setCurrentIndex(index);
224 }
225 else
226 {
227 thumbBar->setCurrentWhenAvailable(currentItemInfo.id());
228 }
229 }
230
232 {
233 if (!imageInfoModel->hasImage(info))
234 {
235 imageInfoModel->addItemInfoSynchronously(info);
236 imageFilterModel->sort(imageFilterModel->sortColumn());
237 }
238 }
239
240public:
241
242 const QString configShowThumbbarEntry = QLatin1String("Show Thumbbar");
243
244 QMainWindow* viewContainer = nullptr;
245
246 QAction* toMainWindowAction = nullptr;
247
249 QAction* fileDeletePermanentlyAction = nullptr;
250 QAction* fileDeletePermanentlyDirectlyAction = nullptr;
251 QAction* fileTrashDirectlyAction = nullptr;
252
254 ItemListModel* imageInfoModel = nullptr;
255 ItemFilterModel* imageFilterModel = nullptr;
256 ItemDragDropHandler* dragDropHandler = nullptr;
257
258 ItemThumbnailBar* thumbBar = nullptr;
259 ThumbBarDock* thumbBarDock = nullptr;
260
261 ItemPropertiesSideBarDB* rightSideBar = nullptr;
262
264
265 QList<FaceTagsIface> facesList;
266};
267
268} // namespace Digikam
Definition collectionlocation.h:31
QString albumRootPath() const
Definition collectionlocation.cpp:50
bool isNull() const
Definition collectionlocation.h:163
Definition imagewindow_p.h:147
QString toplevelDirectory(const QString &path) override
Definition imagewindow_p.h:150
Definition imagewindow_p.h:166
ItemInfo imageInfo(const QModelIndex &index) const
Definition imagewindow_p.h:212
QModelIndex previousIndex() const
Definition imagewindow_p.h:197
QModelIndex lastIndex() const
Definition imagewindow_p.h:207
ItemInfo currentItemInfo
Definition imagewindow_p.h:253
QModelIndex currentSourceIndex() const
Definition imagewindow_p.h:177
QList< FaceTagsIface > facesList
Definition imagewindow_p.h:265
bool currentIsValid() const
Definition imagewindow_p.h:182
void ensureModelContains(const ItemInfo &info)
Definition imagewindow_p.h:231
DatabaseVersionManager versionManager
Definition imagewindow_p.h:263
QModelIndex nextIndex() const
Definition imagewindow_p.h:192
QUrl currentUrl() const
Definition imagewindow_p.h:187
QModelIndex currentIndex() const
Definition imagewindow_p.h:172
QModelIndex firstIndex() const
Definition imagewindow_p.h:202
void setThumbBarToCurrent()
Definition imagewindow_p.h:217
Definition imagewindow.h:38
Definition itemdragdrop.h:32
Definition itemfiltermodel.h:115
Definition iteminfo.h:68
Definition itemlistmodel.h:29
Definition itempropertiessidebardb.h:45
Definition itemthumbnailbar.h:28
Definition thumbbardock.h:74
Definition versionmanager.h:36
Definition datefolderview.cpp:34