From 993499567bc648f7f1383165228999c80081c007 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Fri, 13 May 2022 18:55:42 +0300 Subject: [PATCH] fix(@chat): Fixed blurry emojis --- ui/StatusQ | 2 +- ui/imports/shared/controls/EmojiHash.qml | 3 +-- ui/imports/shared/status/StatusEmojiPopup.qml | 4 ++-- ui/imports/shared/status/StatusEmojiSection.qml | 3 +-- ui/imports/shared/views/chat/ChatTextView.qml | 17 ++++++++--------- ui/imports/utils/Style.qml | 2 +- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/ui/StatusQ b/ui/StatusQ index eb96e5e08d..99a3aa522f 160000 --- a/ui/StatusQ +++ b/ui/StatusQ @@ -1 +1 @@ -Subproject commit eb96e5e08d2efe75b80da733b729f6e4ffce6451 +Subproject commit 99a3aa522fb17958f82f6ecef5d7067109731f67 diff --git a/ui/imports/shared/controls/EmojiHash.qml b/ui/imports/shared/controls/EmojiHash.qml index 481e035b0b..98ff5d79ef 100644 --- a/ui/imports/shared/controls/EmojiHash.qml +++ b/ui/imports/shared/controls/EmojiHash.qml @@ -28,8 +28,7 @@ Item { SVGImage { width: root.size height: root.size - - source: StatusQUtils.Emoji.parse(modelData).match('src="(.*\\.svg)')[1] + source: Style.emoji(StatusQUtils.Emoji.iconId(modelData)) } } } diff --git a/ui/imports/shared/status/StatusEmojiPopup.qml b/ui/imports/shared/status/StatusEmojiPopup.qml index ed7502ba2a..15d6da0f78 100644 --- a/ui/imports/shared/status/StatusEmojiPopup.qml +++ b/ui/imports/shared/status/StatusEmojiPopup.qml @@ -247,7 +247,7 @@ Popup { delegate: SVGImage { width: 22 height: 22 - source: Style.emoji("72x72/" + modelData) + source: Style.emoji(modelData) MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent @@ -268,7 +268,7 @@ Popup { anchors.right: parent.right anchors.rightMargin: emojiHeader.headerMargin visible: !skinToneEmoji.expandSkinColorOptions - source: Style.emoji("72x72/1f590" + ((localAccountSensitiveSettings.skinColor !== "" && visible) ? ("-" + localAccountSensitiveSettings.skinColor) : "")) + source: Style.emoji("1f590" + ((localAccountSensitiveSettings.skinColor !== "" && visible) ? ("-" + localAccountSensitiveSettings.skinColor) : "")) MouseArea { cursorShape: Qt.PointingHandCursor anchors.fill: parent diff --git a/ui/imports/shared/status/StatusEmojiSection.qml b/ui/imports/shared/status/StatusEmojiSection.qml index 43adf6bab2..8634aa8441 100644 --- a/ui/imports/shared/status/StatusEmojiSection.qml +++ b/ui/imports/shared/status/StatusEmojiSection.qml @@ -92,8 +92,7 @@ Item { SVGImage { width: emojiSection.imageWidth height: emojiSection.imageWidth - //TODO EMOJI SVG? - source: "qrc:/StatusQ/src/assets/twemoji/svg/" + modelData.filename + "?22x22" + source: Style.emoji(modelData.filename) MouseArea { cursorShape: Qt.PointingHandCursor diff --git a/ui/imports/shared/views/chat/ChatTextView.qml b/ui/imports/shared/views/chat/ChatTextView.qml index 7b47188eb4..531eae6375 100644 --- a/ui/imports/shared/views/chat/ChatTextView.qml +++ b/ui/imports/shared/views/chat/ChatTextView.qml @@ -112,17 +112,16 @@ Item { } text: { - if(contentType === Constants.messageContentType.stickerType) return ""; + if (contentType === Constants.messageContentType.stickerType) return ""; let msg = Utils.linkifyAndXSS(message); - if(isEmoji) { - return StatusQUtils.Emoji.parse(msg, StatusQUtils.Emoji.size.middle); - } else { - if(isEdited){ - let index = msg.endsWith("code>") ? msg.length : msg.length - 4 - return Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg.slice(0, index) + Constants.editLabel + msg.slice(index)), isCurrentUser, hoveredLink) - } - return Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg), isCurrentUser, hoveredLink) + if (isEmoji) + return StatusQUtils.Emoji.parse(msg, StatusQUtils.Emoji.size.middle, StatusQUtils.Emoji.format.png); + if (isEdited) { + let index = msg.endsWith("code>") ? msg.length : msg.length - 4 + return Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg.slice(0, index) + Constants.editLabel + msg.slice(index)), isCurrentUser, hoveredLink) } + return Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg), isCurrentUser, hoveredLink) + } } diff --git a/ui/imports/utils/Style.qml b/ui/imports/utils/Style.qml index c32b92bb8a..32e0770417 100644 --- a/ui/imports/utils/Style.qml +++ b/ui/imports/utils/Style.qml @@ -47,7 +47,7 @@ QtObject { return assetPath + "icons/" + name + ".svg"; } function emoji(name) { - return "qrc:/StatusQ/src/assets/twemoji/" + name + ".png"; + return "qrc:/StatusQ/src/assets/twemoji/svg/" + name + ".svg"; } function lottie(name) { return assetPath + "lottie/" + name + ".json";