Make use of new RoomMember item from libquotient
Depends on https://github.com/quotient-im/libQuotient/pull/695 Currently basic just to show a working implementation using RoomMember. Currently only the room event and search models are moved over. Will change everything else over once the dependent pr is complete.
This commit is contained in:
committed by
Tobias Fella
parent
58d727350d
commit
430bafafe7
@@ -10,7 +10,7 @@
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include <QCoroTask>
|
||||
#include <Quotient/user.h>
|
||||
#include <Quotient/roommember.h>
|
||||
|
||||
#include "enums/pushrule.h"
|
||||
#include "pollhandler.h"
|
||||
@@ -93,9 +93,9 @@ class NeoChatRoom : public Quotient::Room
|
||||
Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false)
|
||||
|
||||
/**
|
||||
* @brief Get a user object for the other person in a direct chat.
|
||||
* @brief Get a RoomMember object for the other person in a direct chat.
|
||||
*/
|
||||
Q_PROPERTY(Quotient::User *directChatRemoteUser READ directChatRemoteUser CONSTANT)
|
||||
Q_PROPERTY(Quotient::RoomMember directChatRemoteMember READ directChatRemoteMember CONSTANT)
|
||||
|
||||
/**
|
||||
* @brief The Matrix IDs of this room's parents.
|
||||
@@ -235,58 +235,6 @@ public:
|
||||
|
||||
explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
|
||||
|
||||
/**
|
||||
* @brief Get a user in the context of this room.
|
||||
*
|
||||
* This is different to getting a Quotient::User object
|
||||
* as neither of those can provide details like the displayName or avatarMediaId
|
||||
* without the room context as these can vary from room to room. This function
|
||||
* provides the room context and outputs the result as QVariantMap.
|
||||
*
|
||||
* Can be called with an empty QString to return an empty user, which is a useful return
|
||||
* from models to avoid undefined properties.
|
||||
*
|
||||
* @param userID the ID of the user to output.
|
||||
*
|
||||
* @return a QVariantMap for the user with the following properties:
|
||||
* - isLocalUser - Whether the user is the local user.
|
||||
* - id - The matrix ID of the user.
|
||||
* - displayName - Display name in the context of this room.
|
||||
* - avatarSource - The mxc URL for the user's avatar in the current room.
|
||||
* - avatarMediaId - Avatar id in the context of this room.
|
||||
* - color - Color for the user.
|
||||
* - object - The Quotient::User object for the user.
|
||||
*
|
||||
* @sa Quotient::User
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] QVariantMap getUser(const QString &userID) const;
|
||||
|
||||
/**
|
||||
* @brief Get a user in the context of this room.
|
||||
*
|
||||
* This is different to getting a Quotient::User object
|
||||
* as neither of those can provide details like the displayName or avatarMediaId
|
||||
* without the room context as these can vary from room to room. This function
|
||||
* provides the room context and outputs the result as QVariantMap.
|
||||
*
|
||||
* Can be called with a nullptr to return an empty user, which is a useful return
|
||||
* from models to avoid undefined properties.
|
||||
*
|
||||
* @param user the user to output.
|
||||
*
|
||||
* @return a QVariantMap for the user with the following properties:
|
||||
* - isLocalUser - Whether the user is the local user.
|
||||
* - id - The matrix ID of the user.
|
||||
* - displayName - Display name in the context of this room.
|
||||
* - avatarSource - The mxc URL for the user's avatar in the current room.
|
||||
* - avatarMediaId - Avatar id in the context of this room.
|
||||
* - color - Color for the user.
|
||||
* - object - The Quotient::User object for the user.
|
||||
*
|
||||
* @sa Quotient::User
|
||||
*/
|
||||
Q_INVOKABLE [[nodiscard]] QVariantMap getUser(Quotient::User *user) const;
|
||||
|
||||
[[nodiscard]] QVariantList getUsersTyping() const;
|
||||
|
||||
[[nodiscard]] QDateTime lastActiveTime();
|
||||
@@ -400,7 +348,7 @@ public:
|
||||
|
||||
[[nodiscard]] QString avatarMediaId() const;
|
||||
|
||||
Quotient::User *directChatRemoteUser() const;
|
||||
Quotient::RoomMember directChatRemoteMember() const;
|
||||
|
||||
/**
|
||||
* @brief Whether this room has one or more parent spaces set.
|
||||
@@ -630,8 +578,6 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE QByteArray roomAcountDataJson(const QString &eventType);
|
||||
|
||||
Q_INVOKABLE [[nodiscard]] QUrl avatarForMember(Quotient::User *user) const;
|
||||
|
||||
/**
|
||||
* @brief Loads the event with the given id from the server and saves it locally.
|
||||
*
|
||||
@@ -660,7 +606,7 @@ public:
|
||||
/**
|
||||
* If we're invited to this room, the user that invited us. Undefined in other cases.
|
||||
*/
|
||||
Q_INVOKABLE Quotient::User *invitingUser() const;
|
||||
Q_INVOKABLE QString invitingUserId() const;
|
||||
|
||||
private:
|
||||
QSet<const Quotient::RoomEvent *> highlights;
|
||||
|
||||
Reference in New Issue
Block a user