mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 11:38:57 +00:00
chore(qml): adapt assets to support mediaserver images
This commit is contained in:
parent
216a5511f2
commit
dfbac49302
@ -76,7 +76,7 @@ Item {
|
|||||||
statusChatListItems.itemAtIndex(from).categoryId,
|
statusChatListItems.itemAtIndex(from).categoryId,
|
||||||
statusChatListItems.itemAtIndex(to).categoryPosition
|
statusChatListItems.itemAtIndex(to).categoryPosition
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
root.chatItemReordered(
|
root.chatItemReordered(
|
||||||
statusChatListItems.itemAtIndex(to).categoryId,
|
statusChatListItems.itemAtIndex(to).categoryId,
|
||||||
@ -174,7 +174,6 @@ Item {
|
|||||||
selected: (model.active && root.highlightItem)
|
selected: (model.active && root.highlightItem)
|
||||||
asset.emoji: !!model.emoji ? model.emoji : ""
|
asset.emoji: !!model.emoji ? model.emoji : ""
|
||||||
asset.color: !!model.color ? model.color : Theme.palette.userCustomizationColors[model.colorId]
|
asset.color: !!model.color ? model.color : Theme.palette.userCustomizationColors[model.colorId]
|
||||||
asset.isImage: model.icon.includes("data")
|
|
||||||
asset.name: model.icon
|
asset.name: model.icon
|
||||||
ringSettings.ringSpecModel: type === StatusChatListItem.Type.OneToOneChat && root.isEnsVerified(chatId) ? undefined : model.colorHash
|
ringSettings.ringSpecModel: type === StatusChatListItem.Type.OneToOneChat && root.isEnsVerified(chatId) ? undefined : model.colorHash
|
||||||
onlineStatus: !!model.onlineStatus ? model.onlineStatus : StatusChatListItem.OnlineStatus.Inactive
|
onlineStatus: !!model.onlineStatus ? model.onlineStatus : StatusChatListItem.OnlineStatus.Inactive
|
||||||
|
@ -24,8 +24,12 @@ Loader {
|
|||||||
distinctiveColors: Theme.palette.identiconRingColors
|
distinctiveColors: Theme.palette.identiconRingColors
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceComponent: root.loading ? loadingComp : (root.asset.isLetterIdenticon || root.asset.name === "") ? letterIdenticon :
|
sourceComponent: {
|
||||||
!root.asset.isImage ? roundedIcon : roundedImage
|
if (root.loading) return loadingComp
|
||||||
|
if (root.asset.isLetterIdenticon || root.asset.name === "") return letterIdenticon
|
||||||
|
if (root.asset.isImage) return roundedImage
|
||||||
|
return roundedIcon
|
||||||
|
}
|
||||||
|
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
property bool hoverEnabled: false
|
property bool hoverEnabled: false
|
||||||
|
@ -33,10 +33,16 @@ QtObject {
|
|||||||
property int bgBorderWidth: 0
|
property int bgBorderWidth: 0
|
||||||
|
|
||||||
//image
|
//image
|
||||||
property bool isImage: false
|
property bool isImage: isImgSrc(root.name)
|
||||||
property int imgStatus
|
property int imgStatus
|
||||||
property bool imgIsIdenticon: false
|
property bool imgIsIdenticon: false
|
||||||
|
|
||||||
// ring settings hints
|
// ring settings hints
|
||||||
readonly property real ringPxSize: Math.max(1.5, root.width / 24.0)
|
readonly property real ringPxSize: Math.max(1.5, root.width / 24.0)
|
||||||
|
|
||||||
|
function isImgSrc(name) {
|
||||||
|
return name.toLowerCase().startsWith("data:image") ||
|
||||||
|
name.toLowerCase().startsWith("http://") ||
|
||||||
|
name.toLowerCase().startsWith("https://")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ QtObject {
|
|||||||
width: root.width
|
width: root.width
|
||||||
height: root.height
|
height: root.height
|
||||||
name: root.name
|
name: root.name
|
||||||
isImage: name.startsWith("data")
|
|
||||||
isLetterIdenticon: (name === "")
|
isLetterIdenticon: (name === "")
|
||||||
imgIsIdenticon: root.isIdenticon
|
imgIsIdenticon: root.isIdenticon
|
||||||
color: Theme.palette.userCustomizationColors[root.colorId]
|
color: Theme.palette.userCustomizationColors[root.colorId]
|
||||||
|
@ -20,7 +20,6 @@ StatusListItem {
|
|||||||
|
|
||||||
asset.isLetterIdenticon: true
|
asset.isLetterIdenticon: true
|
||||||
asset.letterSize: 12
|
asset.letterSize: 12
|
||||||
asset.isImage: asset.name.includes("data")
|
|
||||||
asset.width: 32
|
asset.width: 32
|
||||||
asset.height: 32
|
asset.height: 32
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ StatusListView {
|
|||||||
subTitle: model.description
|
subTitle: model.description
|
||||||
tertiaryTitle: qsTr("%n member(s)", "", model.members.count)
|
tertiaryTitle: qsTr("%n member(s)", "", model.members.count)
|
||||||
asset.name: model.image
|
asset.name: model.image
|
||||||
asset.isImage: asset.name.includes("data")
|
|
||||||
asset.isLetterIdenticon: !model.image
|
asset.isLetterIdenticon: !model.image
|
||||||
asset.bgColor: model.color || Theme.palette.primaryColor1
|
asset.bgColor: model.color || Theme.palette.primaryColor1
|
||||||
asset.width: 40
|
asset.width: 40
|
||||||
|
@ -60,7 +60,6 @@ StatusListItem {
|
|||||||
asset.letterSize: asset._twoLettersSize
|
asset.letterSize: asset._twoLettersSize
|
||||||
asset.charactersLen: 2
|
asset.charactersLen: 2
|
||||||
asset.name: root.iconSource
|
asset.name: root.iconSource
|
||||||
asset.isImage: asset.name.includes("data")
|
|
||||||
asset.isLetterIdenticon: root.iconSource.toString() === ""
|
asset.isLetterIdenticon: root.iconSource.toString() === ""
|
||||||
ringSettings {
|
ringSettings {
|
||||||
ringSpecModel: Utils.getColorHashAsJson(root.publicKey, root.ensVerified)
|
ringSpecModel: Utils.getColorHashAsJson(root.publicKey, root.ensVerified)
|
||||||
|
@ -47,7 +47,6 @@ ModalPopup {
|
|||||||
asset.width: 40
|
asset.width: 40
|
||||||
asset.height: 40
|
asset.height: 40
|
||||||
asset.name: model.icon
|
asset.name: model.icon
|
||||||
asset.isImage: asset.name.includes("data")
|
|
||||||
asset.isLetterIdenticon: asset.name === ""
|
asset.isLetterIdenticon: asset.name === ""
|
||||||
asset.letterSize: 15
|
asset.letterSize: 15
|
||||||
asset.color: Theme.palette.miscColor5
|
asset.color: Theme.palette.miscColor5
|
||||||
|
@ -885,7 +885,7 @@ Item {
|
|||||||
value: true
|
value: true
|
||||||
restoreMode: Binding.RestoreNone
|
restoreMode: Binding.RestoreNone
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: loadingStateComponent
|
id: loadingStateComponent
|
||||||
Item {
|
Item {
|
||||||
@ -902,7 +902,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: errorStateComponent
|
id: errorStateComponent
|
||||||
Item {
|
Item {
|
||||||
@ -1274,7 +1274,6 @@ Item {
|
|||||||
asset.height: 30
|
asset.height: 30
|
||||||
asset.color: modelData ? modelData.color : ""
|
asset.color: modelData ? modelData.color : ""
|
||||||
asset.name: modelData ? modelData.icon : ""
|
asset.name: modelData ? modelData.icon : ""
|
||||||
asset.isImage: asset.name.includes("data")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAboutToShow: rootStore.rebuildChatSearchModel()
|
onAboutToShow: rootStore.rebuildChatSearchModel()
|
||||||
|
@ -36,7 +36,6 @@ ActivityNotificationBase {
|
|||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
name: contactDetails ? contactDetails.displayIcon : ""
|
name: contactDetails ? contactDetails.displayIcon : ""
|
||||||
assetSettings.isImage: contactDetails && contactDetails.displayIcon.startsWith("data")
|
|
||||||
pubkey: contactId
|
pubkey: contactId
|
||||||
colorId: Utils.colorIdForPubkey(contactId)
|
colorId: Utils.colorIdForPubkey(contactId)
|
||||||
colorHash: Utils.getColorHashAsJson(contactId, sender.isEnsVerified)
|
colorHash: Utils.getColorHashAsJson(contactId, sender.isEnsVerified)
|
||||||
|
@ -46,6 +46,7 @@ Item {
|
|||||||
Property holds asset settings for contact icon.
|
Property holds asset settings for contact icon.
|
||||||
*/
|
*/
|
||||||
property StatusAssetSettings asset: StatusAssetSettings {
|
property StatusAssetSettings asset: StatusAssetSettings {
|
||||||
|
id: statusAssetSettings
|
||||||
width: 36
|
width: 36
|
||||||
height: 36
|
height: 36
|
||||||
color: d.isContact ? Utils.colorForPubkey(root.contactPubKey) : d.walletAddressColor
|
color: d.isContact ? Utils.colorForPubkey(root.contactPubKey) : d.walletAddressColor
|
||||||
@ -57,7 +58,7 @@ Item {
|
|||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
isImage: d.isContact && d.contactData.displayIcon.includes("data")
|
isImage: d.isContact && statusAssetSettings.isImgSrc(d.contactData.displayIcon)
|
||||||
emoji: d.isWallet && !!d.walletAddressEmoji ? d.walletAddressEmoji : ""
|
emoji: d.isWallet && !!d.walletAddressEmoji ? d.walletAddressEmoji : ""
|
||||||
isLetterIdenticon: d.isContact && !isImage
|
isLetterIdenticon: d.isContact && !isImage
|
||||||
charactersLen: 2
|
charactersLen: 2
|
||||||
|
@ -602,7 +602,6 @@ Loader {
|
|||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
name: root.senderIcon || ""
|
name: root.senderIcon || ""
|
||||||
assetSettings.isImage: root.isDiscordMessage || root.senderIcon.startsWith("data")
|
|
||||||
pubkey: root.senderId
|
pubkey: root.senderId
|
||||||
colorId: Utils.colorIdForPubkey(root.senderId)
|
colorId: Utils.colorIdForPubkey(root.senderId)
|
||||||
colorHash: root.senderColorHash
|
colorHash: root.senderColorHash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user