Add presence circle on members avatar and account
This commit is contained in:
parent
512c08fe0a
commit
215557e353
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Shapes 1.15
|
||||
|
||||
HAvatar {
|
||||
name: displayName || userId.substring(1) // no leading @
|
||||
|
@ -9,6 +10,7 @@ HAvatar {
|
|||
|
||||
property string userId
|
||||
property string displayName
|
||||
property string presence: ""
|
||||
property int powerLevel: 0
|
||||
property bool shiftMembershipIconPosition: true
|
||||
property bool invited: false
|
||||
|
@ -51,4 +53,31 @@ HAvatar {
|
|||
}
|
||||
}
|
||||
|
||||
HLoader {
|
||||
active: presence
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.bottomMargin: -diameter / 2
|
||||
anchors.rightMargin: -diameter / 2
|
||||
z: 100
|
||||
|
||||
property bool small: false
|
||||
property int diameter: small ? 8 : 13
|
||||
|
||||
sourceComponent: Rectangle {
|
||||
width: diameter
|
||||
height: diameter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
radius: diameter / 2
|
||||
|
||||
// TODO: Let it be thes for now
|
||||
color:
|
||||
presence === "online" ?
|
||||
"green" :
|
||||
"gray"
|
||||
border.color: "black"
|
||||
border.width: diameter / 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ HTile {
|
|||
radius: theme.mainPane.listView.account.avatarRadius
|
||||
compact: account.compact
|
||||
|
||||
// XXX
|
||||
presence: model.first_sync_done ? "online" : ""
|
||||
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
HLoader {
|
||||
|
|
|
@ -24,40 +24,26 @@ HTile {
|
|||
shiftMembershipIconPosition: ! roomPane.collapsed
|
||||
invited: model.invited
|
||||
compact: member.compact
|
||||
presence: model.presence
|
||||
}
|
||||
|
||||
HColumnLayout {
|
||||
HRowLayout {
|
||||
spacing: room.spacing
|
||||
TitleLabel {
|
||||
text: model.display_name || model.id
|
||||
color:
|
||||
member.hovered ?
|
||||
utils.nameColor(
|
||||
model.display_name || model.id.substring(1)
|
||||
) :
|
||||
theme.chat.roomPane.listView.member.name
|
||||
|
||||
TitleLabel {
|
||||
text: model.display_name || model.id
|
||||
color:
|
||||
member.hovered ?
|
||||
utils.nameColor(
|
||||
model.display_name || model.id.substring(1)
|
||||
) :
|
||||
theme.chat.roomPane.listView.member.name
|
||||
|
||||
Behavior on color { HColorAnimation {} }
|
||||
}
|
||||
|
||||
TitleRightInfoLabel {
|
||||
tile: room
|
||||
// color: theme.mainPane.listView.member.lastActiveAgo
|
||||
text:
|
||||
model.last_active_ago === -1 ?
|
||||
"" :
|
||||
utils.formatRelativeTime(model.last_active_ago)
|
||||
}
|
||||
Behavior on color { HColorAnimation {} }
|
||||
}
|
||||
|
||||
SubtitleLabel {
|
||||
tile: member
|
||||
color: theme.chat.roomPane.listView.member.subtitle
|
||||
text:
|
||||
model.status_message.trim() ||
|
||||
(model.display_name ? model.id : "")
|
||||
text: model.status_message.trim() || model.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user