diff options
-rw-r--r-- | room.cpp | 4 | ||||
-rw-r--r-- | room.h | 3 | ||||
-rw-r--r-- | user.cpp | 7 | ||||
-rw-r--r-- | user.h | 2 |
4 files changed, 10 insertions, 6 deletions
@@ -213,6 +213,7 @@ RoomEventPtr TimelineItem::replaceEvent(RoomEventPtr&& other) Room::Room(Connection* connection, QString id, JoinState initialJoinState) : QObject(connection), d(new Private(connection, id, initialJoinState)) { + setObjectName(id); // See "Accessing the Public Class" section in // https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl-%E2%80%94-reloaded/ d->q = this; @@ -757,7 +758,7 @@ void Room::Private::removeMember(User* u) } } -QString Room::roomMembername(User *u) const +QString Room::roomMembername(const User* u) const { // See the CS spec, section 11.2.2.3 @@ -1239,6 +1240,7 @@ void Room::processStateEvents(const RoomEvents& events) case EventType::RoomCanonicalAlias: { auto aliasEvent = static_cast<RoomCanonicalAliasEvent*>(event); d->canonicalAlias = aliasEvent->alias(); + setObjectName(d->canonicalAlias); qCDebug(MAIN) << "Room canonical alias updated:" << d->canonicalAlias; emitNamesChanged = true; break; @@ -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 @@ -51,7 +51,9 @@ class User::Private User::User(QString userId, Connection* connection) : QObject(connection), d(new Private(std::move(userId), connection)) -{ } +{ + setObjectName(userId); +} User::~User() { @@ -74,6 +76,7 @@ void User::updateName(const QString& newName) if (oldName != newName) { d->name = newName; + setObjectName(displayname()); emit nameChanged(newName, oldName); } } @@ -127,7 +130,7 @@ QString User::bridged() const { return d->bridged; } -const Avatar& User::avatarObject() +const Avatar& User::avatarObject() const { return d->avatar; } @@ -58,7 +58,7 @@ namespace QMatrixClient */ QString bridged() const; - const Avatar& avatarObject(); + const Avatar& avatarObject() const; Q_INVOKABLE QImage avatar(int dimension); Q_INVOKABLE QImage avatar(int requestedWidth, int requestedHeight); |