mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-21 07:05:59 +02:00
conference: host can add or remove moderator for a conference or rendez-vous
Change-Id: I89d3ef02fea54448f3b7bc38da5550cc52d6cbcd
This commit is contained in:
parent
c472fe83ae
commit
0c3b2df65b
4 changed files with 79 additions and 1 deletions
|
@ -264,6 +264,7 @@ CallAdapter::getConferencesInfos()
|
||||||
data["y"] = participant["y"].toInt();
|
data["y"] = participant["y"].toInt();
|
||||||
data["w"] = participant["w"].toInt();
|
data["w"] = participant["w"].toInt();
|
||||||
data["h"] = participant["h"].toInt();
|
data["h"] = participant["h"].toInt();
|
||||||
|
data["uri"] = participant["uri"];
|
||||||
data["active"] = participant["active"] == "true";
|
data["active"] = participant["active"] == "true";
|
||||||
auto bestName = participant["uri"];
|
auto bestName = participant["uri"];
|
||||||
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
|
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
|
||||||
|
@ -622,6 +623,44 @@ CallAdapter::isCurrentHost() const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CallAdapter::participantIsHost(const QString& uri) const
|
||||||
|
{
|
||||||
|
auto* convModel = LRCInstance::getCurrentConversationModel();
|
||||||
|
const auto convInfo = convModel->getConversationForUID(convUid_);
|
||||||
|
if (!convInfo.uid.isEmpty()) {
|
||||||
|
auto& accInfo = LRCInstance::getAccountInfo(accountId_);
|
||||||
|
auto* callModel = accInfo.callModel.get();
|
||||||
|
try {
|
||||||
|
auto call = callModel->getCall(convInfo.callId);
|
||||||
|
if (call.participantsInfos.size() == 0) {
|
||||||
|
return (uri.isEmpty() || uri == accInfo.profileInfo.uri);
|
||||||
|
} else {
|
||||||
|
return !convInfo.confId.isEmpty()
|
||||||
|
&& callModel->hasCall(convInfo.confId)
|
||||||
|
&& (uri.isEmpty() || uri == accInfo.profileInfo.uri);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CallAdapter::isModerator(const QString& uri) const
|
||||||
|
{
|
||||||
|
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 {
|
||||||
|
return callModel->isModerator(confId, uri);
|
||||||
|
} catch (...) {}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CallAdapter::isCurrentModerator() const
|
CallAdapter::isCurrentModerator() const
|
||||||
{
|
{
|
||||||
|
@ -647,6 +686,21 @@ CallAdapter::isCurrentModerator() const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CallAdapter::setModerator(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 {
|
||||||
|
callModel->setModerator(confId, uri, state);
|
||||||
|
} catch (...) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
CallAdapter::getCurrentLayoutType() const
|
CallAdapter::getCurrentLayoutType() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,8 +56,11 @@ public:
|
||||||
Q_INVOKABLE void maximizeParticipant(const QString& uri, bool isActive);
|
Q_INVOKABLE void maximizeParticipant(const QString& uri, bool isActive);
|
||||||
Q_INVOKABLE void minimizeParticipant();
|
Q_INVOKABLE void minimizeParticipant();
|
||||||
Q_INVOKABLE void hangUpThisCall();
|
Q_INVOKABLE void hangUpThisCall();
|
||||||
Q_INVOKABLE bool isCurrentModerator() const;
|
Q_INVOKABLE void setModerator(const QString& uri, const bool state);
|
||||||
Q_INVOKABLE bool isCurrentHost() const;
|
Q_INVOKABLE bool isCurrentHost() const;
|
||||||
|
Q_INVOKABLE bool participantIsHost(const QString& uri = {}) const;
|
||||||
|
Q_INVOKABLE bool isModerator(const QString& uri = {}) const;
|
||||||
|
Q_INVOKABLE bool isCurrentModerator() const;
|
||||||
Q_INVOKABLE int getCurrentLayoutType() const;
|
Q_INVOKABLE int getCurrentLayoutType() const;
|
||||||
Q_INVOKABLE void holdThisCallToggle();
|
Q_INVOKABLE void holdThisCallToggle();
|
||||||
Q_INVOKABLE void muteThisCallToggle();
|
Q_INVOKABLE void muteThisCallToggle();
|
||||||
|
|
|
@ -35,6 +35,8 @@ Item {
|
||||||
property var showHangup: false
|
property var showHangup: false
|
||||||
property var showMaximize: false
|
property var showMaximize: false
|
||||||
property var showMinimize: false
|
property var showMinimize: false
|
||||||
|
property var showSetModerator: false
|
||||||
|
property var showUnsetModerator: false
|
||||||
|
|
||||||
function openMenu(){
|
function openMenu(){
|
||||||
ContextMenuGenerator.initMenu()
|
ContextMenuGenerator.initMenu()
|
||||||
|
@ -58,6 +60,20 @@ Item {
|
||||||
CallAdapter.minimizeParticipant()
|
CallAdapter.minimizeParticipant()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (showSetModerator)
|
||||||
|
ContextMenuGenerator.addMenuItem(qsTr("Set moderator"),
|
||||||
|
"qrc:/images/icons/person_add-24px.svg",
|
||||||
|
function (){
|
||||||
|
CallAdapter.setModerator(uri, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (showUnsetModerator)
|
||||||
|
ContextMenuGenerator.addMenuItem(qsTr("Unset moderator"),
|
||||||
|
"qrc:/images/icons/round-close-24px.svg",
|
||||||
|
function (){
|
||||||
|
CallAdapter.setModerator(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()
|
||||||
|
|
|
@ -155,6 +155,9 @@ Rectangle {
|
||||||
var layout = CallAdapter.getCurrentLayoutType()
|
var layout = CallAdapter.getCurrentLayoutType()
|
||||||
var showMaximized = layout !== 2
|
var showMaximized = layout !== 2
|
||||||
var showMinimized = !(layout === 0 || (layout === 1 && !active))
|
var showMinimized = !(layout === 0 || (layout === 1 && !active))
|
||||||
|
var isModerator = CallAdapter.isModerator(uri)
|
||||||
|
var isHost = CallAdapter.isCurrentHost()
|
||||||
|
var participantIsHost = CallAdapter.participantIsHost(uri)
|
||||||
injectedContextMenu.showHangup = !root.isLocal && showEndCall
|
injectedContextMenu.showHangup = !root.isLocal && showEndCall
|
||||||
injectedContextMenu.showMaximize = showMaximized
|
injectedContextMenu.showMaximize = showMaximized
|
||||||
injectedContextMenu.showMinimize = showMinimized
|
injectedContextMenu.showMinimize = showMinimized
|
||||||
|
@ -162,6 +165,8 @@ Rectangle {
|
||||||
injectedContextMenu.active = active
|
injectedContextMenu.active = active
|
||||||
injectedContextMenu.x = mousePos.x
|
injectedContextMenu.x = mousePos.x
|
||||||
injectedContextMenu.y = mousePos.y - injectedContextMenu.height
|
injectedContextMenu.y = mousePos.y - injectedContextMenu.height
|
||||||
|
injectedContextMenu.showSetModerator = (isHost && !participantIsHost && !isModerator)
|
||||||
|
injectedContextMenu.showUnsetModerator = (isHost && !participantIsHost && isModerator)
|
||||||
injectedContextMenu.openMenu()
|
injectedContextMenu.openMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue