Skip to content

Commit 73823ed

Browse files
committed
Qt: Make message box utility parameter order consistent
1 parent 8311a0c commit 73823ed

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/duckstation-qt/consolesettingswidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ void ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked(int state)
192192
"system requirements.\n\nBy enabling this option you are agreeing to not create any bug reports unless you "
193193
"have confirmed the bug also occurs with overclocking disabled.\n\nThis warning will only be shown once.");
194194

195-
QMessageBox* const mb = QtUtils::NewMessageBox(QMessageBox::Warning, tr("CPU Overclocking Warning"), message,
196-
QMessageBox::NoButton, QMessageBox::NoButton, this);
195+
QMessageBox* const mb = QtUtils::NewMessageBox(this, QMessageBox::Warning, tr("CPU Overclocking Warning"), message,
196+
QMessageBox::NoButton, QMessageBox::NoButton);
197197
const QPushButton* const yes_button =
198198
mb->addButton(tr("Yes, I will confirm bugs without overclocking before reporting."), QMessageBox::YesRole);
199199
const QPushButton* const no_button = mb->addButton(tr("No, take me back to safety."), QMessageBox::NoRole);

src/duckstation-qt/gamecheatsettingswidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,10 @@ void GameCheatSettingsWidget::checkForMasterDisable()
397397
if (!game_settings_enabled)
398398
{
399399
QMessageBox* mbox = QtUtils::NewMessageBox(
400-
QMessageBox::Warning, tr("Confirm Game Settings Enable"),
400+
this, QMessageBox::Warning, tr("Confirm Game Settings Enable"),
401401
tr("<h3>Game settings are currently disabled.</h3><p>This is <strong>not</strong> the default. Enabling this "
402402
"cheat will not have any effect until game settings are enabled. Do you want to do this now?"),
403-
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, this);
403+
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
404404
QCheckBox* cb = new QCheckBox(mbox);
405405
cb->setText(tr("Do not show again"));
406406
mbox->setCheckBox(cb);
@@ -417,10 +417,10 @@ void GameCheatSettingsWidget::checkForMasterDisable()
417417
if (!cheats_enabled)
418418
{
419419
QMessageBox* mbox = QtUtils::NewMessageBox(
420-
QMessageBox::Warning, tr("Confirm Cheat Enable"),
420+
this, QMessageBox::Warning, tr("Confirm Cheat Enable"),
421421
tr("<h3>Cheats are not currently enabled for this game.</h3><p>Enabling this cheat will not have any "
422422
"effect until cheats are enabled for this game. Do you want to do this now?"),
423-
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, this);
423+
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
424424
QCheckBox* cb = new QCheckBox(mbox);
425425
cb->setText(tr("Do not show again"));
426426
cb->setChecked(m_master_enable_ignored);

src/duckstation-qt/mainwindow.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,9 +1283,9 @@ void MainWindow::promptForDiscChange(const QString& path)
12831283
SystemLock lock(pauseAndLockSystem());
12841284

12851285
QMessageBox* const mb =
1286-
QtUtils::NewMessageBox(QMessageBox::Question, tr("Confirm Disc Change"),
1286+
QtUtils::NewMessageBox(lock.getDialogParent(), QMessageBox::Question, tr("Confirm Disc Change"),
12871287
tr("Do you want to swap discs or boot the new image (via system reset)?"),
1288-
QMessageBox::NoButton, QMessageBox::NoButton, lock.getDialogParent());
1288+
QMessageBox::NoButton, QMessageBox::NoButton);
12891289

12901290
/*const QAbstractButton* const swap_button = */ mb->addButton(tr("Swap Disc"), QMessageBox::YesRole);
12911291
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
30653065

30663066
SystemLock lock(pauseAndLockSystem());
30673067

3068-
QMessageBox* msgbox =
3069-
QtUtils::NewMessageBox(QMessageBox::Question, quit_afterwards ? tr("Confirm Exit") : tr("Confirm Close"),
3070-
quit_afterwards ? tr("Are you sure you want to exit the application?") :
3071-
tr("Are you sure you want to close the current game?"),
3072-
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes, lock.getDialogParent());
3068+
QMessageBox* const msgbox = QtUtils::NewMessageBox(
3069+
lock.getDialogParent(), QMessageBox::Question, quit_afterwards ? tr("Confirm Exit") : tr("Confirm Close"),
3070+
quit_afterwards ? tr("Are you sure you want to exit the application?") :
3071+
tr("Are you sure you want to close the current game?"),
3072+
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
30733073

30743074
QCheckBox* const save_cb = new QCheckBox(tr("Save State For Resume"), msgbox);
30753075
save_cb->setChecked(allow_save_to_state && save_state);

src/duckstation-qt/qthost.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,8 +2172,8 @@ void Host::ConfirmMessageAsync(std::string_view title, std::string_view message,
21722172
no_text = QtUtils::StringViewToQString(no_text), needs_pause]() mutable {
21732173
auto lock = g_main_window->pauseAndLockSystem();
21742174

2175-
QMessageBox* const msgbox = QtUtils::NewMessageBox(QMessageBox::Question, title, message, QMessageBox::NoButton,
2176-
QMessageBox::NoButton, lock.getDialogParent());
2175+
QMessageBox* const msgbox = QtUtils::NewMessageBox(lock.getDialogParent(), QMessageBox::Question, title, message,
2176+
QMessageBox::NoButton, QMessageBox::NoButton);
21772177

21782178
QPushButton* const yes_button = msgbox->addButton(yes_text, QMessageBox::AcceptRole);
21792179
msgbox->addButton(no_text, QMessageBox::RejectRole);

src/duckstation-qt/qtutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ QMessageBox::StandardButton QtUtils::MessageBoxIcon(QWidget* parent, QMessageBox
280280
return static_cast<QMessageBox::StandardButton>(msgbox.exec());
281281
}
282282

283-
QMessageBox* QtUtils::NewMessageBox(QMessageBox::Icon icon, const QString& title, const QString& text,
283+
QMessageBox* QtUtils::NewMessageBox(QWidget* parent, QMessageBox::Icon icon, const QString& title, const QString& text,
284284
QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton,
285-
QWidget* parent, bool delete_on_close)
285+
bool delete_on_close)
286286
{
287287
#ifndef __APPLE__
288288
QMessageBox* msgbox = new QMessageBox(icon, title, text, buttons, parent ? QtUtils::GetRootWidget(parent) : nullptr);

src/duckstation-qt/qtutils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ QMessageBox::StandardButton MessageBoxQuestion(
126126
QMessageBox::StandardButton MessageBoxIcon(QWidget* parent, QMessageBox::Icon icon, const QString& title,
127127
const QString& text, QMessageBox::StandardButtons buttons,
128128
QMessageBox::StandardButton defaultButton);
129-
QMessageBox* NewMessageBox(QMessageBox::Icon icon, const QString& title, const QString& text,
129+
QMessageBox* NewMessageBox(QWidget* parent, QMessageBox::Icon icon, const QString& title, const QString& text,
130130
QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton,
131-
QWidget* parent, bool delete_on_close = true);
131+
bool delete_on_close = true);
132132

133133
/// Styles a popup menu for the current theme.
134134
void StylePopupMenu(QMenu* menu);

0 commit comments

Comments
 (0)