diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-24 19:49:31 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-24 19:49:31 +0900 |
commit | be336237914ae4517e21f6e82d6c6facf16660d8 (patch) | |
tree | f0ee020cafc117817d5931b7db8853a91cc9bea6 /user.h | |
parent | 2c095d29b96393dcfa3121c8cb9f4c4fd4f88d6a (diff) | |
parent | e10927767faaf7a03a772ab97fe6292907cc4b4b (diff) | |
download | libquotient-be336237914ae4517e21f6e82d6c6facf16660d8.tar.gz libquotient-be336237914ae4517e21f6e82d6c6facf16660d8.zip |
Merge branch 'kitsune-room-specific-userinfo'
Diffstat (limited to 'user.h')
-rw-r--r-- | user.h | 43 |
1 files changed, 27 insertions, 16 deletions
@@ -24,8 +24,10 @@ namespace QMatrixClient { - class Event; class Connection; + class Room; + class RoomMemberEvent; + class User: public QObject { Q_OBJECT @@ -51,7 +53,7 @@ namespace QMatrixClient * it. * \sa displayName */ - QString name() const; + QString name(const Room* room = nullptr) const; /** Get the displayed user name * This method returns the result of name() if its non-empty; @@ -60,7 +62,7 @@ namespace QMatrixClient * should be disambiguated. * \sa name, id, fullName Room::roomMembername */ - QString displayname() const; + QString displayname(const Room* room = nullptr) const; /** Get user name and id in one string * The constructed string follows the format 'name (id)' @@ -68,7 +70,7 @@ namespace QMatrixClient * places. * \sa displayName, Room::roomMembername */ - QString fullName() const; + QString fullName(const Room* room = nullptr) const; /** * Returns the name of bridge the user is connected from or empty. @@ -82,32 +84,41 @@ namespace QMatrixClient */ bool isGuest() const; - const Avatar& avatarObject() const; - Q_INVOKABLE QImage avatar(int dimension); - Q_INVOKABLE QImage avatar(int width, int height); - QImage avatar(int width, int height, Avatar::get_callback_t callback); + const Avatar& avatarObject(const Room* room = nullptr) const; + Q_INVOKABLE QImage avatar(int dimension, const Room* room = nullptr); + Q_INVOKABLE QImage avatar(int requestedWidth, int requestedHeight, + const Room* room = nullptr); + QImage avatar(int width, int height, const Room* room, + Avatar::get_callback_t callback); - QString avatarMediaId() const; - QUrl avatarUrl() const; + QString avatarMediaId(const Room* room = nullptr) const; + QUrl avatarUrl(const Room* room = nullptr) const; - void processEvent(Event* event); + void processEvent(RoomMemberEvent* event, const Room* r = nullptr); public slots: void rename(const QString& newName); + void rename(const QString& newName, const Room* r); bool setAvatar(const QString& fileName); bool setAvatar(QIODevice* source); signals: - void nameChanged(QString newName, QString oldName); - void avatarChanged(User* user); + void nameAboutToChange(QString newName, QString oldName, + const Room* roomContext); + void nameChanged(QString newName, QString oldName, + const Room* roomContext); + void avatarChanged(User* user, const Room* roomContext); private slots: - void updateName(const QString& newName); - void updateAvatarUrl(const QUrl& newUrl); + void updateName(const QString& newName, const Room* room = nullptr); + void updateName(const QString& newName, const QString& oldName, + const Room* room = nullptr); + void updateAvatarUrl(const QUrl& newUrl, const QUrl& oldUrl, + const Room* room = nullptr); private: class Private; - Private* d; + QScopedPointer<Private> d; }; } Q_DECLARE_METATYPE(QMatrixClient::User*) |