From Chat room infos:

- Fix hidden buzy indicator on participant invitations (from Chat Room infos).
- Fix auto removing participant on timeout invitations  (30s).
This commit is contained in:
Julien Wadel 2022-11-22 10:54:07 +01:00
parent 91833adbae
commit f8ca666219
4 changed files with 34 additions and 23 deletions

View file

@ -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<ParticipantModel>(i)->getSipAddress());
for(int i = 0 ; i < participants->getCount() ; ++i) {
auto participant = participants->getAt<ParticipantModel>(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<ParticipantModel>(i)->getSipAddress());
for(int i = 0 ; i < participants->getCount() ; ++i) {
auto participant = participants->getAt<ParticipantModel>(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<ParticipantListModel*>(sourceModel());
if(!participantsModel->contains(address)){
QSharedPointer<ParticipantModel> participant = QSharedPointer<ParticipantModel>::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<linphone::Call>& 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<std::shared_ptr<linphone::Address>> 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);

View file

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

View file

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

View file

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