diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index a8728f1a1..87fd18e7a 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -179,6 +179,8 @@ ChatForm::ChatForm(Friend* chatFriend, IChatLog& chatLog, IMessageDispatcher& me [this] { onAnswerCallTriggered(lastCallIsVideo); }); connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered); + connect(bodySplitter, &QSplitter::splitterMoved, this, &ChatForm::onSplitterMoved); + updateCallButtons(); setAcceptDrops(true); @@ -745,3 +747,24 @@ void ChatForm::hideNetcam() delete netcam; netcam = nullptr; } + +void ChatForm::onSplitterMoved(int, int) +{ + if (netcam) { + netcam->setShowMessages(bodySplitter->sizes()[1] == 0); + } +} + +void ChatForm::onShowMessagesClicked() +{ + if (netcam) { + if (bodySplitter->sizes()[1] == 0) { + bodySplitter->setSizes({1, 1}); + } + else { + bodySplitter->setSizes({1, 0}); + } + + onSplitterMoved(0, 0); + } +} diff --git a/src/widget/form/chatform.h b/src/widget/form/chatform.h index 0dd024724..1a419bf3a 100644 --- a/src/widget/form/chatform.h +++ b/src/widget/form/chatform.h @@ -74,6 +74,8 @@ public slots: void onAvatarChanged(const ToxPk& friendPk, const QPixmap& pic); void onFileNameChanged(const ToxPk& friendPk); void clearChatArea(); + void onShowMessagesClicked(); + void onSplitterMoved(int pos, int index); private slots: void updateFriendActivityForFile(const ToxFile& file); diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 33e0af7aa..86c43270e 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -297,7 +297,6 @@ GenericChatForm::GenericChatForm(const Contact* contact, IChatLog& chatLog, msgEdit->setFrameStyle(QFrame::NoFrame); bodySplitter = new QSplitter(Qt::Vertical, this); - connect(bodySplitter, &QSplitter::splitterMoved, this, &GenericChatForm::onSplitterMoved); QWidget* contentWidget = new QWidget(this); bodySplitter->addWidget(contentWidget); @@ -866,24 +865,6 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event) return false; } -void GenericChatForm::onSplitterMoved(int, int) -{ - if (netcam) - netcam->setShowMessages(bodySplitter->sizes()[1] == 0); -} - -void GenericChatForm::onShowMessagesClicked() -{ - if (netcam) { - if (bodySplitter->sizes()[1] == 0) - bodySplitter->setSizes({1, 1}); - else - bodySplitter->setSizes({1, 0}); - - onSplitterMoved(0, 0); - } -} - void GenericChatForm::quoteSelectedText() { QString selectedText = chatWidget->getSelectedText(); diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index 3c3d451b2..e76cb7118 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -106,8 +106,6 @@ protected slots: void onSelectAllClicked(); void showFileMenu(); void hideFileMenu(); - void onShowMessagesClicked(); - void onSplitterMoved(int pos, int index); void quoteSelectedText(); void copyLink(); void onLoadHistory();