Commit 60a3e631 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

callwidget: reset videooverlay when conversation changed from one to another

- keep the button state as the setting od the user
- set chatview close by default

Change-Id: Idd6d1c4f1173d7dbe23eda9008f7d2b1b70ef7db
parent 4e275bda
......@@ -645,8 +645,19 @@ void CallWidget::slotShowCallView(const std::string& accountId,
Q_UNUSED(convInfo);
qDebug() << "slotShowCallView";
setCallPanelVisibility(true);
auto callModel = LRCInstance::getCurrentCallModel();
if (callModel->hasCall(convInfo.callId)) {
auto call = callModel->getCall(convInfo.callId);
ui->videoWidget->resetVideoOverlay(call.audioMuted && (call.status != lrc::api::call::Status::PAUSED),
call.videoMuted && (call.status != lrc::api::call::Status::PAUSED) && (!call.isAudioOnly),
callModel->isRecording(convInfo.callId),
call.status == lrc::api::call::Status::PAUSED);
} else {
ui->videoWidget->resetVideoOverlay(false, false, false, false);
}
ui->callStackWidget->setCurrentWidget(ui->videoPage);
ui->videoWidget->showChatviewIfToggled();
hideMiniSpinner();
ui->videoWidget->pushRenderer(convInfo.callId);
}
......
......@@ -155,6 +155,23 @@ oneShotConnect( const typename QtPrivate::FunctionPointer<Func1>::Object* sender
});
}
template<class T>
class Blocker {
T *blocked;
bool previous;
public:
Blocker(T *blocked)
: blocked(blocked),
previous(blocked->blockSignals(true)) {}
~Blocker() { blocked->blockSignals(previous); }
T *operator->() { return blocked; }
};
template<class T>
inline Blocker<T> whileBlocking(T *blocked) {
return Blocker<T>(blocked);
}
template<typename T>
void
setElidedText(T* object, const QString &text, Qt::TextElideMode mode = Qt::ElideMiddle, int padding = 32) {
......
......@@ -175,3 +175,14 @@ VideoOverlay::on_recButton_clicked()
callModel->toggleAudioRecord(callId_);
}
}
void
VideoOverlay::resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding)
{
// Block the signals of buttons
Utils::whileBlocking(ui->noMicButton)->setChecked(isAudioMuted);
Utils::whileBlocking(ui->noVideoButton)->setChecked(isVideoMuted);
Utils::whileBlocking(ui->recButton)->setChecked(isRecording);
Utils::whileBlocking(ui->holdButton)->setChecked(isHolding);
Utils::whileBlocking(ui->onHoldLabel)->setVisible(isHolding);
}
......@@ -45,6 +45,7 @@ public:
bool shouldShowOverlay();
void simulateShowChatview(bool checked);
bool getShowChatView();
void resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding);
//UI SLOTS
private slots:
......
......@@ -171,12 +171,6 @@ VideoView::slotCallStatusChanged(const std::string& callId)
QObject::disconnect(timerConnection_);
}
void
VideoView::showChatviewIfToggled()
{
emit setChatVisibility(overlay_->getShowChatView());
}
void
VideoView::simulateShowChatview(bool checked)
{
......@@ -432,3 +426,9 @@ VideoView::mouseMoveEvent(QMouseEvent* event)
and geometry().contains(event->pos()))
previewRect.setBottomRight(event->pos());
}
void
VideoView::resetVideoOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding)
{
emit overlay_->setChatVisibility(false);
overlay_->resetOverlay(isAudioMuted, isVideoMuted, isRecording, isHolding);
}
......@@ -37,8 +37,8 @@ public:
explicit VideoView(QWidget* parent = 0);
~VideoView();
void pushRenderer(const std::string& callUid);
void showChatviewIfToggled();
void simulateShowChatview(bool checked);
void resetVideoOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding);
protected:
void resizeEvent(QResizeEvent* event);
......
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