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 osmaczko
parent bf3578cf7c
commit 10cd9b23c1
3 changed files with 25 additions and 7 deletions

View File

@ -103,7 +103,9 @@ StatusPopupMenu {
text: model.text text: model.text
image.source: model.imageSource image.source: model.imageSource
iconSettings.name: model.iconName 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: { onTriggered: {
searchPopup.resetSearchSelection() searchPopup.resetSearchSelection()
if (menuLoader.parentTitleText === "Chat") { if (menuLoader.parentTitleText === "Chat") {
@ -112,7 +114,10 @@ StatusPopupMenu {
model.imageSource, model.imageSource,
model.isIdenticon, model.isIdenticon,
model.iconName, model.iconName,
model.iconColor) model.iconColor,
model.isUserIcon,
model.colorId,
model.colorHash.toJson())
} else { } else {
searchPopup.setSearchSelection(menuLoader.parentTitleText, searchPopup.setSearchSelection(menuLoader.parentTitleText,
model.text, model.text,

View File

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

View File

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