mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #7898 from spycrab/qt_netplay_empty_chat
Qt/NetPlayDialog: Prevent players from sending empty chat messages
This commit is contained in:
commit
7acefe8a28
@ -210,6 +210,8 @@ void NetPlayDialog::CreateChatLayout()
|
|||||||
m_chat_type_edit = new QLineEdit;
|
m_chat_type_edit = new QLineEdit;
|
||||||
m_chat_send_button = new QPushButton(tr("Send"));
|
m_chat_send_button = new QPushButton(tr("Send"));
|
||||||
|
|
||||||
|
// This button will get re-enabled when something gets entered into the chat box
|
||||||
|
m_chat_send_button->setEnabled(false);
|
||||||
m_chat_send_button->setDefault(false);
|
m_chat_send_button->setDefault(false);
|
||||||
m_chat_send_button->setAutoDefault(false);
|
m_chat_send_button->setAutoDefault(false);
|
||||||
|
|
||||||
@ -285,6 +287,8 @@ void NetPlayDialog::ConnectWidgets()
|
|||||||
// Chat
|
// Chat
|
||||||
connect(m_chat_send_button, &QPushButton::clicked, this, &NetPlayDialog::OnChat);
|
connect(m_chat_send_button, &QPushButton::clicked, this, &NetPlayDialog::OnChat);
|
||||||
connect(m_chat_type_edit, &QLineEdit::returnPressed, this, &NetPlayDialog::OnChat);
|
connect(m_chat_type_edit, &QLineEdit::returnPressed, this, &NetPlayDialog::OnChat);
|
||||||
|
connect(m_chat_type_edit, &QLineEdit::textChanged, this,
|
||||||
|
[this] { m_chat_send_button->setEnabled(!m_chat_type_edit->text().isEmpty()); });
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
@ -355,6 +359,10 @@ void NetPlayDialog::OnChat()
|
|||||||
{
|
{
|
||||||
QueueOnObject(this, [this] {
|
QueueOnObject(this, [this] {
|
||||||
auto msg = m_chat_type_edit->text().toStdString();
|
auto msg = m_chat_type_edit->text().toStdString();
|
||||||
|
|
||||||
|
if (msg.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
Settings::Instance().GetNetPlayClient()->SendChatMessage(msg);
|
Settings::Instance().GetNetPlayClient()->SendChatMessage(msg);
|
||||||
m_chat_type_edit->clear();
|
m_chat_type_edit->clear();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user