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_PRIVATE_H 0017 #define DIGIKAM_IMAGE_WINDOW_PRIVATE_H 0018 0019 #include "imagewindow.h" 0020 0021 // C++ includes 0022 0023 #include <cstdio> 0024 #include <vector> 0025 #include <algorithm> 0026 0027 // Qt includes 0028 0029 #include <QKeySequence> 0030 #include <QCloseEvent> 0031 #include <QDragMoveEvent> 0032 #include <QDropEvent> 0033 #include <QFrame> 0034 #include <QHBoxLayout> 0035 #include <QImage> 0036 #include <QLabel> 0037 #include <QPainter> 0038 #include <QPersistentModelIndex> 0039 #include <QPixmap> 0040 #include <QProgressBar> 0041 #include <QSplitter> 0042 #include <QTimer> 0043 #include <QAction> 0044 #include <QMenu> 0045 #include <QMenuBar> 0046 #include <QMessageBox> 0047 #include <QApplication> 0048 #include <QScopedPointer> 0049 0050 // KDE includes 0051 0052 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU) 0053 # pragma GCC diagnostic push 0054 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" 0055 #endif 0056 0057 #if defined(Q_CC_CLANG) 0058 # pragma clang diagnostic push 0059 # pragma clang diagnostic ignored "-Wdeprecated-declarations" 0060 #endif 0061 0062 #include <kactioncollection.h> 0063 #include <klocalizedstring.h> 0064 #include <kconfiggroup.h> 0065 #include <ksharedconfig.h> 0066 0067 // Restore warnings 0068 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU) 0069 # pragma GCC diagnostic pop 0070 #endif 0071 0072 #if defined(Q_CC_CLANG) 0073 # pragma clang diagnostic pop 0074 #endif 0075 0076 // Local includes 0077 0078 #include "versionmanager.h" 0079 #include "dlayoutbox.h" 0080 #include "album.h" 0081 #include "coredb.h" 0082 #include "albummanager.h" 0083 #include "albummodel.h" 0084 #include "albumfiltermodel.h" 0085 #include "applicationsettings.h" 0086 #include "canvas.h" 0087 #include "collectionlocation.h" 0088 #include "collectionmanager.h" 0089 #include "collectionscanner.h" 0090 #include "componentsinfodlg.h" 0091 #include "coredbaccess.h" 0092 #include "coredbwatch.h" 0093 #include "coredbchangesets.h" 0094 #include "ddragobjects.h" 0095 #include "deletedialog.h" 0096 #include "dimg.h" 0097 #include "editorcore.h" 0098 #include "dimagehistory.h" 0099 #include "digikamapp.h" 0100 #include "dio.h" 0101 #include "dmetadata.h" 0102 #include "editorstackview.h" 0103 #include "fileactionmngr.h" 0104 #include "dfileoperations.h" 0105 #include "digikam_globals.h" 0106 #include "digikam_debug.h" 0107 #include "iccsettingscontainer.h" 0108 #include "itemattributeswatch.h" 0109 #include "itemfiltermodel.h" 0110 #include "itemdragdrop.h" 0111 #include "itemdescedittab.h" 0112 #include "iteminfo.h" 0113 #include "itemlistmodel.h" 0114 #include "itempropertiessidebardb.h" 0115 #include "itempropertiesversionstab.h" 0116 #include "itemscanner.h" 0117 #include "itemthumbnailbar.h" 0118 #include "iofilesettings.h" 0119 #include "dnotificationwrapper.h" 0120 #include "loadingcacheinterface.h" 0121 #include "metadatahub.h" 0122 #include "metaenginesettings.h" 0123 #include "colorlabelwidget.h" 0124 #include "picklabelwidget.h" 0125 #include "ratingwidget.h" 0126 #include "savingcontext.h" 0127 #include "scancontroller.h" 0128 #include "setup.h" 0129 #include "statusprogressbar.h" 0130 #include "syncjob.h" 0131 #include "tagsactionmngr.h" 0132 #include "tagscache.h" 0133 #include "tagspopupmenu.h" 0134 #include "tagregion.h" 0135 #include "thememanager.h" 0136 #include "thumbbardock.h" 0137 #include "thumbnailloadthread.h" 0138 #include "undostate.h" 0139 #include "dexpanderbox.h" 0140 #include "dbinfoiface.h" 0141 #include "facetagseditor.h" 0142 0143 namespace Digikam 0144 { 0145 0146 class Q_DECL_HIDDEN DatabaseVersionManager : public VersionManager 0147 { 0148 public: 0149 0150 QString toplevelDirectory(const QString& path) override 0151 { 0152 CollectionLocation loc = CollectionManager::instance()->locationForPath(path); 0153 0154 if (!loc.isNull()) 0155 { 0156 return loc.albumRootPath(); 0157 } 0158 0159 return QLatin1String("/"); 0160 } 0161 }; 0162 0163 // ----------------------------------------------------------------------------------------- 0164 0165 class Q_DECL_HIDDEN ImageWindow::Private 0166 { 0167 0168 public: 0169 0170 Private() 0171 : configShowThumbbarEntry (QLatin1String("Show Thumbbar")), 0172 configHorizontalThumbbarEntry (QLatin1String("HorizontalThumbbar")), 0173 viewContainer (nullptr), 0174 toMainWindowAction (nullptr), 0175 fileDeletePermanentlyAction (nullptr), 0176 fileDeletePermanentlyDirectlyAction (nullptr), 0177 fileTrashDirectlyAction (nullptr), 0178 imageInfoModel (nullptr), 0179 imageFilterModel (nullptr), 0180 dragDropHandler (nullptr), 0181 thumbBar (nullptr), 0182 thumbBarDock (nullptr), 0183 rightSideBar (nullptr) 0184 { 0185 } 0186 0187 QModelIndex currentIndex() const 0188 { 0189 return imageFilterModel->indexForItemInfo(currentItemInfo); 0190 } 0191 0192 QModelIndex currentSourceIndex() const 0193 { 0194 return imageInfoModel->indexForItemInfo(currentItemInfo); 0195 } 0196 0197 bool currentIsValid() const 0198 { 0199 return !currentItemInfo.isNull(); 0200 } 0201 0202 QUrl currentUrl() const 0203 { 0204 return currentItemInfo.fileUrl(); 0205 } 0206 0207 QModelIndex nextIndex() const 0208 { 0209 return imageFilterModel->index(currentIndex().row() + 1, 0); 0210 } 0211 0212 QModelIndex previousIndex() const 0213 { 0214 return imageFilterModel->index(currentIndex().row() - 1, 0); 0215 } 0216 0217 QModelIndex firstIndex() const 0218 { 0219 return imageFilterModel->index(0, 0); 0220 } 0221 0222 QModelIndex lastIndex() const 0223 { 0224 return imageFilterModel->index(imageFilterModel->rowCount() - 1, 0); 0225 } 0226 0227 ItemInfo imageInfo(const QModelIndex& index) const 0228 { 0229 return imageFilterModel->imageInfo(index); 0230 } 0231 0232 void setThumbBarToCurrent() 0233 { 0234 QModelIndex index = imageFilterModel->indexForItemInfo(currentItemInfo); 0235 0236 if (index.isValid()) 0237 { 0238 thumbBar->setCurrentIndex(index); 0239 } 0240 else 0241 { 0242 thumbBar->setCurrentWhenAvailable(currentItemInfo.id()); 0243 } 0244 } 0245 0246 void ensureModelContains(const ItemInfo& info) 0247 { 0248 if (!imageInfoModel->hasImage(info)) 0249 { 0250 imageInfoModel->addItemInfoSynchronously(info); 0251 imageFilterModel->sort(imageFilterModel->sortColumn()); 0252 } 0253 } 0254 0255 public: 0256 0257 const QString configShowThumbbarEntry; 0258 const QString configHorizontalThumbbarEntry; 0259 0260 KMainWindow* viewContainer; 0261 0262 QAction* toMainWindowAction; 0263 0264 /// Delete actions 0265 QAction* fileDeletePermanentlyAction; 0266 QAction* fileDeletePermanentlyDirectlyAction; 0267 QAction* fileTrashDirectlyAction; 0268 0269 ItemInfo currentItemInfo; 0270 ItemListModel* imageInfoModel; 0271 ItemFilterModel* imageFilterModel; 0272 ItemDragDropHandler* dragDropHandler; 0273 0274 ItemThumbnailBar* thumbBar; 0275 ThumbBarDock* thumbBarDock; 0276 0277 ItemPropertiesSideBarDB* rightSideBar; 0278 0279 DatabaseVersionManager versionManager; 0280 0281 QList<FaceTagsIface> facesList; 0282 QSize faceImageSize; 0283 }; 0284 0285 } // namespace Digikam 0286 0287 #endif // DIGIKAM_IMAGE_WINDOW_PRIVATE_H