Skip to content
Snippets Groups Projects
Commit c8007db5 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

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
parent 4aef4a69
No related branches found
No related tags found
No related merge requests found
......@@ -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
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)
property int mode_
property string imageId_
visible: false
showPresenceIndicator: false
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment