diff options
Diffstat (limited to 'user.cpp')
-rw-r--r-- | user.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
@@ -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); + }); } |