mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(chatform): move onMessagesClicked, onSplitterMoved to ChatForm
These API are only relevant for NetCamView, which is only used by ChatForm.
This commit is contained in:
parent
4c816b1bff
commit
8d8e75b800
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user