1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #4886

Pavel Karelin (1):
      fix: Correct display the call confirm window (CallConfirmWidget)
This commit is contained in:
sudden6 2018-01-04 23:05:59 +01:00
commit ea6364ae02
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
4 changed files with 12 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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