mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-03 14:25:38 +02:00
conference: only load avatars if visible
Wrap avatars in a Loader to avoid constantly querying the image provider for remote video participants. Change-Id: Ieca2457416dfd4c33fc3a960a1e36643ea1f11ef
This commit is contained in:
parent
4aef4a690d
commit
c8007db590
2 changed files with 28 additions and 19 deletions
|
@ -38,6 +38,11 @@ public:
|
|||
{
|
||||
Q_UNUSED(size)
|
||||
|
||||
if (requestedSize == QSize(0, 0)) {
|
||||
qWarning() << Q_FUNC_INFO << "Image request has no dimensions";
|
||||
return {};
|
||||
}
|
||||
|
||||
// the first string is the item uri and the second is a uid
|
||||
// that is used for trigger a reload of the underlying image
|
||||
// data and can be discarded at this point
|
||||
|
|
|
@ -54,16 +54,11 @@ Item {
|
|||
|
||||
function setAvatar(show, uri, isLocal) {
|
||||
if (!show)
|
||||
avatar.visible = false
|
||||
avatar.active = false
|
||||
else {
|
||||
if (isLocal) {
|
||||
avatar.mode = Avatar.Mode.Account
|
||||
avatar.imageId = LRCInstance.currentAccountId
|
||||
} else {
|
||||
avatar.mode = Avatar.Mode.Contact
|
||||
avatar.imageId = uri
|
||||
}
|
||||
avatar.visible = true
|
||||
avatar.mode_ = isLocal ? Avatar.Mode.Account : Avatar.Mode.Contact
|
||||
avatar.imageId_ = isLocal ? LRCInstance.currentAccountId : uri
|
||||
avatar.active = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,22 +162,31 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Avatar {
|
||||
Loader {
|
||||
id: avatar
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
property real size: Math.min(parent.width / 2, parent.height / 2)
|
||||
height: size
|
||||
width: size
|
||||
active: false
|
||||
|
||||
// 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)
|
||||
property real size_: Math.min(parent.width / 2, parent.height / 2)
|
||||
height: size_
|
||||
width: size_
|
||||
|
||||
visible: false
|
||||
showPresenceIndicator: false
|
||||
property int mode_
|
||||
property string imageId_
|
||||
|
||||
sourceComponent: Component {
|
||||
Avatar {
|
||||
// round the avatar source size up to some nearest multiple
|
||||
readonly property real step: 96
|
||||
property real size: Math.floor((size_ + step - 1) / step) * step
|
||||
sourceSize: Qt.size(size, size)
|
||||
mode: mode_
|
||||
imageId: size_ ? imageId_ : ""
|
||||
showPresenceIndicator: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Participant background and buttons for moderation
|
||||
|
|
Loading…
Add table
Reference in a new issue