From 6c37f219badd2dd4208cbec35e565daf41502500 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 16 Feb 2023 16:48:27 +0100 Subject: [PATCH 1/6] MessageView: improve styling of presence status Significantly reduce the font size as to visually indicate this is additional information and not part of the username or message text. Align the text with the username field besides it. Signed-off-by: Marcus Hoffmann --- resources/qml/MessageView.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 7f39791f..5309fcf4 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -348,6 +348,7 @@ Item { } property int remainingWidth: chat.delegateMaxWidth - spacing - messageUserAvatar.width AbstractButton { + id: userNameButton contentItem: ElidedLabel { id: userName_ fullText: userName @@ -373,12 +374,14 @@ Item { Label { id: statusMsg + anchors.baseline: userNameButton.baseline color: Nheko.colors.buttonText text: Presence.userStatus(userId) textFormat: Text.PlainText elide: Text.ElideRight width: userInfo.remainingWidth - userName_.width - parent.spacing font.italic: true + font.pointSize: fontMetrics.font.pointSize * 0.8 Connections { target: Presence From 9c5a7c407598ac67d41426140610dcfff3b0c33a Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 16 Feb 2023 23:18:41 +0100 Subject: [PATCH 2/6] MessageView: Add ToolTip to status message Show the user that this is a status text on hover. We need to change the status text label width to be it's implicitWidth (or the maximum width as specified before), otherwise the tooltip is wildly off-centered. Signed-off-by: Marcus Hoffmann --- resources/qml/MessageView.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 5309fcf4..573c8344 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -379,9 +379,16 @@ Item { text: Presence.userStatus(userId) textFormat: Text.PlainText elide: Text.ElideRight - width: userInfo.remainingWidth - userName_.width - parent.spacing + width: Math.min(implicitWidth, userInfo.remainingWidth - userName_.width - parent.spacing) font.italic: true - font.pointSize: fontMetrics.font.pointSize * 0.8 + 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 { target: Presence From 9635b248f864d85a7765d54055194b678309ed0b Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 16 Feb 2023 23:02:06 +0100 Subject: [PATCH 3/6] UserProfile: display status message Signed-off-by: Marcus Hoffmann --- resources/qml/dialogs/UserProfile.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml index 684ada8f..e20c7bc5 100644 --- a/resources/qml/dialogs/UserProfile.qml +++ b/resources/qml/dialogs/UserProfile.qml @@ -177,6 +177,21 @@ ApplicationWindow { Layout.alignment: Qt.AlignHCenter } + MatrixText { + id: statusMsg + text: qsTr("Status: %1").arg(Presence.userStatus(profile.userid)) + visible: Presence.userStatus(profile.userid) != "" + Layout.alignment: Qt.AlignHCenter + font.italic: true + font.pointSize: Math.floor(fontMetrics.font.pointSize * 0.9) + Connections { + target: Presence + function onPresenceChanged(id) { + if (id == profile.userid) statusMsg.text = Presence.userStatus(profile.userid); + } + } + } + RowLayout { visible: !profile.isGlobalUserProfile Layout.alignment: Qt.AlignHCenter From 7c7a8d2d9ac0cf0f53771374db1af0cf84538fbb Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 16 Feb 2023 23:02:45 +0100 Subject: [PATCH 4/6] UserProfile: reduce spacing by a bit Signed-off-by: Marcus Hoffmann --- resources/qml/dialogs/UserProfile.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml index e20c7bc5..cf627a88 100644 --- a/resources/qml/dialogs/UserProfile.qml +++ b/resources/qml/dialogs/UserProfile.qml @@ -56,7 +56,7 @@ ApplicationWindow { id: contentL width: devicelist.width - spacing: 10 + spacing: Nheko.paddingMedium Avatar { id: displayAvatar From 4c328193cedc5c75154474eb68636c6dcacf1f16 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Tue, 21 Feb 2023 14:24:25 +0100 Subject: [PATCH 5/6] UserProfile: fix status message overflowing Also style the "Status:" prefix bold. --- resources/qml/dialogs/UserProfile.qml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml index cf627a88..c34ef2b5 100644 --- a/resources/qml/dialogs/UserProfile.qml +++ b/resources/qml/dialogs/UserProfile.qml @@ -179,15 +179,22 @@ ApplicationWindow { MatrixText { id: statusMsg - text: qsTr("Status: %1").arg(Presence.userStatus(profile.userid)) + text: updateStatus() visible: Presence.userStatus(profile.userid) != "" Layout.alignment: Qt.AlignHCenter - font.italic: true + 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("Status: %1").arg(Presence.userStatus(profile.userid)) + } Connections { target: Presence function onPresenceChanged(id) { - if (id == profile.userid) statusMsg.text = Presence.userStatus(profile.userid); + if (id == profile.userid) statusMsg.text = statusMsg.updateStatus(); } } } From 7fe62aa4ca2be32c48e74765f8637070affe33b1 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Tue, 21 Feb 2023 14:26:22 +0100 Subject: [PATCH 6/6] UserProfile: add padding to device list Add the same padding as is applied to long status messages. Signed-off-by: Marcus Hoffmann --- resources/qml/dialogs/UserProfile.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml index c34ef2b5..75852245 100644 --- a/resources/qml/dialogs/UserProfile.qml +++ b/resources/qml/dialogs/UserProfile.qml @@ -317,6 +317,8 @@ ApplicationWindow { ColumnLayout { spacing: 0 + Layout.leftMargin: Nheko.paddingMedium + Layout.rightMargin: Nheko.paddingMedium RowLayout { Text { Layout.fillWidth: true