aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-25 19:48:08 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-25 19:48:08 +0900
commit80f7e44e1a9056fc55147718dd2812eb93925ec1 (patch)
treeb6d1014f736b8c75e05e1dea8157e7ed04cc7820 /room.cpp
parent3a913f33853c675a1051460bc36278be20a4c941 (diff)
downloadlibquotient-80f7e44e1a9056fc55147718dd2812eb93925ec1.tar.gz
libquotient-80f7e44e1a9056fc55147718dd2812eb93925ec1.zip
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.
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp9
1 files changed, 7 insertions, 2 deletions
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 {};
}