summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2019-03-16 13:09:28 -0400
committerGitHub <noreply@github.com>2019-03-16 13:09:28 -0400
commit7acefe8a289e691517412a7b79ef3bbfd1acb26d (patch)
treee22ce00af9d1fcdbbaf333bac700977451573357 /Source/Core
parenta40b5f913396181e384095df98c7c43757b14c75 (diff)
parente64b6d27c867ffcae55bc9e9940f4940ce8bd608 (diff)
Merge pull request #7898 from spycrab/qt_netplay_empty_chat
Qt/NetPlayDialog: Prevent players from sending empty chat messages
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
index 2327161009..f400ef37e2 100644
--- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
+++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
@@ -210,6 +210,8 @@ void NetPlayDialog::CreateChatLayout()
m_chat_type_edit = new QLineEdit;
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->setAutoDefault(false);
@@ -285,6 +287,8 @@ void NetPlayDialog::ConnectWidgets()
// Chat
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::textChanged, this,
+ [this] { m_chat_send_button->setEnabled(!m_chat_type_edit->text().isEmpty()); });
// Other
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
@@ -355,6 +359,10 @@ void NetPlayDialog::OnChat()
{
QueueOnObject(this, [this] {
auto msg = m_chat_type_edit->text().toStdString();
+
+ if (msg.empty())
+ return;
+
Settings::Instance().GetNetPlayClient()->SendChatMessage(msg);
m_chat_type_edit->clear();