Improve the "Friends" space notification and tooltip text

If you're a first-time user, the different states on this button may be
a bit confusing. Instead of showing a "plus" sign (meaning an invite) it
will add it to the total notification count. The tooltip text is also
changed to reflect this.
This commit is contained in:
Joshua Goins
2025-04-17 09:25:17 +00:00
committed by Tobias Fella
parent 23803223bf
commit 50ceddaa7e

View File

@@ -125,12 +125,20 @@ QQC2.Control {
AvatarTabButton {
id: directChatButton
readonly property bool hasCountableNotifications: root.connection.directChatNotifications > 0 || root.connection.directChatInvites > 0
Layout.fillWidth: true
Layout.preferredHeight: width - Kirigami.Units.smallSpacing
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing / 2
text: i18nc("@button View all one-on-one chats with your friends.", "Friends")
text: {
if (directChatButton.hasCountableNotifications) {
return i18ncp("@button View all one-on-one chats with your friends.", "Friends (%1 notification)", "Friends (%1 notifications)", root.connection.directChatNotifications + root.connection.directChatInvites);
}
return i18nc("@button View all one-on-one chats with your friends.", "Friends");
}
contentItem: Kirigami.Icon {
source: "system-users-symbolic"
@@ -144,8 +152,8 @@ QQC2.Control {
width: Math.max(directChatNotificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
height: Kirigami.Units.iconSizes.smallMedium
text: root.connection.directChatNotifications > 0 ? root.connection.directChatNotifications : ""
visible: (root.connection.directChatNotifications > 0 || root.connection.directChatInvites) && RoomManager.currentSpace !== "DM"
text: visible ? root.connection.directChatNotifications + root.connection.directChatInvites : ""
visible: directChatButton.hasCountableNotifications && RoomManager.currentSpace !== "DM"
color: Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
@@ -160,13 +168,6 @@ QQC2.Control {
id: directChatNotificationCountTextMetrics
text: directChatNotificationCountLabel.text
}
Kirigami.Icon {
anchors.fill: parent
source: "list-add-symbolic"
visible: root.connection.directChatInvites && root.connection.directChatNotifications === 0
}
}
}