mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-23 00:03:55 +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& callModel = accInfo.callModel;
|
||||||
auto call = callModel->getCall(confId);
|
auto call = callModel->getCall(confId);
|
||||||
const auto convInfo = LRCInstance::getConversationFromCallId(confId);
|
const auto convInfo = LRCInstance::getConversationFromCallId(confId);
|
||||||
|
bool currentMuted = false;
|
||||||
if (!convInfo.uid.isEmpty()) {
|
if (!convInfo.uid.isEmpty()) {
|
||||||
// Convert to QML
|
// Convert to QML
|
||||||
QVariantList map;
|
QVariantList map;
|
||||||
|
@ -350,6 +351,7 @@ CallAdapter::connectCallModel(const QString& accountId)
|
||||||
if (bestName == accInfo.profileInfo.uri) {
|
if (bestName == accInfo.profileInfo.uri) {
|
||||||
bestName = tr("me");
|
bestName = tr("me");
|
||||||
data["isLocal"] = true;
|
data["isLocal"] = true;
|
||||||
|
currentMuted = participant["audioMuted"] == "true";
|
||||||
if (participant["videoMuted"] == "true")
|
if (participant["videoMuted"] == "true")
|
||||||
data["avatar"] = accInfo.profileInfo.avatar;
|
data["avatar"] = accInfo.profileInfo.avatar;
|
||||||
} else {
|
} else {
|
||||||
|
@ -366,6 +368,19 @@ CallAdapter::connectCallModel(const QString& accountId)
|
||||||
data["bestName"] = bestName;
|
data["bestName"] = bestName;
|
||||||
map.push_back(QVariant(data));
|
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);
|
emit updateParticipantsInfos(map, accountId, confId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -700,6 +715,68 @@ CallAdapter::setModerator(const QString& uri, const bool state)
|
||||||
} catch (...) {}
|
} 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
|
int
|
||||||
CallAdapter::getCurrentLayoutType() const
|
CallAdapter::getCurrentLayoutType() const
|
||||||
|
|
|
@ -68,6 +68,9 @@ public:
|
||||||
Q_INVOKABLE void videoPauseThisCallToggle();
|
Q_INVOKABLE void videoPauseThisCallToggle();
|
||||||
Q_INVOKABLE bool isRecordingThisCall();
|
Q_INVOKABLE bool isRecordingThisCall();
|
||||||
Q_INVOKABLE QVariantList getConferencesInfos();
|
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:
|
signals:
|
||||||
void callStatusChanged(int index, const QString& accountId, const QString& convUid);
|
void callStatusChanged(int index, const QString& accountId, const QString& convUid);
|
||||||
|
|
|
@ -37,6 +37,8 @@ Item {
|
||||||
property var showMinimize: false
|
property var showMinimize: false
|
||||||
property var showSetModerator: false
|
property var showSetModerator: false
|
||||||
property var showUnsetModerator: false
|
property var showUnsetModerator: false
|
||||||
|
property var showMute: false
|
||||||
|
property var showUnmute: false
|
||||||
|
|
||||||
function openMenu(){
|
function openMenu(){
|
||||||
ContextMenuGenerator.initMenu()
|
ContextMenuGenerator.initMenu()
|
||||||
|
@ -74,6 +76,21 @@ Item {
|
||||||
CallAdapter.setModerator(uri, false)
|
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.height = ContextMenuGenerator.getMenu().height
|
||||||
root.width = ContextMenuGenerator.getMenu().width
|
root.width = ContextMenuGenerator.getMenu().width
|
||||||
ContextMenuGenerator.getMenu().open()
|
ContextMenuGenerator.getMenu().open()
|
||||||
|
|
|
@ -158,6 +158,7 @@ Rectangle {
|
||||||
var isModerator = CallAdapter.isModerator(uri)
|
var isModerator = CallAdapter.isModerator(uri)
|
||||||
var isHost = CallAdapter.isCurrentHost()
|
var isHost = CallAdapter.isCurrentHost()
|
||||||
var participantIsHost = CallAdapter.participantIsHost(uri)
|
var participantIsHost = CallAdapter.participantIsHost(uri)
|
||||||
|
var isMuted = CallAdapter.isMuted(uri)
|
||||||
injectedContextMenu.showHangup = !root.isLocal && showEndCall
|
injectedContextMenu.showHangup = !root.isLocal && showEndCall
|
||||||
injectedContextMenu.showMaximize = showMaximized
|
injectedContextMenu.showMaximize = showMaximized
|
||||||
injectedContextMenu.showMinimize = showMinimized
|
injectedContextMenu.showMinimize = showMinimized
|
||||||
|
@ -167,6 +168,8 @@ Rectangle {
|
||||||
injectedContextMenu.y = mousePos.y - injectedContextMenu.height
|
injectedContextMenu.y = mousePos.y - injectedContextMenu.height
|
||||||
injectedContextMenu.showSetModerator = (isHost && !participantIsHost && !isModerator)
|
injectedContextMenu.showSetModerator = (isHost && !participantIsHost && !isModerator)
|
||||||
injectedContextMenu.showUnsetModerator = (isHost && !participantIsHost && isModerator)
|
injectedContextMenu.showUnsetModerator = (isHost && !participantIsHost && isModerator)
|
||||||
|
injectedContextMenu.showMute = !isMuted
|
||||||
|
injectedContextMenu.showUnmute = isMuted && root.isLocal
|
||||||
injectedContextMenu.openMenu()
|
injectedContextMenu.openMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue