diff options
Diffstat (limited to 'jobs/mediathumbnailjob.cpp')
-rw-r--r-- | jobs/mediathumbnailjob.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/jobs/mediathumbnailjob.cpp b/jobs/mediathumbnailjob.cpp index c0d67a63..d768d253 100644 --- a/jobs/mediathumbnailjob.cpp +++ b/jobs/mediathumbnailjob.cpp @@ -17,23 +17,12 @@ */ #include "mediathumbnailjob.h" -#include "util.h" - -#include <QtCore/QDebug> using namespace QMatrixClient; -MediaThumbnailJob::MediaThumbnailJob(QUrl url, QSize requestedSize, - ThumbnailType thumbnailType) - : BaseJob(HttpVerb::Get, "MediaThumbnailJob", - QStringLiteral("/_matrix/media/v1/thumbnail/%1%2") - .arg(url.host(), url.path()), - Query( - { { "width", QString::number(requestedSize.width()) } - , { "height", QString::number(requestedSize.height()) } - , { "method", - thumbnailType == ThumbnailType::Scale ? "scale" : "crop" } - })) +MediaThumbnailJob::MediaThumbnailJob(QUrl url, QSize requestedSize) + : GetContentThumbnailJob(url.host(), url.path().mid(1), + requestedSize.width(), requestedSize.height()) { } QImage MediaThumbnailJob::thumbnail() const @@ -47,9 +36,10 @@ QImage MediaThumbnailJob::scaledThumbnail(QSize toSize) const Qt::KeepAspectRatio, Qt::SmoothTransformation); } -BaseJob::Status MediaThumbnailJob::parseReply(QByteArray data) +BaseJob::Status MediaThumbnailJob::parseReply(QNetworkReply* reply) { - if( !_thumbnail.loadFromData(data) ) + GetContentThumbnailJob::parseReply(reply); + if( !_thumbnail.loadFromData(content()) ) { qCDebug(JOBS) << "MediaThumbnailJob: could not read image data"; } |