From 80f7e44e1a9056fc55147718dd2812eb93925ec1 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 25 Jan 2018 19:48:08 +0900 Subject: Room, User: expose avatarMediaId(); declare User for the metatype system To make it easy to use User objects and fetch room and user avatars from QML. Closes #155. --- room.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'room.cpp') diff --git a/room.cpp b/room.cpp index d79363a3..bc7c083e 100644 --- a/room.cpp +++ b/room.cpp @@ -263,6 +263,11 @@ QString Room::topic() const return d->topic; } +QString Room::avatarMediaId() const +{ + return d->avatar.mediaId(); +} + QUrl Room::avatarUrl() const { return d->avatar.url(); @@ -284,8 +289,8 @@ QImage Room::avatar(int width, int height) auto theOtherOneIt = d->membersMap.begin(); if (theOtherOneIt.value() == localUser()) ++theOtherOneIt; - return theOtherOneIt.value()->avatarObject() - .get(width, height, [=] { emit avatarChanged(); }); + return (*theOtherOneIt)->avatarObject() + .get(width, height, [=] { emit avatarChanged(); }); } return {}; } -- cgit v1.2.3