Skip to content

Commit

Permalink
Qt/MD5Dialog: Fix pressing enter on NetPlay window causing dialog to …
Browse files Browse the repository at this point in the history
…close
  • Loading branch information
Techjar committed Aug 27, 2018
1 parent ea26ccb commit f1bc17a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Source/Core/DolphinQt/NetPlay/MD5Dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <QGroupBox>
#include <QLabel>
#include <QProgressBar>
#include <QPushButton>
#include <QVBoxLayout>

#include "Core/NetPlayClient.h"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit f1bc17a

Please sign in to comment.