summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-21 20:28:38 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-21 20:28:38 +0200
commitc123bada94bfd21121d6d847c472c910b88fed65 (patch)
treebeb24ae17228126b91468cd683d78a8f0910ab0f /include
parentFix iterator crash (diff)
downloadnheko-c123bada94bfd21121d6d847c472c910b88fed65.tar.xz
Refactor avatar fetching in one function
Diffstat (limited to 'include')
-rw-r--r--include/ChatPage.h1
-rw-r--r--include/Community.h3
-rw-r--r--include/MatrixClient.h7
3 files changed, 4 insertions, 7 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h
index 0eae3838..3da84b33 100644
--- a/include/ChatPage.h
+++ b/include/ChatPage.h
@@ -83,7 +83,6 @@ private slots:
         void updateTopBarAvatar(const QString &roomid, const QPixmap &img);
         void updateOwnProfileInfo(const QUrl &avatar_url, const QString &display_name);
         void updateOwnCommunitiesInfo(const QList<QString> &own_communities);
-        void setOwnAvatar(const QPixmap &img);
         void initialSyncCompleted(const mtx::responses::Sync &response);
         void syncCompleted(const mtx::responses::Sync &response);
         void changeTopRoomInfo(const QString &room_id);
diff --git a/include/Community.h b/include/Community.h
index 0d70dee1..5f3adba0 100644
--- a/include/Community.h
+++ b/include/Community.h
@@ -19,9 +19,6 @@ public:
         inline QString getLongDescription() const;
         inline const QList<QString> getRoomList() const;
 
-signals:
-        void roomsChanged(QList<QString> &rooms);
-
 private:
         QUrl avatar_;
         QString name_;
diff --git a/include/MatrixClient.h b/include/MatrixClient.h
index 6847ab22..d3eebe49 100644
--- a/include/MatrixClient.h
+++ b/include/MatrixClient.h
@@ -47,11 +47,13 @@ public:
                           const QString &server) noexcept;
         void versions() noexcept;
         void fetchRoomAvatar(const QString &roomid, const QUrl &avatar_url);
-        void fetchUserAvatar(const QString &userId, const QUrl &avatarUrl);
+        //! Download user's avatar.
+        void fetchUserAvatar(const QUrl &avatarUrl,
+                             std::function<void(QImage)> onSuccess,
+                             std::function<void(QString)> onError);
         void fetchCommunityAvatar(const QString &communityId, const QUrl &avatarUrl);
         void fetchCommunityProfile(const QString &communityId);
         void fetchCommunityRooms(const QString &communityId);
-        void fetchOwnAvatar(const QUrl &avatar_url);
         void downloadImage(const QString &event_id, const QUrl &url);
         void downloadFile(const QString &event_id, const QUrl &url);
         void messages(const QString &room_id, const QString &from_token, int limit = 30) noexcept;
@@ -120,7 +122,6 @@ signals:
         void communityAvatarRetrieved(const QString &communityId, const QPixmap &img);
         void communityProfileRetrieved(const QString &communityId, const QJsonObject &profile);
         void communityRoomsRetrieved(const QString &communityId, const QJsonObject &rooms);
-        void ownAvatarRetrieved(const QPixmap &img);
         void imageDownloaded(const QString &event_id, const QPixmap &img);
         void fileDownloaded(const QString &event_id, const QByteArray &data);