print state events without bubbles, displaynames or avatars and in a smaller font

pull/920/head
Malte E 3 years ago
parent 9d194cc2e6
commit 384c9c91e3
  1. 11
      resources/qml/MessageView.qml
  2. 6
      resources/qml/TimelineRow.qml
  3. 31
      resources/qml/delegates/MessageDelegate.qml
  4. 3
      resources/qml/delegates/NoticeMessage.qml
  5. 2
      resources/qml/delegates/Pill.qml
  6. 2
      resources/qml/delegates/Reply.qml

@ -252,9 +252,9 @@ ScrollView {
topPadding: 4 topPadding: 4
bottomPadding: 4 bottomPadding: 4
spacing: 8 spacing: 8
visible: (previousMessageUserId !== userId || previousMessageDay !== day) visible: (previousMessageUserId !== userId || previousMessageDay !== day || previousMessageIsStateEvent) && !isStateEvent
width: parentWidth width: parentWidth
height: ((previousMessageDay !== day) ? dateBubble.height + 8 + userName.height : userName.height) + 8 height: ((previousMessageDay !== day) ? dateBubble.height : 0) + (isStateEvent? 0 : userName.height +8 )
Label { Label {
id: dateBubble id: dateBubble
@ -317,7 +317,7 @@ ScrollView {
color: TimelineManager.userColor(userId, Nheko.colors.base) color: TimelineManager.userColor(userId, Nheko.colors.base)
textFormat: Text.RichText textFormat: Text.RichText
ToolTip.visible: displayNameHover.hovered ToolTip.visible: displayNameHover.hovered
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
ToolTip.text: userId ToolTip.text: userId
TapHandler { TapHandler {
@ -379,6 +379,8 @@ ScrollView {
required property bool isEncrypted required property bool isEncrypted
required property bool isEditable required property bool isEditable
required property bool isEdited required property bool isEdited
required property bool isStateEvent
required property bool previousMessageIsStateEvent
required property string replyTo required property string replyTo
required property string userId required property string userId
required property string roomTopic required property string roomTopic
@ -455,6 +457,8 @@ ScrollView {
property string previousMessageUserId: wrapper.previousMessageUserId property string previousMessageUserId: wrapper.previousMessageUserId
property string day: wrapper.day property string day: wrapper.day
property string previousMessageDay: wrapper.previousMessageDay property string previousMessageDay: wrapper.previousMessageDay
property bool previousMessageIsStateEvent: wrapper.previousMessageIsStateEvent
property bool isStateEvent: wrapper.isStateEvent
property string userName: wrapper.userName property string userName: wrapper.userName
property date timestamp: wrapper.timestamp property date timestamp: wrapper.timestamp
@ -487,6 +491,7 @@ ScrollView {
isEncrypted: wrapper.isEncrypted isEncrypted: wrapper.isEncrypted
isEditable: wrapper.isEditable isEditable: wrapper.isEditable
isEdited: wrapper.isEdited isEdited: wrapper.isEdited
isStateEvent: wrapper.isStateEvent
replyTo: wrapper.replyTo replyTo: wrapper.replyTo
userId: wrapper.userId userId: wrapper.userId
userName: wrapper.userName userName: wrapper.userName

@ -31,6 +31,7 @@ Item {
required property bool isEncrypted required property bool isEncrypted
required property bool isEditable required property bool isEditable
required property bool isEdited required property bool isEdited
required property bool isStateEvent
required property string replyTo required property string replyTo
required property string userId required property string userId
required property string userName required property string userName
@ -89,7 +90,7 @@ Item {
property color bgColor: Nheko.colors.base property color bgColor: Nheko.colors.base
color: Qt.rgba(userColor.r*0.1+bgColor.r*0.9,userColor.g*0.1+bgColor.g*0.9,userColor.b*0.1+bgColor.b*0.9,1) //TimelineManager.userColor(userId, Nheko.colors.base) color: Qt.rgba(userColor.r*0.1+bgColor.r*0.9,userColor.g*0.1+bgColor.g*0.9,userColor.b*0.1+bgColor.b*0.9,1) //TimelineManager.userColor(userId, Nheko.colors.base)
radius: 4 radius: 4
visible: Settings.bubbles visible: Settings.bubbles && !isStateEvent
} }
GridLayout { GridLayout {
@ -130,6 +131,7 @@ Item {
url: r.relatedEventCacheBuster, fromModel(Room.Url) ?? "" url: r.relatedEventCacheBuster, fromModel(Room.Url) ?? ""
originalWidth: r.relatedEventCacheBuster, fromModel(Room.OriginalWidth) ?? 0 originalWidth: r.relatedEventCacheBuster, fromModel(Room.OriginalWidth) ?? 0
isOnlyEmoji: r.relatedEventCacheBuster, fromModel(Room.IsOnlyEmoji) ?? false isOnlyEmoji: r.relatedEventCacheBuster, fromModel(Room.IsOnlyEmoji) ?? false
isStateEvent: r.relatedEventCacheBuster, fromModel(Room.IsStateEvent) ?? false
userId: r.relatedEventCacheBuster, fromModel(Room.UserId) ?? "" userId: r.relatedEventCacheBuster, fromModel(Room.UserId) ?? ""
userName: r.relatedEventCacheBuster, fromModel(Room.UserName) ?? "" userName: r.relatedEventCacheBuster, fromModel(Room.UserName) ?? ""
thumbnailUrl: r.relatedEventCacheBuster, fromModel(Room.ThumbnailUrl) ?? "" thumbnailUrl: r.relatedEventCacheBuster, fromModel(Room.ThumbnailUrl) ?? ""
@ -160,6 +162,7 @@ Item {
thumbnailUrl: r.thumbnailUrl thumbnailUrl: r.thumbnailUrl
originalWidth: r.originalWidth originalWidth: r.originalWidth
isOnlyEmoji: r.isOnlyEmoji isOnlyEmoji: r.isOnlyEmoji
isStateEvent: r.isStateEvent
userId: r.userId userId: r.userId
userName: r.userName userName: r.userName
roomTopic: r.roomTopic roomTopic: r.roomTopic
@ -176,6 +179,7 @@ Item {
Layout.rowSpan: msg.narrowLayout? 1 : 2 Layout.rowSpan: msg.narrowLayout? 1 : 2
Layout.bottomMargin: msg.narrowLayout? -4 : 0 Layout.bottomMargin: msg.narrowLayout? -4 : 0
Layout.alignment: Qt.AlignTop | Qt.AlignRight Layout.alignment: Qt.AlignTop | Qt.AlignRight
visible: !isStateEvent
property double scaling: msg.narrowLayout? 0.75 : 1 property double scaling: msg.narrowLayout? 0.75 : 1
StatusIndicator { StatusIndicator {

@ -27,6 +27,7 @@ Item {
required property string url required property string url
required property string thumbnailUrl required property string thumbnailUrl
required property bool isOnlyEmoji required property bool isOnlyEmoji
required property bool isStateEvent
required property string userId required property string userId
required property string userName required property string userName
required property string roomTopic required property string roomTopic
@ -77,6 +78,7 @@ Item {
body: d.body body: d.body
isOnlyEmoji: d.isOnlyEmoji isOnlyEmoji: d.isOnlyEmoji
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
} }
} }
@ -90,6 +92,7 @@ Item {
body: d.body body: d.body
isOnlyEmoji: d.isOnlyEmoji isOnlyEmoji: d.isOnlyEmoji
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
} }
} }
@ -184,6 +187,7 @@ Item {
Pill { Pill {
text: qsTr("removed") text: qsTr("removed")
isStateEvent: d.isStateEvent
} }
} }
@ -193,6 +197,7 @@ Item {
Pill { Pill {
text: qsTr("Encryption enabled") text: qsTr("Encryption enabled")
isStateEvent: d.isStateEvent
} }
} }
@ -214,6 +219,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: d.roomName ? qsTr("room name changed to: %1").arg(d.roomName) : qsTr("removed room name") formatted: d.roomName ? qsTr("room name changed to: %1").arg(d.roomName) : qsTr("removed room name")
} }
@ -226,6 +232,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: d.roomTopic ? qsTr("topic changed to: %1").arg(d.roomTopic) : qsTr("removed topic") formatted: d.roomTopic ? qsTr("topic changed to: %1").arg(d.roomTopic) : qsTr("removed topic")
} }
@ -238,6 +245,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the room avatar").arg(d.userName) formatted: qsTr("%1 changed the room avatar").arg(d.userName)
} }
@ -250,6 +258,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the pinned messages.").arg(d.userName) formatted: qsTr("%1 changed the pinned messages.").arg(d.userName)
} }
@ -262,6 +271,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the stickers and emotes in this room.").arg(d.userName) formatted: qsTr("%1 changed the stickers and emotes in this room.").arg(d.userName)
} }
@ -274,6 +284,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the addresses for this room.").arg(d.userName) formatted: qsTr("%1 changed the addresses for this room.").arg(d.userName)
} }
@ -286,6 +297,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the parent spaces for this room.").arg(d.userName) formatted: qsTr("%1 changed the parent spaces for this room.").arg(d.userName)
} }
@ -298,6 +310,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 created and configured room: %2").arg(d.userName).arg(room.roomId) formatted: qsTr("%1 created and configured room: %2").arg(d.userName).arg(room.roomId)
} }
@ -310,6 +323,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: { formatted: {
switch (d.callType) { switch (d.callType) {
case "voice": case "voice":
@ -331,6 +345,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 answered the call.").arg(d.userName) formatted: qsTr("%1 answered the call.").arg(d.userName)
} }
@ -343,6 +358,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("%1 ended the call.").arg(d.userName) formatted: qsTr("%1 ended the call.").arg(d.userName)
} }
@ -355,6 +371,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("Negotiating call...") formatted: qsTr("Negotiating call...")
} }
@ -368,6 +385,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatPowerLevelEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatPowerLevelEvent(d.eventId)
} }
@ -380,6 +398,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatJoinRuleEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatJoinRuleEvent(d.eventId)
} }
@ -392,6 +411,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatHistoryVisibilityEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatHistoryVisibilityEvent(d.eventId)
} }
@ -404,6 +424,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatGuestAccessEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatGuestAccessEvent(d.eventId)
} }
@ -419,6 +440,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
Layout.fillWidth: true Layout.fillWidth: true
formatted: d.relatedEventCacheBuster, room.formatMemberEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatMemberEvent(d.eventId)
} }
@ -441,6 +463,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationRequest" formatted: "KeyVerificationRequest"
} }
@ -453,6 +476,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationStart" formatted: "KeyVerificationStart"
} }
@ -465,6 +489,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationReady" formatted: "KeyVerificationReady"
} }
@ -477,6 +502,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationCancel" formatted: "KeyVerificationCancel"
} }
@ -489,6 +515,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationKey" formatted: "KeyVerificationKey"
} }
@ -501,6 +528,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationMac" formatted: "KeyVerificationMac"
} }
@ -513,6 +541,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationDone" formatted: "KeyVerificationDone"
} }
@ -525,6 +554,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationDone" formatted: "KeyVerificationDone"
} }
@ -537,6 +567,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: "KeyVerificationAccept" formatted: "KeyVerificationAccept"
} }

