File indexing completed on 2024-05-19 04:48:28

0001 #pragma once
0002 
0003 #include "pulpo/pulpo.h"
0004 #include <QImage>
0005 #include <QObject>
0006 #include <QQuickImageProvider>
0007 #include <QThread>
0008 
0009 class ArtworkFetcher : public QObject
0010 {
0011     Q_OBJECT
0012 
0013 public:
0014     void fetch(FMH::MODEL data, PULPO::ONTOLOGY ontology);
0015 
0016 Q_SIGNALS:
0017     void artworkReady(const QUrl &url);
0018     void finished();
0019 };
0020 
0021 class AsyncImageResponse : public QQuickImageResponse
0022 {
0023 public:
0024     AsyncImageResponse(const QString &id, const QSize &requestedSize);
0025     QQuickTextureFactory *textureFactory() const override;
0026 
0027 private:
0028     QString m_id;
0029     QSize m_requestedSize;
0030     QImage m_image;
0031     QThread m_worker;
0032 };
0033 
0034 class ArtworkProvider : public QQuickAsyncImageProvider
0035 {
0036 public:
0037     QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;
0038 
0039     //    void updateArtwork(const int index, const QString &artwork);
0040     //    void startFetchingArtwork(FMH::MODEL_LIST data, PULPO::ONTOLOGY ontology);
0041 };