diff --git a/src/accountadapter.cpp b/src/accountadapter.cpp index 18477fd0f6b26dacf8906b42041c59976584842a..d05f58e1fe5543f76a7c10de0cc8f38e39ac33b7 100644 --- a/src/accountadapter.cpp +++ b/src/accountadapter.cpp @@ -246,7 +246,7 @@ AccountAdapter::startPreviewing(bool force) void AccountAdapter::stopPreviewing() { - if (!lrcInstance_->hasVideoCall() && lrcInstance_->renderer()->isPreviewing()) { + if (!lrcInstance_->hasActiveCall(true) && lrcInstance_->renderer()->isPreviewing()) { lrcInstance_->renderer()->stopPreviewing(); } } @@ -254,7 +254,7 @@ AccountAdapter::stopPreviewing() bool AccountAdapter::hasVideoCall() { - return lrcInstance_->hasVideoCall(); + return lrcInstance_->hasActiveCall(true); } bool diff --git a/src/calladapter.cpp b/src/calladapter.cpp index 9775f08616b32912351288c27e9d926ab72ae512..c631325048d7c52ec91a36415cf05f97ead6bbd2 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -86,6 +86,10 @@ CallAdapter::onAccountChanged() void CallAdapter::onCallStatusChanged(const QString& accountId, const QString& callId) { + // :/ one timer for all the call overlays + if (!lrcInstance_->hasActiveCall()) + oneSecondTimer_->stop(); + #ifdef Q_OS_LINUX auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId); auto& callModel = accInfo.callModel; @@ -119,6 +123,9 @@ CallAdapter::onCallStatusChanged(const QString& accountId, const QString& callId Utils::QImageToByteArray(contactPhoto)); } } +#else + Q_UNUSED(accountId) + Q_UNUSED(callId) #endif } @@ -420,6 +427,13 @@ CallAdapter::connectCallModel(const QString& accountId) { auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId); + QObject::connect( + oneSecondTimer_, + &QTimer::timeout, + this, + [this] { setTime(accountId_, convUid_); }, + Qt::UniqueConnection); + connect( accInfo.callModel.get(), &lrc::api::NewCallModel::onParticipantsChanged, @@ -573,9 +587,7 @@ void CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo) { setTime(accountId_, convUid_); - QObject::disconnect(oneSecondTimer_); - QObject::connect(oneSecondTimer_, &QTimer::timeout, [this] { setTime(accountId_, convUid_); }); - oneSecondTimer_->start(20); + oneSecondTimer_->start(1000); auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId_); auto* call = lrcInstance_->getCallInfoForConversation(convInfo); diff --git a/src/lrcinstance.cpp b/src/lrcinstance.cpp index e7c38fe5a5a4f427bcb0619e812435762808ca60..a3e951996973c92a3447be1f6b6d84df123c76e6 100644 --- a/src/lrcinstance.cpp +++ b/src/lrcinstance.cpp @@ -118,7 +118,7 @@ LRCInstance::getCurrentAccountInfo() } bool -LRCInstance::hasVideoCall() +LRCInstance::hasActiveCall(bool withVideo) { auto activeCalls = lrc_->activeCalls(); auto accountList = accountModel().getAccountList(); @@ -126,9 +126,14 @@ LRCInstance::hasVideoCall() for (const auto& callId : activeCalls) { for (const auto& accountId : accountList) { auto& accountInfo = accountModel().getAccountInfo(accountId); - if (accountInfo.callModel->hasCall(callId)) { - auto call = accountInfo.callModel->getCall(callId); - result |= !(call.isAudioOnly || call.videoMuted); + if (withVideo) { + if (accountInfo.callModel->hasCall(callId)) + return true; + } else { + if (accountInfo.callModel->hasCall(callId)) { + auto call = accountInfo.callModel->getCall(callId); + result |= !(call.isAudioOnly || call.videoMuted); + } } } } diff --git a/src/lrcinstance.h b/src/lrcinstance.h index 0532263ffeed1c4bebcbacf8d091a2b9547ff421..332725a1aa52548aab0305476992ecc94fcfd619 100644 --- a/src/lrcinstance.h +++ b/src/lrcinstance.h @@ -110,7 +110,7 @@ public: QString getContentDraft(const QString& convUid, const QString& accountId); void setContentDraft(const QString& convUid, const QString& accountId, const QString& content); - bool hasVideoCall(); + bool hasActiveCall(bool withVideo = false); void pushlastConference(const QString& confId, const QString& callId); QString poplastConference(const QString& confId); VectorString getConferenceSubcalls(const QString& callId); diff --git a/src/mainview/components/AudioCallPage.qml b/src/mainview/components/AudioCallPage.qml index b9fcbad00cb31a546da0d3a055cf5b6ab7c72f47..2cbc0b148c791cabb6e08bfbb4354bd05caa48a9 100644 --- a/src/mainview/components/AudioCallPage.qml +++ b/src/mainview/components/AudioCallPage.qml @@ -134,6 +134,10 @@ Rectangle { audioCallOverlay.showOnHoldImage(isPaused) audioCallPageRectCentralRect.visible = !isPaused } + + function onRemoteRecordingChanged(label, state) { + audioCallOverlay.showRemoteRecording(label, state) + } } onOverlayChatButtonClicked: { diff --git a/src/mainview/components/VideoCallPage.qml b/src/mainview/components/VideoCallPage.qml index f600f18faefedcfcf446afd552a160c61bf2c8f3..93617835dfb9eb191175d2f047e4d2aad5f8ddbd 100644 --- a/src/mainview/components/VideoCallPage.qml +++ b/src/mainview/components/VideoCallPage.qml @@ -179,7 +179,6 @@ Rectangle { function onUpdateTimeText(time) { videoCallOverlay.timeText = time - videoCallOverlay.setRecording(CallAdapter.isRecordingThisCall()) } function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted,