mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-05 23:35:50 +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)
|
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
|
// the first string is the item uri and the second is a uid
|
||||||
// that is used for trigger a reload of the underlying image
|
// that is used for trigger a reload of the underlying image
|
||||||
// data and can be discarded at this point
|
// data and can be discarded at this point
|
||||||
|
|
|
@ -54,16 +54,11 @@ Item {
|
||||||
|
|
||||||
function setAvatar(show, uri, isLocal) {
|
function setAvatar(show, uri, isLocal) {
|
||||||
if (!show)
|
if (!show)
|
||||||
avatar.visible = false
|
avatar.active = false
|
||||||
else {
|
else {
|
||||||
if (isLocal) {
|
avatar.mode_ = isLocal ? Avatar.Mode.Account : Avatar.Mode.Contact
|
||||||
avatar.mode = Avatar.Mode.Account
|
avatar.imageId_ = isLocal ? LRCInstance.currentAccountId : uri
|
||||||
avatar.imageId = LRCInstance.currentAccountId
|
avatar.active = true
|
||||||
} else {
|
|
||||||
avatar.mode = Avatar.Mode.Contact
|
|
||||||
avatar.imageId = uri
|
|
||||||
}
|
|
||||||
avatar.visible = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,22 +162,31 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Avatar {
|
Loader {
|
||||||
id: avatar
|
id: avatar
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
property real size: Math.min(parent.width / 2, parent.height / 2)
|
active: false
|
||||||
height: size
|
|
||||||
width: size
|
|
||||||
|
|
||||||
// round the avatar source size up to some nearest multiple
|
property real size_: Math.min(parent.width / 2, parent.height / 2)
|
||||||
readonly property real step: 96
|
height: size_
|
||||||
property real imageSize: Math.floor((size + step - 1) / step) * step
|
width: size_
|
||||||
sourceSize: Qt.size(imageSize, imageSize)
|
|
||||||
|
|
||||||
visible: false
|
property int mode_
|
||||||
showPresenceIndicator: false
|
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
|
// Participant background and buttons for moderation
|
||||||
|
|
Loading…
Add table
Reference in a new issue