aboutsummaryrefslogtreecommitdiff
path: root/jobs/mediathumbnailjob.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-12 22:01:26 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-12 23:15:01 +0900
commit0199c963de5a46a6526389829e210f5c68226911 (patch)
tree3c8f7dfc57bbaa96fd794eb3f59d2af03af44813 /jobs/mediathumbnailjob.cpp
parent93cb0e5897cc94d8cc691bbe62f5b0093dd0a00f (diff)
downloadlibquotient-0199c963de5a46a6526389829e210f5c68226911.tar.gz
libquotient-0199c963de5a46a6526389829e210f5c68226911.zip
BaseJob::Data -> RequestData; support QIODevice* input/output
Diffstat (limited to 'jobs/mediathumbnailjob.cpp')
-rw-r--r--jobs/mediathumbnailjob.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/jobs/mediathumbnailjob.cpp b/jobs/mediathumbnailjob.cpp
index d768d253..ec82f57b 100644
--- a/jobs/mediathumbnailjob.cpp
+++ b/jobs/mediathumbnailjob.cpp
@@ -20,8 +20,15 @@
using namespace QMatrixClient;
-MediaThumbnailJob::MediaThumbnailJob(QUrl url, QSize requestedSize)
- : GetContentThumbnailJob(url.host(), url.path().mid(1),
+MediaThumbnailJob::MediaThumbnailJob(const QString& serverName,
+ const QString& mediaId, QSize requestedSize)
+ : GetContentThumbnailJob(serverName, mediaId,
+ requestedSize.width(), requestedSize.height())
+{ }
+
+MediaThumbnailJob::MediaThumbnailJob(const QUrl& mxcUri, QSize requestedSize)
+ : GetContentThumbnailJob(mxcUri.authority(),
+ mxcUri.path().mid(1), // sans leading '/'
requestedSize.width(), requestedSize.height())
{ }
@@ -39,7 +46,7 @@ QImage MediaThumbnailJob::scaledThumbnail(QSize toSize) const
BaseJob::Status MediaThumbnailJob::parseReply(QNetworkReply* reply)
{
GetContentThumbnailJob::parseReply(reply);
- if( !_thumbnail.loadFromData(content()) )
+ if( !_thumbnail.loadFromData(content()->readAll()) )
{
qCDebug(JOBS) << "MediaThumbnailJob: could not read image data";
}