Qt: Use ModalMessageBox everywhere

This commit is contained in:
spycrab
2019-03-04 20:49:00 +01:00
parent d1cb79f644
commit 70da86f1c3
31 changed files with 244 additions and 298 deletions

View File

@ -16,7 +16,6 @@
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QMessageBox>
#include <QProgressDialog>
#include <QPushButton>
#include <QSignalBlocker>
@ -48,6 +47,7 @@
#include "DolphinQt/NetPlay/MD5Dialog.h"
#include "DolphinQt/NetPlay/PadMappingDialog.h"
#include "DolphinQt/QtUtils/FlowLayout.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/QtUtils/RunOnObject.h"
#include "DolphinQt/Resources.h"
@ -383,15 +383,15 @@ void NetPlayDialog::OnStart()
{
if (!Settings::Instance().GetNetPlayClient()->DoAllPlayersHaveGame())
{
if (QMessageBox::question(this, tr("Warning"),
tr("Not all players have the game. Do you really want to start?")) ==
QMessageBox::No)
if (ModalMessageBox::question(
this, tr("Warning"),
tr("Not all players have the game. Do you really want to start?")) == QMessageBox::No)
return;
}
if (m_strict_settings_sync_box->isChecked() && Config::Get(Config::GFX_EFB_SCALE) == 0)
{
QMessageBox::critical(
ModalMessageBox::critical(
this, tr("Error"),
tr("Auto internal resolution is not allowed in strict sync mode, as it depends on window "
"size.\n\nPlease select a specific internal resolution."));
@ -491,8 +491,8 @@ void NetPlayDialog::OnStart()
void NetPlayDialog::reject()
{
if (QMessageBox::question(this, tr("Confirmation"),
tr("Are you sure you want to quit NetPlay?")) == QMessageBox::Yes)
if (ModalMessageBox::question(this, tr("Confirmation"),
tr("Are you sure you want to quit NetPlay?")) == QMessageBox::Yes)
{
QDialog::reject();
}
@ -922,8 +922,8 @@ void NetPlayDialog::OnConnectionLost()
void NetPlayDialog::OnConnectionError(const std::string& message)
{
QueueOnObject(this, [this, message] {
QMessageBox::critical(this, tr("Error"),
tr("Failed to connect to server: %1").arg(tr(message.c_str())));
ModalMessageBox::critical(this, tr("Error"),
tr("Failed to connect to server: %1").arg(tr(message.c_str())));
});
}
@ -933,12 +933,12 @@ void NetPlayDialog::OnTraversalError(TraversalClient::FailureReason error)
switch (error)
{
case TraversalClient::FailureReason::BadHost:
QMessageBox::critical(this, tr("Traversal Error"), tr("Couldn't look up central server"));
ModalMessageBox::critical(this, tr("Traversal Error"), tr("Couldn't look up central server"));
QDialog::reject();
break;
case TraversalClient::FailureReason::VersionTooOld:
QMessageBox::critical(this, tr("Traversal Error"),
tr("Dolphin is too old for traversal server"));
ModalMessageBox::critical(this, tr("Traversal Error"),
tr("Dolphin is too old for traversal server"));
QDialog::reject();
break;
case TraversalClient::FailureReason::ServerForgotAboutUs:

View File

@ -11,7 +11,6 @@
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QMessageBox>
#include <QPushButton>
#include <QSignalBlocker>
#include <QSpinBox>
@ -20,6 +19,7 @@
#include "Core/Config/NetplaySettings.h"
#include "DolphinQt/GameList/GameListModel.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h"
NetPlaySetupDialog::NetPlaySetupDialog(QWidget* parent)
@ -269,7 +269,7 @@ void NetPlaySetupDialog::accept()
auto items = m_host_games->selectedItems();
if (items.empty())
{
QMessageBox::critical(this, tr("Error"), tr("You must select a game to host!"));
ModalMessageBox::critical(this, tr("Error"), tr("You must select a game to host!"));
return;
}
@ -310,7 +310,7 @@ void NetPlaySetupDialog::ResetTraversalHost()
Config::SetBaseOrCurrent(Config::NETPLAY_TRAVERSAL_PORT,
Config::NETPLAY_TRAVERSAL_PORT.default_value);
QMessageBox::information(
ModalMessageBox::information(
this, tr("Reset Traversal Server"),
tr("Reset Traversal Server to %1:%2")
.arg(QString::fromStdString(Config::NETPLAY_TRAVERSAL_SERVER.default_value),