| 1 | /* This file is part of the KDE project. |
|---|---|
| 2 | SPDX-FileCopyrightText: 2010 Michael Pyne <mpyne@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef KLOCALIMAGECACHEIMPL_H |
| 8 | #define KLOCALIMAGECACHEIMPL_H |
| 9 | |
| 10 | #include <kguiaddons_export.h> |
| 11 | |
| 12 | #include <memory> |
| 13 | |
| 14 | class KLocalImageCacheImplementationPrivate; |
| 15 | |
| 16 | class QImage; |
| 17 | class QPixmap; |
| 18 | class QByteArray; |
| 19 | class QDateTime; |
| 20 | class QString; |
| 21 | |
| 22 | /*! |
| 23 | * You are not supposed to use this class directly, use KImageCache instead |
| 24 | * |
| 25 | * \internal |
| 26 | */ |
| 27 | class KGUIADDONS_EXPORT KLocalImageCacheImplementation |
| 28 | { |
| 29 | private: |
| 30 | explicit KLocalImageCacheImplementation(unsigned defaultCacheSize); |
| 31 | |
| 32 | public: |
| 33 | virtual ~KLocalImageCacheImplementation(); |
| 34 | |
| 35 | QDateTime lastModifiedTime() const; |
| 36 | |
| 37 | bool pixmapCaching() const; |
| 38 | void setPixmapCaching(bool enable); |
| 39 | |
| 40 | int pixmapCacheLimit() const; |
| 41 | void setPixmapCacheLimit(int size); |
| 42 | |
| 43 | protected: |
| 44 | void updateModifiedTime(); |
| 45 | QByteArray serializeImage(const QImage &image) const; |
| 46 | |
| 47 | bool insertLocalPixmap(const QString &key, const QPixmap &pixmap) const; |
| 48 | bool findLocalPixmap(const QString &key, QPixmap *destination) const; |
| 49 | void clearLocalCache(); |
| 50 | |
| 51 | private: |
| 52 | std::unique_ptr<KLocalImageCacheImplementationPrivate> const d; ///< @internal |
| 53 | |
| 54 | template<class T> |
| 55 | friend class KSharedPixmapCacheMixin; |
| 56 | }; |
| 57 | |
| 58 | #endif /* KLOCALIMAGECACHEIMPL_H */ |
| 59 |
