Clip replies by default

In the future we should probably add a gradient when clipped...
master
Nicolas Werner 5 years ago
parent 000ab4853a
commit 004d10bfee
  1. 7
      resources/qml/delegates/ImageMessage.qml
  2. 2
      resources/qml/delegates/MessageDelegate.qml
  3. 2
      resources/qml/delegates/NoticeMessage.qml
  4. 10
      resources/qml/delegates/PlayableMediaMessage.qml
  5. 1
      resources/qml/delegates/Reply.qml
  6. 2
      resources/qml/delegates/TextMessage.qml

@ -6,10 +6,11 @@ Item {
property double tempWidth: Math.min(parent ? parent.width : undefined, model.data.width < 1 ? parent.width : model.data.width) property double tempWidth: Math.min(parent ? parent.width : undefined, model.data.width < 1 ? parent.width : model.data.width)
property double tempHeight: tempWidth * model.data.proportionalHeight property double tempHeight: tempWidth * model.data.proportionalHeight
property bool tooHigh: tempHeight > timelineRoot.height / 2 property double divisor: model.isReply ? 4 : 2
property bool tooHigh: tempHeight > timelineRoot.height / divisor
height: tooHigh ? timelineRoot.height / 2 : tempHeight height: tooHigh ? timelineRoot.height / divisor : tempHeight
width: tooHigh ? (timelineRoot.height / 2) / model.data.proportionalHeight : tempWidth width: tooHigh ? (timelineRoot.height / divisor) / model.data.proportionalHeight : tempWidth
Image { Image {
id: blurhash id: blurhash

@ -6,9 +6,11 @@ Item {
Item { Item {
id: model id: model
property var data; property var data;
property bool isReply: false
} }
property alias modelData: model.data property alias modelData: model.data
property alias isReply: model.isReply
height: chooser.childrenRect.height height: chooser.childrenRect.height
property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width

@ -1,4 +1,6 @@
TextMessage { TextMessage {
font.italic: true font.italic: true
color: colors.buttonText color: colors.buttonText
height: isReply ? Math.min(chat.height / 8, implicitHeight) : undefined
clip: true
} }

@ -20,8 +20,14 @@ Rectangle {
Rectangle { Rectangle {
id: videoContainer id: videoContainer
visible: model.data.type == MtxEvent.VideoMessage visible: model.data.type == MtxEvent.VideoMessage
width: Math.min(parent.width, model.data.width ? model.data.width : 400) // some media has 0 as size... property double tempWidth: Math.min(parent ? parent.width : undefined, model.data.width < 1 ? 400 : model.data.width)
height: width*model.data.proportionalHeight property double tempHeight: tempWidth * model.data.proportionalHeight
property double divisor: model.isReply ? 4 : 2
property bool tooHigh: tempHeight > timelineRoot.height / divisor
height: tooHigh ? timelineRoot.height / divisor : tempHeight
width: tooHigh ? (timelineRoot.height / divisor) / model.data.proportionalHeight : tempWidth
Image { Image {
anchors.fill: parent anchors.fill: parent
source: model.data.thumbnailUrl.replace("mxc://", "image://MxcImage/") source: model.data.thumbnailUrl.replace("mxc://", "image://MxcImage/")

@ -51,6 +51,7 @@ Item {
MessageDelegate { MessageDelegate {
id: reply id: reply
width: parent.width width: parent.width
isReply: true
} }
} }

@ -4,4 +4,6 @@ MatrixText {
property string formatted: model.data.formattedBody property string formatted: model.data.formattedBody
text: "<style type=\"text/css\">a { color:"+colors.link+";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap'>") text: "<style type=\"text/css\">a { color:"+colors.link+";}</style>" + formatted.replace("<pre>", "<pre style='white-space: pre-wrap'>")
width: parent ? parent.width : undefined width: parent ? parent.width : undefined
height: isReply ? Math.min(chat.height / 8, implicitHeight) : undefined
clip: true
} }

Loading…
Cancel
Save