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); });
|
[this] { onAnswerCallTriggered(lastCallIsVideo); });
|
||||||
connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered);
|
connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered);
|
||||||
|
|
||||||
|
connect(bodySplitter, &QSplitter::splitterMoved, this, &ChatForm::onSplitterMoved);
|
||||||
|
|
||||||
updateCallButtons();
|
updateCallButtons();
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
@ -745,3 +747,24 @@ void ChatForm::hideNetcam()
|
||||||
delete netcam;
|
delete netcam;
|
||||||
netcam = nullptr;
|
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 onAvatarChanged(const ToxPk& friendPk, const QPixmap& pic);
|
||||||
void onFileNameChanged(const ToxPk& friendPk);
|
void onFileNameChanged(const ToxPk& friendPk);
|
||||||
void clearChatArea();
|
void clearChatArea();
|
||||||
|
void onShowMessagesClicked();
|
||||||
|
void onSplitterMoved(int pos, int index);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateFriendActivityForFile(const ToxFile& file);
|
void updateFriendActivityForFile(const ToxFile& file);
|
||||||
|
|
|
@ -297,7 +297,6 @@ GenericChatForm::GenericChatForm(const Contact* contact, IChatLog& chatLog,
|
||||||
msgEdit->setFrameStyle(QFrame::NoFrame);
|
msgEdit->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
bodySplitter = new QSplitter(Qt::Vertical, this);
|
bodySplitter = new QSplitter(Qt::Vertical, this);
|
||||||
connect(bodySplitter, &QSplitter::splitterMoved, this, &GenericChatForm::onSplitterMoved);
|
|
||||||
QWidget* contentWidget = new QWidget(this);
|
QWidget* contentWidget = new QWidget(this);
|
||||||
bodySplitter->addWidget(contentWidget);
|
bodySplitter->addWidget(contentWidget);
|
||||||
|
|
||||||
|
@ -866,24 +865,6 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
||||||
return false;
|
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()
|
void GenericChatForm::quoteSelectedText()
|
||||||
{
|
{
|
||||||
QString selectedText = chatWidget->getSelectedText();
|
QString selectedText = chatWidget->getSelectedText();
|
||||||
|
|
|
@ -106,8 +106,6 @@ protected slots:
|
||||||
void onSelectAllClicked();
|
void onSelectAllClicked();
|
||||||
void showFileMenu();
|
void showFileMenu();
|
||||||
void hideFileMenu();
|
void hideFileMenu();
|
||||||
void onShowMessagesClicked();
|
|
||||||
void onSplitterMoved(int pos, int index);
|
|
||||||
void quoteSelectedText();
|
void quoteSelectedText();
|
||||||
void copyLink();
|
void copyLink();
|
||||||
void onLoadHistory();
|
void onLoadHistory();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user