mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Use more descriptive property name
This commit is contained in:
parent
3a86d44c1e
commit
356723fe06
6 changed files with 12 additions and 12 deletions
|
@ -144,7 +144,7 @@ Page {
|
|||
required property bool hasLoudNotification
|
||||
required property bool hasUnreadMessages
|
||||
required property bool isDirect
|
||||
required property string directChatAvatarMxid
|
||||
required property string directChatOtherUserId
|
||||
|
||||
color: background
|
||||
height: avatarSize + 2 * Nheko.paddingMedium
|
||||
|
@ -239,7 +239,7 @@ Page {
|
|||
width: avatarSize
|
||||
url: avatarUrl.replace("mxc://", "image://MxcImage/")
|
||||
displayName: roomName
|
||||
userid: isDirect ? directChatAvatarMxid : undefined
|
||||
userid: isDirect ? directChatOtherUserId : ""
|
||||
roomid: roomId
|
||||
|
||||
Rectangle {
|
||||
|
|
|
@ -66,7 +66,7 @@ Rectangle {
|
|||
height: Nheko.avatarSize
|
||||
url: avatarUrl.replace("mxc://", "image://MxcImage/")
|
||||
roomid: room.roomId
|
||||
userid: room.isDirect ? room.directChatAvatarMxid : undefined
|
||||
userid: room.isDirect ? room.directChatOtherUserId : ""
|
||||
displayName: roomName
|
||||
onClicked: {
|
||||
if (room)
|
||||
|
|
|
@ -77,7 +77,7 @@ RoomlistModel::roleNames() const
|
|||
{Tags, "tags"},
|
||||
{ParentSpaces, "parentSpaces"},
|
||||
{IsDirect, "isDirect"},
|
||||
{DirectChatAvatarMxid, "directChatAvatarMxid"},
|
||||
{DirectChatOtherUserId, "directChatOtherUserId"},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,8 @@ RoomlistModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
case Roles::IsDirect:
|
||||
return room->isDirect();
|
||||
case Roles::DirectChatAvatarMxid:
|
||||
return room->directChatAvatarMxid();
|
||||
case Roles::DirectChatOtherUserId:
|
||||
return room->directChatOtherUserId();
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
Tags,
|
||||
ParentSpaces,
|
||||
IsDirect,
|
||||
DirectChatAvatarMxid,
|
||||
DirectChatOtherUserId,
|
||||
};
|
||||
|
||||
RoomlistModel(TimelineViewManager *parent = nullptr);
|
||||
|
|
|
@ -820,7 +820,7 @@ TimelineModel::syncState(const mtx::responses::State &s)
|
|||
|
||||
if (roomMemberCount() <= 2) {
|
||||
emit isDirectChanged();
|
||||
emit directChatAvatarMxidChanged();
|
||||
emit directChatOtherUserIdChanged();
|
||||
}
|
||||
} else if (std::holds_alternative<StateEvent<state::Encryption>>(e)) {
|
||||
this->isEncrypted_ = cache::isRoomEncrypted(room_id_.toStdString());
|
||||
|
@ -2080,7 +2080,7 @@ TimelineModel::roomMemberCount() const
|
|||
}
|
||||
|
||||
QString
|
||||
TimelineModel::directChatAvatarMxid() const
|
||||
TimelineModel::directChatOtherUserId() const
|
||||
{
|
||||
if (roomMemberCount() < 3) {
|
||||
QString id;
|
||||
|
|
|
@ -178,7 +178,7 @@ class TimelineModel : public QAbstractListModel
|
|||
Q_PROPERTY(int trustlevel READ trustlevel NOTIFY trustlevelChanged)
|
||||
Q_PROPERTY(bool isDirect READ isDirect NOTIFY isDirectChanged)
|
||||
Q_PROPERTY(
|
||||
QString directChatAvatarMxid READ directChatAvatarMxid NOTIFY directChatAvatarMxidChanged)
|
||||
QString directChatOtherUserId READ directChatOtherUserId NOTIFY directChatOtherUserIdChanged)
|
||||
Q_PROPERTY(InputBar *input READ input CONSTANT)
|
||||
Q_PROPERTY(Permissions *permissions READ permissions NOTIFY permissionsChanged)
|
||||
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
crypto::Trust trustlevel() const;
|
||||
int roomMemberCount() const;
|
||||
bool isDirect() const { return roomMemberCount() <= 2; } // TODO: handle invites
|
||||
QString directChatAvatarMxid() const;
|
||||
QString directChatOtherUserId() const;
|
||||
|
||||
std::optional<mtx::events::collections::TimelineEvents> eventById(const QString &id)
|
||||
{
|
||||
|
@ -397,7 +397,7 @@ signals:
|
|||
void roomAvatarUrlChanged();
|
||||
void roomMemberCountChanged();
|
||||
void isDirectChanged();
|
||||
void directChatAvatarMxidChanged();
|
||||
void directChatOtherUserIdChanged();
|
||||
void permissionsChanged();
|
||||
void forwardToRoom(mtx::events::collections::TimelineEvents *e, QString roomId);
|
||||
|
||||
|
|
Loading…
Reference in a new issue