diff --git a/src/calladapter.cpp b/src/calladapter.cpp index f8c6575c..adbaed90 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -307,6 +307,7 @@ CallAdapter::updateCall(const QString& convUid, const QString& accountId, bool f } updateCallOverlay(convInfo); + updateRecordingPeers(true); Q_EMIT previewVisibilityNeedToChange(shouldShowPreview(forceCallOnly)); } @@ -541,28 +542,40 @@ CallAdapter::connectCallModel(const QString& accountId) accInfo.callModel.get(), &lrc::api::NewCallModel::remoteRecordingChanged, this, - [this](const QString& callId, const QSet& peerRec, bool state) { + [this](const QString& callId, const QSet&, bool) { const auto currentCallId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_); - if (callId == currentCallId) { - const auto& accInfo = lrcInstance_->getCurrentAccountInfo(); - QStringList peers {}; - for (const auto& uri : peerRec) { - auto bestName = accInfo.contactModel->bestNameForContact(uri); - if (!bestName.isEmpty()) { - peers.append(bestName); - } - } - if (!peers.isEmpty()) { - Q_EMIT remoteRecordingChanged(peers, true); - } else if (!state) { - Q_EMIT remoteRecordingChanged(peers, false); - } - } + if (callId == currentCallId) + updateRecordingPeers(); }, Qt::UniqueConnection); } +void +CallAdapter::updateRecordingPeers(bool eraseLabelOnEmpty) +{ + const auto& convInfo = lrcInstance_->getConversationFromConvUid(convUid_); + auto* call = lrcInstance_->getCallInfoForConversation(convInfo); + if (!call) { + return; + } + + const auto& accInfo = lrcInstance_->getCurrentAccountInfo(); + QStringList peers {}; + for (const auto& uri : call->peerRec) { + auto bestName = accInfo.contactModel->bestNameForContact(uri); + if (!bestName.isEmpty()) { + peers.append(bestName); + } + } + if (!peers.isEmpty()) + Q_EMIT remoteRecordingChanged(peers, true); + else if (eraseLabelOnEmpty) + Q_EMIT eraseRemoteRecording(); + else + Q_EMIT remoteRecordingChanged(peers, false); +} + void CallAdapter::sipInputPanelPlayDTMF(const QString& key) { diff --git a/src/calladapter.h b/src/calladapter.h index 54b9625a..2c4a363d 100644 --- a/src/calladapter.h +++ b/src/calladapter.h @@ -97,6 +97,7 @@ Q_SIGNALS: bool isConferenceCall, const QString& bestName); void remoteRecordingChanged(const QStringList& peers, bool state); + void eraseRemoteRecording(); public Q_SLOTS: void onShowIncomingCallView(const QString& accountId, const QString& convUid); @@ -105,6 +106,7 @@ public Q_SLOTS: void onCallStatusChanged(const QString& accountId, const QString& callId); private: + void updateRecordingPeers(bool eraseLabelOnEmpty = false); bool shouldShowPreview(bool force); void showNotification(const QString& accountId, const QString& convUid); QJsonObject fillParticipantData(QMap participant); diff --git a/src/mainview/components/CallOverlay.qml b/src/mainview/components/CallOverlay.qml index c164cd0c..1c375c73 100644 --- a/src/mainview/components/CallOverlay.qml +++ b/src/mainview/components/CallOverlay.qml @@ -218,6 +218,12 @@ Rectangle { callOverlayRectMouseArea.entered() } + function resetRemoteRecording() { + remoteRecordingLabel = "" + callViewContextMenu.peerIsRecording = false + recordingRect.visible = callViewContextMenu.localIsRecording + } + anchors.fill: parent SipInputPanel { diff --git a/src/mainview/components/OngoingCallPage.qml b/src/mainview/components/OngoingCallPage.qml index 812c58ba..a549db80 100644 --- a/src/mainview/components/OngoingCallPage.qml +++ b/src/mainview/components/OngoingCallPage.qml @@ -208,6 +208,10 @@ Rectangle { function onRemoteRecordingChanged(label, state) { callOverlay.showRemoteRecording(label, state) } + + function onEraseRemoteRecording() { + callOverlay.resetRemoteRecording() + } } onOverlayChatButtonClicked: {