File indexing completed on 2024-05-05 17:09:08
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * Copyright (C) 2013 Shantanu Tushar <shantanu@kde.org> 0005 * Copyright (C) 2013 Sujith Haridasan <sujith.h@gmail.com> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 * 0022 */ 0023 0024 #ifndef CQIMAGEPROVIDER_H 0025 #define CQIMAGEPROVIDER_H 0026 0027 #include <QDeclarativeImageProvider> 0028 #include <QHash> 0029 0030 class CQImageProvider : public QDeclarativeImageProvider 0031 { 0032 public: 0033 static const char identificationString[]; 0034 static CQImageProvider *s_imageProvider; 0035 0036 CQImageProvider(); 0037 virtual ~CQImageProvider(); 0038 virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); 0039 0040 void addImage(const QString& id, const QImage &image); 0041 bool containsId(const QString &id); 0042 void clearCache(); 0043 private: 0044 0045 QHash<QString, QImage> m_images; 0046 }; 0047 0048 #endif // CQIMAGEPROVIDER_H