merge calls

This commit is contained in:
Gaelle Braud 2024-05-29 14:33:40 +02:00
parent 305c969bbb
commit 9e8b1d5dd9
7 changed files with 84 additions and 4 deletions

View file

@ -78,6 +78,49 @@ void CallList::setSelf(QSharedPointer<CallList> me) {
});
});
});
mModelConnection->makeConnectToCore(&CallList::lMergeAll, [this]() {
mModelConnection->invokeToModel([this]() {
auto core = CoreModel::getInstance()->getCore();
auto currentCalls = CoreModel::getInstance()->getCore()->getCalls();
std::shared_ptr<linphone::Conference> conference = nullptr;
// Search a managable conference from calls
for (auto call : currentCalls) {
auto dbConference = call->getConference();
if (dbConference && dbConference->getMe()->isAdmin()) {
conference = dbConference;
break;
}
}
auto currentCall = CoreModel::getInstance()->getCore()->getCurrentCall();
bool enablingVideo = false;
if (currentCall) enablingVideo = currentCall->getCurrentParams()->videoEnabled();
if (!conference) {
auto parameters = core->createConferenceParams(conference);
parameters->enableVideo(enablingVideo);
parameters->setSubject("Meeting");
conference = core->createConferenceWithParams(parameters);
}
std::list<std::shared_ptr<linphone::Address>> allLinphoneAddresses;
std::list<std::shared_ptr<linphone::Address>> newCalls;
std::list<std::shared_ptr<linphone::Call>> runningCallsToAdd;
for (auto call : currentCalls) {
if (!call->getConference()) {
runningCallsToAdd.push_back(call);
}
}
// 1) Add running calls
if (runningCallsToAdd.size() > 0) {
conference->addParticipants(runningCallsToAdd);
}
// emit lUpdate();
});
});
mModelConnection->makeConnectToModel(&CoreModel::firstCallStarted,
[this]() { mModelConnection->invokeToCore([this]() { setHaveCall(true); }); });

View file

@ -56,6 +56,7 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
signals:
void lUpdate();
void lMergeAll();
void haveCallChanged();
void currentCallChanged();

View file

@ -28,6 +28,7 @@ CallProxy::CallProxy(QObject *parent) : SortFilterProxy(parent) {
mList = CallList::create();
connect(mList.get(), &CallList::currentCallChanged, this, &CallProxy::resetCurrentCall);
connect(mList.get(), &CallList::haveCallChanged, this, &CallProxy::haveCallChanged);
connect(this, &CallProxy::lMergeAll, mList.get(), &CallList::lMergeAll);
setSourceModel(mList.get());
sort(0);
}

View file

@ -51,6 +51,7 @@ public:
bool getHaveCall() const;
signals:
void lMergeAll();
void filterTextChanged();
void currentCallChanged();
void haveCallChanged();

View file

@ -556,8 +556,38 @@ AppWindow {
Component {
id: callsListPanel
ColumnLayout {
Control.StackView.onActivated: rightPanel.headerTitleText = qsTr("Liste d'appel")
Control.StackView.onActivated: {
rightPanel.headerTitleText = qsTr("Liste d'appel")
rightPanel.customHeaderButtons = mergeCallPopupButton.createObject(rightPanel)
}
spacing: 0
Component {
id: mergeCallPopupButton
PopupButton {
visible: callsModel.count >= 2
id: popupbutton
popup.contentItem: Button {
background: Item{}
contentItem: RowLayout {
spacing: 5 * DefaultStyle.dp
EffectImage {
colorizationColor: DefaultStyle.main2_600
imageSource: AppIcons.arrowsMerge
Layout.preferredWidth: 32 * DefaultStyle.dp
Layout.preferredHeight: 32 * DefaultStyle.dp
}
Text {
text: qsTr("Merger tous les appels")
font.pixelSize: 14 * DefaultStyle.dp
}
}
onClicked: {
callsModel.lMergeAll()
popupbutton.close()
}
}
}
}
RoundedBackgroundControl {
Layout.fillWidth: true
Layout.maximumHeight: rightPanel.height
@ -598,7 +628,9 @@ AppWindow {
Text {
id: delegateName
property var remoteAddress: UtilsCpp.getDisplayName(modelData.core.peerAddress)
text: remoteAddress ? remoteAddress.value : ""
text: modelData.core.isConference
? modelData.core.conference.core.subject
: remoteAddress ? remoteAddress.value : ""
Layout.leftMargin: 8 * DefaultStyle.dp
Connections {
target: modelData.core
@ -758,10 +790,11 @@ AppWindow {
}
Control.StackView.onActivated: {
rightPanel.customHeaderButtons = headerbutton.createObject(rightPanel)
rightPanel.headerTitleText = qsTr("Participants (%1)").arg(count)
}
call: mainWindow.call
onAddParticipantRequested: participantsStack.push(addParticipantComp)
onCountChanged: if (participantsStack.Control.StackView.status === Control.StackView.Active && participantsStack.currentItem == participantListComp) {
onCountChanged: {
rightPanel.headerTitleText = qsTr("Participants (%1)").arg(count)
}
Connections {

View file

@ -488,7 +488,7 @@ AbstractMainPage {
onStartGroupCallRequested: {
if (groupName.length === 0) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Un nom doit être donné à l'appel de groupe"), false)
} if(!mainItem.isRegistered) {
} else if(!mainItem.isRegistered) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Vous n'etes pas connecté"), false)
} else {
mainItem.confInfoGui = Qt.createQmlObject('import Linphone

View file

@ -14,6 +14,7 @@ QtObject {
property string rightArrow: "image://internal/caret-right.svg"
property string upArrow: "image://internal/caret-up.svg"
property string reloadArrow: "image://internal/arrow-clockwise.svg"
property string arrowsMerge: "image://internal/arrows-merge.svg"
property string info: "image://internal/info.svg"
property string loginImage: "image://internal/login_image.svg"
property string belledonne: "image://internal/belledonne.svg"