fix: fix chat height being too high in compact mode
This commit is contained in:
parent
fe3995bb3d
commit
261460f8fb
|
@ -1,26 +1,12 @@
|
|||
import QtQuick 2.3
|
||||
import "../../../../../imports"
|
||||
|
||||
Rectangle {
|
||||
ImageLoader {
|
||||
property int chatVerticalPadding: 12
|
||||
property int chatHorizontalPadding: 12
|
||||
property int imageWidth: 250
|
||||
property string imageSource: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gIoSUNDX1BST0ZJTEUAAQEAAAIYAAAAAAIQAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAAHRyWFlaAAABZAAAABRnWFlaAAABeAAAABRiWFlaAAABjAAAABRyVFJDAAABoAAAAChnVFJDAAABoAAAAChiVFJDAAABoAAAACh3dHB0AAAByAAAABRjcHJ0AAAB3AAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAFgAAAAcAHMAUgBHAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFhZWiAAAAAAAABvogAAOPUAAAOQWFlaIAAAAAAAAGKZAAC3hQAAGNpYWVogAAAAAAAAJKAAAA+EAAC2z3BhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABYWVogAAAAAAAA9tYAAQAAAADTLW1sdWMAAAAAAAAAAQAAAAxlblVTAAAAIAAAABwARwBvAG8AZwBsAGUAIABJAG4AYwAuACAAMgAwADEANv/bAEMADQkKCwoIDQsKCw4ODQ8TIBUTEhITJxweFyAuKTEwLiktLDM6Sj4zNkY3LC1AV0FGTE5SU1IyPlphWlBgS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c71yWouRlEdPciycHVtl/Fb9h0uoCUD4YGCOCH7cP2qyeksTi5tNx/ysjh8xcY+1Lc8L6u/4Yes01/Stq5O3CbPOIwkrxu4x2yb1mzcayMi3OD1CxTfnyr1Wqs9NyF5Dnp+V3xu9zHYrF8RjbNfYmRuLlMyN0wIbbcrxUU7VMummbWj1bPTQMuQw59HHtVsrnVy1m+H3IztyDmMnPqK/+U0zw4xTEkVZZgk70VG1G5duRt2z5puDPB6voc0VO1FUYVC4R8nP2oormxbTTR6CcVKLRE1dv4kohJVwYOauTFpHkP3CuWsJhDJ3xvipz/ty+j/FdGLtJnBnHrJpml4QhcuxNgCWPye9ahWV4UBduS9Afvn3CtWkz9hR9C2v/t2/95/DWR4jLFm3HdJXIiH59q0vEbsITtwlIMjLHfsH8tYviMrl+VosCkVkrg3xgN/q1IpsjaCF2ennFtwVyoLydz704eM6WRl08hxxs5rPtl3rPjyCWHGA++/4pW7j40ulyZ5/mim2lhfElJtNHu9AWbWmNX/UTtkhjFQMZQ9c+fkUV4qxrNTattm3qLkLUneBNBzztRSHN2ao8Cr2WUUZopB0ziT5hLCfvVumt6i+THoSAKZRTu/bb81DtVumvFjURuIsTaQdx/7+1NhyOOXhl8jx4zTklpdpr9/RNyc7JcsyDPQvVE33B55z+Kcl4zZuWOrSyJ3HbCIj5uTH70hc8TtEJSSbccqMcC/nisiELifEjLpkqgD677ccU9a7ZzGnHGau7JnNZSk5Vd1rtKabWRufJc+WZ+GmFlISOY57p7U9VWCWnelGrugEIp1ZznypSnv0tvpTLn/Vnel7unnbFPmPM7UicZPTTwzilX2U0UUUqjVY6m9FFFIOiFHNFFQorvWi5FOHGM12xCcomRiGDIpnG3b6fu0UVp8fTm+bFJJl8LMISZhmTzJ3WrOOcUUVqOaR6s/0i+vBRheXPobFFFQoU1Nrol1xDpex2aKKKzzirN3HJ9T/2Q=="
|
||||
|
||||
id: imageChatBox
|
||||
height: imageMessage.height + imageChatBox.chatVerticalPadding
|
||||
width: imageMessage.width + 2 * chatHorizontalPadding
|
||||
radius: 16
|
||||
visible: isImage
|
||||
color: "transparent"
|
||||
|
||||
|
||||
ImageLoader {
|
||||
id: imageMessage
|
||||
verticalPadding: imageChatBox.chatVerticalPadding
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: imageChatBox.chatVerticalPadding
|
||||
verticalPadding: chatVerticalPadding
|
||||
source: imageSource
|
||||
imageWidth: imageChatBox.imageWidth
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,18 @@ import QtQuick 2.3
|
|||
import "../../../../../shared"
|
||||
import "../../../../../imports"
|
||||
|
||||
Rectangle {
|
||||
property alias textField: lblReplyMessage
|
||||
Loader {
|
||||
property int textFieldWidth: item ? item.textField.width : 0
|
||||
property bool longReply: false
|
||||
property color elementsColor: isCurrentUser ? Style.current.chatReplyCurrentUser : Style.current.secondaryText
|
||||
|
||||
id: root
|
||||
active: responseTo != "" && replyMessageIndex > -1
|
||||
|
||||
sourceComponent: Component {
|
||||
Rectangle {
|
||||
property alias textField: lblReplyMessage
|
||||
|
||||
id: chatReply
|
||||
visible: responseTo != "" && replyMessageIndex > -1
|
||||
// childrenRect.height shows a binding loop for soem reason, so we use heights instead
|
||||
|
@ -16,7 +23,7 @@ Rectangle {
|
|||
StyledTextEdit {
|
||||
id: lblReplyAuthor
|
||||
text: "↳" + repliedMessageAuthor
|
||||
color: chatReply.elementsColor
|
||||
color: root.elementsColor
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
wrapMode: Text.Wrap
|
||||
|
@ -42,12 +49,12 @@ Rectangle {
|
|||
anchors.topMargin: 5
|
||||
text: Emoji.parse(Utils.linkifyAndXSS(repliedMessageContent), "26x26");
|
||||
textFormat: Text.RichText
|
||||
color: chatReply.elementsColor
|
||||
color: root.elementsColor
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
wrapMode: Text.Wrap
|
||||
anchors.left: parent.left
|
||||
anchors.right: chatReply.longReply ? parent.right : undefined
|
||||
anchors.right: root.longReply ? parent.right : undefined
|
||||
z: 51
|
||||
}
|
||||
|
||||
|
@ -57,6 +64,9 @@ Rectangle {
|
|||
anchors.left: lblReplyMessage.left
|
||||
anchors.right: lblReplyMessage.right
|
||||
anchors.rightMargin: chatTextItem.chatHorizontalPadding
|
||||
color: chatReply.elementsColor
|
||||
color: root.elementsColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ Item {
|
|||
active: emojiReactions !== ""
|
||||
anchors.top: chatText.bottom
|
||||
anchors.left: chatText.left
|
||||
anchors.topMargin: 2
|
||||
anchors.topMargin: active ? 2 : 0
|
||||
|
||||
sourceComponent: Component {
|
||||
EmojiReactions {}
|
||||
|
|
|
@ -71,8 +71,8 @@ Item {
|
|||
return 400;
|
||||
}
|
||||
let baseWidth = chatText.width;
|
||||
if (chatReply.visible && chatText.width < chatReply.textField.width) {
|
||||
baseWidth = chatReply.textField.width
|
||||
if (chatReply.visible && chatText.width < chatReply.textFieldWidth) {
|
||||
baseWidth = chatReply.textFieldWidth
|
||||
}
|
||||
return baseWidth + 2 * chatHorizontalPadding
|
||||
}
|
||||
|
@ -113,17 +113,24 @@ Item {
|
|||
|
||||
Loader {
|
||||
id: chatImageContent
|
||||
active: isImage
|
||||
sourceComponent: chatImageComponent
|
||||
}
|
||||
active: isImage && !!image
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.smallPadding
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: chatBox.chatHorizontalPadding
|
||||
|
||||
Component {
|
||||
id: chatImageComponent
|
||||
sourceComponent: Component {
|
||||
Item {
|
||||
width: chatImageComponent.width + 2 * chatBox.chatHorizontalPadding
|
||||
height: chatImageComponent.height
|
||||
ChatImage {
|
||||
id: chatImageComponent
|
||||
imageSource: image
|
||||
imageWidth: 250
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: audioPlayerLoader
|
||||
|
|
|
@ -2,9 +2,13 @@ import QtQuick 2.3
|
|||
import "../../../../../shared"
|
||||
import "../../../../../imports"
|
||||
|
||||
Loader {
|
||||
active: isMessage && authorCurrentMsg !== authorPrevMsg
|
||||
height: active ? item.height : 0
|
||||
|
||||
sourceComponent: Component {
|
||||
Rectangle {
|
||||
id: chatImage
|
||||
visible: isMessage && authorCurrentMsg != authorPrevMsg
|
||||
width: identiconImage.width
|
||||
height: identiconImage.height
|
||||
border.width: 1
|
||||
|
@ -14,7 +18,7 @@ Rectangle {
|
|||
Image {
|
||||
id: identiconImage
|
||||
width: 36
|
||||
height: chatImage.visible ? 36 : 0
|
||||
height: 36
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: !isCurrentUser ? identicon : profileModel.profile.identicon
|
||||
mipmap: true
|
||||
|
@ -31,3 +35,5 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue