diff --git a/src/gui/Base/HUserAvatar.qml b/src/gui/Base/HUserAvatar.qml index 82a6bc6a..0f0f96ec 100644 --- a/src/gui/Base/HUserAvatar.qml +++ b/src/gui/Base/HUserAvatar.qml @@ -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 + } + } } diff --git a/src/gui/MainPane/AccountDelegate.qml b/src/gui/MainPane/AccountDelegate.qml index 9709d196..2ad37f56 100644 --- a/src/gui/MainPane/AccountDelegate.qml +++ b/src/gui/MainPane/AccountDelegate.qml @@ -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 { diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml index f5ae3d4c..803871bb 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml @@ -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 } } }