Qt: Make message box utility parameter order consistent

This commit is contained in:
Stenzek
2025-11-26 22:00:24 +10:00
parent 8311a0cf55
commit 73823edf56
6 changed files with 19 additions and 19 deletions

View File

@@ -192,8 +192,8 @@ void ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked(int state)
"system requirements.\n\nBy enabling this option you are agreeing to not create any bug reports unless you "
"have confirmed the bug also occurs with overclocking disabled.\n\nThis warning will only be shown once.");
QMessageBox* const mb = QtUtils::NewMessageBox(QMessageBox::Warning, tr("CPU Overclocking Warning"), message,
QMessageBox::NoButton, QMessageBox::NoButton, this);
QMessageBox* const mb = QtUtils::NewMessageBox(this, QMessageBox::Warning, tr("CPU Overclocking Warning"), message,
QMessageBox::NoButton, QMessageBox::NoButton);
const QPushButton* const yes_button =
mb->addButton(tr("Yes, I will confirm bugs without overclocking before reporting."), QMessageBox::YesRole);
const QPushButton* const no_button = mb->addButton(tr("No, take me back to safety."), QMessageBox::NoRole);

View File

@@ -397,10 +397,10 @@ void GameCheatSettingsWidget::checkForMasterDisable()
if (!game_settings_enabled)
{
QMessageBox* mbox = QtUtils::NewMessageBox(
QMessageBox::Warning, tr("Confirm Game Settings Enable"),
this, QMessageBox::Warning, tr("Confirm Game Settings Enable"),
tr("<h3>Game settings are currently disabled.</h3><p>This is <strong>not</strong> the default. Enabling this "
"cheat will not have any effect until game settings are enabled. Do you want to do this now?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, this);
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
QCheckBox* cb = new QCheckBox(mbox);
cb->setText(tr("Do not show again"));
mbox->setCheckBox(cb);
@@ -417,10 +417,10 @@ void GameCheatSettingsWidget::checkForMasterDisable()
if (!cheats_enabled)
{
QMessageBox* mbox = QtUtils::NewMessageBox(
QMessageBox::Warning, tr("Confirm Cheat Enable"),
this, QMessageBox::Warning, tr("Confirm Cheat Enable"),
tr("<h3>Cheats are not currently enabled for this game.</h3><p>Enabling this cheat will not have any "
"effect until cheats are enabled for this game. Do you want to do this now?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, this);
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
QCheckBox* cb = new QCheckBox(mbox);
cb->setText(tr("Do not show again"));
cb->setChecked(m_master_enable_ignored);

View File

@@ -1283,9 +1283,9 @@ void MainWindow::promptForDiscChange(const QString& path)
SystemLock lock(pauseAndLockSystem());
QMessageBox* const mb =
QtUtils::NewMessageBox(QMessageBox::Question, tr("Confirm Disc Change"),
QtUtils::NewMessageBox(lock.getDialogParent(), QMessageBox::Question, tr("Confirm Disc Change"),
tr("Do you want to swap discs or boot the new image (via system reset)?"),
QMessageBox::NoButton, QMessageBox::NoButton, lock.getDialogParent());
QMessageBox::NoButton, QMessageBox::NoButton);
/*const QAbstractButton* const swap_button = */ mb->addButton(tr("Swap Disc"), QMessageBox::YesRole);
const QAbstractButton* const reset_button = mb->addButton(tr("Reset"), QMessageBox::NoRole);
@@ -3065,11 +3065,11 @@ void MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, b
SystemLock lock(pauseAndLockSystem());
QMessageBox* msgbox =
QtUtils::NewMessageBox(QMessageBox::Question, quit_afterwards ? tr("Confirm Exit") : tr("Confirm Close"),
quit_afterwards ? tr("Are you sure you want to exit the application?") :
tr("Are you sure you want to close the current game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes, lock.getDialogParent());
QMessageBox* const msgbox = QtUtils::NewMessageBox(
lock.getDialogParent(), QMessageBox::Question, quit_afterwards ? tr("Confirm Exit") : tr("Confirm Close"),
quit_afterwards ? tr("Are you sure you want to exit the application?") :
tr("Are you sure you want to close the current game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
QCheckBox* const save_cb = new QCheckBox(tr("Save State For Resume"), msgbox);
save_cb->setChecked(allow_save_to_state && save_state);

View File

@@ -2172,8 +2172,8 @@ void Host::ConfirmMessageAsync(std::string_view title, std::string_view message,
no_text = QtUtils::StringViewToQString(no_text), needs_pause]() mutable {
auto lock = g_main_window->pauseAndLockSystem();
QMessageBox* const msgbox = QtUtils::NewMessageBox(QMessageBox::Question, title, message, QMessageBox::NoButton,
QMessageBox::NoButton, lock.getDialogParent());
QMessageBox* const msgbox = QtUtils::NewMessageBox(lock.getDialogParent(), QMessageBox::Question, title, message,
QMessageBox::NoButton, QMessageBox::NoButton);
QPushButton* const yes_button = msgbox->addButton(yes_text, QMessageBox::AcceptRole);
msgbox->addButton(no_text, QMessageBox::RejectRole);

View File

@@ -280,9 +280,9 @@ QMessageBox::StandardButton QtUtils::MessageBoxIcon(QWidget* parent, QMessageBox
return static_cast<QMessageBox::StandardButton>(msgbox.exec());
}
QMessageBox* QtUtils::NewMessageBox(QMessageBox::Icon icon, const QString& title, const QString& text,
QMessageBox* QtUtils::NewMessageBox(QWidget* parent, QMessageBox::Icon icon, const QString& title, const QString& text,
QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton,
QWidget* parent, bool delete_on_close)
bool delete_on_close)
{
#ifndef __APPLE__
QMessageBox* msgbox = new QMessageBox(icon, title, text, buttons, parent ? QtUtils::GetRootWidget(parent) : nullptr);

View File

@@ -126,9 +126,9 @@ QMessageBox::StandardButton MessageBoxQuestion(
QMessageBox::StandardButton MessageBoxIcon(QWidget* parent, QMessageBox::Icon icon, const QString& title,
const QString& text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton);
QMessageBox* NewMessageBox(QMessageBox::Icon icon, const QString& title, const QString& text,
QMessageBox* NewMessageBox(QWidget* parent, QMessageBox::Icon icon, const QString& title, const QString& text,
QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton,
QWidget* parent, bool delete_on_close = true);
bool delete_on_close = true);
/// Styles a popup menu for the current theme.
void StylePopupMenu(QMenu* menu);