diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-05 11:17:13 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-09 11:54:45 +0900 |
commit | a671d1aeff6bc9c01aa4204e0c05da894c72b603 (patch) | |
tree | 9e239608ffea3e59cc971358483d0c80063e3ae9 /jobs/mediathumbnailjob.cpp | |
parent | 4c1d52601be66caafa913171b5d5ed47ee4eb67d (diff) | |
download | libquotient-a671d1aeff6bc9c01aa4204e0c05da894c72b603.tar.gz libquotient-a671d1aeff6bc9c01aa4204e0c05da894c72b603.zip |
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.
Diffstat (limited to 'jobs/mediathumbnailjob.cpp')
-rw-r--r-- | jobs/mediathumbnailjob.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
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 <QtNetwork/QNetworkReply> -#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 @@ -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"; } |