mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-07-23 08:55:26 +02:00
conference: add mute participant for moderator
Change-Id: I9bb1f7476fcbd4d2830ee2b73b6984f607e5395a
This commit is contained in:
parent
0c3b2df65b
commit
18abbce09d
5 changed files with 101 additions and 1 deletions
|
@ -331,6 +331,7 @@ CallAdapter::connectCallModel(const QString& accountId)
|
|||
auto& callModel = accInfo.callModel;
|
||||
auto call = callModel->getCall(confId);
|
||||
const auto convInfo = LRCInstance::getConversationFromCallId(confId);
|
||||
bool currentMuted = false;
|
||||
if (!convInfo.uid.isEmpty()) {
|
||||
// Convert to QML
|
||||
QVariantList map;
|
||||
|
@ -350,6 +351,7 @@ CallAdapter::connectCallModel(const QString& accountId)
|
|||
if (bestName == accInfo.profileInfo.uri) {
|
||||
bestName = tr("me");
|
||||
data["isLocal"] = true;
|
||||
currentMuted = participant["audioMuted"] == "true";
|
||||
if (participant["videoMuted"] == "true")
|
||||
data["avatar"] = accInfo.profileInfo.avatar;
|
||||
} else {
|
||||
|
@ -366,6 +368,19 @@ CallAdapter::connectCallModel(const QString& accountId)
|
|||
data["bestName"] = bestName;
|
||||
map.push_back(QVariant(data));
|
||||
}
|
||||
|
||||
// Link local mute to conference mute
|
||||
auto* convModel = LRCInstance::getCurrentConversationModel();
|
||||
const auto convInfo = convModel->getConversationForUID(convUid_);
|
||||
if (!convInfo.uid.isEmpty()) {
|
||||
auto call = LRCInstance::getCallInfoForConversation(convInfo);
|
||||
if (call) {
|
||||
if (currentMuted != call->audioMuted) {
|
||||
muteThisCallToggle();
|
||||
updateCallOverlay(convInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
emit updateParticipantsInfos(map, accountId, confId);
|
||||
}
|
||||
});
|
||||
|
@ -700,6 +715,68 @@ CallAdapter::setModerator(const QString& uri, const bool state)
|
|||
} catch (...) {}
|
||||
}
|
||||
|
||||
void
|
||||
CallAdapter::muteParticipant(const QString& uri, const bool state) {
|
||||
|
||||
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
|
||||
auto* convModel = LRCInstance::getCurrentConversationModel();
|
||||
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid());
|
||||
auto confId = conversation.confId;
|
||||
if (confId.isEmpty())
|
||||
confId = conversation.callId;
|
||||
try {
|
||||
const auto call = callModel->getCall(confId);
|
||||
callModel->muteParticipant(confId, uri, state);
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
bool
|
||||
CallAdapter::isMuted(const QString& uri) const
|
||||
{
|
||||
auto* convModel = LRCInstance::getCurrentConversationModel();
|
||||
const auto convInfo = convModel->getConversationForUID(convUid_);
|
||||
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
|
||||
auto confId = convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
|
||||
try {
|
||||
auto call = callModel->getCall(confId);
|
||||
if (call.participantsInfos.size() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
for (const auto& participant : call.participantsInfos) {
|
||||
if (participant["uri"] == uri)
|
||||
return participant["audioMuted"] == "true";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (...) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
CallAdapter::isCurrentMuted() const
|
||||
{
|
||||
auto* convModel = LRCInstance::getCurrentConversationModel();
|
||||
const auto convInfo = convModel->getConversationForUID(convUid_);
|
||||
if (!convInfo.uid.isEmpty()) {
|
||||
auto* callModel = LRCInstance::getAccountInfo(accountId_).callModel.get();
|
||||
try {
|
||||
auto call = callModel->getCall(convInfo.callId);
|
||||
if (call.participantsInfos.size() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
|
||||
for (const auto& participant : call.participantsInfos) {
|
||||
if (participant["uri"] == accInfo.profileInfo.uri)
|
||||
return participant["audioMuted"] == "true";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
CallAdapter::getCurrentLayoutType() const
|
||||
|
|
|
@ -68,6 +68,9 @@ public:
|
|||
Q_INVOKABLE void videoPauseThisCallToggle();
|
||||
Q_INVOKABLE bool isRecordingThisCall();
|
||||
Q_INVOKABLE QVariantList getConferencesInfos();
|
||||
Q_INVOKABLE void muteParticipant(const QString& uri, const bool state);
|
||||
Q_INVOKABLE bool isMuted(const QString& uri) const;
|
||||
Q_INVOKABLE bool isCurrentMuted() const;
|
||||
|
||||
signals:
|
||||
void callStatusChanged(int index, const QString& accountId, const QString& convUid);
|
||||
|
|
|
@ -74,7 +74,7 @@ Rectangle {
|
|||
function closePotentialMediaHandlerPicker() {
|
||||
MediaHandlerPickerCreation.closeMediaHandlerPicker()
|
||||
}
|
||||
|
||||
|
||||
function handleParticipantsInfo(infos) {
|
||||
videoCallOverlay.updateMenu()
|
||||
var isModerator = CallAdapter.isCurrentModerator()
|
||||
|
|
|
@ -37,6 +37,8 @@ Item {
|
|||
property var showMinimize: false
|
||||
property var showSetModerator: false
|
||||
property var showUnsetModerator: false
|
||||
property var showMute: false
|
||||
property var showUnmute: false
|
||||
|
||||
function openMenu(){
|
||||
ContextMenuGenerator.initMenu()
|
||||
|
@ -74,6 +76,21 @@ Item {
|
|||
CallAdapter.setModerator(uri, false)
|
||||
})
|
||||
|
||||
if (showMute)
|
||||
ContextMenuGenerator.addMenuItem(qsTr("Mute participant"),
|
||||
"qrc:/images/icons/mic_off-24px.svg",
|
||||
function (){
|
||||
CallAdapter.muteParticipant(uri, true)
|
||||
})
|
||||
|
||||
if (showUnmute)
|
||||
ContextMenuGenerator.addMenuItem(qsTr("Unmute participant"),
|
||||
"qrc:/images/icons/mic-24px.svg",
|
||||
function (){
|
||||
CallAdapter.muteParticipant(uri, false)
|
||||
})
|
||||
|
||||
|
||||
root.height = ContextMenuGenerator.getMenu().height
|
||||
root.width = ContextMenuGenerator.getMenu().width
|
||||
ContextMenuGenerator.getMenu().open()
|
||||
|
|
|
@ -158,6 +158,7 @@ Rectangle {
|
|||
var isModerator = CallAdapter.isModerator(uri)
|
||||
var isHost = CallAdapter.isCurrentHost()
|
||||
var participantIsHost = CallAdapter.participantIsHost(uri)
|
||||
var isMuted = CallAdapter.isMuted(uri)
|
||||
injectedContextMenu.showHangup = !root.isLocal && showEndCall
|
||||
injectedContextMenu.showMaximize = showMaximized
|
||||
injectedContextMenu.showMinimize = showMinimized
|
||||
|
@ -167,6 +168,8 @@ Rectangle {
|
|||
injectedContextMenu.y = mousePos.y - injectedContextMenu.height
|
||||
injectedContextMenu.showSetModerator = (isHost && !participantIsHost && !isModerator)
|
||||
injectedContextMenu.showUnsetModerator = (isHost && !participantIsHost && isModerator)
|
||||
injectedContextMenu.showMute = !isMuted
|
||||
injectedContextMenu.showUnmute = isMuted && root.isLocal
|
||||
injectedContextMenu.openMenu()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue