2020-08-09 20:00:57 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2020 Aniket Kumar <anikketkumar786@gmail.com>
|
2020-08-09 20:00:57 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2020-08-09 20:00:57 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "thumbnailsprovider.h"
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
ThumbnailsProvider::ThumbnailsProvider()
|
|
|
|
: QQuickImageProvider(QQuickImageProvider::Image)
|
2020-08-09 20:00:57 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-07-28 08:11:43 +01:00
|
|
|
QImage ThumbnailsProvider::requestImage(const QString &id, QSize * /*size*/, const QSize & /*requestedSize*/)
|
2022-09-10 22:23:52 +01:00
|
|
|
{
|
2020-08-09 20:00:57 +01:00
|
|
|
if (m_thumbnails.contains(id)) {
|
|
|
|
return m_thumbnails.value(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
return QImage();
|
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void ThumbnailsProvider::addImage(const QString &id, const QImage &image)
|
|
|
|
{
|
2020-08-09 20:00:57 +01:00
|
|
|
m_thumbnails.insert(id, image);
|
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void ThumbnailsProvider::clear()
|
|
|
|
{
|
2020-08-09 20:00:57 +01:00
|
|
|
m_thumbnails.clear();
|
|
|
|
}
|