Thread alignment

It doesn't make sense for a thread to be on the right or tinted when the local user started it as they contain messages from multiple users. So always make them align left and never tint them.
This commit is contained in:
James Graham
2024-12-25 19:53:41 +00:00
parent 3480c5f067
commit b595a2966c
3 changed files with 13 additions and 6 deletions

View File

@@ -51,6 +51,11 @@ QQC2.Control {
*/ */
required property var contentModel required property var contentModel
/**
* @brief Whether the message in a thread.
*/
required property bool isThreaded
/** /**
* @brief Whether the bubble background should be shown. * @brief Whether the bubble background should be shown.
*/ */
@@ -134,7 +139,7 @@ QQC2.Control {
visible: root.showBackground visible: root.showBackground
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
color: if (root.author.isLocalMember) { color: if (root.author.isLocalMember && !root.isThreaded) {
return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15); return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15);
} else if (root.showHighlight) { } else if (root.showHighlight) {
return Kirigami.Theme.positiveBackgroundColor; return Kirigami.Theme.positiveBackgroundColor;

View File

@@ -201,7 +201,7 @@ TimelineDelegate {
/** /**
* @brief The width available to the bubble content. * @brief The width available to the bubble content.
*/ */
property real contentMaxWidth: bubbleSizeHelper.currentWidth - bubble.leftPadding - bubble.rightPadding property real contentMaxWidth: (root.isThreaded ? bubbleSizeHelper.parentWidth : bubbleSizeHelper.currentWidth) - bubble.leftPadding - bubble.rightPadding
width: parent?.width width: parent?.width
rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing
@@ -246,7 +246,7 @@ TimelineDelegate {
topMargin: Kirigami.Units.smallSpacing topMargin: Kirigami.Units.smallSpacing
} }
visible: (root.contentModel?.showAuthor ?? false) && NeoChatConfig.showAvatarInTimeline && (NeoChatConfig.compactLayout || !_private.showUserMessageOnRight) visible: ((root.contentModel?.showAuthor ?? false) || root.isThreaded) && NeoChatConfig.showAvatarInTimeline && (NeoChatConfig.compactLayout || !_private.showUserMessageOnRight)
name: root.author.displayName name: root.author.displayName
source: root.author.avatarUrl source: root.author.avatarUrl
color: root.author.color color: root.author.color
@@ -258,7 +258,7 @@ TimelineDelegate {
id: bubble id: bubble
anchors.left: avatar.right anchors.left: avatar.right
anchors.leftMargin: Kirigami.Units.largeSpacing anchors.leftMargin: Kirigami.Units.largeSpacing
anchors.rightMargin: Kirigami.Units.largeSpacing anchors.rightMargin: rightPadding
maxContentWidth: root.contentMaxWidth maxContentWidth: root.contentMaxWidth
topPadding: NeoChatConfig.compactLayout ? Kirigami.Units.smallSpacing / 2 : Kirigami.Units.largeSpacing topPadding: NeoChatConfig.compactLayout ? Kirigami.Units.smallSpacing / 2 : Kirigami.Units.largeSpacing
@@ -290,8 +290,8 @@ TimelineDelegate {
room: root.room room: root.room
index: root.index index: root.index
author: root.author author: root.author
isThreaded: root.isThreaded
// HACK: This is stupid but seemingly QConcatenateTablesProxyModel // HACK: This is stupid but seemingly QConcatenateTablesProxyModel
// can't be passed as a model role, always returning null. // can't be passed as a model role, always returning null.
@@ -383,7 +383,7 @@ TimelineDelegate {
/** /**
* @brief Whether local user messages should be aligned right. * @brief Whether local user messages should be aligned right.
*/ */
property bool showUserMessageOnRight: NeoChatConfig.showLocalMessagesOnRight && root.author.isLocalMember && !NeoChatConfig.compactLayout && !root.alwaysFillWidth property bool showUserMessageOnRight: NeoChatConfig.showLocalMessagesOnRight && root.author.isLocalMember && !NeoChatConfig.compactLayout && !root.alwaysFillWidth && !root.isThreaded
function showMessageMenu() { function showMessageMenu() {
RoomManager.viewEventMenu(root.eventId, root.room, root.author, root.selectedText, root.hoveredLink); RoomManager.viewEventMenu(root.eventId, root.room, root.author, root.selectedText, root.hoveredLink);

View File

@@ -38,6 +38,8 @@ Delegates.RoundedItemDelegate {
leftInset: 0 leftInset: 0
rightInset: 0 rightInset: 0
highlighted: true
icon.name: "mail-reply-custom" icon.name: "mail-reply-custom"
text: i18nc("@action:button", "Reply") text: i18nc("@action:button", "Reply")