From 867ec4a333ab4359fd87e3e99c6ae73b057d32ea Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 13 Jun 2022 19:03:12 +0200 Subject: [PATCH] Display the subject of the conference in calls view. Allow to add running call in conference. Fix double participants on invitation while adding a new participant. Fix "alone text" when the user is alone in conference. Fix conference creation layout when switching of scheduled or not mode. Fix led and start button behaviour while creating a new conference. --- .../src/components/call/CallModel.cpp | 8 ++++- .../src/components/call/CallModel.hpp | 4 +-- .../participant/ParticipantListModel.cpp | 32 +++++++++++++++---- .../participant/ParticipantListModel.hpp | 3 ++ .../participant/ParticipantProxyModel.cpp | 24 ++++++++++++-- .../Linphone/Menus/VideoConferenceMenu.qml | 2 +- .../ui/views/App/Dialog/NewConference.qml | 22 +++++++++---- 7 files changed, 74 insertions(+), 21 deletions(-) diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 24bfe7a55..ec6bb9d19 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -414,7 +414,13 @@ void CallModel::handleCallStateChanged (const shared_ptr &call, return; updateIsInConference(); - + if(!mConferenceInfoModel){// Check if conferenceInfo has been set. + auto conferenceInfo = CoreManager::getInstance()->getCore()->findConferenceInformationFromUri(getConferenceAddress()); + if( conferenceInfo ){ + mConferenceInfoModel = ConferenceInfoModel::create(conferenceInfo); + emit conferenceInfoModelChanged(); + } + } switch (state) { case linphone::Call::State::Error: case linphone::Call::State::End: diff --git a/linphone-app/src/components/call/CallModel.hpp b/linphone-app/src/components/call/CallModel.hpp index 129597c57..d4aa0b00e 100644 --- a/linphone-app/src/components/call/CallModel.hpp +++ b/linphone-app/src/components/call/CallModel.hpp @@ -45,7 +45,7 @@ class CallModel : public QObject { Q_PROPERTY(ContactModel *contactModel READ getContactModel CONSTANT ) Q_PROPERTY(ChatRoomModel * chatRoomModel READ getChatRoomModel NOTIFY chatRoomModelChanged) Q_PROPERTY(ConferenceModel * conferenceModel READ getConferenceModel NOTIFY conferenceModelChanged) - Q_PROPERTY(ConferenceInfoModel * conferenceInfoModel READ getConferenceInfoModel NOTIFY conferenceModelInfoChanged) + Q_PROPERTY(ConferenceInfoModel * conferenceInfoModel READ getConferenceInfoModel NOTIFY conferenceInfoModelChanged) Q_PROPERTY(CallStatus status READ getStatus NOTIFY statusChanged) Q_PROPERTY(QString callError READ getCallError NOTIFY callErrorChanged) @@ -195,7 +195,7 @@ signals: void callIdChanged(); void isInConferenceChanged (bool status); void conferenceModelChanged(); - void conferenceModelInfoChanged(); + void conferenceInfoModelChanged(); void chatRoomModelChanged(); void speakerMutedChanged (bool status); void microMutedChanged (bool status); diff --git a/linphone-app/src/components/participant/ParticipantListModel.cpp b/linphone-app/src/components/participant/ParticipantListModel.cpp index f1e964980..71863342c 100644 --- a/linphone-app/src/components/participant/ParticipantListModel.cpp +++ b/linphone-app/src/components/participant/ParticipantListModel.cpp @@ -55,9 +55,11 @@ ParticipantListModel::ParticipantListModel (ConferenceModel * conferenceModel, Q mConferenceModel = conferenceModel; connect(mConferenceModel, &ConferenceModel::participantAdded, this, QOverload &>::of(&ParticipantListModel::onParticipantAdded)); + connect(mConferenceModel, &ConferenceModel::participantDeviceJoined, this, QOverload &>::of(&ParticipantListModel::onParticipantDeviceJoined)); connect(mConferenceModel, &ConferenceModel::participantRemoved, this, QOverload &>::of(&ParticipantListModel::onParticipantRemoved)); connect(mConferenceModel, &ConferenceModel::participantAdminStatusChanged, this, QOverload &>::of(&ParticipantListModel::onParticipantAdminStatusChanged)); connect(mConferenceModel, &ConferenceModel::conferenceStateChanged, this, &ParticipantListModel::onStateChanged); + updateParticipants(); } @@ -163,11 +165,14 @@ void ParticipantListModel::updateParticipants () { // Add new for(auto dbParticipant : dbParticipants){ auto itParticipant = mList.begin(); - while(itParticipant != mList.end() && ( itParticipant->objectCast()->getParticipant() && !dbParticipant->getAddress()->weakEqual(itParticipant->objectCast()->getParticipant()->getAddress()) - || (!itParticipant->objectCast()->getParticipant() && !dbParticipant->getAddress()->weakEqual(Utils::interpretUrl(itParticipant->objectCast()->getSipAddress()))) - ) + while(itParticipant != mList.end() + && (( itParticipant->objectCast()->getParticipant() + && !dbParticipant->getAddress()->weakEqual(itParticipant->objectCast()->getParticipant()->getAddress()) ) + + || (!itParticipant->objectCast()->getParticipant() + && !dbParticipant->getAddress()->weakEqual(Utils::interpretUrl(itParticipant->objectCast()->getSipAddress())) + )) ){ - ++itParticipant; } if( itParticipant == mList.end()){ @@ -201,9 +206,7 @@ void ParticipantListModel::add (QSharedPointer participant){ } void ParticipantListModel::add(const std::shared_ptr & participant){ - auto unconstParticipant = (mChatRoomModel ? mChatRoomModel->getChatRoom()->findParticipant(participant->getAddress()) : mConferenceModel->getConference()->findParticipant(participant->getAddress())); - if( unconstParticipant) - add(QSharedPointer::create(unconstParticipant)); + updateParticipants(); } void ParticipantListModel::add(const std::shared_ptr & participantAddress){ @@ -314,6 +317,21 @@ void ParticipantListModel::onParticipantRemoved(const std::shared_ptr & eventLog){ + qDebug() << "onParticipantDeviceJoined event: " << eventLog->getParticipantAddress()->asString().c_str(); + updateParticipants(); +} + +void ParticipantListModel::onParticipantDeviceJoined(const std::shared_ptr & device){ + qDebug() << "onParticipantDeviceJoined part: " << device->getAddress()->asString().c_str(); + updateParticipants(); +} + +void ParticipantListModel::onParticipantDeviceJoined(const std::shared_ptr& address){ + qDebug() << "onParticipantDeviceJoined addr: " << address->asString().c_str(); + updateParticipants(); +} + void ParticipantListModel::onParticipantAdminStatusChanged(const std::shared_ptr & eventLog){ onParticipantAdminStatusChanged(eventLog->getParticipantAddress()); diff --git a/linphone-app/src/components/participant/ParticipantListModel.hpp b/linphone-app/src/components/participant/ParticipantListModel.hpp index 5d09fab99..d7d156cb2 100644 --- a/linphone-app/src/components/participant/ParticipantListModel.hpp +++ b/linphone-app/src/components/participant/ParticipantListModel.hpp @@ -76,6 +76,9 @@ public slots: void onParticipantRemoved(const std::shared_ptr & participant); void onParticipantRemoved(const std::shared_ptr & eventLog); void onParticipantRemoved(const std::shared_ptr& address); + void onParticipantDeviceJoined(const std::shared_ptr & device); + void onParticipantDeviceJoined(const std::shared_ptr & eventLog); + void onParticipantDeviceJoined(const std::shared_ptr& address); void onParticipantAdminStatusChanged(const std::shared_ptr & participant); void onParticipantAdminStatusChanged(const std::shared_ptr & eventLog); void onParticipantAdminStatusChanged(const std::shared_ptr& address ); diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index c84709280..2accba332 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -87,12 +87,15 @@ void ParticipantProxyModel::setChatRoomModel(ChatRoomModel * chatRoomModel){ mChatRoomModel = chatRoomModel; if(mChatRoomModel) { auto participants = mChatRoomModel->getParticipantListModel(); + connect(participants, &ParticipantListModel::countChanged, this, &ParticipantProxyModel::countChanged); setSourceModel(participants); emit participantListModelChanged(); for(int i = 0 ; i < participants->getCount() ; ++i) emit addressAdded(participants->getAt(i)->getSipAddress()); }else if(!sourceModel()){ - setSourceModel(new ParticipantListModel((ChatRoomModel*)nullptr, this)); + auto model = new ParticipantListModel((ChatRoomModel*)nullptr, this); + connect(model, &ParticipantListModel::countChanged, this, &ParticipantProxyModel::countChanged); + setSourceModel(model); emit participantListModelChanged(); } sort(0); @@ -105,12 +108,15 @@ void ParticipantProxyModel::setConferenceModel(ConferenceModel * conferenceModel mConferenceModel = conferenceModel; if(mConferenceModel) { auto participants = mConferenceModel->getParticipantListModel(); + connect(participants, &ParticipantListModel::countChanged, this, &ParticipantProxyModel::countChanged); setSourceModel(participants); emit participantListModelChanged(); for(int i = 0 ; i < participants->getCount() ; ++i) emit addressAdded(participants->getAt(i)->getSipAddress()); }else if(!sourceModel()){ - setSourceModel(new ParticipantListModel((ConferenceModel*)nullptr, this)); + auto model = new ParticipantListModel((ConferenceModel*)nullptr, this); + connect(model, &ParticipantListModel::countChanged, this, &ParticipantProxyModel::countChanged); + setSourceModel(model); emit participantListModelChanged(); } sort(0); @@ -145,7 +151,19 @@ void ParticipantProxyModel::addAddress(const QString& address){ } if( mConferenceModel && mConferenceModel->getConference()){ auto addressToInvite = Utils::interpretUrl(address); - mConferenceModel->getConference()->addParticipant(addressToInvite); + std::list> runningCallsToAdd; + auto currentCalls = CoreManager::getInstance()->getCore()->getCalls(); + auto haveCall = std::find_if(currentCalls.begin(), currentCalls.end(), [addressToInvite](const std::shared_ptr& call){ + return call->getRemoteAddress()->weakEqual(addressToInvite); + }); + if( haveCall == currentCalls.end()) + mConferenceModel->getConference()->addParticipant(addressToInvite); + else{ + runningCallsToAdd.push_back(*haveCall); + mConferenceModel->getConference()->addParticipants(runningCallsToAdd); + } + + /* std::list> addressesToInvite; addressesToInvite.push_back(addressToInvite); diff --git a/linphone-app/ui/modules/Linphone/Menus/VideoConferenceMenu.qml b/linphone-app/ui/modules/Linphone/Menus/VideoConferenceMenu.qml index 01dbd9a6f..3cb2492b5 100644 --- a/linphone-app/ui/modules/Linphone/Menus/VideoConferenceMenu.qml +++ b/linphone-app/ui/modules/Linphone/Menus/VideoConferenceMenu.qml @@ -268,7 +268,7 @@ Rectangle{ Text{ //: 'Your are currently alone in this conference' : Message to warn the user when there is no other participant. text: qsTr('conferenceMenuParticipantsAlone') - visible: parent.count + visible: parent.count <= 1 } } Item{// Spacer diff --git a/linphone-app/ui/views/App/Dialog/NewConference.qml b/linphone-app/ui/views/App/Dialog/NewConference.qml index 3e47210da..0b90b17b4 100644 --- a/linphone-app/ui/views/App/Dialog/NewConference.qml +++ b/linphone-app/ui/views/App/Dialog/NewConference.qml @@ -20,12 +20,13 @@ DialogPlus { property bool isNew: !conferenceInfoModel || conferenceInfoModel.uri === '' property ConferenceInfoModel conferenceInfoModel: ConferenceInfoModel{} onConferenceInfoModelChanged: selectedParticipants.setAddresses(conferenceInfoModel) + property int creationState: 0 Connections{ target: conferenceInfoModel onConferenceCreated: { - creationStatus.icon = 'led_green' + conferenceManager.creationState = 2 } - onConferenceCreationFailed:{ creationStatus.icon = 'led_red' } + onConferenceCreationFailed:{ conferenceManager.creationState = -1 } onInvitationsSent: { exit(1) } @@ -100,7 +101,7 @@ DialogPlus { onClicked: exit(0) }, TextButtonB { - enabled: selectedParticipants.count >= conferenceManager.minParticipants && subject.text != '' && AccountSettingsModel.conferenceURI != '' + enabled: conferenceManager.creationState != 1 && selectedParticipants.count >= conferenceManager.minParticipants && subject.text != '' && AccountSettingsModel.conferenceURI != '' //: 'Launch' : Launch button text: conferenceManager.isNew ? qsTr('launchButton') //: 'Update' : Update button @@ -112,7 +113,7 @@ DialogPlus { } onClicked: { - creationStatus.icon = 'led_orange' + conferenceManager.creationState = 1 conferenceInfoModel.isScheduled = scheduledSwitch.checked if( scheduledSwitch.checked){ var startDateTime = Utils.buildDate(dateField.getDate(), timeField.getTime()) @@ -149,10 +150,13 @@ DialogPlus { } , Icon{ id: creationStatus - height: 10 - width: 10 + height: 15 + width: 15 visible: icon != '' - icon: '' + icon: conferenceManager.creationState==2 ? 'led_green' + : conferenceManager.creationState==-1 ? 'led_red' + : conferenceManager.creationState==1 ? 'led_orange' + : '' } ] @@ -405,6 +409,10 @@ DialogPlus { width: parent.width } } + Item{ + Layout.fillHeight: true + Layout.fillWidth: true + } } StackView{