From a671d1aeff6bc9c01aa4204e0c05da894c72b603 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 5 Jan 2018 11:17:13 +0900 Subject: MediaThumbnailJob: Rewire to GetContentThumbnailJob; decommission ThumbnailType "crop" thumbnail type didn't seem to be ever used. Once GTAD is able to generate enums, the respective code will show up in GetContentThumbnailJob and this parameter can be reintroduced in MediaThumbnailJob. As of now, just rely on the default "scale" value. --- jobs/mediathumbnailjob.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'jobs/mediathumbnailjob.cpp') diff --git a/jobs/mediathumbnailjob.cpp b/jobs/mediathumbnailjob.cpp index 9337549e..d768d253 100644 --- a/jobs/mediathumbnailjob.cpp +++ b/jobs/mediathumbnailjob.cpp @@ -18,22 +18,11 @@ #include "mediathumbnailjob.h" -#include -#include - 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 @@ -49,7 +38,8 @@ QImage MediaThumbnailJob::scaledThumbnail(QSize toSize) const BaseJob::Status MediaThumbnailJob::parseReply(QNetworkReply* reply) { - if( !_thumbnail.loadFromData(reply->readAll()) ) + GetContentThumbnailJob::parseReply(reply); + if( !_thumbnail.loadFromData(content()) ) { qCDebug(JOBS) << "MediaThumbnailJob: could not read image data"; } -- cgit v1.2.3