aboutsummaryrefslogtreecommitdiff
path: root/user.cpp
diff options
context:
space:
mode:
authorFelix Rohrbach <fxrh@gmx.de>2016-05-08 18:59:11 +0200
committerFelix Rohrbach <fxrh@gmx.de>2016-05-08 18:59:11 +0200
commit1cd8802c73ee3c0cc0095f8be30a9bbf3442c3ca (patch)
treefa0f4aded71f27974c9922bd587ba78774ade46c /user.cpp
parentfc95edb7a63bcacb02418c55e15a1aa21ac080cd (diff)
parent5a0e6080a6245aa2c68f254d7105f19629a5a654 (diff)
downloadlibquotient-1cd8802c73ee3c0cc0095f8be30a9bbf3442c3ca.tar.gz
libquotient-1cd8802c73ee3c0cc0095f8be30a9bbf3442c3ca.zip
Merge pull request #5 from KitsuneRal/basejob-improvement
Basejob improvement
Diffstat (limited to 'user.cpp')
-rw-r--r--user.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/user.cpp b/user.cpp
index f9529db3..5018fe83 100644
--- a/user.cpp
+++ b/user.cpp
@@ -28,7 +28,7 @@
using namespace QMatrixClient;
-class User::Private: public QObject
+class User::Private
{
public:
User* q;
@@ -45,8 +45,6 @@ class User::Private: public QObject
QHash<QPair<int,int>,QPixmap> scaledMap;
void requestAvatar();
- public slots:
- void gotAvatar(KJob* job);
};
User::User(QString userId, Connection* connection)
@@ -135,17 +133,12 @@ void User::Private::requestAvatar()
{
MediaThumbnailJob* job =
connection->getThumbnail(avatarUrl, requestedWidth, requestedHeight);
- connect( job, &MediaThumbnailJob::result, this, &User::Private::gotAvatar );
-}
-
-void User::Private::gotAvatar(KJob* job)
-{
- avatarOngoingRequest = false;
- avatarValid = true;
- avatar =
- static_cast<MediaThumbnailJob*>(job)->thumbnail()
- .scaled(requestedWidth, requestedHeight,
- Qt::KeepAspectRatio, Qt::SmoothTransformation);
- scaledMap.clear();
- emit q->avatarChanged(q);
+ connect( job, &MediaThumbnailJob::success, [=]() {
+ avatarOngoingRequest = false;
+ avatarValid = true;
+ avatar = job->thumbnail().scaled(requestedWidth, requestedHeight,
+ Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ scaledMap.clear();
+ emit q->avatarChanged(q);
+ });
}