diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-19 18:08:57 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-19 18:08:57 +0900 |
commit | 35ef29ead1da906e4978dcd908e7c1513ac9bfd3 (patch) | |
tree | 0e784f13ec837b9dd6f40e07423e0a3eb8012256 /jobs/mediathumbnailjob.cpp | |
parent | c5c26ff4a09eecaa6d8e1507087566ccf0fd96b4 (diff) | |
parent | 0b11b06379fe668063ea5658a261f53f1dcf117a (diff) | |
download | libquotient-35ef29ead1da906e4978dcd908e7c1513ac9bfd3.tar.gz libquotient-35ef29ead1da906e4978dcd908e7c1513ac9bfd3.zip |
Merge branch 'master' into cache-state-to-json
Diffstat (limited to 'jobs/mediathumbnailjob.cpp')
-rw-r--r-- | jobs/mediathumbnailjob.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/jobs/mediathumbnailjob.cpp b/jobs/mediathumbnailjob.cpp index 9bb731b9..9579f6b2 100644 --- a/jobs/mediathumbnailjob.cpp +++ b/jobs/mediathumbnailjob.cpp @@ -23,12 +23,6 @@ using namespace QMatrixClient; -class MediaThumbnailJob::Private -{ - public: - QPixmap thumbnail; -}; - MediaThumbnailJob::MediaThumbnailJob(const ConnectionData* data, QUrl url, QSize requestedSize, ThumbnailType thumbnailType) : BaseJob(data, HttpVerb::Get, "MediaThumbnailJob", @@ -39,22 +33,21 @@ MediaThumbnailJob::MediaThumbnailJob(const ConnectionData* data, QUrl url, QSize , { "method", thumbnailType == ThumbnailType::Scale ? "scale" : "crop" } })) - , d(new Private) { } -MediaThumbnailJob::~MediaThumbnailJob() +QPixmap MediaThumbnailJob::thumbnail() { - delete d; + return pixmap; } -QPixmap MediaThumbnailJob::thumbnail() +QPixmap MediaThumbnailJob::scaledThumbnail(QSize toSize) { - return d->thumbnail; + return pixmap.scaled(toSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); } BaseJob::Status MediaThumbnailJob::parseReply(QByteArray data) { - if( !d->thumbnail.loadFromData(data) ) + if( !pixmap.loadFromData(data) ) { qCDebug(JOBS) << "MediaThumbnailJob: could not read image data"; } |