File indexing completed on 2024-11-10 09:37:55
0001 /* This file is part of the KDE project. 0002 SPDX-FileCopyrightText: 2010 Michael Pyne <mpyne@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef KLOCALIMAGECACHEIMPL_H 0008 #define KLOCALIMAGECACHEIMPL_H 0009 0010 #include <kguiaddons_export.h> 0011 0012 #include <memory> 0013 0014 class KLocalImageCacheImplementationPrivate; 0015 0016 class QImage; 0017 class QPixmap; 0018 class QByteArray; 0019 class QDateTime; 0020 class QString; 0021 0022 /** 0023 * You are not supposed to use this class directly, use KImageCache instead 0024 * 0025 * @internal 0026 */ 0027 class KGUIADDONS_EXPORT KLocalImageCacheImplementation 0028 { 0029 private: 0030 explicit KLocalImageCacheImplementation(unsigned defaultCacheSize); 0031 0032 public: 0033 virtual ~KLocalImageCacheImplementation(); 0034 0035 QDateTime lastModifiedTime() const; 0036 0037 bool pixmapCaching() const; 0038 void setPixmapCaching(bool enable); 0039 0040 int pixmapCacheLimit() const; 0041 void setPixmapCacheLimit(int size); 0042 0043 protected: 0044 void updateModifiedTime(); 0045 QByteArray serializeImage(const QImage &image) const; 0046 0047 bool insertLocalPixmap(const QString &key, const QPixmap &pixmap) const; 0048 bool findLocalPixmap(const QString &key, QPixmap *destination) const; 0049 void clearLocalCache(); 0050 0051 private: 0052 std::unique_ptr<KLocalImageCacheImplementationPrivate> const d; ///< @internal 0053 0054 template<class T> 0055 friend class KSharedPixmapCacheMixin; 0056 }; 0057 0058 #endif /* KLOCALIMAGECACHEIMPL_H */