Add presence circle on members avatar and account

This commit is contained in:
vslg 2020-06-29 13:26:28 -03:00 committed by miruka
parent 512c08fe0a
commit 215557e353
3 changed files with 43 additions and 25 deletions

View File

@ -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
}
}
}

View File

@ -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 {

View File

@ -24,12 +24,10 @@ 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:
@ -42,22 +40,10 @@ HTile {
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)
}
}
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
}
}
}