File indexing completed on 2024-05-12 16:23:41

0001 // SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 // SPDX-FileCopyrightText: 2020 Rinigus <rinigus.git@gmail.com>
0003 //
0004 // SPDX-License-Identifier: GPL-2.0-or-later
0005 
0006 #ifndef ICONIMAGEPROVIDER_H
0007 #define ICONIMAGEPROVIDER_H
0008 
0009 #include <QQuickImageProvider>
0010 #include <QQuickAsyncImageProvider>
0011 
0012 #include <QCoro/QCoroTask>
0013 #include <QCoro/QCoroImageProvider>
0014 
0015 class IconImageProvider : public QCoro::ImageProvider
0016 {
0017 public:
0018     IconImageProvider();
0019 
0020     QCoro::Task<QImage> asyncRequestImage(const QString &id, const QSize &) override;
0021 
0022     static QString providerId();
0023 };
0024 
0025 // store image into the database if it is missing. Return new
0026 // image:// uri that should be used to fetch the icon
0027 QCoro::Task<QString> storeIcon(QQmlEngine *engine, const QString &iconSource);
0028 
0029 #endif // ICONIMAGEPROVIDER_H