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.
This commit is contained in:
Julien Wadel 2022-06-10 17:11:38 +02:00
parent 04f609d907
commit 39ca09d353
6 changed files with 37 additions and 23 deletions

View file

@ -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<ParticipantModel>::create(localParticipant);
qDebug() << "Is Admin: " << localParticipant->isAdmin() << " " << mLocalParticipant->getAdminStatus();
changed = true;
emit localParticipantChanged();
}
return changed;
}
@ -125,10 +126,7 @@ std::list<std::shared_ptr<linphone::Participant>> ConferenceModel::getParticipan
//-----------------------------------------------------------------------------------------------------------------------
void ConferenceModel::onParticipantAdded(const std::shared_ptr<const linphone::Participant> & 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<const linphone::Participant> & participant){
@ -137,13 +135,14 @@ void ConferenceModel::onParticipantRemoved(const std::shared_ptr<const linphone:
}
void ConferenceModel::onParticipantAdminStatusChanged(const std::shared_ptr<const linphone::Participant> & 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<const linphone::ParticipantDevice> & participantDevice){
qDebug() << "Me devices : " << mConference->getMe()->getDevices().size();
updateLocalParticipant();
emit participantDeviceAdded(participantDevice);
}
void ConferenceModel::onParticipantDeviceRemoved(const std::shared_ptr<const linphone::ParticipantDevice> & participantDevice){

View file

@ -233,19 +233,19 @@ void ConferenceInfoModel::createConference(const int& securityLevel, const int&
static std::shared_ptr<linphone::Conference> 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);
}

View file

@ -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<std::shared_ptr<linphone::Address>> 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);

View file

@ -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

View file

@ -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 : ''

View file

@ -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.
}