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

@ -12,7 +12,6 @@
#include <QGroupBox>
#include <QInputDialog>
#include <QLabel>
#include <QMessageBox>
#include <QPushButton>
#include <QVBoxLayout>
@ -29,6 +28,7 @@
#include "Core/HW/GCMemcard/GCMemcard.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
enum
{
@ -216,10 +216,10 @@ void GameCubePane::OnConfigPressed(int slot)
if (!mc.IsValid())
{
QMessageBox::critical(this, tr("Error"),
tr("Cannot use that file as a memory card.\n%1\n"
"is not a valid GameCube memory card file")
.arg(filename));
ModalMessageBox::critical(this, tr("Error"),
tr("Cannot use that file as a memory card.\n%1\n"
"is not a valid GameCube memory card file")
.arg(filename));
return;
}
@ -237,7 +237,8 @@ void GameCubePane::OnConfigPressed(int slot)
if (path_abs == path_b)
{
QMessageBox::critical(this, tr("Error"), tr("The same file can't be used in both slots."));
ModalMessageBox::critical(this, tr("Error"),
tr("The same file can't be used in both slots."));
return;
}
}

View File

@ -11,7 +11,6 @@
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QMessageBox>
#include <QPushButton>
#include <QRadioButton>
#include <QSlider>
@ -25,6 +24,7 @@
#include "Core/Core.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h"
#include "UICommon/AutoUpdate.h"
@ -324,9 +324,8 @@ void GeneralPane::GenerateNewIdentity()
{
DolphinAnalytics::Instance()->GenerateNewIdentity();
DolphinAnalytics::Instance()->ReloadConfig();
QMessageBox message_box(this);
ModalMessageBox message_box(this);
message_box.setIcon(QMessageBox::Information);
message_box.setWindowModality(Qt::WindowModal);
message_box.setWindowTitle(tr("Identity Generation"));
message_box.setText(tr("New identity generated."));
message_box.exec();

View File

@ -10,7 +10,6 @@
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QWidget>
@ -24,6 +23,7 @@
#include "Core/ConfigManager.h"
#include "DolphinQt/GameList/GameListModel.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h"
#include "UICommon/GameFile.h"
@ -269,12 +269,9 @@ void InterfacePane::OnSaveConfig()
if (new_language != SConfig::GetInstance().m_InterfaceLanguage)
{
SConfig::GetInstance().m_InterfaceLanguage = new_language;
QMessageBox msg(QMessageBox::Information, tr("Restart Required"),
tr("You must restart Dolphin in order for the change to take effect."),
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::information(
this, tr("Restart Required"),
tr("You must restart Dolphin in order for the change to take effect."));
}
const bool use_covers = m_checkbox_use_covers->isChecked();

View File

@ -13,7 +13,6 @@
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QMessageBox>
#include <QPushButton>
#include <QTimer>
#include <QVBoxLayout>
@ -23,6 +22,7 @@
#include "Core/ConfigManager.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings/WiiPane.h"
#include "UICommon/USBUtils.h"
@ -129,9 +129,8 @@ void USBDeviceAddToWhitelistDialog::AddUSBDeviceToWhitelist()
if (!IsValidUSBIDString(vid_string))
{
// i18n: Here, VID means Vendor ID (for a USB device).
QMessageBox vid_warning_box(this);
ModalMessageBox vid_warning_box(this);
vid_warning_box.setIcon(QMessageBox::Warning);
vid_warning_box.setWindowModality(Qt::WindowModal);
vid_warning_box.setWindowTitle(tr("USB Whitelist Error"));
// i18n: Here, VID means Vendor ID (for a USB device).
vid_warning_box.setText(tr("The entered VID is invalid."));
@ -142,9 +141,8 @@ void USBDeviceAddToWhitelistDialog::AddUSBDeviceToWhitelist()
if (!IsValidUSBIDString(pid_string))
{
// i18n: Here, PID means Product ID (for a USB device).
QMessageBox pid_warning_box(this);
ModalMessageBox pid_warning_box(this);
pid_warning_box.setIcon(QMessageBox::Warning);
pid_warning_box.setWindowModality(Qt::WindowModal);
pid_warning_box.setWindowTitle(tr("USB Whitelist Error"));
// i18n: Here, PID means Product ID (for a USB device).
pid_warning_box.setText(tr("The entered PID is invalid."));
@ -158,12 +156,7 @@ void USBDeviceAddToWhitelistDialog::AddUSBDeviceToWhitelist()
if (SConfig::GetInstance().IsUSBDeviceWhitelisted({vid, pid}))
{
QMessageBox error_box(this);
error_box.setIcon(QMessageBox::Warning);
error_box.setWindowModality(Qt::WindowModal);
error_box.setWindowTitle(tr("USB Whitelist Error"));
error_box.setText(tr("This USB device is already whitelisted."));
error_box.exec();
ModalMessageBox::critical(this, tr("Error"), tr("This USB device is already whitelisted."));
return;
}
SConfig::GetInstance().m_usb_passthrough_devices.emplace(vid, pid);