aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/mediathumbnailjob.h
blob: cb55a0b09dee5827b1cbb444cee96039223468ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/******************************************************************************
 * SPDX-FileCopyrightText: 2016 Felix Rohrbach <kde@fxrh.de>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#pragma once

#include "csapi/content-repo.h"

#include <QtGui/QPixmap>

namespace Quotient {
class MediaThumbnailJob : public GetContentThumbnailJob {
public:
    using GetContentThumbnailJob::makeRequestUrl;
    static QUrl makeRequestUrl(QUrl baseUrl, const QUrl& mxcUri,
                               QSize requestedSize);

    MediaThumbnailJob(const QString& serverName, const QString& mediaId,
                      QSize requestedSize);
    MediaThumbnailJob(const QUrl& mxcUri, QSize requestedSize);

    QImage thumbnail() const;
    QImage scaledThumbnail(QSize toSize) const;

protected:
    Status prepareResult() override;

private:
    QImage _thumbnail;
};
} // namespace Quotient