summary refs log tree commit diff
path: root/include
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
parentBump cache format version (diff)
downloadnheko-29bd8b71d183e852c43c1bac7cd4c9020f1a4877.tar.xz
Implement media cache
Diffstat (limited to 'include')
-rw-r--r--include/AvatarProvider.h11
-rw-r--r--include/ChatPage.h4
2 files changed, 9 insertions, 6 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_; }; diff --git a/include/ChatPage.h b/include/ChatPage.h
index b3b379cb..d0be9ce1 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h
@@ -51,8 +51,8 @@ constexpr int CONSENSUS_TIMEOUT = 1000; constexpr int SHOW_CONTENT_TIMEOUT = 3000; constexpr int TYPING_REFRESH_TIMEOUT = 10000; -Q_DECLARE_METATYPE(mtx::responses::Rooms); -Q_DECLARE_METATYPE(std::vector<std::string>); +Q_DECLARE_METATYPE(mtx::responses::Rooms) +Q_DECLARE_METATYPE(std::vector<std::string>) class ChatPage : public QWidget {