Merge pull request #1379 from Bubu/style_presence_status

Status Message Improvements
This commit is contained in:
DeepBlueV7.X 2023-02-21 23:21:57 +01:00 committed by GitHub
commit 5301f98d4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 2 deletions

View file

@ -348,6 +348,7 @@ Item {
} }
property int remainingWidth: chat.delegateMaxWidth - spacing - messageUserAvatar.width property int remainingWidth: chat.delegateMaxWidth - spacing - messageUserAvatar.width
AbstractButton { AbstractButton {
id: userNameButton
contentItem: ElidedLabel { contentItem: ElidedLabel {
id: userName_ id: userName_
fullText: userName fullText: userName
@ -373,12 +374,21 @@ Item {
Label { Label {
id: statusMsg id: statusMsg
anchors.baseline: userNameButton.baseline
color: Nheko.colors.buttonText color: Nheko.colors.buttonText
text: Presence.userStatus(userId) text: Presence.userStatus(userId)
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
width: userInfo.remainingWidth - userName_.width - parent.spacing width: Math.min(implicitWidth, userInfo.remainingWidth - userName_.width - parent.spacing)
font.italic: true font.italic: true
font.pointSize: Math.floor(fontMetrics.font.pointSize * 0.8)
ToolTip.text: qsTr("%1's status message").arg(userName)
ToolTip.visible: statusMsgHoverHandler.hovered
ToolTip.delay: Nheko.tooltipDelay
HoverHandler {
id: statusMsgHoverHandler
}
Connections { Connections {
target: Presence target: Presence

View file

@ -56,7 +56,7 @@ ApplicationWindow {
id: contentL id: contentL
width: devicelist.width width: devicelist.width
spacing: 10 spacing: Nheko.paddingMedium
Avatar { Avatar {
id: displayAvatar id: displayAvatar
@ -177,6 +177,28 @@ ApplicationWindow {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
MatrixText {
id: statusMsg
text: updateStatus()
visible: Presence.userStatus(profile.userid) != ""
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
horizontalAlignment: TextEdit.AlignHCenter
Layout.leftMargin: Nheko.paddingMedium
Layout.rightMargin: Nheko.paddingMedium
font.pointSize: Math.floor(fontMetrics.font.pointSize * 0.9)
function updateStatus(){
return qsTr("<i><b>Status:</b> %1</i>").arg(Presence.userStatus(profile.userid))
}
Connections {
target: Presence
function onPresenceChanged(id) {
if (id == profile.userid) statusMsg.text = statusMsg.updateStatus();
}
}
}
RowLayout { RowLayout {
visible: !profile.isGlobalUserProfile visible: !profile.isGlobalUserProfile
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -295,6 +317,8 @@ ApplicationWindow {
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
Layout.leftMargin: Nheko.paddingMedium
Layout.rightMargin: Nheko.paddingMedium
RowLayout { RowLayout {
Text { Text {
Layout.fillWidth: true Layout.fillWidth: true