From e47c63679eff45ddbe19a120dc36c014361a9b70 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 18 Aug 2022 14:09:40 +0200 Subject: [PATCH] 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. --- .../src/components/calls/CallsListModel.cpp | 21 ++++++++++--------- linphone-app/ui/views/App/Calls/Incall.qml | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp index c1793b2fe..ad11d1360 100644 --- a/linphone-app/src/components/calls/CallsListModel.cpp +++ b/linphone-app/src/components/calls/CallsListModel.cpp @@ -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> &list, const shared_ptr &call) { @@ -458,8 +458,11 @@ void CallsListModel::handleCallStateChanged (const shared_ptr &c CallModel * model = &call->getData("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("call-model")); @@ -515,7 +518,7 @@ void CallsListModel::addDummyCall () { } void CallsListModel::removeCall (const shared_ptr &call) { - CallModel *callModel; + CallModel *callModel = nullptr; try { callModel = &call->getData("call-model"); @@ -525,14 +528,12 @@ void CallsListModel::removeCall (const shared_ptr &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) { diff --git a/linphone-app/ui/views/App/Calls/Incall.qml b/linphone-app/ui/views/App/Calls/Incall.qml index 206e31e2d..ffc761780 100644 --- a/linphone-app/ui/views/App/Calls/Incall.qml +++ b/linphone-app/ui/views/App/Calls/Incall.qml @@ -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