Merge pull request #7849 from spycrab/qt_modal_again

Qt: Make every messagebox modal
This commit is contained in:
Mat M 2019-03-04 17:40:27 -05:00 committed by GitHub
commit 147f7ca321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 326 additions and 299 deletions

View File

@ -104,6 +104,7 @@ add_executable(dolphin-emu
QtUtils/DoubleClickEventFilter.cpp QtUtils/DoubleClickEventFilter.cpp
QtUtils/ElidedButton.cpp QtUtils/ElidedButton.cpp
QtUtils/FlowLayout.cpp QtUtils/FlowLayout.cpp
QtUtils/ModalMessageBox.cpp
QtUtils/ImageConverter.cpp QtUtils/ImageConverter.cpp
QtUtils/SignalDaemon.cpp QtUtils/SignalDaemon.cpp
QtUtils/WindowActivationEventFilter.cpp QtUtils/WindowActivationEventFilter.cpp

View File

@ -9,7 +9,6 @@
#include <QGridLayout> #include <QGridLayout>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QStringList> #include <QStringList>
#include <QTextEdit> #include <QTextEdit>
@ -17,6 +16,8 @@
#include "Core/ActionReplay.h" #include "Core/ActionReplay.h"
#include "Core/GeckoCodeConfig.h" #include "Core/GeckoCodeConfig.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
CheatCodeEditor::CheatCodeEditor(QWidget* parent) : QDialog(parent) CheatCodeEditor::CheatCodeEditor(QWidget* parent) : QDialog(parent)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -167,7 +168,7 @@ bool CheatCodeEditor::AcceptAR()
if (!good) if (!good)
{ {
auto result = QMessageBox::warning( auto result = ModalMessageBox::warning(
this, tr("Parsing Error"), this, tr("Parsing Error"),
tr("Unable to parse line %1 of the entered AR code as a valid " tr("Unable to parse line %1 of the entered AR code as a valid "
"encrypted or decrypted code. Make sure you typed it correctly.\n\n" "encrypted or decrypted code. Make sure you typed it correctly.\n\n"
@ -184,7 +185,7 @@ bool CheatCodeEditor::AcceptAR()
{ {
if (!entries.empty()) if (!entries.empty())
{ {
auto result = QMessageBox::warning( auto result = ModalMessageBox::warning(
this, tr("Invalid Mixed Code"), this, tr("Invalid Mixed Code"),
tr("This Action Replay code contains both encrypted and unencrypted lines; " tr("This Action Replay code contains both encrypted and unencrypted lines; "
"you should check that you have entered it correctly.\n\n" "you should check that you have entered it correctly.\n\n"
@ -213,8 +214,8 @@ bool CheatCodeEditor::AcceptAR()
if (entries.empty()) if (entries.empty())
{ {
QMessageBox::critical(this, tr("Error"), ModalMessageBox::critical(this, tr("Error"),
tr("The resulting decrypted AR code doesn't contain any lines.")); tr("The resulting decrypted AR code doesn't contain any lines."));
return false; return false;
} }
@ -253,13 +254,13 @@ bool CheatCodeEditor::AcceptGecko()
if (!good) if (!good)
{ {
auto result = auto result = ModalMessageBox::warning(
QMessageBox::warning(this, tr("Parsing Error"), this, tr("Parsing Error"),
tr("Unable to parse line %1 of the entered Gecko code as a valid " tr("Unable to parse line %1 of the entered Gecko code as a valid "
"code. Make sure you typed it correctly.\n\n" "code. Make sure you typed it correctly.\n\n"
"Would you like to ignore this line and continue parsing?") "Would you like to ignore this line and continue parsing?")
.arg(i + 1), .arg(i + 1),
QMessageBox::Ok | QMessageBox::Abort); QMessageBox::Ok | QMessageBox::Abort);
if (result == QMessageBox::Abort) if (result == QMessageBox::Abort)
return false; return false;
@ -277,8 +278,8 @@ bool CheatCodeEditor::AcceptGecko()
if (entries.empty()) if (entries.empty())
{ {
QMessageBox::critical(this, tr("Error"), ModalMessageBox::critical(this, tr("Error"),
tr("The resulting decrypted AR code doesn't contain any lines.")); tr("The resulting decrypted AR code doesn't contain any lines."));
return false; return false;
} }

View File

@ -14,7 +14,6 @@
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QRadioButton> #include <QRadioButton>
#include <QScreen> #include <QScreen>
@ -34,6 +33,7 @@
#include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h" #include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h" #include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/WrapInScrollArea.h" #include "DolphinQt/QtUtils/WrapInScrollArea.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -328,12 +328,9 @@ void ControllersWindow::OnBluetoothPassthroughResetPressed()
if (!ios) if (!ios)
{ {
QMessageBox error(this); ModalMessageBox::warning(
error.setIcon(QMessageBox::Warning); this, tr("Warning"),
error.setWindowModality(Qt::WindowModal); tr("Saved Wii Remote pairings can only be reset when a Wii game is running."));
error.setWindowTitle(tr("Warning"));
error.setText(tr("Saved Wii Remote pairings can only be reset when a Wii game is running."));
error.exec();
return; return;
} }
@ -350,12 +347,8 @@ void ControllersWindow::OnBluetoothPassthroughSyncPressed()
if (!ios) if (!ios)
{ {
QMessageBox error(this); ModalMessageBox::warning(this, tr("Warning"),
error.setIcon(QMessageBox::Warning); tr("A sync can only be triggered when a Wii game is running."));
error.setWindowModality(Qt::WindowModal);
error.setWindowTitle(tr("Warning"));
error.setText(tr("A sync can only be triggered when a Wii game is running."));
error.exec();
return; return;
} }

View File

@ -10,7 +10,6 @@
#include <QFileInfo> #include <QFileInfo>
#include <QHeaderView> #include <QHeaderView>
#include <QMenu> #include <QMenu>
#include <QMessageBox>
#include <QProgressDialog> #include <QProgressDialog>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QStyleFactory> #include <QStyleFactory>
@ -23,6 +22,7 @@
#include "DiscIO/Filesystem.h" #include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
@ -199,9 +199,10 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
return; return;
if (ExtractSystemData(partition, folder)) if (ExtractSystemData(partition, folder))
QMessageBox::information(this, tr("Success"), tr("Successfully extracted system data.")); ModalMessageBox::information(this, tr("Success"),
tr("Successfully extracted system data."));
else else
QMessageBox::critical(this, tr("Error"), tr("Failed to extract system data.")); ModalMessageBox::critical(this, tr("Error"), tr("Failed to extract system data."));
}); });
} }
@ -323,9 +324,9 @@ void FilesystemWidget::ExtractFile(const DiscIO::Partition& partition, const QSt
*m_volume, partition, filesystem->FindFileInfo(path.toStdString()).get(), out.toStdString()); *m_volume, partition, filesystem->FindFileInfo(path.toStdString()).get(), out.toStdString());
if (success) if (success)
QMessageBox::information(this, tr("Success"), tr("Successfully extracted file.")); ModalMessageBox::information(this, tr("Success"), tr("Successfully extracted file."));
else else
QMessageBox::critical(this, tr("Error"), tr("Failed to extract file.")); ModalMessageBox::critical(this, tr("Error"), tr("Failed to extract file."));
} }
void FilesystemWidget::CheckIntegrity(const DiscIO::Partition& partition) void FilesystemWidget::CheckIntegrity(const DiscIO::Partition& partition)
@ -348,10 +349,14 @@ void FilesystemWidget::CheckIntegrity(const DiscIO::Partition& partition)
dialog->close(); dialog->close();
if (is_valid.get()) if (is_valid.get())
QMessageBox::information(this, tr("Success"), {
tr("Integrity check completed. No errors have been found.")); ModalMessageBox::information(this, tr("Success"),
tr("Integrity check completed. No errors have been found."));
}
else else
QMessageBox::critical(this, tr("Error"), {
tr("Integrity check for partition failed. The disc image is most " ModalMessageBox::critical(this, tr("Error"),
"likely corrupted or has been patched incorrectly.")); tr("Integrity check for partition failed. The disc image is most "
"likely corrupted or has been patched incorrectly."));
}
} }

View File

@ -10,7 +10,6 @@
#include <QFile> #include <QFile>
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox>
#include <QScrollBar> #include <QScrollBar>
#include <QStringListModel> #include <QStringListModel>
#include <QTextCursor> #include <QTextCursor>
@ -20,6 +19,7 @@
#include <QWhatsThis> #include <QWhatsThis>
#include "DolphinQt/Config/GameConfigHighlighter.h" #include "DolphinQt/Config/GameConfigHighlighter.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
GameConfigEdit::GameConfigEdit(QWidget* parent, const QString& path, bool read_only) GameConfigEdit::GameConfigEdit(QWidget* parent, const QString& path, bool read_only)
: m_path(path), m_read_only(read_only) : m_path(path), m_read_only(read_only)
@ -122,14 +122,14 @@ void GameConfigEdit::SaveFile()
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
{ {
QMessageBox::warning(this, tr("Warning"), tr("Failed to open config file!")); ModalMessageBox::warning(this, tr("Warning"), tr("Failed to open config file!"));
return; return;
} }
const QByteArray contents = m_edit->toPlainText().toUtf8(); const QByteArray contents = m_edit->toPlainText().toUtf8();
if (file.write(contents) == -1) if (file.write(contents) == -1)
QMessageBox::warning(this, tr("Warning"), tr("Failed to write config file!")); ModalMessageBox::warning(this, tr("Warning"), tr("Failed to write config file!"));
} }
void GameConfigEdit::ConnectWidgets() void GameConfigEdit::ConnectWidgets()

13
Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp Executable file → Normal file
View File

@ -9,7 +9,6 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QListWidget> #include <QListWidget>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QTextEdit> #include <QTextEdit>
#include <QVBoxLayout> #include <QVBoxLayout>
@ -22,6 +21,7 @@
#include "DolphinQt/Config/CheatCodeEditor.h" #include "DolphinQt/Config/CheatCodeEditor.h"
#include "DolphinQt/Config/CheatWarningWidget.h" #include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "UICommon/GameFile.h" #include "UICommon/GameFile.h"
@ -255,13 +255,13 @@ void GeckoCodeWidget::DownloadCodes()
if (!success) if (!success)
{ {
QMessageBox::critical(this, tr("Error"), tr("Failed to download codes.")); ModalMessageBox::critical(this, tr("Error"), tr("Failed to download codes."));
return; return;
} }
if (codes.empty()) if (codes.empty())
{ {
QMessageBox::critical(this, tr("Error"), tr("File contained no codes.")); ModalMessageBox::critical(this, tr("Error"), tr("File contained no codes."));
return; return;
} }
@ -281,7 +281,8 @@ void GeckoCodeWidget::DownloadCodes()
UpdateList(); UpdateList();
SaveCodes(); SaveCodes();
QMessageBox::information(this, tr("Download complete"), ModalMessageBox::information(
tr("Downloaded %1 codes. (added %2)") this, tr("Download complete"),
.arg(QString::number(codes.size()), QString::number(added_count))); tr("Downloaded %1 codes. (added %2)")
.arg(QString::number(codes.size()), QString::number(added_count)));
} }

View File

@ -10,7 +10,6 @@
#include <QGroupBox> #include <QGroupBox>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QMessageBox>
#include <QRadioButton> #include <QRadioButton>
#include <QSignalBlocker> #include <QSignalBlocker>
#include <QVBoxLayout> #include <QVBoxLayout>
@ -23,6 +22,7 @@
#include "DolphinQt/Config/Graphics/GraphicsChoice.h" #include "DolphinQt/Config/Graphics/GraphicsChoice.h"
#include "DolphinQt/Config/Graphics/GraphicsRadio.h" #include "DolphinQt/Config/Graphics/GraphicsRadio.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
#include "UICommon/VideoUtils.h" #include "UICommon/VideoUtils.h"
@ -172,10 +172,9 @@ void GeneralWidget::SaveSettings()
{ {
if (current_backend == "Software Renderer") if (current_backend == "Software Renderer")
{ {
QMessageBox confirm_sw(this); ModalMessageBox confirm_sw(this);
confirm_sw.setIcon(QMessageBox::Warning); confirm_sw.setIcon(QMessageBox::Warning);
confirm_sw.setWindowModality(Qt::WindowModal);
confirm_sw.setStandardButtons(QMessageBox::Yes | QMessageBox::No); confirm_sw.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
confirm_sw.setWindowTitle(tr("Confirm backend change")); confirm_sw.setWindowTitle(tr("Confirm backend change"));
confirm_sw.setText(tr("The software renderer is significantly slower than other " confirm_sw.setText(tr("The software renderer is significantly slower than other "

View File

@ -10,7 +10,6 @@
#include <QAction> #include <QAction>
#include <QDateTime> #include <QDateTime>
#include <QMessageBox>
#include <QPainter> #include <QPainter>
#include <QTimer> #include <QTimer>
@ -23,6 +22,7 @@
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h" #include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
#include "InputCommon/ControllerInterface/Device.h" #include "InputCommon/ControllerInterface/Device.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
// Color constants to keep things looking consistent: // Color constants to keep things looking consistent:
@ -480,11 +480,9 @@ CalibrationWidget::CalibrationWidget(ControllerEmu::ReshapableInput& input,
if (*std::max_element(m_calibration_data.begin(), m_calibration_data.end()) > 0.5) if (*std::max_element(m_calibration_data.begin(), m_calibration_data.end()) > 0.5)
return; return;
QMessageBox msg(QMessageBox::Information, tr("Calibration"), ModalMessageBox::information(
tr("For best results please slowly move your input to all possible regions."), this, tr("Calibration"),
QMessageBox::Ok, this); tr("For best results please slowly move your input to all possible regions."));
msg.setWindowModality(Qt::WindowModal);
msg.exec();
}); });
m_informative_timer->setSingleShot(true); m_informative_timer->setSingleShot(true);
} }

View File

@ -9,7 +9,6 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QGroupBox> #include <QGroupBox>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QTabWidget> #include <QTabWidget>
#include <QVBoxLayout> #include <QVBoxLayout>
@ -36,6 +35,7 @@
#include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h" #include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuGeneral.h" #include "DolphinQt/Config/Mapping/WiimoteEmuGeneral.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h" #include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/WrapInScrollArea.h" #include "DolphinQt/QtUtils/WrapInScrollArea.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -161,19 +161,17 @@ void MappingWindow::OnDeleteProfilePressed()
if (!File::Exists(profile_path.toStdString())) if (!File::Exists(profile_path.toStdString()))
{ {
QMessageBox error(this); ModalMessageBox error(this);
error.setIcon(QMessageBox::Critical); error.setIcon(QMessageBox::Critical);
error.setWindowModality(Qt::WindowModal);
error.setWindowTitle(tr("Error")); error.setWindowTitle(tr("Error"));
error.setText(tr("The profile '%1' does not exist").arg(profile_name)); error.setText(tr("The profile '%1' does not exist").arg(profile_name));
error.exec(); error.exec();
return; return;
} }
QMessageBox confirm(this); ModalMessageBox confirm(this);
confirm.setIcon(QMessageBox::Warning); confirm.setIcon(QMessageBox::Warning);
confirm.setWindowModality(Qt::WindowModal);
confirm.setWindowTitle(tr("Confirm")); confirm.setWindowTitle(tr("Confirm"));
confirm.setText(tr("Are you sure that you want to delete '%1'?").arg(profile_name)); confirm.setText(tr("Are you sure that you want to delete '%1'?").arg(profile_name));
confirm.setInformativeText(tr("This cannot be undone!")); confirm.setInformativeText(tr("This cannot be undone!"));
@ -188,7 +186,7 @@ void MappingWindow::OnDeleteProfilePressed()
File::Delete(profile_path.toStdString()); File::Delete(profile_path.toStdString());
QMessageBox result(this); ModalMessageBox result(this);
result.setIcon(QMessageBox::Information); result.setIcon(QMessageBox::Information);
result.setWindowModality(Qt::WindowModal); result.setWindowModality(Qt::WindowModal);
result.setWindowTitle(tr("Success")); result.setWindowTitle(tr("Success"));

View File

@ -9,13 +9,13 @@
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QRadioButton> #include <QRadioButton>
#include <QScrollArea> #include <QScrollArea>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
NewPatchDialog::NewPatchDialog(QWidget* parent, PatchEngine::Patch& patch) NewPatchDialog::NewPatchDialog(QWidget* parent, PatchEngine::Patch& patch)
: QDialog(parent), m_patch(patch) : QDialog(parent), m_patch(patch)
@ -191,7 +191,7 @@ void NewPatchDialog::accept()
{ {
if (m_name_edit->text().isEmpty()) if (m_name_edit->text().isEmpty())
{ {
QMessageBox::critical(this, tr("Error"), tr("You have to enter a name.")); ModalMessageBox::critical(this, tr("Error"), tr("You have to enter a name."));
return; return;
} }
@ -206,7 +206,7 @@ void NewPatchDialog::accept()
if (!valid) if (!valid)
{ {
QMessageBox::critical( ModalMessageBox::critical(
this, tr("Error"), this, tr("Error"),
tr("Some values you provided are invalid.\nPlease check the highlighted values.")); tr("Some values you provided are invalid.\nPlease check the highlighted values."));
return; return;

View File

@ -11,7 +11,6 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QRadioButton> #include <QRadioButton>
#include <QScrollArea> #include <QScrollArea>
@ -27,6 +26,7 @@
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/Debugger/MemoryViewWidget.h" #include "DolphinQt/Debugger/MemoryViewWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent) MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent)
@ -399,13 +399,13 @@ void MemoryWidget::OnSetValue()
if (!good_address) if (!good_address)
{ {
QMessageBox::critical(this, tr("Error"), tr("Bad address provided.")); ModalMessageBox::critical(this, tr("Error"), tr("Bad address provided."));
return; return;
} }
if (m_data_edit->text().isEmpty()) if (m_data_edit->text().isEmpty())
{ {
QMessageBox::critical(this, tr("Error"), tr("No value provided.")); ModalMessageBox::critical(this, tr("Error"), tr("No value provided."));
return; return;
} }
@ -423,7 +423,7 @@ void MemoryWidget::OnSetValue()
if (!good_value) if (!good_value)
{ {
QMessageBox::critical(this, tr("Error"), tr("Bad value provided.")); ModalMessageBox::critical(this, tr("Error"), tr("Bad value provided."));
return; return;
} }
@ -455,7 +455,7 @@ static void DumpArray(const std::string& filename, const u8* data, size_t length
if (!f) if (!f)
{ {
QMessageBox::critical( ModalMessageBox::critical(
nullptr, QObject::tr("Error"), nullptr, QObject::tr("Error"),
QObject::tr("Failed to dump %1: Can't open file").arg(QString::fromStdString(filename))); QObject::tr("Failed to dump %1: Can't open file").arg(QString::fromStdString(filename)));
return; return;
@ -463,9 +463,9 @@ static void DumpArray(const std::string& filename, const u8* data, size_t length
if (!f.WriteBytes(data, length)) if (!f.WriteBytes(data, length))
{ {
QMessageBox::critical(nullptr, QObject::tr("Error"), ModalMessageBox::critical(nullptr, QObject::tr("Error"),
QObject::tr("Failed to dump %1: Failed to write to file") QObject::tr("Failed to dump %1: Failed to write to file")
.arg(QString::fromStdString(filename))); .arg(QString::fromStdString(filename)));
} }
} }

View File

@ -11,11 +11,11 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QRadioButton> #include <QRadioButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "DolphinQt/Debugger/BreakpointWidget.h" #include "DolphinQt/Debugger/BreakpointWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
NewBreakpointDialog::NewBreakpointDialog(BreakpointWidget* parent) NewBreakpointDialog::NewBreakpointDialog(BreakpointWidget* parent)
: QDialog(parent), m_parent(parent) : QDialog(parent), m_parent(parent)
@ -138,7 +138,8 @@ void NewBreakpointDialog::OnAddressTypeChanged()
void NewBreakpointDialog::accept() void NewBreakpointDialog::accept()
{ {
auto invalid_input = [this](QString field) { auto invalid_input = [this](QString field) {
QMessageBox::critical(this, tr("Error"), tr("Invalid input for the field \"%1\"").arg(field)); ModalMessageBox::critical(this, tr("Error"),
tr("Invalid input for the field \"%1\"").arg(field));
}; };
bool instruction = m_instruction_bp->isChecked(); bool instruction = m_instruction_bp->isChecked();

View File

@ -7,7 +7,7 @@
#include <cstring> #include <cstring>
#include <utility> #include <utility>
#include <QMessageBox> #include "DolphinQt/QtUtils/ModalMessageBox.h"
RegisterColumn::RegisterColumn(RegisterType type, std::function<u64()> get, RegisterColumn::RegisterColumn(RegisterType type, std::function<u64()> get,
std::function<void(u64)> set) std::function<void(u64)> set)
@ -84,7 +84,7 @@ void RegisterColumn::SetValue()
} }
if (!valid) if (!valid)
QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid input provided")); ModalMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid input provided"));
else else
m_set_register(value); m_set_register(value);

View File

@ -4,6 +4,12 @@
#include "DolphinQt/Debugger/WatchWidget.h" #include "DolphinQt/Debugger/WatchWidget.h"
#include <QHeaderView>
#include <QMenu>
#include <QTableWidget>
#include <QToolBar>
#include <QVBoxLayout>
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -11,16 +17,10 @@
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
#include <QHeaderView>
#include <QMenu>
#include <QMessageBox>
#include <QTableWidget>
#include <QToolBar>
#include <QVBoxLayout>
WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent) WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
{ {
// i18n: This kind of "watch" is used for watching emulated memory. // i18n: This kind of "watch" is used for watching emulated memory.
@ -306,7 +306,7 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item)
} }
else else
{ {
QMessageBox::critical(this, tr("Error"), tr("Invalid input provided")); ModalMessageBox::critical(this, tr("Error"), tr("Invalid input provided"));
} }
break; break;
} }

View File

@ -154,6 +154,7 @@
<QtMoc Include="QtUtils\DoubleClickEventFilter.h" /> <QtMoc Include="QtUtils\DoubleClickEventFilter.h" />
<QtMoc Include="QtUtils\ElidedButton.h" /> <QtMoc Include="QtUtils\ElidedButton.h" />
<QtMoc Include="QtUtils\FlowLayout.h" /> <QtMoc Include="QtUtils\FlowLayout.h" />
<QtMoc Include="QtUtils\ModalMessageBox.h" />
<QtMoc Include="QtUtils\WindowActivationEventFilter.h" /> <QtMoc Include="QtUtils\WindowActivationEventFilter.h" />
<QtMoc Include="QtUtils\WrapInScrollArea.h" /> <QtMoc Include="QtUtils\WrapInScrollArea.h" />
<QtMoc Include="RenderWidget.h" /> <QtMoc Include="RenderWidget.h" />
@ -245,6 +246,7 @@
<ClCompile Include="$(QtMocOutPrefix)MemoryViewWidget.cpp" /> <ClCompile Include="$(QtMocOutPrefix)MemoryViewWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MemoryWidget.cpp" /> <ClCompile Include="$(QtMocOutPrefix)MemoryWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" /> <ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ModalMessageBox.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NetPlayDialog.cpp" /> <ClCompile Include="$(QtMocOutPrefix)NetPlayDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NetPlaySetupDialog.cpp" /> <ClCompile Include="$(QtMocOutPrefix)NetPlaySetupDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NewBreakpointDialog.cpp" /> <ClCompile Include="$(QtMocOutPrefix)NewBreakpointDialog.cpp" />
@ -371,6 +373,7 @@
<ClCompile Include="QtUtils\ElidedButton.cpp" /> <ClCompile Include="QtUtils\ElidedButton.cpp" />
<ClCompile Include="QtUtils\FlowLayout.cpp" /> <ClCompile Include="QtUtils\FlowLayout.cpp" />
<ClCompile Include="QtUtils\ImageConverter.cpp" /> <ClCompile Include="QtUtils\ImageConverter.cpp" />
<ClCompile Include="QtUtils\ModalMessageBox.cpp" />
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" /> <ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" /> <ClCompile Include="QtUtils\WrapInScrollArea.cpp" />
<ClCompile Include="RenderWidget.cpp" /> <ClCompile Include="RenderWidget.cpp" />
@ -491,4 +494,4 @@
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" /> <Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" /> <Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target> </Target>
</Project> </Project>

View File

@ -10,7 +10,6 @@
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QListWidget> #include <QListWidget>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QSplitter> #include <QSplitter>
#include <QTextBrowser> #include <QTextBrowser>

View File

@ -10,7 +10,6 @@
#include <QGroupBox> #include <QGroupBox>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QSpinBox> #include <QSpinBox>
#include <QTabWidget> #include <QTabWidget>
@ -25,6 +24,7 @@
#include "Core/FifoPlayer/FifoRecorder.h" #include "Core/FifoPlayer/FifoRecorder.h"
#include "DolphinQt/FIFO/FIFOAnalyzer.h" #include "DolphinQt/FIFO/FIFOAnalyzer.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -205,10 +205,7 @@ void FIFOPlayerWindow::SaveRecording()
if (!result) if (!result)
{ {
QMessageBox msg(QMessageBox::Critical, tr("Error"), tr("Failed to save FIFO log."), ModalMessageBox::critical(this, tr("Error"), tr("Failed to save FIFO log."));
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
} }

View File

@ -15,7 +15,6 @@
#include <QImage> #include <QImage>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QPixmap> #include <QPixmap>
#include <QPushButton> #include <QPushButton>
#include <QTableWidget> #include <QTableWidget>
@ -27,6 +26,8 @@
#include "Core/HW/GCMemcard/GCMemcard.h" #include "Core/HW/GCMemcard/GCMemcard.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
constexpr u32 BANNER_WIDTH = 96; constexpr u32 BANNER_WIDTH = 96;
constexpr u32 ANIM_FRAME_WIDTH = 32; constexpr u32 ANIM_FRAME_WIDTH = 32;
constexpr u32 IMAGE_HEIGHT = 32; constexpr u32 IMAGE_HEIGHT = 32;
@ -306,10 +307,7 @@ void GCMemcardManager::ExportFiles(bool prompt)
QString text = count == 1 ? tr("Successfully exported the save file.") : QString text = count == 1 ? tr("Successfully exported the save file.") :
tr("Successfully exported the %1 save files.").arg(count); tr("Successfully exported the %1 save files.").arg(count);
QMessageBox msg(QMessageBox::Information, tr("Success"), text, QMessageBox::Ok, this); ModalMessageBox::information(this, tr("Success"), text);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
void GCMemcardManager::ExportAllFiles() void GCMemcardManager::ExportAllFiles()
@ -333,10 +331,7 @@ void GCMemcardManager::ImportFile()
if (result != SUCCESS) if (result != SUCCESS)
{ {
QMessageBox msg(QMessageBox::Critical, tr("Import failed"), ModalMessageBox::critical(this, tr("Import failed"), tr("Failed to import \"%1\".").arg(path));
tr("Failed to import \"%1\".").arg(path), QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
return; return;
} }
@ -362,10 +357,7 @@ void GCMemcardManager::CopyFiles()
if (result != SUCCESS) if (result != SUCCESS)
{ {
QMessageBox msg(QMessageBox::Warning, tr("Copy failed"), tr("Failed to copy file"), ModalMessageBox::warning(this, tr("Copy failed"), tr("Failed to copy file"));
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
} }
@ -391,11 +383,8 @@ void GCMemcardManager::DeleteFiles()
QString text = count == 1 ? tr("Do you want to delete the selected save file?") : QString text = count == 1 ? tr("Do you want to delete the selected save file?") :
tr("Do you want to delete the %1 selected save files?").arg(count); tr("Do you want to delete the %1 selected save files?").arg(count);
QMessageBox msg(QMessageBox::Warning, tr("Question"), text, auto response = ModalMessageBox::question(this, tr("Question"), text);
QMessageBox::Yes | QMessageBox::Abort, this); ;
msg.setWindowModality(Qt::WindowModal);
auto response = msg.exec();
if (response == QMessageBox::Abort) if (response == QMessageBox::Abort)
return; return;
@ -412,10 +401,7 @@ void GCMemcardManager::DeleteFiles()
{ {
if (memcard->RemoveFile(file_index) != SUCCESS) if (memcard->RemoveFile(file_index) != SUCCESS)
{ {
QMessageBox msg(QMessageBox::Warning, tr("Remove failed"), tr("Failed to remove file"), ModalMessageBox::warning(this, tr("Remove failed"), tr("Failed to remove file"));
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
} }
@ -425,10 +411,7 @@ void GCMemcardManager::DeleteFiles()
} }
else else
{ {
QMessageBox msg(QMessageBox::Information, tr("Success"), tr("Successfully deleted files."), ModalMessageBox::information(this, tr("Success"), tr("Successfully deleted files."));
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
UpdateSlotTable(m_active_slot); UpdateSlotTable(m_active_slot);

View File

@ -20,7 +20,6 @@
#include <QListView> #include <QListView>
#include <QMap> #include <QMap>
#include <QMenu> #include <QMenu>
#include <QMessageBox>
#include <QProgressDialog> #include <QProgressDialog>
#include <QShortcut> #include <QShortcut>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -44,6 +43,7 @@
#include "DolphinQt/GameList/ListProxyModel.h" #include "DolphinQt/GameList/ListProxyModel.h"
#include "DolphinQt/MenuBar.h" #include "DolphinQt/MenuBar.h"
#include "DolphinQt/QtUtils/DoubleClickEventFilter.h" #include "DolphinQt/QtUtils/DoubleClickEventFilter.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
#include "DolphinQt/WiiUpdate.h" #include "DolphinQt/WiiUpdate.h"
@ -442,19 +442,12 @@ void GameList::ExportWiiSave()
QString failed_str; QString failed_str;
for (const std::string& str : failed) for (const std::string& str : failed)
failed_str.append(QStringLiteral("\n")).append(QString::fromStdString(str)); failed_str.append(QStringLiteral("\n")).append(QString::fromStdString(str));
QMessageBox msg(QMessageBox::Critical, tr("Save Export"), ModalMessageBox::critical(this, tr("Save Export"),
tr("Failed to export the following save files:") + failed_str, QMessageBox::Ok, tr("Failed to export the following save files:") + failed_str);
this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
else else
{ {
QMessageBox msg(QMessageBox::Information, tr("Save Export"), ModalMessageBox::information(this, tr("Save Export"), tr("Successfully exported save files"));
tr("Successfully exported save files"), QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
} }
@ -493,9 +486,8 @@ void GameList::CompressISO(bool decompress)
if (!wii_warning_given && !decompress && file->GetPlatform() == DiscIO::Platform::WiiDisc) if (!wii_warning_given && !decompress && file->GetPlatform() == DiscIO::Platform::WiiDisc)
{ {
QMessageBox wii_warning(this); ModalMessageBox wii_warning(this);
wii_warning.setIcon(QMessageBox::Warning); wii_warning.setIcon(QMessageBox::Warning);
wii_warning.setWindowModality(Qt::WindowModal);
wii_warning.setWindowTitle(tr("Confirm")); wii_warning.setWindowTitle(tr("Confirm"));
wii_warning.setText(tr("Are you sure?")); wii_warning.setText(tr("Are you sure?"));
wii_warning.setInformativeText(tr( wii_warning.setInformativeText(tr(
@ -554,9 +546,8 @@ void GameList::CompressISO(bool decompress)
QFileInfo dst_info = QFileInfo(dst_path); QFileInfo dst_info = QFileInfo(dst_path);
if (dst_info.exists()) if (dst_info.exists())
{ {
QMessageBox confirm_replace(this); ModalMessageBox confirm_replace(this);
confirm_replace.setIcon(QMessageBox::Warning); confirm_replace.setIcon(QMessageBox::Warning);
confirm_replace.setWindowModality(Qt::WindowModal);
confirm_replace.setWindowTitle(tr("Confirm")); confirm_replace.setWindowTitle(tr("Confirm"));
confirm_replace.setText(tr("The file %1 already exists.\n" confirm_replace.setText(tr("The file %1 already exists.\n"
"Do you wish to replace it?") "Do you wish to replace it?")
@ -602,13 +593,10 @@ void GameList::CompressISO(bool decompress)
} }
} }
QMessageBox msg(QMessageBox::Information, tr("Success"), ModalMessageBox::information(this, tr("Success"),
decompress ? tr("Successfully decompressed %n image(s).", "", files.size()) : decompress ?
tr("Successfully compressed %n image(s).", "", files.size()), tr("Successfully decompressed %n image(s).", "", files.size()) :
QMessageBox::Ok, this); tr("Successfully compressed %n image(s).", "", files.size()));
msg.setWindowModality(Qt::WindowModal);
msg.exec();
} }
void GameList::InstallWAD() void GameList::InstallWAD()
@ -617,12 +605,11 @@ void GameList::InstallWAD()
if (!game) if (!game)
return; return;
QMessageBox result_dialog(this); ModalMessageBox result_dialog(this);
const bool success = WiiUtils::InstallWAD(game->GetFilePath()); const bool success = WiiUtils::InstallWAD(game->GetFilePath());
result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical); result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setWindowModality(Qt::WindowModal);
result_dialog.setWindowTitle(success ? tr("Success") : tr("Failure")); result_dialog.setWindowTitle(success ? tr("Success") : tr("Failure"));
result_dialog.setText(success ? tr("Successfully installed this title to the NAND.") : result_dialog.setText(success ? tr("Successfully installed this title to the NAND.") :
tr("Failed to install this title to the NAND.")); tr("Failed to install this title to the NAND."));
@ -635,10 +622,9 @@ void GameList::UninstallWAD()
if (!game) if (!game)
return; return;
QMessageBox warning_dialog(this); ModalMessageBox warning_dialog(this);
warning_dialog.setIcon(QMessageBox::Information); warning_dialog.setIcon(QMessageBox::Information);
warning_dialog.setWindowModality(Qt::WindowModal);
warning_dialog.setWindowTitle(tr("Confirm")); warning_dialog.setWindowTitle(tr("Confirm"));
warning_dialog.setText(tr("Uninstalling the WAD will remove the currently installed version of " warning_dialog.setText(tr("Uninstalling the WAD will remove the currently installed version of "
"this title from the NAND without deleting its save data. Continue?")); "this title from the NAND without deleting its save data. Continue?"));
@ -647,12 +633,11 @@ void GameList::UninstallWAD()
if (warning_dialog.exec() == QMessageBox::No) if (warning_dialog.exec() == QMessageBox::No)
return; return;
QMessageBox result_dialog(this); ModalMessageBox result_dialog(this);
const bool success = WiiUtils::UninstallTitle(game->GetTitleID()); const bool success = WiiUtils::UninstallTitle(game->GetTitleID());
result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical); result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setWindowModality(Qt::WindowModal);
result_dialog.setWindowTitle(success ? tr("Success") : tr("Failure")); result_dialog.setWindowTitle(success ? tr("Success") : tr("Failure"));
result_dialog.setText(success ? tr("Successfully removed this title from the NAND.") : result_dialog.setText(success ? tr("Successfully removed this title from the NAND.") :
tr("Failed to remove this title from the NAND.")); tr("Failed to remove this title from the NAND."));
@ -692,12 +677,10 @@ void GameList::OpenSaveFolder()
void GameList::DeleteFile() void GameList::DeleteFile()
{ {
QMessageBox confirm_dialog(this); ModalMessageBox confirm_dialog(this);
confirm_dialog.setIcon(QMessageBox::Warning); confirm_dialog.setIcon(QMessageBox::Warning);
confirm_dialog.setWindowModality(Qt::WindowModal);
confirm_dialog.setWindowTitle(tr("Confirm")); confirm_dialog.setWindowTitle(tr("Confirm"));
confirm_dialog.setWindowModality(Qt::WindowModal);
confirm_dialog.setText(tr("Are you sure you want to delete this file?")); confirm_dialog.setText(tr("Are you sure you want to delete this file?"));
confirm_dialog.setInformativeText(tr("This cannot be undone!")); confirm_dialog.setInformativeText(tr("This cannot be undone!"));
confirm_dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); confirm_dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
@ -718,10 +701,9 @@ void GameList::DeleteFile()
} }
else else
{ {
QMessageBox error_dialog(this); ModalMessageBox error_dialog(this);
error_dialog.setIcon(QMessageBox::Critical); error_dialog.setIcon(QMessageBox::Critical);
error_dialog.setWindowModality(Qt::WindowModal);
error_dialog.setWindowTitle(tr("Failure")); error_dialog.setWindowTitle(tr("Failure"));
error_dialog.setText(tr("Failed to delete the selected file.")); error_dialog.setText(tr("Failed to delete the selected file."));
error_dialog.setInformativeText(tr("Check whether you have the permissions required to " error_dialog.setInformativeText(tr("Check whether you have the permissions required to "

View File

@ -12,30 +12,33 @@
#include <OptionParser.h> #include <OptionParser.h>
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QObject> #include <QObject>
#include <QPushButton> #include <QPushButton>
#include <QWidget> #include <QWidget>
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Core/Analytics.h" #include "Core/Analytics.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DolphinQt/Host.h" #include "DolphinQt/Host.h"
#include "DolphinQt/MainWindow.h" #include "DolphinQt/MainWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/RunOnObject.h" #include "DolphinQt/QtUtils/RunOnObject.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
#include "DolphinQt/Translation.h" #include "DolphinQt/Translation.h"
#include "DolphinQt/Updater.h" #include "DolphinQt/Updater.h"
#include "UICommon/CommandLineParse.h" #include "UICommon/CommandLineParse.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no, MsgType style) static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no, MsgType style)
{ {
std::optional<bool> r = RunOnObject(QApplication::instance(), [&] { std::optional<bool> r = RunOnObject(QApplication::instance(), [&] {
QMessageBox message_box(QApplication::activeWindow()); ModalMessageBox message_box(QApplication::activeWindow());
message_box.setWindowTitle(QString::fromUtf8(caption)); message_box.setWindowTitle(QString::fromUtf8(caption));
message_box.setText(QString::fromUtf8(text)); message_box.setText(QString::fromUtf8(text));
@ -162,7 +165,7 @@ int main(int argc, char* argv[])
} }
else else
{ {
QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid title ID.")); ModalMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid title ID."));
} }
} }
else if (!args.empty()) else if (!args.empty())
@ -183,10 +186,9 @@ int main(int argc, char* argv[])
#if defined(USE_ANALYTICS) && USE_ANALYTICS #if defined(USE_ANALYTICS) && USE_ANALYTICS
if (!SConfig::GetInstance().m_analytics_permission_asked) if (!SConfig::GetInstance().m_analytics_permission_asked)
{ {
QMessageBox analytics_prompt(&win); ModalMessageBox analytics_prompt(&win);
analytics_prompt.setIcon(QMessageBox::Question); analytics_prompt.setIcon(QMessageBox::Question);
analytics_prompt.setWindowModality(Qt::WindowModal);
analytics_prompt.setStandardButtons(QMessageBox::Yes | QMessageBox::No); analytics_prompt.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
analytics_prompt.setWindowTitle(QObject::tr("Allow Usage Statistics Reporting")); analytics_prompt.setWindowTitle(QObject::tr("Allow Usage Statistics Reporting"));
analytics_prompt.setText( analytics_prompt.setText(

View File

@ -11,7 +11,6 @@
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo> #include <QFileInfo>
#include <QIcon> #include <QIcon>
#include <QMessageBox>
#include <QMimeData> #include <QMimeData>
#include <QProgressDialog> #include <QProgressDialog>
#include <QStackedWidget> #include <QStackedWidget>
@ -83,6 +82,7 @@
#include "DolphinQt/MenuBar.h" #include "DolphinQt/MenuBar.h"
#include "DolphinQt/NetPlay/NetPlayDialog.h" #include "DolphinQt/NetPlay/NetPlayDialog.h"
#include "DolphinQt/NetPlay/NetPlaySetupDialog.h" #include "DolphinQt/NetPlay/NetPlaySetupDialog.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/QtUtils/RunOnObject.h" #include "DolphinQt/QtUtils/RunOnObject.h"
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h" #include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
@ -142,7 +142,7 @@ static WindowSystemType GetWindowSystemType()
else if (platform_name == QStringLiteral("wayland")) else if (platform_name == QStringLiteral("wayland"))
return WindowSystemType::Wayland; return WindowSystemType::Wayland;
QMessageBox::critical( ModalMessageBox::critical(
nullptr, QStringLiteral("Error"), nullptr, QStringLiteral("Error"),
QString::asprintf("Unknown Qt platform: %s", platform_name.toStdString().c_str())); QString::asprintf("Unknown Qt platform: %s", platform_name.toStdString().c_str()));
return WindowSystemType::Headless; return WindowSystemType::Headless;
@ -227,16 +227,17 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
Settings::Instance().RefreshWidgetVisibility(); Settings::Instance().RefreshWidgetVisibility();
if (!ResourcePack::Init()) if (!ResourcePack::Init())
QMessageBox::critical(this, tr("Error"), tr("Error occured while loading some texture packs")); ModalMessageBox::critical(this, tr("Error"),
tr("Error occured while loading some texture packs"));
for (auto& pack : ResourcePack::GetPacks()) for (auto& pack : ResourcePack::GetPacks())
{ {
if (!pack.IsValid()) if (!pack.IsValid())
{ {
QMessageBox::critical(this, tr("Error"), ModalMessageBox::critical(this, tr("Error"),
tr("Invalid Pack %1 provided: %2") tr("Invalid Pack %1 provided: %2")
.arg(QString::fromStdString(pack.GetPath())) .arg(QString::fromStdString(pack.GetPath()))
.arg(QString::fromStdString(pack.GetError()))); .arg(QString::fromStdString(pack.GetError())));
return; return;
} }
} }
@ -759,13 +760,12 @@ bool MainWindow::RequestStop()
if (pause) if (pause)
Core::SetState(Core::State::Paused); Core::SetState(Core::State::Paused);
QMessageBox::StandardButton confirm; auto confirm = ModalMessageBox::question(
confirm = QMessageBox::question(this, tr("Confirm"), this, tr("Confirm"),
m_stop_requested ? m_stop_requested ? tr("A shutdown is already in progress. Unsaved data "
tr("A shutdown is already in progress. Unsaved data " "may be lost if you stop the current emulation "
"may be lost if you stop the current emulation " "before it completes. Force stop?") :
"before it completes. Force stop?") : tr("Do you want to stop the current emulation?"));
tr("Do you want to stop the current emulation?"));
if (confirm != QMessageBox::Yes) if (confirm != QMessageBox::Yes)
{ {
@ -908,7 +908,7 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
if (!BootManager::BootCore(std::move(parameters), if (!BootManager::BootCore(std::move(parameters),
GetWindowSystemInfo(m_render_widget->windowHandle()))) GetWindowSystemInfo(m_render_widget->windowHandle())))
{ {
QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok); ModalMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok);
HideRenderWidget(); HideRenderWidget();
return; return;
} }
@ -1231,7 +1231,7 @@ bool MainWindow::NetPlayJoin()
{ {
if (Core::IsRunning()) if (Core::IsRunning())
{ {
QMessageBox::critical( ModalMessageBox::critical(
nullptr, QObject::tr("Error"), nullptr, QObject::tr("Error"),
QObject::tr("Can't start a NetPlay Session while a game is still running!")); QObject::tr("Can't start a NetPlay Session while a game is still running!"));
return false; return false;
@ -1239,8 +1239,8 @@ bool MainWindow::NetPlayJoin()
if (m_netplay_dialog->isVisible()) if (m_netplay_dialog->isVisible())
{ {
QMessageBox::critical(nullptr, QObject::tr("Error"), ModalMessageBox::critical(nullptr, QObject::tr("Error"),
QObject::tr("A NetPlay Session is already in progress!")); QObject::tr("A NetPlay Session is already in progress!"));
return false; return false;
} }
@ -1302,7 +1302,7 @@ bool MainWindow::NetPlayHost(const QString& game_id)
{ {
if (Core::IsRunning()) if (Core::IsRunning())
{ {
QMessageBox::critical( ModalMessageBox::critical(
nullptr, QObject::tr("Error"), nullptr, QObject::tr("Error"),
QObject::tr("Can't start a NetPlay Session while a game is still running!")); QObject::tr("Can't start a NetPlay Session while a game is still running!"));
return false; return false;
@ -1310,8 +1310,8 @@ bool MainWindow::NetPlayHost(const QString& game_id)
if (m_netplay_dialog->isVisible()) if (m_netplay_dialog->isVisible())
{ {
QMessageBox::critical(nullptr, QObject::tr("Error"), ModalMessageBox::critical(nullptr, QObject::tr("Error"),
QObject::tr("A NetPlay Session is already in progress!")); QObject::tr("A NetPlay Session is already in progress!"));
return false; return false;
} }
@ -1334,7 +1334,7 @@ bool MainWindow::NetPlayHost(const QString& game_id)
if (!Settings::Instance().GetNetPlayServer()->is_connected) if (!Settings::Instance().GetNetPlayServer()->is_connected)
{ {
QMessageBox::critical( ModalMessageBox::critical(
nullptr, QObject::tr("Failed to open server"), nullptr, QObject::tr("Failed to open server"),
QObject::tr( QObject::tr(
"Failed to listen on port %1. Is another instance of the NetPlay server running?") "Failed to listen on port %1. Is another instance of the NetPlay server running?")
@ -1404,7 +1404,7 @@ void MainWindow::dropEvent(QDropEvent* event)
if (!file_info.exists() || !file_info.isReadable()) if (!file_info.exists() || !file_info.isReadable())
{ {
QMessageBox::critical(this, tr("Error"), tr("Failed to open '%1'").arg(path)); ModalMessageBox::critical(this, tr("Error"), tr("Failed to open '%1'").arg(path));
return; return;
} }
@ -1424,7 +1424,7 @@ void MainWindow::dropEvent(QDropEvent* event)
{ {
if (show_confirm) if (show_confirm)
{ {
if (QMessageBox::question( if (ModalMessageBox::question(
this, tr("Confirm"), this, tr("Confirm"),
tr("Do you want to add \"%1\" to the list of Game Paths?").arg(folder)) != tr("Do you want to add \"%1\" to the list of Game Paths?").arg(folder)) !=
QMessageBox::Yes) QMessageBox::Yes)
@ -1447,7 +1447,7 @@ void MainWindow::OnBootGameCubeIPL(DiscIO::Region region)
void MainWindow::OnImportNANDBackup() void MainWindow::OnImportNANDBackup()
{ {
auto response = QMessageBox::question( auto response = ModalMessageBox::question(
this, tr("Question"), this, tr("Question"),
tr("Merging a new NAND over your currently selected NAND will overwrite any channels " tr("Merging a new NAND over your currently selected NAND will overwrite any channels "
"and savegames that already exist. This process is not reversible, so it is " "and savegames that already exist. This process is not reversible, so it is "

View File

@ -12,7 +12,6 @@
#include <QFontDialog> #include <QFontDialog>
#include <QInputDialog> #include <QInputDialog>
#include <QMap> #include <QMap>
#include <QMessageBox>
#include <QUrl> #include <QUrl>
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
@ -49,6 +48,7 @@
#include "DolphinQt/AboutDialog.h" #include "DolphinQt/AboutDialog.h"
#include "DolphinQt/Host.h" #include "DolphinQt/Host.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
#include "DolphinQt/Updater.h" #include "DolphinQt/Updater.h"
@ -519,7 +519,7 @@ void MenuBar::InstallUpdateManually()
if (!updater->CheckForUpdate()) if (!updater->CheckForUpdate())
{ {
QMessageBox::information( ModalMessageBox::information(
this, tr("Update"), this, tr("Update"),
tr("You are running the latest version available on this update track.")); tr("You are running the latest version available on this update track."));
} }
@ -969,23 +969,18 @@ void MenuBar::InstallWAD()
if (wad_file.isEmpty()) if (wad_file.isEmpty())
return; return;
QMessageBox result_dialog(this); ModalMessageBox result_dialog(this);
if (WiiUtils::InstallWAD(wad_file.toStdString())) if (WiiUtils::InstallWAD(wad_file.toStdString()))
{ {
Settings::Instance().NANDRefresh(); Settings::Instance().NANDRefresh();
result_dialog.setIcon(QMessageBox::Information); ModalMessageBox::information(this, tr("Success"),
result_dialog.setWindowTitle(tr("Success")); tr("Successfully installed this title to the NAND."));
result_dialog.setText(tr("Successfully installed this title to the NAND."));
} }
else else
{ {
result_dialog.setIcon(QMessageBox::Critical); ModalMessageBox::critical(this, tr("Failure"), tr("Failed to install this title to the NAND."));
result_dialog.setWindowTitle(tr("Failure"));
result_dialog.setText(tr("Failed to install this title to the NAND."));
} }
result_dialog.exec();
} }
void MenuBar::ImportWiiSave() void MenuBar::ImportWiiSave()
@ -999,7 +994,7 @@ void MenuBar::ImportWiiSave()
bool cancelled = false; bool cancelled = false;
auto can_overwrite = [&] { auto can_overwrite = [&] {
bool yes = QMessageBox::question( bool yes = ModalMessageBox::question(
this, tr("Save Import"), this, tr("Save Import"),
tr("Save data for this title already exists in the NAND. Consider backing up " tr("Save data for this title already exists in the NAND. Consider backing up "
"the current data before overwriting.\nOverwrite now?")) == QMessageBox::Yes; "the current data before overwriting.\nOverwrite now?")) == QMessageBox::Yes;
@ -1007,9 +1002,9 @@ void MenuBar::ImportWiiSave()
return yes; return yes;
}; };
if (WiiSave::Import(file.toStdString(), can_overwrite)) if (WiiSave::Import(file.toStdString(), can_overwrite))
QMessageBox::information(this, tr("Save Import"), tr("Successfully imported save files.")); ModalMessageBox::information(this, tr("Save Import"), tr("Successfully imported save files."));
else if (!cancelled) else if (!cancelled)
QMessageBox::critical(this, tr("Save Import"), tr("Failed to import save files.")); ModalMessageBox::critical(this, tr("Save Import"), tr("Failed to import save files."));
} }
void MenuBar::ExportWiiSaves() void MenuBar::ExportWiiSaves()
@ -1021,8 +1016,8 @@ void MenuBar::ExportWiiSaves()
return; return;
const size_t count = WiiSave::ExportAll(export_dir.toStdString()); const size_t count = WiiSave::ExportAll(export_dir.toStdString());
QMessageBox::information(this, tr("Save Export"), ModalMessageBox::information(this, tr("Save Export"),
tr("Exported %n save(s)", "", static_cast<int>(count))); tr("Exported %n save(s)", "", static_cast<int>(count)));
} }
void MenuBar::CheckNAND() void MenuBar::CheckNAND()
@ -1031,7 +1026,7 @@ void MenuBar::CheckNAND()
WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios); WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios);
if (!result.bad) if (!result.bad)
{ {
QMessageBox::information(this, tr("NAND Check"), tr("No issues have been detected.")); ModalMessageBox::information(this, tr("NAND Check"), tr("No issues have been detected."));
return; return;
} }
@ -1075,30 +1070,30 @@ void MenuBar::CheckNAND()
.arg(QString::fromStdString(title_listings)); .arg(QString::fromStdString(title_listings));
} }
if (QMessageBox::question(this, tr("NAND Check"), message) != QMessageBox::Yes) if (ModalMessageBox::question(this, tr("NAND Check"), message) != QMessageBox::Yes)
return; return;
if (WiiUtils::RepairNAND(ios)) if (WiiUtils::RepairNAND(ios))
{ {
QMessageBox::information(this, tr("NAND Check"), tr("The NAND has been repaired.")); ModalMessageBox::information(this, tr("NAND Check"), tr("The NAND has been repaired."));
return; return;
} }
QMessageBox::critical(this, tr("NAND Check"), ModalMessageBox::critical(this, tr("NAND Check"),
tr("The NAND could not be repaired. It is recommended to back up " tr("The NAND could not be repaired. It is recommended to back up "
"your current data and start over with a fresh NAND.")); "your current data and start over with a fresh NAND."));
} }
void MenuBar::NANDExtractCertificates() void MenuBar::NANDExtractCertificates()
{ {
if (DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX))) if (DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)))
{ {
QMessageBox::information(this, tr("Success"), ModalMessageBox::information(this, tr("Success"),
tr("Successfully extracted certificates from NAND")); tr("Successfully extracted certificates from NAND"));
} }
else else
{ {
QMessageBox::critical(this, tr("Error"), tr("Failed to extract certificates from NAND")); ModalMessageBox::critical(this, tr("Error"), tr("Failed to extract certificates from NAND"));
} }
} }
@ -1133,9 +1128,9 @@ void MenuBar::ChangeDebugFont()
void MenuBar::ClearSymbols() void MenuBar::ClearSymbols()
{ {
auto result = QMessageBox::warning(this, tr("Confirmation"), auto result = ModalMessageBox::warning(this, tr("Confirmation"),
tr("Do you want to clear the list of symbol names?"), tr("Do you want to clear the list of symbol names?"),
QMessageBox::Yes | QMessageBox::Cancel); QMessageBox::Yes | QMessageBox::Cancel);
if (result == QMessageBox::Cancel) if (result == QMessageBox::Cancel)
return; return;
@ -1157,14 +1152,14 @@ void MenuBar::GenerateSymbolsFromSignatureDB()
if (db.Load(File::GetSysDirectory() + TOTALDB)) if (db.Load(File::GetSysDirectory() + TOTALDB))
{ {
db.Apply(&g_symbolDB); db.Apply(&g_symbolDB);
QMessageBox::information( ModalMessageBox::information(
this, tr("Information"), this, tr("Information"),
tr("Generated symbol names from '%1'").arg(QString::fromStdString(TOTALDB))); tr("Generated symbol names from '%1'").arg(QString::fromStdString(TOTALDB)));
db.List(); db.List();
} }
else else
{ {
QMessageBox::critical( ModalMessageBox::critical(
this, tr("Error"), this, tr("Error"),
tr("'%1' not found, no symbol names generated").arg(QString::fromStdString(TOTALDB))); tr("'%1' not found, no symbol names generated").arg(QString::fromStdString(TOTALDB)));
} }
@ -1180,7 +1175,7 @@ void MenuBar::GenerateSymbolsFromRSO()
if (!good) if (!good)
{ {
QMessageBox::warning(this, tr("Error"), tr("Invalid RSO module address: %1").arg(text)); ModalMessageBox::warning(this, tr("Error"), tr("Invalid RSO module address: %1").arg(text));
return; return;
} }
@ -1192,7 +1187,7 @@ void MenuBar::GenerateSymbolsFromRSO()
} }
else else
{ {
QMessageBox::warning(this, tr("Error"), tr("Failed to load RSO module at %1").arg(text)); ModalMessageBox::warning(this, tr("Error"), tr("Failed to load RSO module at %1").arg(text));
} }
} }
@ -1209,9 +1204,9 @@ void MenuBar::LoadSymbolMap()
if (db.Load(File::GetSysDirectory() + TOTALDB)) if (db.Load(File::GetSysDirectory() + TOTALDB))
db.Apply(&g_symbolDB); db.Apply(&g_symbolDB);
QMessageBox::warning(this, tr("Warning"), ModalMessageBox::warning(this, tr("Warning"),
tr("'%1' not found, scanning for common functions instead") tr("'%1' not found, scanning for common functions instead")
.arg(QString::fromStdString(writable_map_file))); .arg(QString::fromStdString(writable_map_file)));
} }
else else
{ {
@ -1220,8 +1215,8 @@ void MenuBar::LoadSymbolMap()
if (!TryLoadMapFile(existing_map_file_path)) if (!TryLoadMapFile(existing_map_file_path))
return; return;
QMessageBox::information(this, tr("Information"), ModalMessageBox::information(this, tr("Information"),
tr("Loaded symbols from '%1'").arg(existing_map_file_path)); tr("Loaded symbols from '%1'").arg(existing_map_file_path));
} }
HLE::PatchFunctions(); HLE::PatchFunctions();
@ -1292,7 +1287,7 @@ void MenuBar::SaveCode()
if (!g_symbolDB.SaveCodeMap(path)) if (!g_symbolDB.SaveCodeMap(path))
{ {
QMessageBox::warning( ModalMessageBox::warning(
this, tr("Error"), this, tr("Error"),
tr("Failed to save code map to path '%1'").arg(QString::fromStdString(path))); tr("Failed to save code map to path '%1'").arg(QString::fromStdString(path)));
} }
@ -1302,7 +1297,7 @@ bool MenuBar::TryLoadMapFile(const QString& path, const bool bad)
{ {
if (!g_symbolDB.LoadMap(path.toStdString(), bad)) if (!g_symbolDB.LoadMap(path.toStdString(), bad))
{ {
QMessageBox::warning(this, tr("Error"), tr("Failed to load map file '%1'").arg(path)); ModalMessageBox::warning(this, tr("Error"), tr("Failed to load map file '%1'").arg(path));
return false; return false;
} }
@ -1314,7 +1309,8 @@ void MenuBar::TrySaveSymbolMap(const QString& path)
if (g_symbolDB.SaveSymbolMap(path.toStdString())) if (g_symbolDB.SaveSymbolMap(path.toStdString()))
return; return;
QMessageBox::warning(this, tr("Error"), tr("Failed to save symbol map to path '%1'").arg(path)); ModalMessageBox::warning(this, tr("Error"),
tr("Failed to save symbol map to path '%1'").arg(path));
} }
void MenuBar::CreateSignatureFile() void MenuBar::CreateSignatureFile()
@ -1334,7 +1330,7 @@ void MenuBar::CreateSignatureFile()
if (!db.Save(save_path)) if (!db.Save(save_path))
{ {
QMessageBox::warning(this, tr("Error"), tr("Failed to save signature file '%1'").arg(file)); ModalMessageBox::warning(this, tr("Error"), tr("Failed to save signature file '%1'").arg(file));
return; return;
} }
@ -1359,8 +1355,8 @@ void MenuBar::AppendSignatureFile()
db.Load(signature_path); db.Load(signature_path);
if (!db.Save(signature_path)) if (!db.Save(signature_path))
{ {
QMessageBox::warning(this, tr("Error"), ModalMessageBox::warning(this, tr("Error"),
tr("Failed to append to signature file '%1'").arg(file)); tr("Failed to append to signature file '%1'").arg(file));
return; return;
} }
@ -1412,8 +1408,8 @@ void MenuBar::CombineSignatureFiles()
db.Load(load_pathSecondaryFile); db.Load(load_pathSecondaryFile);
if (!db.Save(save_path)) if (!db.Save(save_path))
{ {
QMessageBox::warning(this, tr("Error"), ModalMessageBox::warning(this, tr("Error"),
tr("Failed to save to signature file '%1'").arg(saveFile)); tr("Failed to save to signature file '%1'").arg(saveFile));
return; return;
} }

View File

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

View File

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

View File

@ -0,0 +1,54 @@
// Copyright 2019 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include <QApplication>
ModalMessageBox::ModalMessageBox(QWidget* parent) : QMessageBox(parent)
{
setWindowModality(Qt::WindowModal);
// No parent is still preferable to showing a hidden parent here.
if (parent != nullptr && !parent->isVisible())
setParent(nullptr);
}
static inline int ExecMessageBox(ModalMessageBox::Icon icon, QWidget* parent, const QString& title,
const QString& text, ModalMessageBox::StandardButtons buttons,
ModalMessageBox::StandardButton default_button)
{
ModalMessageBox msg(parent);
msg.setIcon(icon);
msg.setWindowTitle(title);
msg.setText(text);
msg.setStandardButtons(buttons);
msg.setDefaultButton(default_button);
return msg.exec();
}
int ModalMessageBox::critical(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons, StandardButton default_button)
{
return ExecMessageBox(QMessageBox::Critical, parent, title, text, buttons, default_button);
}
int ModalMessageBox::information(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons, StandardButton default_button)
{
return ExecMessageBox(QMessageBox::Information, parent, title, text, buttons, default_button);
}
int ModalMessageBox::question(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons, StandardButton default_button)
{
return ExecMessageBox(QMessageBox::Critical, parent, title, text, buttons, default_button);
}
int ModalMessageBox::warning(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons, StandardButton default_button)
{
return ExecMessageBox(QMessageBox::Warning, parent, title, text, buttons, default_button);
}

View File

@ -0,0 +1,23 @@
// Copyright 2019 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QMessageBox>
// Helper for making message boxes modal by default
class ModalMessageBox : public QMessageBox
{
public:
explicit ModalMessageBox(QWidget* parent);
static int critical(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
static int information(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
static int question(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons = Yes | No, StandardButton default_button = NoButton);
static int warning(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
};

View File

@ -10,7 +10,6 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QIcon> #include <QIcon>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMessageBox>
#include <QMimeData> #include <QMimeData>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPalette> #include <QPalette>
@ -24,6 +23,7 @@
#include "Core/State.h" #include "Core/State.h"
#include "DolphinQt/Host.h" #include "DolphinQt/Host.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/RenderWidget.h" #include "DolphinQt/RenderWidget.h"
#include "DolphinQt/Resources.h" #include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -112,7 +112,7 @@ void RenderWidget::dropEvent(QDropEvent* event)
if (!file_info.exists() || !file_info.isReadable()) if (!file_info.exists() || !file_info.isReadable())
{ {
QMessageBox::critical(this, tr("Error"), tr("Failed to open '%1'").arg(path)); ModalMessageBox::critical(this, tr("Error"), tr("Failed to open '%1'").arg(path));
return; return;
} }

View File

@ -8,12 +8,12 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QGridLayout> #include <QGridLayout>
#include <QHeaderView> #include <QHeaderView>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QTableWidget> #include <QTableWidget>
#include <QUrl> #include <QUrl>
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "UICommon/ResourcePack/Manager.h" #include "UICommon/ResourcePack/Manager.h"
ResourcePackManager::ResourcePackManager(QWidget* widget) : QDialog(widget) ResourcePackManager::ResourcePackManager(QWidget* widget) : QDialog(widget)
@ -196,7 +196,7 @@ void ResourcePackManager::Install()
if (!success) if (!success)
{ {
QMessageBox::critical( ModalMessageBox::critical(
this, tr("Error"), this, tr("Error"),
tr("Failed to install pack: %1").arg(QString::fromStdString(item.GetError()))); tr("Failed to install pack: %1").arg(QString::fromStdString(item.GetError())));
} }
@ -217,7 +217,7 @@ void ResourcePackManager::Uninstall()
if (!success) if (!success)
{ {
QMessageBox::critical( ModalMessageBox::critical(
this, tr("Error"), this, tr("Error"),
tr("Failed to uninstall pack: %1").arg(QString::fromStdString(item.GetError()))); tr("Failed to uninstall pack: %1").arg(QString::fromStdString(item.GetError())));
} }
@ -232,7 +232,7 @@ void ResourcePackManager::Remove()
if (items.empty()) if (items.empty())
return; return;
QMessageBox box(this); ModalMessageBox box(this);
box.setWindowTitle(tr("Confirmation")); box.setWindowTitle(tr("Confirmation"));
box.setText(tr("Are you sure you want to delete this pack?")); box.setText(tr("Are you sure you want to delete this pack?"));
box.setIcon(QMessageBox::Warning); box.setIcon(QMessageBox::Warning);

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,6 @@
#include <QApplication> #include <QApplication>
#include <QLocale> #include <QLocale>
#include <QMessageBox>
#include <QTranslator> #include <QTranslator>
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
@ -20,6 +19,8 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
constexpr u32 MO_MAGIC_NUMBER = 0x950412de; constexpr u32 MO_MAGIC_NUMBER = 0x950412de;
@ -300,7 +301,7 @@ void Translation::Initialize()
if (TryInstallTranslator(QString::fromStdString(configured_language))) if (TryInstallTranslator(QString::fromStdString(configured_language)))
return; return;
QMessageBox::warning( ModalMessageBox::warning(
nullptr, QObject::tr("Error"), nullptr, QObject::tr("Error"),
QObject::tr("Error loading selected language. Falling back to system default.")); QObject::tr("Error loading selected language. Falling back to system default."));
configured_language.clear(); configured_language.clear();

View File

@ -8,7 +8,6 @@
#include <QDialog> #include <QDialog>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QLabel> #include <QLabel>
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QTextBrowser> #include <QTextBrowser>
#include <QVBoxLayout> #include <QVBoxLayout>

View File

@ -8,7 +8,6 @@
#include <future> #include <future>
#include <QCloseEvent> #include <QCloseEvent>
#include <QMessageBox>
#include <QObject> #include <QObject>
#include <QProgressDialog> #include <QProgressDialog>
#include <QPushButton> #include <QPushButton>
@ -21,6 +20,7 @@
#include "DiscIO/NANDImporter.h" #include "DiscIO/NANDImporter.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/QtUtils/QueueOnObject.h"
namespace WiiUpdate namespace WiiUpdate
@ -30,47 +30,48 @@ static void ShowResult(QWidget* parent, WiiUtils::UpdateResult result)
switch (result) switch (result)
{ {
case WiiUtils::UpdateResult::Succeeded: case WiiUtils::UpdateResult::Succeeded:
QMessageBox::information(parent, QObject::tr("Update completed"), ModalMessageBox::information(parent, QObject::tr("Update completed"),
QObject::tr("The emulated Wii console has been updated.")); QObject::tr("The emulated Wii console has been updated."));
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)); DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
break; break;
case WiiUtils::UpdateResult::AlreadyUpToDate: case WiiUtils::UpdateResult::AlreadyUpToDate:
QMessageBox::information(parent, QObject::tr("Update completed"), ModalMessageBox::information(parent, QObject::tr("Update completed"),
QObject::tr("The emulated Wii console is already up-to-date.")); QObject::tr("The emulated Wii console is already up-to-date."));
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)); DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
break; break;
case WiiUtils::UpdateResult::ServerFailed: case WiiUtils::UpdateResult::ServerFailed:
QMessageBox::critical(parent, QObject::tr("Update failed"), ModalMessageBox::critical(parent, QObject::tr("Update failed"),
QObject::tr("Could not download update information from Nintendo. " QObject::tr("Could not download update information from Nintendo. "
"Please check your Internet connection and try again.")); "Please check your Internet connection and try again."));
break; break;
case WiiUtils::UpdateResult::DownloadFailed: case WiiUtils::UpdateResult::DownloadFailed:
QMessageBox::critical(parent, QObject::tr("Update failed"), ModalMessageBox::critical(parent, QObject::tr("Update failed"),
QObject::tr("Could not download update files from Nintendo. " QObject::tr("Could not download update files from Nintendo. "
"Please check your Internet connection and try again.")); "Please check your Internet connection and try again."));
break; break;
case WiiUtils::UpdateResult::ImportFailed: case WiiUtils::UpdateResult::ImportFailed:
QMessageBox::critical(parent, QObject::tr("Update failed"), ModalMessageBox::critical(parent, QObject::tr("Update failed"),
QObject::tr("Could not install an update to the Wii system memory. " QObject::tr("Could not install an update to the Wii system memory. "
"Please refer to logs for more information.")); "Please refer to logs for more information."));
break; break;
case WiiUtils::UpdateResult::Cancelled: case WiiUtils::UpdateResult::Cancelled:
QMessageBox::warning( ModalMessageBox::warning(
parent, QObject::tr("Update cancelled"), parent, QObject::tr("Update cancelled"),
QObject::tr("The update has been cancelled. It is strongly recommended to " QObject::tr("The update has been cancelled. It is strongly recommended to "
"finish it in order to avoid inconsistent system software versions.")); "finish it in order to avoid inconsistent system software versions."));
break; break;
case WiiUtils::UpdateResult::RegionMismatch: case WiiUtils::UpdateResult::RegionMismatch:
QMessageBox::critical(parent, QObject::tr("Update failed"), ModalMessageBox::critical(
QObject::tr("The game's region does not match your console's. " parent, QObject::tr("Update failed"),
"To avoid issues with the system menu, it is not possible " QObject::tr("The game's region does not match your console's. "
"to update the emulated console using this disc.")); "To avoid issues with the system menu, it is not possible "
"to update the emulated console using this disc."));
break; break;
case WiiUtils::UpdateResult::MissingUpdatePartition: case WiiUtils::UpdateResult::MissingUpdatePartition:
case WiiUtils::UpdateResult::DiscReadFailed: case WiiUtils::UpdateResult::DiscReadFailed:
QMessageBox::critical(parent, QObject::tr("Update failed"), ModalMessageBox::critical(parent, QObject::tr("Update failed"),
QObject::tr("The game disc does not contain any usable " QObject::tr("The game disc does not contain any usable "
"update information.")); "update information."));
break; break;
} }
} }
@ -133,7 +134,7 @@ static WiiUtils::UpdateResult ShowProgress(QWidget* parent, Callable function, A
void PerformOnlineUpdate(const std::string& region, QWidget* parent) void PerformOnlineUpdate(const std::string& region, QWidget* parent)
{ {
const int confirm = QMessageBox::question( const int confirm = ModalMessageBox::question(
parent, QObject::tr("Confirm"), parent, QObject::tr("Confirm"),
QObject::tr("Connect to the Internet and perform an online system update?")); QObject::tr("Connect to the Internet and perform an online system update?"));
if (confirm != QMessageBox::Yes) if (confirm != QMessageBox::Yes)