diff --git a/src/gui/Pages/Chat/Timeline/EventContent.qml b/src/gui/Pages/Chat/Timeline/EventContent.qml index d4726348..d2c5bfe4 100644 --- a/src/gui/Pages/Chat/Timeline/EventContent.qml +++ b/src/gui/Pages/Chat/Timeline/EventContent.qml @@ -26,7 +26,7 @@ HRowLayout { } readonly property string senderText: - hideNameLine ? "" : ( + asOneLine || onRight || combine ? "" : ( `<${compact ? "span" : "div"} class='sender'>` + utils.coloredNameHtml(model.sender_name, model.sender_id) + (compact ? ": " : "") + @@ -82,12 +82,25 @@ HRowLayout { opacity: combine ? 0 : 1 Layout.alignment: Qt.AlignTop - Layout.preferredHeight: combine ? 1 : Layout.preferredWidth + Layout.preferredWidth: compact ? theme.chat.message.collapsedAvatarSize : theme.chat.message.avatarSize + Layout.preferredHeight: + combine ? + 1 : + + compact || ( + asOneLine && + nextModel && + eventList.canCombine(model, nextModel) + ) ? + theme.chat.message.collapsedAvatarSize : + + theme.chat.message.avatarSize + HUserAvatar { id: avatar clientUserId: chat.userId @@ -97,7 +110,6 @@ HRowLayout { width: parent.width height: combine ? 1 : parent.Layout.preferredWidth radius: theme.chat.message.avatarRadius - } } diff --git a/src/gui/Pages/Chat/Timeline/EventDelegate.qml b/src/gui/Pages/Chat/Timeline/EventDelegate.qml index a0e23103..91a97ea2 100644 --- a/src/gui/Pages/Chat/Timeline/EventDelegate.qml +++ b/src/gui/Pages/Chat/Timeline/EventDelegate.qml @@ -25,20 +25,12 @@ HColumnLayout { readonly property bool isRedacted: model.event_type === "RedactedEvent" readonly property bool onRight: ! eventList.ownEventsOnLeft && isOwn readonly property bool combine: eventList.canCombine(previousModel, model) + readonly property bool asOneLine: eventList.renderEventAsOneLine(model) readonly property bool talkBreak: eventList.canTalkBreak(previousModel, model) readonly property bool dayBreak: eventList.canDayBreak(previousModel, model) - readonly property bool hideNameLine: - model.event_type === "RoomMessageEmote" || - ! ( - model.event_type.startsWith("RoomMessage") || - model.event_type.startsWith("RoomEncrypted") - ) || - onRight || - combine - readonly property int cursorShape: eventContent.hoveredLink || hoveredMediaTypeUrl.length === 3 ? Qt.PointingHandCursor : diff --git a/src/gui/Pages/Chat/Timeline/EventList.qml b/src/gui/Pages/Chat/Timeline/EventList.qml index ddbbaebc..e85b5cdf 100644 --- a/src/gui/Pages/Chat/Timeline/EventList.qml +++ b/src/gui/Pages/Chat/Timeline/EventList.qml @@ -323,6 +323,14 @@ Rectangle { return item.date.getDate() !== itemAfter.date.getDate() } + function renderEventAsOneLine(event) { + return ( + event.event_type !== "RoomMessageEmote" && + ! event.event_type.startsWith("RoomMessage") && + ! event.event_type.startsWith("RoomEncrypted") + ) + } + function loadPastEvents() { loadPastEventsFuture = py.callClientCoro( chat.userId,