aboutsummaryrefslogtreecommitdiff
path: root/user.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-27 19:51:08 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-27 19:51:08 +0900
commit375bea5ee67a90c6419acf50c06c05ed0435c772 (patch)
tree76f0a1c830797fe1b17b3bea67ddaf7fb53cbd6a /user.h
parente80bfd2fc710d4780a2c22bde9d605a41bd4aaa4 (diff)
parentefeeca097a3c69991683615366f07625855ba2ac (diff)
downloadlibquotient-375bea5ee67a90c6419acf50c06c05ed0435c772.tar.gz
libquotient-375bea5ee67a90c6419acf50c06c05ed0435c772.zip
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'user.h')
-rw-r--r--user.h42
1 files changed, 27 insertions, 15 deletions
diff --git a/user.h b/user.h
index 37977e08..d19fa8f4 100644
--- a/user.h
+++ b/user.h
@@ -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,31 +84,41 @@ namespace QMatrixClient
*/
bool isGuest() const;
- const Avatar& avatarObject() const;
- Q_INVOKABLE QImage avatar(int dimension);
- Q_INVOKABLE QImage avatar(int requestedWidth, int requestedHeight);
+ 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*)