feat(StatusIconSetting): add emojiSize setting for icons (#579)

This commit is contained in:
Jonathan Rainville 2022-03-17 14:14:39 -04:00 committed by Michał Cieślak
parent dfad051880
commit 66b5b9d34b
6 changed files with 11 additions and 3 deletions

View File

@ -28,8 +28,9 @@ Rectangle {
width: 24 width: 24
height: 24 height: 24
color: Theme.palette.miscColor5 color: Theme.palette.miscColor5
letterSize: emoji ? 14 : 15 letterSize: emoji ? 10 : 15
emoji: "" emoji: ""
emojiSize: Emoji.size.verySmall
charactersLen: 1 charactersLen: 1
} }
property int type: StatusChatListItem.Type.PublicChat property int type: StatusChatListItem.Type.PublicChat

View File

@ -9,6 +9,7 @@ Rectangle {
property alias identiconText: identiconText property alias identiconText: identiconText
property string name property string name
property string emoji property string emoji
property string emojiSize
property int letterSize: 21 property int letterSize: 21
property int charactersLen: 1 property int charactersLen: 1
@ -35,7 +36,7 @@ Rectangle {
if(Utils.isHtml(emoji)) if(Utils.isHtml(emoji))
return emoji return emoji
else else
return Emoji.parse(emoji) return Emoji.parse(emoji, emojiSize || undefined)
} }
const shift = (root.name.charAt(0) === "#") || const shift = (root.name.charAt(0) === "#") ||

View File

@ -57,6 +57,8 @@ Control {
visible: root.icon.isLetterIdenticon visible: root.icon.isLetterIdenticon
color: root.icon.color color: root.icon.color
name: root.primaryText name: root.primaryText
emoji: root.icon.emoji
emojiSize: root.icon.emojiSize
} }
StatusBaseText { StatusBaseText {
font.weight: Font.Medium font.weight: Font.Medium

View File

@ -85,6 +85,7 @@ Loader {
color: statusSmartIdenticon.icon.color color: statusSmartIdenticon.icon.color
name: statusSmartIdenticon.name name: statusSmartIdenticon.name
emoji: statusSmartIdenticon.icon.emoji emoji: statusSmartIdenticon.icon.emoji
emojiSize: statusSmartIdenticon.icon.emojiSize
letterSize: statusSmartIdenticon.icon.letterSize letterSize: statusSmartIdenticon.icon.letterSize
identiconText.color: statusSmartIdenticon.icon.textColor identiconText.color: statusSmartIdenticon.icon.textColor
charactersLen: statusSmartIdenticon.icon.charactersLen charactersLen: statusSmartIdenticon.icon.charactersLen

View File

@ -16,5 +16,6 @@ QtObject {
property int letterSize property int letterSize
property int charactersLen property int charactersLen
property string emoji property string emoji
property string emojiSize
property StatusIconBackgroundSettings background: StatusIconBackgroundSettings {} property StatusIconBackgroundSettings background: StatusIconBackgroundSettings {}
} }

View File

@ -8,9 +8,11 @@ import "./emojiList.js" as EmojiJSON
QtObject { QtObject {
readonly property var size: { readonly property var size: {
"veryBig": "86x86",
"big": "72x72", "big": "72x72",
"middle": "32x32", "middle": "32x32",
"small": "18x18" "small": "18x18",
"verySmall": "16x16"
} }
property string base: Qt.resolvedUrl("../../../assets/twemoji/") property string base: Qt.resolvedUrl("../../../assets/twemoji/")
function parse(text, renderSize = size.small) { function parse(text, renderSize = size.small) {