mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-01 12:43:30 +02:00
calls: fix call overlay updates
- don't query the recording state in the set time text function - change set time text function interval from 20ms to 1000ms - stop the account-wide time text update timer when there are no calls Change-Id: Iaaabfd52a50ba61aaabade59cae4f061c562cb2d
This commit is contained in:
parent
cc3931b36e
commit
cfa10ce268
6 changed files with 31 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -134,6 +134,10 @@ Rectangle {
|
|||
audioCallOverlay.showOnHoldImage(isPaused)
|
||||
audioCallPageRectCentralRect.visible = !isPaused
|
||||
}
|
||||
|
||||
function onRemoteRecordingChanged(label, state) {
|
||||
audioCallOverlay.showRemoteRecording(label, state)
|
||||
}
|
||||
}
|
||||
|
||||
onOverlayChatButtonClicked: {
|
||||
|
|
|
@ -179,7 +179,6 @@ Rectangle {
|
|||
|
||||
function onUpdateTimeText(time) {
|
||||
videoCallOverlay.timeText = time
|
||||
videoCallOverlay.setRecording(CallAdapter.isRecordingThisCall())
|
||||
}
|
||||
|
||||
function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted,
|
||||
|
|
Loading…
Add table
Reference in a new issue