From 6f673554e4271f777d8d5e87040dea367b17702d Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 5 Dec 2022 15:13:10 +0100 Subject: [PATCH] Display all participants count in ICS (all = SDK participants + organizer) --- .../conferenceInfo/ConferenceInfoModel.cpp | 18 ++++++++++++++++++ .../conferenceInfo/ConferenceInfoModel.hpp | 3 +++ .../Linphone/Chat/ChatCalendarMessage.qml | 4 ++-- .../Chat/ChatConferenceInvitationMessage.qml | 6 +++--- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp index 941556fcd..2ee413582 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp @@ -207,11 +207,29 @@ QVariantList ConferenceInfoModel::getParticipants() const{ } return addresses; } +QVariantList ConferenceInfoModel::getAllParticipants() const{ + QVariantList addresses = getParticipants(); + QString organizerAddress = QString::fromStdString(mConferenceInfo->getOrganizer()->asStringUriOnly()); + for(auto item : addresses){ + if( item.toMap()["address"] == organizerAddress) + return addresses; + } + QVariantMap participant; + participant["displayName"] = Utils::getDisplayName(mConferenceInfo->getOrganizer()); + participant["address"] = organizerAddress; + addresses << participant; + return addresses; +} + int ConferenceInfoModel::getParticipantCount()const{ return mConferenceInfo->getParticipants().size(); } +int ConferenceInfoModel::getAllParticipantCount()const{ + return getAllParticipants().size(); +} + TimeZoneModel* ConferenceInfoModel::getTimeZoneModel() const{ TimeZoneModel * model = new TimeZoneModel(mTimeZone); App::getInstance()->getEngine()->setObjectOwnership(model, QQmlEngine::JavaScriptOwnership); diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp index da7f01fc4..7f2ec0e27 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.hpp @@ -50,6 +50,7 @@ public: Q_PROPERTY(bool isScheduled READ isScheduled WRITE setIsScheduled NOTIFY isScheduledChanged) Q_PROPERTY(int inviteMode READ getInviteMode WRITE setInviteMode NOTIFY inviteModeChanged) Q_PROPERTY(int participantCount READ getParticipantCount NOTIFY participantsChanged) + Q_PROPERTY(int allParticipantCount READ getAllParticipantCount NOTIFY participantsChanged) Q_PROPERTY(LinphoneEnums::ConferenceInfoState state READ getConferenceInfoState NOTIFY conferenceInfoStateChanged) Q_PROPERTY(LinphoneEnums::ConferenceSchedulerState conferenceSchedulerState READ getConferenceSchedulerState NOTIFY conferenceSchedulerStateChanged) @@ -74,7 +75,9 @@ public: bool isScheduled() const; int getInviteMode() const; Q_INVOKABLE QVariantList getParticipants() const; + Q_INVOKABLE QVariantList getAllParticipants() const; Q_INVOKABLE int getParticipantCount()const; + Q_INVOKABLE int getAllParticipantCount()const; Q_INVOKABLE TimeZoneModel* getTimeZoneModel() const; Q_INVOKABLE QString getIcalendarString() const; LinphoneEnums::ConferenceInfoState getConferenceInfoState() const; diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml index 61a34add5..b6c53e37d 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatCalendarMessage.qml @@ -212,10 +212,10 @@ Loader{ Layout.alignment: Qt.AlignTop spacing: 0 visible: mainItem.isExpanded - onVisibleChanged: visible ? model= mainItem.conferenceInfoModel.getParticipants() : model = [] + onVisibleChanged: visible ? model= mainItem.conferenceInfoModel.getAllParticipants() : model = [] Connections{ target: mainItem.conferenceInfoModel - onParticipantsChanged: if(expandedParticipantsList.visible) expandedParticipantsList.model = mainItem.conferenceInfoModel.getParticipants() + onParticipantsChanged: if(expandedParticipantsList.visible) expandedParticipantsList.model = mainItem.conferenceInfoModel.getAllParticipants() } delegate: Row{ diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatConferenceInvitationMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatConferenceInvitationMessage.qml index cced32c2a..750bf9de1 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatConferenceInvitationMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatConferenceInvitationMessage.qml @@ -109,7 +109,7 @@ Loader{ } RowLayout { id: participantsRow - property int participantCount: mainItem.conferenceInfoModel.participantCount + property int participantCount: mainItem.conferenceInfoModel.allParticipantCount Layout.fillWidth: true Layout.preferredHeight: ChatCalendarMessageStyle.participants.iconSize Layout.leftMargin: 5 @@ -204,10 +204,10 @@ Loader{ Layout.leftMargin: 10 spacing: 0 visible: mainItem.isExpanded - onVisibleChanged: visible ? model= mainItem.conferenceInfoModel.getParticipants() : model = [] + onVisibleChanged: visible ? model= mainItem.conferenceInfoModel.getAllParticipants() : model = [] Connections{ target: mainItem.conferenceInfoModel - onParticipantsChanged: if(expandedParticipantsList.visible) expandedParticipantsList.model = mainItem.conferenceInfoModel.getParticipants() + onParticipantsChanged: if(expandedParticipantsList.visible) expandedParticipantsList.model = mainItem.conferenceInfoModel.getAllParticipants() } delegate: Row{