1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-03 14:25:38 +02:00

conference: avoid excessive image caching during resize events

Throttle avatar image queries to the image provider when the
component size changes.

Gitlab: #466
Change-Id: Ie619671a593bcca75899f3d97c2af2071c427ab4
This commit is contained in:
Andreas Traczyk 2021-07-13 21:28:03 -04:00
parent 92a3d03206
commit 4aef4a690d
2 changed files with 10 additions and 2 deletions

View file

@ -29,6 +29,7 @@ Item {
enum Mode { Account, Contact, Conversation }
property int mode: Avatar.Mode.Account
property alias sourceSize: image.sourceSize
property string imageId

View file

@ -171,8 +171,15 @@ Item {
id: avatar
anchors.centerIn: parent
height: Math.min(parent.width / 2, parent.height / 2)
width: Math.min(parent.width / 2, parent.height / 2)
property real size: Math.min(parent.width / 2, parent.height / 2)
height: size
width: size
// round the avatar source size up to some nearest multiple
readonly property real step: 96
property real imageSize: Math.floor((size + step - 1) / step) * step
sourceSize: Qt.size(imageSize, imageSize)
visible: false
showPresenceIndicator: false