File indexing completed on 2025-04-27 03:58:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-04-30 0007 * Description : Graphics View item for DImg - Private containers 0008 * 0009 * SPDX-FileCopyrightText: 2010-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_DIMG_ITEMS_P_H 0016 #define DIGIKAM_DIMG_ITEMS_P_H 0017 0018 // Qt includes 0019 0020 #include <QPixmapCache> 0021 #include <QQueue> 0022 #include <QString> 0023 0024 // Local includes 0025 0026 #include "digikam_export.h" 0027 #include "dimg.h" 0028 #include "dimgpreviewitem.h" 0029 #include "imagezoomsettings.h" 0030 #include "previewsettings.h" 0031 0032 namespace Digikam 0033 { 0034 0035 class CachedPixmapKey 0036 { 0037 public: 0038 0039 QRect region; 0040 QPixmapCache::Key key; 0041 }; 0042 0043 // ------------------------------------------------------------------------------- 0044 0045 class CachedPixmaps 0046 { 0047 public: 0048 0049 explicit CachedPixmaps(int maxCount = 2); 0050 ~CachedPixmaps(); 0051 0052 void setMaxCount(int); 0053 void clear(); 0054 bool find(const QRect& region, QPixmap* const pix, QRect* const source); 0055 void insert(const QRect& region, const QPixmap& pixmap); 0056 0057 protected: 0058 0059 int maxCount; 0060 QQueue<CachedPixmapKey> keys; 0061 }; 0062 0063 // ------------------------------------------------------------------------------- 0064 0065 class DIGIKAM_EXPORT GraphicsDImgItem::GraphicsDImgItemPrivate 0066 { 0067 public: 0068 0069 explicit GraphicsDImgItemPrivate() 0070 { 0071 } 0072 0073 void init(GraphicsDImgItem* const q); 0074 0075 public: 0076 0077 DImg image; 0078 ImageZoomSettings zoomSettings; 0079 mutable CachedPixmaps cachedPixmaps; 0080 }; 0081 0082 // ------------------------------------------------------------------------------- 0083 0084 class PreviewLoadThread; 0085 class DImgPreviewItem; 0086 0087 class DIGIKAM_EXPORT DImgPreviewItem::DImgPreviewItemPrivate : public GraphicsDImgItem::GraphicsDImgItemPrivate 0088 { 0089 public: 0090 0091 explicit DImgPreviewItemPrivate(); 0092 void init(DImgPreviewItem* const q); 0093 0094 public: 0095 0096 DImgPreviewItem::State state; 0097 bool exifRotate; 0098 int previewSize; 0099 0100 QString path; 0101 PreviewSettings previewSettings; 0102 PreviewLoadThread* previewThread; 0103 PreviewLoadThread* preloadThread; 0104 QStringList pathsToPreload; 0105 }; 0106 0107 } // namespace Digikam 0108 0109 #endif // DIGIKAM_DIMG_ITEMS_P_H