summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorMalte E <malte.e@mailbox.org>2022-02-03 20:26:20 +0100
committerMalte E <malte.e@mailbox.org>2022-02-03 20:26:20 +0100
commit04b47d68829dcdbb5bbde615b0e344a74be86598 (patch)
tree1401e5f34b7ec97e62a85a55806d4b95e4fedcdd /resources/qml/delegates
parentsplit point is pointless (diff)
downloadnheko-04b47d68829dcdbb5bbde615b0e344a74be86598.tar.xz
prepare code for message bubbles and dynamic message layout
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/MessageDelegate.qml9
-rw-r--r--resources/qml/delegates/Placeholder.qml2
-rw-r--r--resources/qml/delegates/Reply.qml14
-rw-r--r--resources/qml/delegates/TextMessage.qml4
4 files changed, 16 insertions, 13 deletions
diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml

index c0266c2c..ad6e7580 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml
@@ -13,7 +13,7 @@ Item { required property bool isReply property alias child: chooser.child - property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width +// property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width required property double proportionalHeight required property int type required property string typeString @@ -35,14 +35,17 @@ Item { required property int encryptionError required property int relatedEventCacheBuster - height: chooser.child ? chooser.child.height : Nheko.paddingLarge + Layout.preferredHeight: chooser.child ? chooser.child.height : Nheko.paddingLarge DelegateChooser { id: chooser //role: "type" //< not supported in our custom implementation, have to use roleValue roleValue: type - anchors.fill: parent + //anchors.fill: parent + + anchors.left: parent.left + anchors.right: parent.right DelegateChoice { roleValue: MtxEvent.UnknownMessage diff --git a/resources/qml/delegates/Placeholder.qml b/resources/qml/delegates/Placeholder.qml
index 19e48393..f63e62f5 100644 --- a/resources/qml/delegates/Placeholder.qml +++ b/resources/qml/delegates/Placeholder.qml
@@ -10,6 +10,6 @@ MatrixText { required property string typeString text: qsTr("unimplemented event: ") + typeString - width: parent.width +// width: parent.width color: Nheko.inactiveColors.text } diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index d148f858..efa959a0 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -35,7 +35,7 @@ Item { property int encryptionError property int relatedEventCacheBuster - width: parent.width + Layout.preferredHeight: replyContainer.height height: replyContainer.height CursorShape { @@ -52,12 +52,12 @@ Item { color: TimelineManager.userColor(userId, Nheko.colors.base) } - Column { + ColumnLayout { id: replyContainer anchors.left: colorLine.right - anchors.leftMargin: 4 width: parent.width - 8 + spacing: 0 TapHandler { acceptedButtons: Qt.LeftButton @@ -80,6 +80,7 @@ Item { } Text { + Layout.leftMargin: 4 id: userName_ text: TimelineManager.escapeEmoji(userName) @@ -94,8 +95,8 @@ Item { } MessageDelegate { + Layout.leftMargin: 4 id: reply - blurhash: r.blurhash body: r.body formattedBody: r.formattedBody @@ -118,7 +119,7 @@ Item { encryptionError: r.encryptionError // This is disabled so that left clicking the reply goes to its location enabled: false - width: parent.width + Layout.fillWidth: true isReply: true } @@ -128,8 +129,7 @@ Item { id: backgroundItem z: -1 - height: replyContainer.height - width: Math.min(Math.max(reply.implicitWidth, userName_.implicitWidth) + 8 + 4, parent.width) + anchors.fill: replyContainer color: Qt.rgba(userColor.r, userColor.g, userColor.b, 0.1) } diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index eea8cd1e..c9b8a882 100644 --- a/resources/qml/delegates/TextMessage.qml +++ b/resources/qml/delegates/TextMessage.qml
@@ -33,8 +33,8 @@ MatrixText { blockquote { margin-left: 1em; } </style> " + formatted.replace("<pre>", "<pre style='white-space: pre-wrap; background-color: " + Nheko.colors.alternateBase + "'>").replace("<del>", "<s>").replace("</del>", "</s>").replace("<strike>", "<s>").replace("</strike>", "</s>") - width: parent.width - height: isReply ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : undefined +// width: parent.width + //height: isReply ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : undefined clip: isReply selectByMouse: !Settings.mobileMode && !isReply font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize