File indexing completed on 2024-05-12 13:04:45

0001 /*
0002  * This file is part of the KDE project
0003  *
0004  * SPDX-FileCopyrightText: 2013 Shantanu Tushar <shantanu@kde.org>
0005  * SPDX-FileCopyrightText: 2013 Sujith Haridasan <sujith.h@gmail.com>
0006  *
0007  * SPDX-License-Identifier: LGPL-2.0-or-later
0008  *
0009  */
0010 
0011 #ifndef CQIMAGEPROVIDER_H
0012 #define CQIMAGEPROVIDER_H
0013 
0014 #include <QDeclarativeImageProvider>
0015 #include <QHash>
0016 
0017 class CQImageProvider : public QDeclarativeImageProvider
0018 {
0019 public:
0020     static const char identificationString[];
0021     static CQImageProvider *s_imageProvider;
0022 
0023     CQImageProvider();
0024     virtual ~CQImageProvider();
0025     virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize);
0026 
0027     void addImage(const QString& id, const QImage &image);
0028     bool containsId(const QString &id);
0029     void clearCache();
0030 private:
0031 
0032     QHash<QString, QImage> m_images;
0033 };
0034 
0035 #endif // CQIMAGEPROVIDER_H