mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-03 22:35:45 +02:00
conference: show avatar for videoMuted peer
GitLab: #379 Change-Id: I885ad338d7a5c06fca7c765680e644c44f33228d
This commit is contained in:
parent
9e40648b8e
commit
ce88a30712
4 changed files with 62 additions and 54 deletions
|
@ -29,8 +29,8 @@ class AvatarImageProvider : public QuickImageProviderBase
|
|||
public:
|
||||
AvatarImageProvider(LRCInstance* instance = nullptr)
|
||||
: QuickImageProviderBase(QQuickImageProvider::Image,
|
||||
QQmlImageProviderBase::ForceAsynchronousImageLoading,
|
||||
instance)
|
||||
QQmlImageProviderBase::ForceAsynchronousImageLoading,
|
||||
instance)
|
||||
{}
|
||||
|
||||
/*
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
} else if (idType == "contact") {
|
||||
return Utils::contactPhoto(lrcInstance_, idContent, requestedSize);
|
||||
} else if (idType == "fallback") {
|
||||
return Utils::fallbackAvatar(QString(), idContent, requestedSize);
|
||||
return Utils::fallbackAvatar(idContent, QString(), requestedSize);
|
||||
} else if (idType == "default") {
|
||||
return Utils::fallbackAvatar(QString(), QString(), requestedSize);
|
||||
} else if (idType == "base64") {
|
||||
|
|
|
@ -339,6 +339,7 @@ CallAdapter::fillParticipantData(QMap<QString, QString> participant)
|
|||
data["videoMuted"] = participant["videoMuted"] == "true";
|
||||
data["audioLocalMuted"] = participant["audioLocalMuted"] == "true";
|
||||
data["audioModeratorMuted"] = participant["audioModeratorMuted"] == "true";
|
||||
data["isContact"] = false;
|
||||
|
||||
auto bestName = participant["uri"];
|
||||
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId_);
|
||||
|
@ -356,7 +357,7 @@ CallAdapter::fillParticipantData(QMap<QString, QString> participant)
|
|||
participant["uri"]);
|
||||
if (participant["videoMuted"] == "true")
|
||||
data["avatar"] = contact.profileInfo.avatar;
|
||||
|
||||
data["isContact"] = true;
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,9 +130,9 @@ Rectangle {
|
|||
participantOverlays[p].setMenu(participant.uri, participant.bestName,
|
||||
participant.isLocal, participant.active, showMax)
|
||||
if (participant.videoMuted)
|
||||
participantOverlays[p].setAvatar(participant.avatar)
|
||||
participantOverlays[p].setAvatar(true, participant.avatar, participant.uri, participant.isLocal, participant.isContact)
|
||||
else
|
||||
participantOverlays[p].setAvatar("")
|
||||
participantOverlays[p].setAvatar(false)
|
||||
currentUris.push(participantOverlays[p].uri)
|
||||
} else {
|
||||
// Participant is no longer in conference
|
||||
|
@ -173,9 +173,9 @@ Rectangle {
|
|||
hover.setMenu(infos[infoVariant].uri, infos[infoVariant].bestName,
|
||||
infos[infoVariant].isLocal, infos[infoVariant].active, showMax)
|
||||
if (infos[infoVariant].videoMuted)
|
||||
hover.setAvatar(infos[infoVariant].avatar)
|
||||
hover.setAvatar(true, infos[infoVariant].avatar, infos[infoVariant].uri, infos[infoVariant].isLocal, infos[infoVariant].isContact)
|
||||
else
|
||||
hover.setAvatar("")
|
||||
hover.setAvatar(false)
|
||||
participantOverlays.push(hover)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,15 +47,26 @@ Rectangle {
|
|||
property bool participantIsModerator: false
|
||||
property bool participantIsMuted: false
|
||||
property bool participantIsModeratorMuted: false
|
||||
|
||||
property bool participantMenuActive: false
|
||||
|
||||
// TODO: try to use AvatarImage as well
|
||||
function setAvatar(avatar) {
|
||||
if (avatar === "") {
|
||||
contactImage.source = ""
|
||||
} else {
|
||||
contactImage.source = JamiQmlUtils.base64StringTitle + avatar
|
||||
function setAvatar(show, avatar, uri, local, isContact) {
|
||||
if (!show)
|
||||
contactImage.visible = false
|
||||
else {
|
||||
if (avatar) {
|
||||
contactImage.mode = AvatarImage.Mode.FromBase64
|
||||
contactImage.updateImage(avatar)
|
||||
} else if (local) {
|
||||
contactImage.mode = AvatarImage.Mode.FromAccount
|
||||
contactImage.updateImage(AccountAdapter.currentAccountId)
|
||||
} else if (isContact) {
|
||||
contactImage.mode = AvatarImage.Mode.FromContactUri
|
||||
contactImage.updateImage(uri)
|
||||
} else {
|
||||
contactImage.mode = AvatarImage.Mode.FromTemporaryName
|
||||
contactImage.updateImage(uri)
|
||||
}
|
||||
contactImage.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,6 +184,35 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
AvatarImage {
|
||||
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
|
||||
imageId: ""
|
||||
visible: false
|
||||
mode: AvatarImage.Mode.Default
|
||||
showPresenceIndicator: false
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
layer.mipmap: false
|
||||
layer.smooth: true
|
||||
}
|
||||
|
||||
// Participant background, mousearea, hover and buttons for moderation
|
||||
Rectangle {
|
||||
id: participantRect
|
||||
|
@ -190,42 +230,13 @@ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
layer.mipmap: false
|
||||
layer.smooth: true
|
||||
}
|
||||
|
||||
ParticipantOverlayMenu {
|
||||
id: overlayMenu
|
||||
visible: participantRect.opacity !== 0
|
||||
|
||||
onMouseAreaExited: {
|
||||
if (contactImage.status === Image.Null) {
|
||||
root.z = 1
|
||||
participantRect.state = "exited"
|
||||
}
|
||||
root.z = 1
|
||||
participantRect.state = "exited"
|
||||
}
|
||||
onMouseChanged: {
|
||||
participantRect.state = "entered"
|
||||
|
@ -235,17 +246,13 @@ Rectangle {
|
|||
}
|
||||
|
||||
onEntered: {
|
||||
if (contactImage.status === Image.Null) {
|
||||
root.z = 2
|
||||
participantRect.state = "entered"
|
||||
}
|
||||
root.z = 2
|
||||
participantRect.state = "entered"
|
||||
}
|
||||
|
||||
onExited: {
|
||||
if (contactImage.status === Image.Null) {
|
||||
root.z = 1
|
||||
participantRect.state = "exited"
|
||||
}
|
||||
root.z = 1
|
||||
participantRect.state = "exited"
|
||||
}
|
||||
|
||||
onMouseXChanged: {
|
||||
|
|
Loading…
Add table
Reference in a new issue