summary refs log tree commit diff
path: root/include/AvatarProvider.h
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-21 21:18:57 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-21 21:18:57 +0300
commit29bd8b71d183e852c43c1bac7cd4c9020f1a4877 (patch)
treef03b3ea5188fa910c2bace502af68b88c3e46189 /include/AvatarProvider.h
parentBump cache format version (diff)
downloadnheko-29bd8b71d183e852c43c1bac7cd4c9020f1a4877.tar.xz
Implement media cache
Diffstat (limited to 'include/AvatarProvider.h')
-rw-r--r--include/AvatarProvider.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/AvatarProvider.h b/include/AvatarProvider.h

index dabd609c..fd5f15c4 100644 --- a/include/AvatarProvider.h +++ b/include/AvatarProvider.h
@@ -24,23 +24,26 @@ class MatrixClient; class TimelineItem; +class Cache; class AvatarProvider : public QObject { Q_OBJECT public: - static void init(QSharedPointer<MatrixClient> client) { client_ = client; } + static void init(QSharedPointer<MatrixClient> client, QSharedPointer<Cache> cache) + { + client_ = client; + cache_ = cache; + } //! The callback is called with the downloaded avatar for the given user //! or the avatar is downloaded first and then saved for re-use. static void resolve(const QString &room_id, const QString &userId, QObject *receiver, std::function<void(QImage)> callback); - //! Remove all saved data. - static void clear() { avatars_.clear(); }; private: static QSharedPointer<MatrixClient> client_; - static QHash<QString, QImage> avatars_; + static QSharedPointer<Cache> cache_; };