Skip to content
Snippets Groups Projects
Commit c02e33c2 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conference: handle participants without video

Change-Id: I266ab31e31d85b6cd94356b63368540c02e16c6f
parent 74bbebab
No related branches found
No related tags found
No related merge requests found
......@@ -308,19 +308,24 @@ CallAdapter::connectCallModel(const QString& accountId)
data["h"] = participant["h"].toInt();
data["uri"] = participant["uri"];
data["active"] = participant["active"] == "true";
data["videoMuted"] = participant["videoMuted"] == "true";
data["audioMuted"] = participant["audioMuted"] == "true";
auto bestName = participant["uri"];
data["isLocal"] = false;
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
if (bestName == accInfo.profileInfo.uri) {
bestName = tr("me");
data["isLocal"] = true;
if (participant["videoMuted"] == "true")
data["avatar"] = accInfo.profileInfo.avatar;
} else {
try {
auto& contact = LRCInstance::getCurrentAccountInfo()
.contactModel->getContact(participant["uri"]);
bestName = Utils::bestNameForContact(contact);
} catch (...) {
}
if (participant["videoMuted"] == "true")
data["avatar"] = contact.profileInfo.avatar;
} catch (...) {}
}
data["bestName"] = bestName;
map.push_back(QVariant(data));
......
......@@ -97,11 +97,16 @@ Rectangle {
console.log("Error when creating the hover")
return
}
hover.setParticipantName(infos[infoVariant].bestName)
hover.active = infos[infoVariant].active;
hover.isLocal = infos[infoVariant].isLocal;
hover.setMenuVisible(isMaster)
hover.uri = infos[infoVariant].uri
if (infos[infoVariant].videoMuted)
hover.setAvatar(infos[infoVariant].avatar)
else
hover.setAvatar("")
hover.injectedContextMenu = participantContextMenu
participantOverlays.push(hover)
}
......
......@@ -37,6 +37,16 @@ Rectangle {
participantName.text = name
}
function setAvatar(avatar) {
if (avatar === "") {
opacity = 0
contactImage.source = ""
} else {
opacity = 1
contactImage.source = "data:image/png;base64," + avatar
}
}
function setMenuVisible(isVisible) {
optionsButton.visible = isVisible
}
......@@ -53,6 +63,31 @@ Rectangle {
propagateComposedEvents: true
acceptedButtons: Qt.LeftButton
Image {
id: contactImage
anchors.centerIn: parent
height: Math.min(parent.width / 2, parent.height / 2)
width: Math.min(parent.width / 2, parent.height / 2)
fillMode: Image.PreserveAspectFit
source: ""
asynchronous: true
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Rectangle{
width: contactImage.width
height: contactImage.height
radius: {
var size = ((contactImage.width <= contactImage.height)? contactImage.width:contactImage.height)
return size /2
}
}
}
}
RowLayout {
id: bottomLabel
......@@ -130,11 +165,13 @@ Rectangle {
}
onEntered: {
root.state = "entered"
if (contactImage.status === Image.Null)
root.state = "entered"
}
onExited: {
root.state = "exited"
if (contactImage.status === Image.Null)
root.state = "exited"
}
}
......
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