1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-17 14:05:24 +02:00

emojireaction: fix maxMsgWidth is not defined error

Change-Id: Id6229ff59c5b896ffe72068e91fc70e334c11aad
This commit is contained in:
Matheo Joseph 2023-08-23 15:26:17 -04:00
parent ae2380c71b
commit 4619f04f7b
2 changed files with 12 additions and 11 deletions

View file

@ -60,6 +60,8 @@ Control {
property real textContentHeight property real textContentHeight
property bool isReply: ReplyTo !== "" property bool isReply: ReplyTo !== ""
property real maxMsgWidth: root.width - senderMargin - 2 * hPadding - avatarBlockWidth
// If the ListView attached properties are not available, // If the ListView attached properties are not available,
// then the root delegate is likely a Loader. // then the root delegate is likely a Loader.
readonly property ListView listView: ListView.view ? ListView.view : parent.ListView.view readonly property ListView listView: ListView.view ? ListView.view : parent.ListView.view
@ -350,7 +352,7 @@ Control {
height: contentHeight + 5 height: contentHeight + 5
reactions: Reactions reactions: Reactions
borderColor: root.getBaseColor() borderColor: root.getBaseColor()
maxWidth: 2/3 * maxMsgWidth - JamiTheme.emojiMargins maxWidth: 2 / 3 * maxMsgWidth - JamiTheme.emojiMargins
state: root.isOutgoing ? "anchorsRight" : (emojiReactions.width > bubble.width - JamiTheme.emojiMargins ? "anchorsLeft" : "anchorsRight") state: root.isOutgoing ? "anchorsRight" : (emojiReactions.width > bubble.width - JamiTheme.emojiMargins ? "anchorsLeft" : "anchorsRight")
@ -364,12 +366,12 @@ Control {
State { State {
name: "anchorsRight" name: "anchorsRight"
AnchorChanges { AnchorChanges {
target: emojiReactions; target: emojiReactions
anchors.right: bubble.right anchors.right: bubble.right
anchors.left: undefined anchors.left: undefined
} }
PropertyChanges { PropertyChanges {
target: emojiReactions; target: emojiReactions
anchors.rightMargin: JamiTheme.emojiMargins anchors.rightMargin: JamiTheme.emojiMargins
anchors.leftMargin: 0 anchors.leftMargin: 0
} }
@ -377,12 +379,12 @@ Control {
State { State {
name: "anchorsLeft" name: "anchorsLeft"
AnchorChanges { AnchorChanges {
target: emojiReactions; target: emojiReactions
anchors.right: undefined anchors.right: undefined
anchors.left: bubble.left anchors.left: bubble.left
} }
PropertyChanges { PropertyChanges {
target: emojiReactions; target: emojiReactions
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.leftMargin: JamiTheme.emojiMargins anchors.leftMargin: JamiTheme.emojiMargins
} }

View file

@ -30,15 +30,14 @@ SBSMessageBase {
property bool isRemoteImage property bool isRemoteImage
property bool isEmojiOnly: IsEmojiOnly property bool isEmojiOnly: IsEmojiOnly
property real maxMsgWidth: root.width - senderMargin - 2 * hPadding - avatarBlockWidth
property string colorUrl: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark property string colorUrl: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark
property string colorText: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark property string colorText: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
Connections { Connections {
target: bubble target: bubble
function onColorChanged(color) { function onColorChanged(color) {
root.colorUrl = UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark root.colorUrl = UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark;
root.colorText = UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark root.colorText = UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark;
// Update parsed body with correct colors // Update parsed body with correct colors
if (Body !== "") if (Body !== "")
MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, bubble.color); MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, bubble.color);
@ -65,7 +64,7 @@ SBSMessageBase {
text: { text: {
if (Body !== "" && ParsedBody.length === 0) { if (Body !== "" && ParsedBody.length === 0) {
MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, bubble.color); MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, bubble.color);
return "" return "";
} }
return (ParsedBody !== "") ? ParsedBody : "<i>(" + JamiStrings.deletedMessage + ")</i>"; return (ParsedBody !== "") ? ParsedBody : "<i>(" + JamiStrings.deletedMessage + ")</i>";
} }
@ -277,5 +276,5 @@ SBSMessageBase {
duration: 100 duration: 100
} }
} }
Component.onCompleted: opacity = 1; Component.onCompleted: opacity = 1
} }