Remove call only in released state and keep a delay if an error message exists.

Fix disabled camera button on audio call that should not be in this state if video can be enabled.
This commit is contained in:
Julien Wadel 2022-08-18 14:09:40 +02:00
parent 7ee98041af
commit e47c63679e
2 changed files with 12 additions and 11 deletions

View file

@ -47,7 +47,7 @@ using namespace std;
namespace {
// Delay before removing call in ms.
constexpr int DelayBeforeRemoveCall = 3000;
constexpr int DelayBeforeRemoveCall = 6000;
}
static inline int findCallIndex (QList<QSharedPointer<QObject>> &list, const shared_ptr<linphone::Call> &call) {
@ -458,8 +458,11 @@ void CallsListModel::handleCallStateChanged (const shared_ptr<linphone::Call> &c
CallModel * model = &call->getData<CallModel>("call-model");
model->endCall();
}
removeCall(call);
} break;
case linphone::Call::State::Released:
removeCall(call);
break;
case linphone::Call::State::StreamsRunning: {
int index = findCallIndex(mList, call);
emit callRunning(index, &call->getData<CallModel>("call-model"));
@ -515,7 +518,7 @@ void CallsListModel::addDummyCall () {
}
void CallsListModel::removeCall (const shared_ptr<linphone::Call> &call) {
CallModel *callModel;
CallModel *callModel = nullptr;
try {
callModel = &call->getData<CallModel>("call-model");
@ -525,14 +528,12 @@ void CallsListModel::removeCall (const shared_ptr<linphone::Call> &call) {
qWarning() << QStringLiteral("Unable to find call:") << call.get();
return;
}
QTimer::singleShot( DelayBeforeRemoveCall , this, [this, callModel] {
if( callModel->getCallError() != ""){// We got an error, met more time to see it.
QTimer::singleShot( DelayBeforeRemoveCall , this, [this, callModel] {
if( callModel && callModel->getCallError() != ""){ // Wait some time to display an error on ending call.
QTimer::singleShot( DelayBeforeRemoveCall , this, [this, callModel] {
removeCallCb(callModel);
});
}else
removeCallCb(callModel);
});
});
}else
remove(callModel);
}
void CallsListModel::removeCallCb (CallModel *callModel) {

View file

@ -437,7 +437,7 @@ Rectangle {
backgroundRadius: 90
colorSet: callModel && callModel.cameraEnabled ? IncallStyle.buttons.cameraOn : IncallStyle.buttons.cameraOff
updating: callModel.videoEnabled && callModel.updating
enabled: callModel.videoEnabled
visible: callModel && ( !callModel.isConference || callModel.videoEnabled)
onClicked: if(callModel){
if( callModel.isConference)// Only deactivate camera in conference.
callModel.cameraEnabled = !callModel.cameraEnabled