Permalink
Browse files

Qt/MD5Dialog: Fix pressing enter on NetPlay window causing dialog to …

…close
  • Loading branch information...
Techjar committed Aug 27, 2018
1 parent ea26ccb commit f1bc17ab9ea69a3c041e79ed161f94c650600176
Showing with 22 additions and 1 deletion.
  1. +22 −1 Source/Core/DolphinQt/NetPlay/MD5Dialog.cpp
@@ -11,6 +11,7 @@
#include <QGroupBox>
#include <QLabel>
#include <QProgressBar>
#include <QPushButton>
#include <QVBoxLayout>
#include "Core/NetPlayClient.h"
@@ -49,7 +50,7 @@ void MD5Dialog::CreateWidgets()
m_main_layout = new QVBoxLayout;
m_progress_box = new QGroupBox;
m_progress_layout = new QVBoxLayout;
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
m_button_box = new QDialogButtonBox(QDialogButtonBox::NoButton);
m_check_label = new QLabel;
m_progress_box->setLayout(m_progress_layout);
@@ -90,6 +91,21 @@ void MD5Dialog::show(const QString& title)
if (!client)
return;
if (Settings::Instance().GetNetPlayServer())
{
m_button_box->setStandardButtons(QDialogButtonBox::Cancel);
QPushButton* cancel_button = m_button_box->button(QDialogButtonBox::Cancel);
cancel_button->setAutoDefault(false);
cancel_button->setDefault(false);
}
else
{
m_button_box->setStandardButtons(QDialogButtonBox::Close);
QPushButton* close_button = m_button_box->button(QDialogButtonBox::Close);
close_button->setAutoDefault(false);
close_button->setDefault(false);
}
for (const auto* player : client->GetPlayers())
{
m_progress_bars[player->pid] = new QProgressBar;
@@ -138,6 +154,11 @@ void MD5Dialog::SetResult(int pid, const std::string& result)
{
m_check_label->setText(tr("The hashes do not match!"));
}
m_button_box->setStandardButtons(QDialogButtonBox::Close);
QPushButton* close_button = m_button_box->button(QDialogButtonBox::Close);
close_button->setAutoDefault(false);
close_button->setDefault(false);
}
}

0 comments on commit f1bc17a

Please sign in to comment.