fix(StatusSearchPopup): add color hash to chat icons

This commit is contained in:
Patryk Osmaczko 2022-05-31 10:36:42 +02:00 committed by Michał Cieślak
parent 2bce533f46
commit bb3325ee6d
3 changed files with 25 additions and 7 deletions

View File

@ -103,7 +103,9 @@ StatusPopupMenu {
text: model.text
image.source: model.imageSource
iconSettings.name: model.iconName
iconSettings.color: model.iconColor
iconSettings.color: model.isUserIcon ? Theme.palette.userCustomizationColors[model.colorId] : model.iconColor
iconSettings.charactersLen: model.isUserIcon ? 2 : 1
ringSettings.ringSpecModel: model.colorHash
onTriggered: {
searchPopup.resetSearchSelection()
if (menuLoader.parentTitleText === "Chat") {
@ -112,7 +114,10 @@ StatusPopupMenu {
model.imageSource,
model.isIdenticon,
model.iconName,
model.iconColor)
model.iconColor,
model.isUserIcon,
model.colorId,
model.colorHash.toJson())
} else {
searchPopup.setSearchSelection(menuLoader.parentTitleText,
model.text,

View File

@ -40,14 +40,19 @@ StatusModal {
imageSource = "",
isIdenticon = "",
iconName = "",
iconColor = "") {
iconColor = "",
isUserIcon = false,
colorId = 0,
colorHash = "") {
searchSelectionButton.primaryText = text
searchSelectionButton.secondaryText = secondaryText
searchSelectionButton.image.source = imageSource
searchSelectionButton.image.isIdenticon = isIdenticon
searchSelectionButton.iconSettings.name = iconName
searchSelectionButton.iconSettings.color = iconColor !== ""? iconColor : Theme.palette.primaryColor1
searchSelectionButton.iconSettings.color = isUserIcon ? Theme.palette.userCustomizationColors[colorId] : iconColor
searchSelectionButton.iconSettings.isLetterIdenticon = !iconName && !imageSource
searchSelectionButton.iconSettings.charactersLen = isUserIcon ? 2 : 1
searchSelectionButton.ringSettings.ringSpecModel = !!colorHash ? JSON.parse(colorHash) : {}
}
function resetSearchSelection() {
@ -129,7 +134,7 @@ StatusModal {
height: 16
name: ""
isLetterIdenticon: false
letterSize: 11
letterSize: charactersLen > 1 ? 8 : 11
}
property StatusImageSettings image: StatusImageSettings {
@ -139,6 +144,8 @@ StatusModal {
isIdenticon: false
}
property alias ringSettings: identicon.ringSettings
anchors.left: parent.left
anchors.leftMargin: 16
anchors.verticalCenter: parent.verticalCenter
@ -270,7 +277,8 @@ StatusModal {
statusListItemSubTitle.elide: Text.ElideRight
statusListItemSubTitle.color: Theme.palette.directColor1
icon.isLetterIdenticon: (model.image === "")
icon.background.color: model.color
icon.color: model.isUserIcon ? Theme.palette.userCustomizationColors[model.colorId] : model.color
icon.charactersLen: model.isUserIcon ? 2 : 1
titleAsideText: root.formatTimestampFn(model.time)
image.source: model.image
badge.primaryText: model.badgePrimaryText
@ -278,6 +286,7 @@ StatusModal {
badge.image.source: model.badgeImage
badge.icon.isLetterIdenticon: model.badgeIsLetterIdenticon
badge.icon.color: model.badgeIconColor
ringSettings.ringSpecModel: model.colorHash
onClicked: {
root.resultItemClicked(itemId)

View File

@ -16,6 +16,7 @@ MenuItem {
width: 16
isIdenticon: false
}
property StatusIconSettings iconSettings: StatusIconSettings {
height: 16
width: 16
@ -23,9 +24,11 @@ MenuItem {
&& root.iconSettings.name.toString() === "")
background: StatusIconBackgroundSettings {}
color: (name === "channel") ? Theme.palette.directColor1 : "transparent"
letterSize: 11
letterSize: charactersLen > 1 ? 8 : 11
}
property alias ringSettings: identicon.ringSettings
background: Rectangle {
color: root.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor : "transparent"
}
@ -43,6 +46,7 @@ MenuItem {
image: root.image
icon: root.iconSettings
name: root.text
ringSettings: root.ringSettings
}
}
StatusBaseText {