From f8ca666219b4b10186b139fdfa9fc68b47d638a2 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 22 Nov 2022 10:54:07 +0100 Subject: [PATCH] From Chat room infos: - Fix hidden buzy indicator on participant invitations (from Chat Room infos). - Fix auto removing participant on timeout invitations (30s). --- .../participant/ParticipantProxyModel.cpp | 27 ++++++++++--------- .../Styles/Animations/BusyIndicatorStyle.qml | 1 + .../Linphone/View/ParticipantsView.qml | 27 ++++++++++++------- .../views/App/Main/Dialogs/InfoChatRoom.qml | 2 +- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index 6abab1acd..5e32d4729 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -92,8 +92,11 @@ void ParticipantProxyModel::setChatRoomModel(ChatRoomModel * chatRoomModel){ 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()); + for(int i = 0 ; i < participants->getCount() ; ++i) { + auto participant = participants->getAt(i); + connect(participant.get(), &ParticipantModel::invitationTimeout, this, &ParticipantProxyModel::removeModel); + emit addressAdded(participant->getSipAddress()); + } }else if(!sourceModel()){ auto model = new ParticipantListModel((ChatRoomModel*)nullptr, this); connect(model, &ParticipantListModel::countChanged, this, &ParticipantProxyModel::countChanged); @@ -113,8 +116,11 @@ void ParticipantProxyModel::setConferenceModel(ConferenceModel * conferenceModel 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()); + for(int i = 0 ; i < participants->getCount() ; ++i) { + auto participant = participants->getAt(i); + connect(participant.get(), &ParticipantModel::invitationTimeout, this, &ParticipantProxyModel::removeModel); + emit addressAdded(participant->getSipAddress()); + } }else if(!sourceModel()){ auto model = new ParticipantListModel((ConferenceModel*)nullptr, this); connect(model, &ParticipantListModel::countChanged, this, &ParticipantProxyModel::countChanged); @@ -144,12 +150,12 @@ void ParticipantProxyModel::addAddress(const QString& address){ ParticipantListModel * participantsModel = qobject_cast(sourceModel()); if(!participantsModel->contains(address)){ QSharedPointer participant = QSharedPointer::create(nullptr); + connect(participant.get(), &ParticipantModel::invitationTimeout, this, &ParticipantProxyModel::removeModel); participant->setSipAddress(address); participantsModel->add(participant); if(mChatRoomModel && mChatRoomModel->getChatRoom()){// Invite and wait for its creation - mChatRoomModel->getChatRoom()->addParticipant(Utils::interpretUrl(address)); - connect(participant.get(), &ParticipantModel::invitationTimeout, this, &ParticipantProxyModel::removeModel); participant->startInvitation(); + mChatRoomModel->getChatRoom()->addParticipant(Utils::interpretUrl(address)); } if( mConferenceModel && mConferenceModel->getConference()){ auto addressToInvite = Utils::interpretUrl(address); @@ -158,23 +164,18 @@ void ParticipantProxyModel::addAddress(const QString& address){ auto haveCall = std::find_if(currentCalls.begin(), currentCalls.end(), [addressToInvite](const std::shared_ptr& call){ return call->getRemoteAddress()->weakEqual(addressToInvite); }); + participant->startInvitation(); if( haveCall == currentCalls.end()) mConferenceModel->getConference()->addParticipant(addressToInvite); else{ runningCallsToAdd.push_back(*haveCall); mConferenceModel->getConference()->addParticipants(runningCallsToAdd); } - - /* std::list> addressesToInvite; addressesToInvite.push_back(addressToInvite); auto callParameters = CoreManager::getInstance()->getCore()->createCallParams(mConferenceModel->getConference()->getCall()); - mConferenceModel->getConference()->inviteParticipants(addressesToInvite, callParameters);*/ - - connect(participant.get(), &ParticipantModel::invitationTimeout, this, &ParticipantProxyModel::removeModel); - participant->startInvitation(); - + mConferenceModel->getConference()->inviteParticipants(addressesToInvite, callParameters);*/ } emit countChanged(); emit addressAdded(address); diff --git a/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml b/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml index 40b95d07a..083f6d463 100644 --- a/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml @@ -6,6 +6,7 @@ import ColorsList 1.0 QtObject { property string sectionName: 'Busy' property color color: ColorsList.add(sectionName+'_indicator', 'q').color + property color alternateColor: ColorsList.add(sectionName+'_indicator_alt', 'i').color property int duration: 1250 property int nSpheres: 8 } diff --git a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml index fff449043..f38c0b85b 100644 --- a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml +++ b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml @@ -6,6 +6,8 @@ import Linphone 1.0 import Linphone.Styles 1.0 import Common.Styles 1.0 +import 'qrc:/ui/scripts/Utils/utils.js' as Utils + // ============================================================================= ScrollableListView { @@ -253,16 +255,7 @@ ScrollableListView { statusText : showAdminStatus ? getStatus() : '' entry: $modelData - onAvatarClicked: sipAddressesView.entryClicked(parent.entry, index, contactView) - - BusyIndicator{ - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width:15 - height:15 - running: sipAddressesView.showInvitingIndicator && $modelData.inviting - } } @@ -289,6 +282,7 @@ ScrollableListView { } Repeater { + id: actionsRepeater model: sipAddressesView.actions ActionButton { @@ -309,6 +303,21 @@ ScrollableListView { anchors.top:parent.top anchors.horizontalCenter: parent.right } + Loader{ + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + height: parent.height - 2 + width: height + + active: index == actionsRepeater.count -1 && sipAddressesView.showInvitingIndicator && contactView.entry && contactView.entry.inviting + + sourceComponent: Component{ + BusyIndicator{ + color: BusyIndicatorStyle.alternateColor + running: true + } + } + } } } } diff --git a/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml b/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml index cdbd607d2..1097334e2 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml @@ -88,7 +88,7 @@ DialogPlus { secure: chatRoomModel.haveEncryption, visible: true, secureIconVisibleHandler : function(entry) { - return entry.sipAddress && chatRoomModel && chatRoomModel.haveEncryption && UtilsCpp.hasCapability(entry.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh); + return entry && entry.sipAddress && chatRoomModel && chatRoomModel.haveEncryption && UtilsCpp.hasCapability(entry.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh); }, handler: function (entry) { selectedParticipants.addAddress(entry.sipAddress)