From cb54a2a5f9e83a5076eb501e60e88846a4aa28df Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 25 Jan 2018 09:43:11 +0900 Subject: Expose avatar URLs of Room and User as Q_PROPERTY This is needed for QML integration. Closes #155. --- room.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'room.h') diff --git a/room.h b/room.h index 2284e8b1..5b9a1785 100644 --- a/room.h +++ b/room.h @@ -105,6 +105,7 @@ namespace QMatrixClient Q_PROPERTY(QString canonicalAlias READ canonicalAlias NOTIFY namesChanged) Q_PROPERTY(QString displayName READ displayName NOTIFY namesChanged) Q_PROPERTY(QString topic READ topic NOTIFY topicChanged) + Q_PROPERTY(QUrl avatarUrl READ avatarUrl NOTIFY avatarChanged) Q_PROPERTY(int timelineSize READ timelineSize NOTIFY addedMessages) Q_PROPERTY(QStringList memberNames READ memberNames NOTIFY memberListChanged) Q_PROPERTY(int memberCount READ memberCount NOTIFY memberListChanged) @@ -122,6 +123,8 @@ namespace QMatrixClient Room(Connection* connection, QString id, JoinState initialJoinState); ~Room() override; + // Property accessors + Connection* connection() const; User* localUser() const; const QString& id() const; @@ -130,6 +133,7 @@ namespace QMatrixClient QString canonicalAlias() const; QString displayName() const; QString topic() const; + QUrl avatarUrl() const; Q_INVOKABLE JoinState joinState() const; Q_INVOKABLE QList usersTyping() const; QList membersLeft() const; -- cgit v1.2.3 From 3a913f33853c675a1051460bc36278be20a4c941 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 25 Jan 2018 19:45:08 +0900 Subject: Room, User: const-tighten up the code, set QObject names To make debugging (including QML debugging) more convenient. --- room.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'room.h') diff --git a/room.h b/room.h index 5b9a1785..d2962d95 100644 --- a/room.h +++ b/room.h @@ -40,7 +40,6 @@ namespace QMatrixClient class MemberSorter; class LeaveRoomJob; class RedactEventJob; - class Room; class TimelineItem { @@ -162,7 +161,7 @@ namespace QMatrixClient * @brief Produces a disambiguated name for a given user in * the context of the room */ - Q_INVOKABLE QString roomMembername(User* u) const; + Q_INVOKABLE QString roomMembername(const User* u) const; /** * @brief Produces a disambiguated name for a user with this id in * the context of the room -- cgit v1.2.3 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.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'room.h') diff --git a/room.h b/room.h index d2962d95..b908a763 100644 --- a/room.h +++ b/room.h @@ -104,7 +104,9 @@ namespace QMatrixClient Q_PROPERTY(QString canonicalAlias READ canonicalAlias NOTIFY namesChanged) Q_PROPERTY(QString displayName READ displayName NOTIFY namesChanged) Q_PROPERTY(QString topic READ topic NOTIFY topicChanged) + Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false) Q_PROPERTY(QUrl avatarUrl READ avatarUrl NOTIFY avatarChanged) + Q_PROPERTY(int timelineSize READ timelineSize NOTIFY addedMessages) Q_PROPERTY(QStringList memberNames READ memberNames NOTIFY memberListChanged) Q_PROPERTY(int memberCount READ memberCount NOTIFY memberListChanged) @@ -132,6 +134,7 @@ namespace QMatrixClient QString canonicalAlias() const; QString displayName() const; QString topic() const; + QString avatarMediaId() const; QUrl avatarUrl() const; Q_INVOKABLE JoinState joinState() const; Q_INVOKABLE QList usersTyping() const; -- cgit v1.2.3