asyncimageresponse.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) by Oleksandr Zolotov <alex@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #pragma once
  15. #include <QImage>
  16. #include <QQuickImageProvider>
  17. class AsyncImageResponse : public QQuickImageResponse
  18. {
  19. public:
  20. AsyncImageResponse(const QString &id, const QSize &requestedSize);
  21. void setImageAndEmitFinished(const QImage &image = {});
  22. QQuickTextureFactory *textureFactory() const override;
  23. private:
  24. void processNextImage();
  25. private slots:
  26. void slotProcessNetworkReply();
  27. QImage _image;
  28. QStringList _imagePaths;
  29. QSize _requestedImageSize;
  30. int _index = 0;
  31. };