Browse Source

fix: Correct display the call confirm window (CallConfirmWidget)

With an incoming call, the confirmation window (CallConfirmWidget) is only displayed
when the caller is on the active tab. In other cases, the call confirmation window
is not displayed, as a result, the call cannot be answered.
The problem is manifested in Kubuntu 14.04 and Ubuntu 16.04 MATE (Qt 5.6.3/5.9.3)
reviewable/pr4886/r2
Pavel Karelin 8 years ago
parent
commit
f4fe343eca
  1. 9
      src/widget/chatformheader.cpp
  2. 3
      src/widget/chatformheader.h
  3. 3
      src/widget/form/chatform.cpp
  4. 1
      src/widget/form/genericchatform.cpp

9
src/widget/chatformheader.cpp

@ -199,15 +199,20 @@ void ChatFormHeader::showOutgoingCall(bool video) @@ -199,15 +199,20 @@ void ChatFormHeader::showOutgoingCall(bool video)
updateButtonsView();
}
void ChatFormHeader::showCallConfirm(bool video)
void ChatFormHeader::createCallConfirm(bool video)
{
QWidget* btn = video ? videoButton : callButton;
callConfirm = std::unique_ptr<CallConfirmWidget>(new CallConfirmWidget(btn));
callConfirm->show();
connect(callConfirm.get(), &CallConfirmWidget::accepted, this, &ChatFormHeader::callAccepted);
connect(callConfirm.get(), &CallConfirmWidget::rejected, this, &ChatFormHeader::callRejected);
}
void ChatFormHeader::showCallConfirm()
{
if (callConfirm && !callConfirm->isVisible())
callConfirm->show();
}
void ChatFormHeader::removeCallConfirm()
{
callConfirm.reset(nullptr);

3
src/widget/chatformheader.h

@ -60,7 +60,8 @@ public: @@ -60,7 +60,8 @@ public:
void setMode(Mode mode);
void showOutgoingCall(bool video);
void showCallConfirm(bool video);
void createCallConfirm(bool video);
void showCallConfirm();
void removeCallConfirm();
void updateCallButtons(bool online, bool audio, bool video = false);

3
src/widget/form/chatform.cpp

@ -346,7 +346,8 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video) @@ -346,7 +346,8 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video)
Q_ARG(uint32_t, friendId), Q_ARG(bool, video));
onAvStart(friendId, video);
} else {
headWidget->showCallConfirm(video);
headWidget->createCallConfirm(video);
headWidget->showCallConfirm();
lastCallIsVideo = video;
auto msg = ChatMessage::createChatInfoMessage(tr("%1 calling").arg(displayedName),
ChatMessage::INFO, QDateTime::currentDateTime());

1
src/widget/form/genericchatform.cpp

@ -285,6 +285,7 @@ void GenericChatForm::show(ContentLayout* contentLayout) @@ -285,6 +285,7 @@ void GenericChatForm::show(ContentLayout* contentLayout)
void GenericChatForm::showEvent(QShowEvent*)
{
msgEdit->setFocus();
headWidget->showCallConfirm();
}
bool GenericChatForm::event(QEvent* e)

Loading…
Cancel
Save