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