| 1 | // SPDX-FileCopyrightText: 2018 Kitsune Ral <Kitsune-Ral@users.sf.net> |
|---|---|
| 2 | // SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <Quotient/csapi/content-repo.h> |
| 7 | |
| 8 | #include <QtGui/QPixmap> |
| 9 | |
| 10 | namespace Quotient { |
| 11 | class QUOTIENT_API MediaThumbnailJob : public GetContentThumbnailJob { |
| 12 | public: |
| 13 | using GetContentThumbnailJob::makeRequestUrl; |
| 14 | static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri, |
| 15 | QSize requestedSize); |
| 16 | |
| 17 | MediaThumbnailJob(const QString& serverName, const QString& mediaId, |
| 18 | QSize requestedSize); |
| 19 | MediaThumbnailJob(const QUrl& mxcUri, QSize requestedSize); |
| 20 | |
| 21 | QImage thumbnail() const; |
| 22 | QImage scaledThumbnail(QSize toSize) const; |
| 23 | |
| 24 | protected: |
| 25 | Status prepareResult() override; |
| 26 | |
| 27 | private: |
| 28 | QImage _thumbnail; |
| 29 | }; |
| 30 | } // namespace Quotient |
| 31 |