fixed most of the binding loops

This commit is contained in:
Malte E 2022-02-09 21:36:04 +01:00
parent 5db7ec7f03
commit 0e548b7d39
7 changed files with 25 additions and 6 deletions

View file

@ -102,7 +102,7 @@ Item {
left: parent.left
top: parent.top
}
property bool narrowLayout: (r.width < 500) && Settings.bubbles
property bool narrowLayout: Settings.bubbles //&& (timelineView.width < 500) // timelineView causes fewew binding loops than r. But maybe it shouldn't depend on width anyway
rowSpacing: 0
columnSpacing: 2
columns: narrowLayout? 1 : 2
@ -142,6 +142,7 @@ Item {
callType: r.relatedEventCacheBuster, fromModel(Room.CallType) ?? ""
encryptionError: r.relatedEventCacheBuster, fromModel(Room.EncryptionError) ?? ""
relatedEventCacheBuster: r.relatedEventCacheBuster, fromModel(Room.RelatedEventCacheBuster) ?? 0
maxWidth: row.maxWidth
}
// actual message content
@ -173,6 +174,7 @@ Item {
encryptionError: r.encryptionError
relatedEventCacheBuster: r.relatedEventCacheBuster
isReply: false
maxWidth: row.maxWidth
}
RowLayout {

View file

@ -11,9 +11,11 @@ Item {
required property string eventId
required property string filename
required property string filesize
property int maxWidth
height: row.height + 24
width: parent.width
width: maxWidth
implicitWidth: maxWidth
RowLayout {
id: row

View file

@ -17,13 +17,16 @@ Item {
required property string filename
required property bool isReply
required property string eventId
property double tempWidth: Math.min(parent.width, originalWidth < 1 ? 200 : originalWidth)
property int maxWidth
property double tempWidth: Math.min(maxWidth, originalWidth < 1 ? 200 : originalWidth)
property double tempHeight: tempWidth * proportionalHeight
property double divisor: isReply ? 5 : 3
property bool tooHigh: tempHeight > timelineView.height / divisor
height: Math.round(tooHigh ? timelineView.height / divisor : tempHeight)
width: Math.round(tooHigh ? (timelineView.height / divisor) / proportionalHeight : tempWidth)
implicitHeight: height
implicitWidth: width
Image {
id: blurhash_

View file

@ -13,7 +13,7 @@ Item {
required property bool isReply
property alias child: chooser.child
implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width
implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : 0
required property double proportionalHeight
required property int type
required property string typeString
@ -35,6 +35,7 @@ Item {
required property string callType
required property int encryptionError
required property int relatedEventCacheBuster
property int maxWidth
Layout.preferredHeight: chooser.child ? chooser.child.height : Nheko.paddingLarge
@ -110,6 +111,7 @@ Item {
filename: d.filename
isReply: d.isReply
eventId: d.eventId
maxWidth: d.maxWidth
}
}
@ -127,6 +129,7 @@ Item {
filename: d.filename
isReply: d.isReply
eventId: d.eventId
maxWidth: d.maxWidth
}
}
@ -138,6 +141,7 @@ Item {
eventId: d.eventId
filename: d.filename
filesize: d.filesize
maxWidth: d.maxWidth
}
}
@ -154,6 +158,7 @@ Item {
url: d.url
body: d.body
filesize: d.filesize
maxWidth: d.maxWidth
}
}
@ -170,6 +175,7 @@ Item {
url: d.url
body: d.body
filesize: d.filesize
maxWidth: d.maxWidth
}
}
@ -372,7 +378,7 @@ Item {
isOnlyEmoji: false
isReply: d.isReply
isStateEvent: d.isStateEvent
formatted: qsTr("% is negotiating the call...").arg(d.userName)
formatted: qsTr("%1 is negotiating the call...").arg(d.userName)
}
}

View file

@ -22,13 +22,16 @@ Item {
required property string url
required property string body
required property string filesize
property double tempWidth: Math.min(parent.width, originalWidth < 1 ? 400 : originalWidth)
property int maxWidth
property double tempWidth: Math.min(maxWidth, originalWidth < 1 ? 400 : originalWidth)
property double tempHeight: tempWidth * proportionalHeight
property double divisor: isReply ? 4 : 2
property bool tooHigh: tempHeight > timelineRoot.height / divisor
height: (type == MtxEvent.VideoMessage ? tooHigh ? timelineRoot.height / divisor : tempHeight : 80) + fileInfoLabel.height
width: type == MtxEvent.VideoMessage ? tooHigh ? (timelineRoot.height / divisor) / proportionalHeight : tempWidth : 250
implicitHeight: height
implicitWidth: width
MxcMedia {
id: mxcmedia

View file

@ -13,6 +13,7 @@ Rectangle{
required property real delegateWidth
height: redactedLayout.implicitHeight + Nheko.paddingSmall
width: redactedLayout.implicitWidth + 2 * Nheko.paddingMedium
implicitWidth: width
radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall
color: Nheko.colors.alternateBase

View file

@ -35,6 +35,7 @@ Item {
property string callType
property int encryptionError
property int relatedEventCacheBuster
property int maxWidth
Layout.preferredHeight: replyContainer.height
height: replyContainer.height
@ -124,6 +125,7 @@ Item {
enabled: false
Layout.fillWidth: true
isReply: true
maxWidth: r.maxWidth-4
}
}