From 3f8f1f1e25bc91897d5f59cf7af63177468fd5ce Mon Sep 17 00:00:00 2001 From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Tue, 2 Mar 2021 12:05:40 -0500 Subject: [PATCH] call: use callAdapter updateCall when setting up main view It is to make sure that all other call related UI will be set up correctly. Gitlab: #298 Change-Id: Iabc1587e0c0622cc6b9c0fecd99bfd35b156fcf7 --- src/calladapter.cpp | 8 ++++++-- src/mainview/MainView.qml | 2 +- src/utilsadapter.cpp | 8 -------- src/utilsadapter.h | 1 - 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/calladapter.cpp b/src/calladapter.cpp index 99bfd008e..0174a9cc6 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -207,7 +207,9 @@ CallAdapter::onShowCallView(const QString& accountId, const QString& convUid) if (convInfo.uid.isEmpty()) { return; } + updateCall(convInfo.uid, accountId); + emit callSetupMainViewRequired(accountId, convInfo.uid); } void @@ -226,7 +228,6 @@ CallAdapter::updateCall(const QString& convUid, const QString& accountId, bool f return; } - emit callSetupMainViewRequired(accountId_, convUid_); updateCallOverlay(convInfo); emit previewVisibilityNeedToChange(shouldShowPreview(forceCallOnly)); @@ -423,11 +424,14 @@ CallAdapter::connectCallModel(const QString& accountId) /* * Reset the call view corresponding accountId, uid. */ - lrcInstance_->setSelectedConvId(otherConv.uid); updateCall(otherConv.uid, otherConv.accountId, forceCallOnly); + + emit callSetupMainViewRequired(accountId, convInfo.uid); } } } + + return; } preventScreenSaver(false); break; diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml index 0a5ffa9db..35857a6f3 100644 --- a/src/mainview/MainView.qml +++ b/src/mainview/MainView.qml @@ -200,7 +200,7 @@ Rectangle { currentConvUID = currentUID if (callState === Call.Status.IN_PROGRESS || callState === Call.Status.PAUSED) { - UtilsAdapter.setCurrentCall(AccountAdapter.currentAccountId, currentUID) + CallAdapter.updateCall(currentUID, AccountAdapter.currentAccountId) if (isAudioOnly) callStackView.showAudioCallPage() else diff --git a/src/utilsadapter.cpp b/src/utilsadapter.cpp index d886a0f4e..f885a7b0b 100644 --- a/src/utilsadapter.cpp +++ b/src/utilsadapter.cpp @@ -189,14 +189,6 @@ UtilsAdapter::getAccountListSize() return getCurrAccList().size(); } -void -UtilsAdapter::setCurrentCall(const QString& accountId, const QString& convUid) -{ - auto& accInfo = lrcInstance_->getAccountInfo(accountId); - auto const& convInfo = lrcInstance_->getConversationFromConvUid(convUid, accountId); - accInfo.callModel->setCurrentCall(convInfo.callId); -} - bool UtilsAdapter::hasCall(const QString& accountId) { diff --git a/src/utilsadapter.h b/src/utilsadapter.h index 8d4fe6add..5eb3d29c1 100644 --- a/src/utilsadapter.h +++ b/src/utilsadapter.h @@ -58,7 +58,6 @@ public: Q_INVOKABLE void makePermanentCurrentConv(); Q_INVOKABLE const QStringList getCurrAccList(); Q_INVOKABLE int getAccountListSize(); - Q_INVOKABLE void setCurrentCall(const QString& accountId, const QString& convUid); Q_INVOKABLE bool hasCall(const QString& accountId); Q_INVOKABLE const QString getCallConvForAccount(const QString& accountId); Q_INVOKABLE const QString getCallId(const QString& accountId, const QString& convUid); -- GitLab