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
14class KLocalImageCacheImplementationPrivate;
15
16class QImage;
17class QPixmap;
18class QByteArray;
19class QDateTime;
20class QString;
21
22/**
23 * You are not supposed to use this class directly, use KImageCache instead
24 *
25 * @internal
26 */
27class KGUIADDONS_EXPORT KLocalImageCacheImplementation
28{
29private:
30 explicit KLocalImageCacheImplementation(unsigned defaultCacheSize);
31
32public:
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
43protected:
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
51private:
52 std::unique_ptr<KLocalImageCacheImplementationPrivate> const d; ///< @internal
53
54 template<class T>
55 friend class KSharedPixmapCacheMixin;
56};
57
58#endif /* KLOCALIMAGECACHEIMPL_H */
59

source code of kguiaddons/src/util/klocalimagecacheimpl.h