Commit 2de13a70 authored by Ming Rui Zhang's avatar Ming Rui Zhang

videoview: fix the issue where avatar does not hide when call is on hold

Change-Id: Ia9b6909ce2f41906127cf5edb0c785bf1e6c9fea
parent 5186b079
...@@ -56,7 +56,7 @@ CallAudioOnlyAvatarOverlay::writeAvatarOverlay(const lrc::api::conversation::Inf ...@@ -56,7 +56,7 @@ CallAudioOnlyAvatarOverlay::writeAvatarOverlay(const lrc::api::conversation::Inf
} }
void void
CallAudioOnlyAvatarOverlay::respondToPauseLabel(bool pauseButtonDisplayed) CallAudioOnlyAvatarOverlay::respondToPauseLabel(bool isPaused)
{ {
setAvatarVisible(!pauseButtonDisplayed); setAvatarVisible(!isPaused);
} }
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
~CallAudioOnlyAvatarOverlay(); ~CallAudioOnlyAvatarOverlay();
void setAvatarVisible(bool visible); void setAvatarVisible(bool visible);
void writeAvatarOverlay(const lrc::api::conversation::Info& convInfo); void writeAvatarOverlay(const lrc::api::conversation::Info& convInfo);
void respondToPauseLabel(bool pauseButtonDisplayed); void respondToPauseLabel(bool isPaused);
private: private:
Ui::CallAudioOnlyAvatarOverlay *ui; Ui::CallAudioOnlyAvatarOverlay *ui;
......
...@@ -191,19 +191,15 @@ VideoOverlay::on_chatButton_toggled(bool checked) ...@@ -191,19 +191,15 @@ VideoOverlay::on_chatButton_toggled(bool checked)
void void
VideoOverlay::on_holdButton_toggled(bool checked) VideoOverlay::on_holdButton_toggled(bool checked)
{ {
// why is 'checked' unused?
Q_UNUSED(checked); Q_UNUSED(checked);
auto callId = LRCInstance::getCallIdForConversationUid(convUid_, accountId_); auto callId = LRCInstance::getCallIdForConversationUid(convUid_, accountId_);
if (callId.isEmpty() || !LRCInstance::getCurrentCallModel()->hasCall(callId)) { if (callId.isEmpty() || !LRCInstance::getCurrentCallModel()->hasCall(callId)) {
return; return;
} }
auto callModel = LRCInstance::getCurrentCallModel(); auto callModel = LRCInstance::getCurrentCallModel();
bool onHold { false };
if (callModel->hasCall(callId)) { if (callModel->hasCall(callId)) {
callModel->togglePause(callId); callModel->togglePause(callId);
onHold = callModel->getCall(callId).status == lrc::api::call::Status::PAUSED;
} }
ui->onHoldLabel->setVisible(onHold);
} }
void void
......
...@@ -55,7 +55,6 @@ public: ...@@ -55,7 +55,6 @@ public:
signals: signals:
void setChatVisibility(bool visible); void setChatVisibility(bool visible);
void holdStateChanged(bool state);
void videoMuteStateChanged(bool state); void videoMuteStateChanged(bool state);
private: private:
......
...@@ -304,8 +304,9 @@ VideoView::updateCall(const QString& convUid, ...@@ -304,8 +304,9 @@ VideoView::updateCall(const QString& convUid,
} }
overlay_->updateCall(convInfo); overlay_->updateCall(convInfo);
auto isPaused = call->status == lrc::api::call::Status::PAUSED;
// TODO(atraczyk): this should be part of the overlay // TODO(atraczyk): this should be part of the overlay
audioOnlyAvatar_->setAvatarVisible(call->isAudioOnly); audioOnlyAvatar_->setAvatarVisible(call->isAudioOnly && !isPaused);
if (call->isAudioOnly) { if (call->isAudioOnly) {
audioOnlyAvatar_->writeAvatarOverlay(convInfo); audioOnlyAvatar_->writeAvatarOverlay(convInfo);
} }
...@@ -315,7 +316,6 @@ VideoView::updateCall(const QString& convUid, ...@@ -315,7 +316,6 @@ VideoView::updateCall(const QString& convUid,
// distant // distant
ui->distantWidget->setRendererId(call->id); ui->distantWidget->setRendererId(call->id);
auto isPaused = call->status == lrc::api::call::Status::PAUSED;
ui->distantWidget->setVisible(!isPaused); ui->distantWidget->setVisible(!isPaused);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment