From 4b4bfde4faa947ba06fbe834626d74ef715ef46b Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Wed, 19 Dec 2018 09:53:22 -0500 Subject: [PATCH] videoview: move conversation connection to callwidget Fixes crash when no accounts are available, and reconnects signal when account changes. Change-Id: I3b71411bf3493c7831071c51c0b0d3fa30e92f76 --- callwidget.cpp | 6 ++++++ videoview.cpp | 20 ++++++-------------- videoview.h | 1 + 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/callwidget.cpp b/callwidget.cpp index f418d50..493de5a 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -1021,6 +1021,12 @@ CallWidget::connectConversationModel() currentConversationModel, &lrc::api::ConversationModel::newInteraction, [this](const std::string& convUid, uint64_t interactionId, const lrc::api::interaction::Info& interaction) { onIncomingMessage(convUid, interactionId, interaction); + if (interaction.type == lrc::api::interaction::Type::CALL) { + return; + } + if (convUid == selectedConvUid()) { + ui->videoWidget->simulateShowChatview(true); + } } ); interactionRemovedConnection_ = QObject::connect( diff --git a/videoview.cpp b/videoview.cpp index 9db5fb9..b083187 100644 --- a/videoview.cpp +++ b/videoview.cpp @@ -70,20 +70,6 @@ VideoView::VideoView(QWidget* parent) : emit this->setChatVisibility(visible); }); connect(overlay_, &VideoOverlay::videoCfgBtnClicked, [=](){emit videoSettingsClicked();}); - - - auto convModel = LRCInstance::getCurrentConversationModel(); - connect(convModel, &lrc::api::ConversationModel::newInteraction, - [this](const std::string& uid, uint64_t, lrc::api::interaction::Info info) { - if (info.type == lrc::api::interaction::Type::CALL) { - return; - } - auto selectedConvUid = LRCInstance::getSelectedConvUid(); - if (uid == selectedConvUid) { - overlay_->simulateShowChatview(true); - } - }); - } VideoView::~VideoView() @@ -189,6 +175,12 @@ VideoView::showChatviewIfToggled() emit setChatVisibility(overlay_->getShowChatView()); } +void +VideoView::simulateShowChatview(bool checked) +{ + overlay_->simulateShowChatview(true); +} + void VideoView::updateCall() { diff --git a/videoview.h b/videoview.h index ec71e88..f2f388c 100644 --- a/videoview.h +++ b/videoview.h @@ -43,6 +43,7 @@ public: ~VideoView(); void pushRenderer(const std::string& callUid); void showChatviewIfToggled(); + void simulateShowChatview(bool checked); protected: void resizeEvent(QResizeEvent* event); -- GitLab