Fix emoji paths for chat information Items
This commit is contained in:
parent
7b22c522f1
commit
8c69e04e83
4 changed files with 10 additions and 8 deletions
|
@ -79,18 +79,18 @@ ChatInformationTabItemBase {
|
|||
width: parent.width
|
||||
|
||||
// chat title isPrivateChat ? () :
|
||||
primaryText.text: Emoji.emojify(Functions.getUserName(user), primaryText.font.pixelSize)
|
||||
primaryText.text: Emoji.emojify(Functions.getUserName(user), primaryText.font.pixelSize, "../../js/emoji/")
|
||||
// last user
|
||||
prologSecondaryText.text: "@"+(user.username !== "" ? user.username : user_id) + (user_id === chatInformationPage.myUserId ? " " + qsTr("You") : "")
|
||||
secondaryText {
|
||||
horizontalAlignment: Text.AlignRight
|
||||
property string statusText: Functions.getChatMemberStatusText(model.status["@type"])
|
||||
property string customText: model.status.custom_title ? Emoji.emojify(model.status.custom_title, secondaryText.font.pixelSize) : ""
|
||||
property string customText: model.status.custom_title ? Emoji.emojify(model.status.custom_title, secondaryText.font.pixelSize, "../../js/emoji/") : ""
|
||||
text: (statusText !== "" && customText !== "") ? statusText + ", " + customText : statusText + customText
|
||||
}
|
||||
tertiaryText {
|
||||
maximumLineCount: 1
|
||||
text: user.type["@type"] === "userTypeBot" ? (Emoji.emojify("🤖 "+bot_info.description, tertiaryText.font.pixelSize)) : Functions.getChatPartnerStatusText(user.status["@type"], user.status.was_online);
|
||||
text: user.type["@type"] === "userTypeBot" ? (Emoji.emojify("🤖 "+bot_info.description, tertiaryText.font.pixelSize, "../../js/emoji/")) : Functions.getChatPartnerStatusText(user.status["@type"], user.status.was_online);
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ ChatInformationTabItemBase {
|
|||
onChatChanged: {
|
||||
if (changedChatId === chat_id) {
|
||||
// Force update of some list item elements (currently only last message text seems to create problems). dataChanged() doesn't seem to trigger them all :(
|
||||
secondaryText.text = last_message_text ? Emoji.emojify(last_message_text, Theme.fontSizeExtraSmall) : qsTr("Unknown")
|
||||
secondaryText.text = last_message_text ? Emoji.emojify(last_message_text, Theme.fontSizeExtraSmall, "../../js/emoji/") : qsTr("Unknown")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ Column {
|
|||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
textFormat: Text.StyledText
|
||||
color: Theme.highlightColor
|
||||
text: Emoji.emojify( Functions.replaceUrlsWithLinks(textItem.text).replace(/\n/g, "<br>"), Theme.fontSizeExtraSmall).replace(/\.\.\/js/g, "../../js")
|
||||
text: Emoji.emojify( Functions.replaceUrlsWithLinks(textItem.text).replace(/\n/g, "<br>"), Theme.fontSizeExtraSmall, "../../js/emoji/")
|
||||
linkColor: Theme.primaryColor
|
||||
visible: text !== ""
|
||||
onLinkActivated: {
|
||||
|
|
|
@ -568,8 +568,8 @@ var twemoji = (function (
|
|||
}());
|
||||
|
||||
|
||||
function emojify(rawText, emojiSize) {
|
||||
var curatedText = twemoji.parse(rawText, { callback: function(icon, options, variant) { return '../js/emoji/' + icon + '.svg'; }, size: emojiSize });
|
||||
function emojify(rawText, emojiSize, basePath) {
|
||||
var curatedText = twemoji.parse(rawText, { callback: function(icon, options, variant) { return (basePath || '../js/emoji/') + icon + '.svg'; }, size: emojiSize });
|
||||
// QML has a weird bug. If an ampersand is followed by an HTML tag or a character, the tag is ignored and returned as string or the following string is omitted
|
||||
// Therefore replacing the ampersand with & in these cases...
|
||||
return curatedText.replace(/((\&[\w\d]+\;)|((\&)(\<|\w+)))/g, function(match, p1, p2, p3, p4, p5, offset, string) {
|
||||
|
|
|
@ -265,8 +265,10 @@ Page {
|
|||
: "../components/chatInformationPage/ChatInformationProfilePicture.qml"
|
||||
}
|
||||
}
|
||||
// PageHeader changes the html base path:
|
||||
property url emojiBase: "../js/emoji/"
|
||||
leftMargin: imageContainer.minDimension + Theme.horizontalPageMargin + Theme.paddingMedium
|
||||
title: chatInformation.title !== "" ? Emoji.emojify(chatInformation.title, Theme.fontSizeLarge) : qsTr("Unknown")
|
||||
title: chatInformation.title !== "" ? Emoji.emojify(chatInformation.title, Theme.fontSizeLarge, emojiBase) : qsTr("Unknown")
|
||||
description: chatInformationPage.isPrivateChat ? ("@"+(chatInformationPage.privateChatUserInformation.username || chatInformationPage.chatPartnerGroupId)) : ""
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue