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.
This commit is contained in:
Julien Wadel 2022-06-13 19:03:12 +02:00
parent 6e36d78ab8
commit 867ec4a333
7 changed files with 74 additions and 21 deletions

View file

@ -414,7 +414,13 @@ void CallModel::handleCallStateChanged (const shared_ptr<linphone::Call> &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:

View file

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

View file

@ -55,9 +55,11 @@ ParticipantListModel::ParticipantListModel (ConferenceModel * conferenceModel, Q
mConferenceModel = conferenceModel;
connect(mConferenceModel, &ConferenceModel::participantAdded, this, QOverload<const std::shared_ptr<const linphone::Participant> &>::of(&ParticipantListModel::onParticipantAdded));
connect(mConferenceModel, &ConferenceModel::participantDeviceJoined, this, QOverload<const std::shared_ptr<const linphone::ParticipantDevice> &>::of(&ParticipantListModel::onParticipantDeviceJoined));
connect(mConferenceModel, &ConferenceModel::participantRemoved, this, QOverload<const std::shared_ptr<const linphone::Participant> &>::of(&ParticipantListModel::onParticipantRemoved));
connect(mConferenceModel, &ConferenceModel::participantAdminStatusChanged, this, QOverload<const std::shared_ptr<const linphone::Participant> &>::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<ParticipantModel>()->getParticipant() && !dbParticipant->getAddress()->weakEqual(itParticipant->objectCast<ParticipantModel>()->getParticipant()->getAddress())
|| (!itParticipant->objectCast<ParticipantModel>()->getParticipant() && !dbParticipant->getAddress()->weakEqual(Utils::interpretUrl(itParticipant->objectCast<ParticipantModel>()->getSipAddress())))
)
while(itParticipant != mList.end()
&& (( itParticipant->objectCast<ParticipantModel>()->getParticipant()
&& !dbParticipant->getAddress()->weakEqual(itParticipant->objectCast<ParticipantModel>()->getParticipant()->getAddress()) )
|| (!itParticipant->objectCast<ParticipantModel>()->getParticipant()
&& !dbParticipant->getAddress()->weakEqual(Utils::interpretUrl(itParticipant->objectCast<ParticipantModel>()->getSipAddress()))
))
){
++itParticipant;
}
if( itParticipant == mList.end()){
@ -201,9 +206,7 @@ void ParticipantListModel::add (QSharedPointer<ParticipantModel> participant){
}
void ParticipantListModel::add(const std::shared_ptr<const linphone::Participant> & participant){
auto unconstParticipant = (mChatRoomModel ? mChatRoomModel->getChatRoom()->findParticipant(participant->getAddress()) : mConferenceModel->getConference()->findParticipant(participant->getAddress()));
if( unconstParticipant)
add(QSharedPointer<ParticipantModel>::create(unconstParticipant));
updateParticipants();
}
void ParticipantListModel::add(const std::shared_ptr<const linphone::Address> & participantAddress){
@ -314,6 +317,21 @@ void ParticipantListModel::onParticipantRemoved(const std::shared_ptr<const linp
remove(participant.get());
}
void ParticipantListModel::onParticipantDeviceJoined(const std::shared_ptr<const linphone::EventLog> & eventLog){
qDebug() << "onParticipantDeviceJoined event: " << eventLog->getParticipantAddress()->asString().c_str();
updateParticipants();
}
void ParticipantListModel::onParticipantDeviceJoined(const std::shared_ptr<const linphone::ParticipantDevice> & device){
qDebug() << "onParticipantDeviceJoined part: " << device->getAddress()->asString().c_str();
updateParticipants();
}
void ParticipantListModel::onParticipantDeviceJoined(const std::shared_ptr<const linphone::Address>& address){
qDebug() << "onParticipantDeviceJoined addr: " << address->asString().c_str();
updateParticipants();
}
void ParticipantListModel::onParticipantAdminStatusChanged(const std::shared_ptr<const linphone::EventLog> & eventLog){
onParticipantAdminStatusChanged(eventLog->getParticipantAddress());

View file

@ -76,6 +76,9 @@ public slots:
void onParticipantRemoved(const std::shared_ptr<const linphone::Participant> & participant);
void onParticipantRemoved(const std::shared_ptr<const linphone::EventLog> & eventLog);
void onParticipantRemoved(const std::shared_ptr<const linphone::Address>& address);
void onParticipantDeviceJoined(const std::shared_ptr<const linphone::ParticipantDevice> & device);
void onParticipantDeviceJoined(const std::shared_ptr<const linphone::EventLog> & eventLog);
void onParticipantDeviceJoined(const std::shared_ptr<const linphone::Address>& address);
void onParticipantAdminStatusChanged(const std::shared_ptr<const linphone::Participant> & participant);
void onParticipantAdminStatusChanged(const std::shared_ptr<const linphone::EventLog> & eventLog);
void onParticipantAdminStatusChanged(const std::shared_ptr<const linphone::Address>& address );

View file

@ -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<ParticipantModel>(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<ParticipantModel>(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<std::shared_ptr<linphone::Call>> runningCallsToAdd;
auto currentCalls = CoreManager::getInstance()->getCore()->getCalls();
auto haveCall = std::find_if(currentCalls.begin(), currentCalls.end(), [addressToInvite](const std::shared_ptr<linphone::Call>& 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<std::shared_ptr<linphone::Address>> addressesToInvite;
addressesToInvite.push_back(addressToInvite);

View file

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

View file

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