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
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
|
import QtQuick.Shapes 1.15
|
||||||
|
|
||||||
HAvatar {
|
HAvatar {
|
||||||
name: displayName || userId.substring(1) // no leading @
|
name: displayName || userId.substring(1) // no leading @
|
||||||
|
@ -9,6 +10,7 @@ HAvatar {
|
||||||
|
|
||||||
property string userId
|
property string userId
|
||||||
property string displayName
|
property string displayName
|
||||||
|
property string presence: ""
|
||||||
property int powerLevel: 0
|
property int powerLevel: 0
|
||||||
property bool shiftMembershipIconPosition: true
|
property bool shiftMembershipIconPosition: true
|
||||||
property bool invited: false
|
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
|
radius: theme.mainPane.listView.account.avatarRadius
|
||||||
compact: account.compact
|
compact: account.compact
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
presence: model.first_sync_done ? "online" : ""
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
|
||||||
HLoader {
|
HLoader {
|
||||||
|
|
|
@ -24,12 +24,10 @@ HTile {
|
||||||
shiftMembershipIconPosition: ! roomPane.collapsed
|
shiftMembershipIconPosition: ! roomPane.collapsed
|
||||||
invited: model.invited
|
invited: model.invited
|
||||||
compact: member.compact
|
compact: member.compact
|
||||||
|
presence: model.presence
|
||||||
}
|
}
|
||||||
|
|
||||||
HColumnLayout {
|
HColumnLayout {
|
||||||
HRowLayout {
|
|
||||||
spacing: room.spacing
|
|
||||||
|
|
||||||
TitleLabel {
|
TitleLabel {
|
||||||
text: model.display_name || model.id
|
text: model.display_name || model.id
|
||||||
color:
|
color:
|
||||||
|
@ -42,22 +40,10 @@ HTile {
|
||||||
Behavior on color { HColorAnimation {} }
|
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 {
|
SubtitleLabel {
|
||||||
tile: member
|
tile: member
|
||||||
color: theme.chat.roomPane.listView.member.subtitle
|
color: theme.chat.roomPane.listView.member.subtitle
|
||||||
text:
|
text: model.status_message.trim() || model.id
|
||||||
model.status_message.trim() ||
|
|
||||||
(model.display_name ? model.id : "")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user