@ -5,7 +5,10 @@
import im.nheko 1.0 import im.nheko 1.0
TextMessage { TextMessage {
property bool isStateEvent
font.italic: true font.italic: true
color: Nheko.colors.buttonText color: Nheko.colors.buttonText
font.pointSize: isStateEvent? 0.75*fontMetrics.font.pointSize : 1*fontMetrics.font.pointSize
} }

@ -8,10 +8,12 @@ import QtQuick.Controls 2.1
import im.nheko 1.0 import im.nheko 1.0
Label { Label {
property bool isStateEvent
color: Nheko.colors.text color: Nheko.colors.text
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
height: contentHeight * 1.2 height: contentHeight * 1.2
width: contentWidth * 1.2 width: contentWidth * 1.2
font.pointSize: isStateEvent? 0.75*fontMetrics.font.pointSize : 1*fontMetrics.font.pointSize
background: Rectangle { background: Rectangle {
radius: parent.height / 2 radius: parent.height / 2

@ -26,6 +26,7 @@ Item {
property string filesize property string filesize
property string url property string url
property bool isOnlyEmoji property bool isOnlyEmoji
property bool isStateEvent
property string userId property string userId
property string userName property string userName
property string thumbnailUrl property string thumbnailUrl
@ -110,6 +111,7 @@ Item {
thumbnailUrl: r.thumbnailUrl thumbnailUrl: r.thumbnailUrl
originalWidth: r.originalWidth originalWidth: r.originalWidth
isOnlyEmoji: r.isOnlyEmoji isOnlyEmoji: r.isOnlyEmoji
isStateEvent: r.isStateEvent
userId: r.userId userId: r.userId
userName: r.userName userName: r.userName
roomTopic: r.roomTopic roomTopic: r.roomTopic

Loading…
Cancel
Save