Fix pinned messages getting clipped

This commit is contained in:
Nicolas Werner 2022-04-24 16:37:35 +02:00
parent eeb48749ae
commit c21711830f
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
5 changed files with 37 additions and 3 deletions

View file

@ -207,7 +207,7 @@ Item {
image: ":/icons/icons/ui/people.svg" image: ":/icons/icons/ui/people.svg"
hoverEnabled: true hoverEnabled: true
ToolTip.visible: hovered ToolTip.visible: hovered
ToolTip.text: qsTr("View members of %1").arg(room.roomName) ToolTip.text: qsTr("View members of %1").arg(room ? room.roomName : "")
onClicked: TimelineManager.openRoomMembers(room) onClicked: TimelineManager.openRoomMembers(room)
} }

View file

@ -291,6 +291,7 @@ Pane {
userId: e.userId ?? "" userId: e.userId ?? ""
userName: e.userName ?? "" userName: e.userName ?? ""
encryptionError: e.encryptionError ?? "" encryptionError: e.encryptionError ?? ""
keepFullText: true
} }
ImageButton { ImageButton {

View file

@ -12,6 +12,7 @@ Item {
id: d id: d
required property bool isReply required property bool isReply
property bool keepFullText: !isReply
property alias child: chooser.child property alias child: chooser.child
implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : 0 implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : 0
required property double proportionalHeight required property double proportionalHeight
@ -68,6 +69,7 @@ Item {
body: d.body body: d.body
isOnlyEmoji: d.isOnlyEmoji isOnlyEmoji: d.isOnlyEmoji
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
metadataWidth: d.metadataWidth metadataWidth: d.metadataWidth
} }
@ -81,6 +83,7 @@ Item {
body: d.body body: d.body
isOnlyEmoji: d.isOnlyEmoji isOnlyEmoji: d.isOnlyEmoji
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
metadataWidth: d.metadataWidth metadataWidth: d.metadataWidth
} }
@ -96,6 +99,7 @@ Item {
body: d.body body: d.body
isOnlyEmoji: d.isOnlyEmoji isOnlyEmoji: d.isOnlyEmoji
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
metadataWidth: d.metadataWidth metadataWidth: d.metadataWidth
} }
@ -231,6 +235,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.roomName ? qsTr("%2 changed the room name to: %1").arg(d.roomName).arg(d.userName) : qsTr("%1 removed the room name").arg(d.userName) formatted: d.roomName ? qsTr("%2 changed the room name to: %1").arg(d.roomName).arg(d.userName) : qsTr("%1 removed the room name").arg(d.userName)
} }
@ -244,6 +249,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.roomTopic ? qsTr("%2 changed the topic to: %1").arg(d.roomTopic).arg(d.userName): qsTr("%1 removed the topic").arg(d.userName) formatted: d.roomTopic ? qsTr("%2 changed the topic to: %1").arg(d.roomTopic).arg(d.userName): qsTr("%1 removed the topic").arg(d.userName)
} }
@ -257,6 +263,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the room avatar").arg(d.userName) formatted: qsTr("%1 changed the room avatar").arg(d.userName)
} }
@ -270,6 +277,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: qsTr("%1 changed the pinned messages.").arg(d.userName) formatted: qsTr("%1 changed the pinned messages.").arg(d.userName)
} }
@ -283,6 +291,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatImagePackEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatImagePackEvent(d.eventId)
} }
@ -297,6 +306,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent 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)
} }
@ -310,6 +320,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent 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)
} }
@ -323,6 +334,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent 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)
} }
@ -336,6 +348,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: { formatted: {
switch (d.callType) { switch (d.callType) {
@ -358,6 +371,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: qsTr("%1 answered the call.").arg(d.userName) formatted: qsTr("%1 answered the call.").arg(d.userName)
} }
@ -371,6 +385,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: qsTr("%1 ended the call.").arg(d.userName) formatted: qsTr("%1 ended the call.").arg(d.userName)
} }
@ -384,6 +399,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: qsTr("%1 is negotiating the call...").arg(d.userName) formatted: qsTr("%1 is negotiating the call...").arg(d.userName)
} }
@ -397,6 +413,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatPowerLevelEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatPowerLevelEvent(d.eventId)
} }
@ -410,6 +427,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatJoinRuleEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatJoinRuleEvent(d.eventId)
} }
@ -423,6 +441,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatHistoryVisibilityEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatHistoryVisibilityEvent(d.eventId)
} }
@ -436,6 +455,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: d.relatedEventCacheBuster, room.formatGuestAccessEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatGuestAccessEvent(d.eventId)
} }
@ -452,6 +472,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
Layout.fillWidth: true Layout.fillWidth: true
formatted: d.relatedEventCacheBuster, room.formatMemberEvent(d.eventId) formatted: d.relatedEventCacheBuster, room.formatMemberEvent(d.eventId)
@ -475,6 +496,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationRequest" formatted: "KeyVerificationRequest"
} }
@ -488,6 +510,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationStart" formatted: "KeyVerificationStart"
} }
@ -501,6 +524,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationReady" formatted: "KeyVerificationReady"
} }
@ -514,6 +538,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationCancel" formatted: "KeyVerificationCancel"
} }
@ -527,6 +552,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationKey" formatted: "KeyVerificationKey"
} }
@ -540,6 +566,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationMac" formatted: "KeyVerificationMac"
} }
@ -553,6 +580,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationDone" formatted: "KeyVerificationDone"
} }
@ -566,6 +594,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationDone" formatted: "KeyVerificationDone"
} }
@ -579,6 +608,7 @@ Item {
body: formatted body: formatted
isOnlyEmoji: false isOnlyEmoji: false
isReply: d.isReply isReply: d.isReply
keepFullText: d.keepFullText
isStateEvent: d.isStateEvent isStateEvent: d.isStateEvent
formatted: "KeyVerificationAccept" formatted: "KeyVerificationAccept"
} }

View file

@ -38,6 +38,7 @@ AbstractButton {
property int encryptionError property int encryptionError
property int relatedEventCacheBuster property int relatedEventCacheBuster
property int maxWidth property int maxWidth
property bool keepFullText: false
height: replyContainer.height height: replyContainer.height
implicitHeight: replyContainer.height implicitHeight: replyContainer.height
@ -125,6 +126,7 @@ AbstractButton {
enabled: false enabled: false
Layout.fillWidth: true Layout.fillWidth: true
isReply: true isReply: true
keepFullText: r.keepFullText
} }
} }

View file

@ -11,6 +11,7 @@ MatrixText {
required property string body required property string body
required property bool isOnlyEmoji required property bool isOnlyEmoji
required property bool isReply required property bool isReply
required property bool keepFullText
required property string formatted required property string formatted
property string copyText: selectedText ? getText(selectionStart, selectionEnd) : body property string copyText: selectedText ? getText(selectionStart, selectionEnd) : body
property int metadataWidth property int metadataWidth
@ -36,8 +37,8 @@ MatrixText {
</style> </style>
" + formatted.replace(/<pre>/g, "<pre style='white-space: pre-wrap; background-color: " + Nheko.colors.alternateBase + "'>").replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>") " + formatted.replace(/<pre>/g, "<pre style='white-space: pre-wrap; background-color: " + Nheko.colors.alternateBase + "'>").replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
width: parent.width width: parent.width
height: isReply ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : implicitHeight height: !keepFullText ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : implicitHeight
clip: isReply clip: !keepFullText
selectByMouse: !Settings.mobileMode && !isReply selectByMouse: !Settings.mobileMode && !isReply
enabled: !Settings.mobileMode enabled: !Settings.mobileMode
font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize