From 39ca09d35345f888b54273519563a854474157f4 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 10 Jun 2022 17:11:38 +0200 Subject: [PATCH] Remove potential crash on local participant. Add unscheduled conference and adding participants. Quickfix on overwrite missing menu style. Display conference subject and organizer address in call notification/display. --- .../components/conference/ConferenceModel.cpp | 11 ++++--- .../conferenceInfo/ConferenceInfoModel.cpp | 8 ++--- .../participant/ParticipantProxyModel.cpp | 8 +++-- .../ui/modules/Common/Menus/MenuItem.qml | 1 + .../ui/modules/Linphone/Contact/Contact.qml | 29 ++++++++++++------- .../NotificationReceivedCall.qml | 3 ++ 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/linphone-app/src/components/conference/ConferenceModel.cpp b/linphone-app/src/components/conference/ConferenceModel.cpp index 422fc1a25..8ab7c2c07 100644 --- a/linphone-app/src/components/conference/ConferenceModel.cpp +++ b/linphone-app/src/components/conference/ConferenceModel.cpp @@ -77,10 +77,11 @@ bool ConferenceModel::updateLocalParticipant(){ // Me is not in participants, use Me(). if( !localParticipant) localParticipant = mConference->getMe(); - if( localParticipant){ + if( localParticipant && (!mLocalParticipant || mLocalParticipant->getParticipant() != localParticipant) ) { mLocalParticipant = QSharedPointer::create(localParticipant); qDebug() << "Is Admin: " << localParticipant->isAdmin() << " " << mLocalParticipant->getAdminStatus(); changed = true; + emit localParticipantChanged(); } return changed; } @@ -125,10 +126,7 @@ std::list> ConferenceModel::getParticipan //----------------------------------------------------------------------------------------------------------------------- void ConferenceModel::onParticipantAdded(const std::shared_ptr & participant){ qDebug() << "Added call, participant count: " << getParticipantList().size(); - if(!mLocalParticipant){ - if(updateLocalParticipant()) - emit localParticipantChanged(); - } + updateLocalParticipant(); emit participantAdded(participant); } void ConferenceModel::onParticipantRemoved(const std::shared_ptr & participant){ @@ -137,13 +135,14 @@ void ConferenceModel::onParticipantRemoved(const std::shared_ptr & participant){ qDebug() << "onParticipantAdminStatusChanged: " << participant->getAddress()->asString().c_str(); - if(participant == mLocalParticipant->getParticipant()) + if(mLocalParticipant && participant == mLocalParticipant->getParticipant()) emit mLocalParticipant->adminStatusChanged(); emit participantAdminStatusChanged(participant); } void ConferenceModel::onParticipantDeviceAdded(const std::shared_ptr & participantDevice){ qDebug() << "Me devices : " << mConference->getMe()->getDevices().size(); + updateLocalParticipant(); emit participantDeviceAdded(participantDevice); } void ConferenceModel::onParticipantDeviceRemoved(const std::shared_ptr & participantDevice){ diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp index 89935164c..d816724a9 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoModel.cpp @@ -233,19 +233,19 @@ void ConferenceInfoModel::createConference(const int& securityLevel, const int& static std::shared_ptr conference; qInfo() << "Conference creation of " << getSubject() << " at " << securityLevel << " security, organized by " << getOrganizer(); - if( true || isScheduled()){ + if( isScheduled()){ mConferenceScheduler = ConferenceScheduler::create(); connect(mConferenceScheduler.get(), &ConferenceScheduler::invitationsSent, this, &ConferenceInfoModel::onInvitationsSent); connect(mConferenceScheduler.get(), &ConferenceScheduler::stateChanged, this, &ConferenceInfoModel::onStateChanged); mConferenceScheduler->getConferenceScheduler()->setInfo(mConferenceInfo); - }else{// TODO? + }else{ auto conferenceParameters = core->createConferenceParams(nullptr); conferenceParameters->enableAudio(true); conferenceParameters->enableVideo(true); conferenceParameters->setDescription(mConferenceInfo->getDescription()); conferenceParameters->setSubject(mConferenceInfo->getSubject()); - conferenceParameters->setStartTime(mConferenceInfo->getDateTime()); - conferenceParameters->setEndTime(mConferenceInfo->getDateTime() + (mConferenceInfo->getDuration() * 60)); + conferenceParameters->setStartTime(0); + conferenceParameters->setEndTime(0); conferenceParameters->enableLocalParticipant(true); conference = core->createConferenceWithParams(conferenceParameters); } diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index 1c2320e4e..c84709280 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -144,13 +144,17 @@ void ParticipantProxyModel::addAddress(const QString& address){ participant->startInvitation(); } if( mConferenceModel && mConferenceModel->getConference()){ + auto addressToInvite = Utils::interpretUrl(address); + mConferenceModel->getConference()->addParticipant(addressToInvite); + /* std::list> addressesToInvite; - addressesToInvite.push_back(Utils::interpretUrl(address)); + addressesToInvite.push_back(addressToInvite); auto callParameters = CoreManager::getInstance()->getCore()->createCallParams(mConferenceModel->getConference()->getCall()); + mConferenceModel->getConference()->inviteParticipants(addressesToInvite, callParameters);*/ - mConferenceModel->getConference()->inviteParticipants(addressesToInvite, callParameters); connect(participant.get(), &ParticipantModel::invitationTimeout, this, &ParticipantProxyModel::removeModel); participant->startInvitation(); + } emit countChanged(); emit addressAdded(address); diff --git a/linphone-app/ui/modules/Common/Menus/MenuItem.qml b/linphone-app/ui/modules/Common/Menus/MenuItem.qml index 4f1bdb4d6..1fd22c80a 100644 --- a/linphone-app/ui/modules/Common/Menus/MenuItem.qml +++ b/linphone-app/ui/modules/Common/Menus/MenuItem.qml @@ -18,6 +18,7 @@ Controls.MenuItem { property alias iconOverwriteColorMenu: iconArea.overwriteColor property alias iconLayoutDirection : rowArea.layoutDirection property var menuItemStyle : MenuItemStyle.normal + onMenuItemStyleChanged: if(!menuItemStyle) menuItemStyle = MenuItemStyle.normal property alias textWeight : rowText.font.bold property int offsetTopMargin : 0 diff --git a/linphone-app/ui/modules/Linphone/Contact/Contact.qml b/linphone-app/ui/modules/Linphone/Contact/Contact.qml index 9b0d2c2a2..0afbdafc5 100644 --- a/linphone-app/ui/modules/Linphone/Contact/Contact.qml +++ b/linphone-app/ui/modules/Linphone/Contact/Contact.qml @@ -14,6 +14,9 @@ Rectangle { id: item // --------------------------------------------------------------------------- + // An entry from `SipAddressesModel`, an `SipAddressObserver` or a ChatRoomModel + property var entry + // entry should have these functions : presenceStatus, sipAddress, username, avatar (image) property alias sipAddressColor: description.sipAddressColor property alias usernameColor: description.usernameColor @@ -23,15 +26,11 @@ Rectangle { property bool showContactAddress : true property bool showAuxData : false - // An entry from `SipAddressesModel`, an `SipAddressObserver` or a ChatRoomModel - property var entry - - // entry should have these functions : presenceStatus, sipAddress, username, avatar (image) - - property string username: (entry != undefined ?( entry.username != undefined ?entry.username - : entry.contactModel != undefined ? entry.contactModel.vcard.username - : UtilsCpp.getDisplayName(entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '') - ):'') + property string username: (entry != undefined ? ( entry.conferenceInfoModel && entry.conferenceInfoModel.subject ? entry.conferenceInfoModel.subject + : entry.username != undefined ? entry.username + : entry.contactModel != undefined ? entry.contactModel.vcard.username + : UtilsCpp.getDisplayName(entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '') + ): '') signal avatarClicked(var mouse) // --------------------------------------------------------------------------- @@ -64,7 +63,13 @@ Rectangle { //username: UtilsCpp.getDisplayName(entry.sipAddress || entry.peerAddress ) - username : entry!=undefined && entry.isOneToOne!=undefined && !entry.isOneToOne ? '' : item.username + username : entry!=undefined + ? entry.conferenceInfoModel + ? UtilsCpp.getDisplayName(entry.conferenceInfoModel.organizer) + : entry.isOneToOne!=undefined && !entry.isOneToOne + ? '' + : item.username + : item.username visible:!groupChat.visible @@ -122,7 +127,9 @@ Rectangle { && (item.showAuxData ? entry.auxDataToShow || '' : (entry.isOneToOne == undefined || entry.isOneToOne) && (entry.haveEncryption == undefined || !entry.haveEncryption) - ? entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '' + ? entry.conferenceInfoModel + ? entry.conferenceInfoModel.organizer + : entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '' : '') ) || '' participants: entry && item.showContactAddress && sipAddress == '' && entry.isOneToOne && entry.participants ? entry.participants.addressesToString : '' diff --git a/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml b/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml index e6d6c14c0..37a64aae2 100644 --- a/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml +++ b/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml @@ -33,11 +33,14 @@ Notification { Contact { Layout.fillWidth: true + /* property var peerAddress: notification.call ? notification.call.fullPeerAddress : '' onPeerAddressChanged: { entry=SipAddressesModel.getSipAddressObserver(peerAddress, notification.call ? notification.call.fullLocalAddress : '') } entry: SipAddressesModel.getSipAddressObserver(peerAddress, notification.call ? notification.call.fullLocalAddress : '') + */ + entry: notification.call Component.onDestruction: entry=null// Need to set it to null because of not calling destructor if not. }