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