@@ -396,11 +396,11 @@ void GameCheatSettingsWidget::checkForMasterDisable()
396396
397397 if (!game_settings_enabled)
398398 {
399- QMessageBox* mbox = QtUtils::NewMessageBox (
399+ QMessageBox* const mbox = QtUtils::NewMessageBox (
400400 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 );
403+ QMessageBox::Yes | QMessageBox::No);
404404 QCheckBox* cb = new QCheckBox (mbox);
405405 cb->setText (tr (" Do not show again" ));
406406 mbox->setCheckBox (cb);
@@ -416,11 +416,11 @@ void GameCheatSettingsWidget::checkForMasterDisable()
416416
417417 if (!cheats_enabled)
418418 {
419- QMessageBox* mbox = QtUtils::NewMessageBox (
419+ QMessageBox* const mbox = QtUtils::NewMessageBox (
420420 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 );
423+ QMessageBox::Yes | QMessageBox::No);
424424 QCheckBox* cb = new QCheckBox (mbox);
425425 cb->setText (tr (" Do not show again" ));
426426 cb->setChecked (m_master_enable_ignored);
@@ -574,8 +574,8 @@ void GameCheatSettingsWidget::onImportFromFileTriggered()
574574 const std::optional<std::string> file_contents = FileSystem::ReadFileToString (filename.toStdString ().c_str (), &error);
575575 if (!file_contents.has_value ())
576576 {
577- QtUtils::MessageBoxCritical (this , tr (" Error" ),
578- tr (" Failed to read file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
577+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ),
578+ tr (" Failed to read file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
579579 return ;
580580 }
581581
@@ -597,15 +597,15 @@ void GameCheatSettingsWidget::importCodes(const std::string& file_contents)
597597 Cheats::CodeInfoList new_codes;
598598 if (!Cheats::ImportCodesFromString (&new_codes, file_contents, Cheats::FileFormat::Unknown, true , &error))
599599 {
600- QtUtils::MessageBoxCritical (this , tr (" Error" ),
601- tr (" Failed to parse file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
600+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ),
601+ tr (" Failed to parse file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
602602 return ;
603603 }
604604
605605 if (!Cheats::SaveCodesToFile (getPathForSavingCheats ().c_str (), new_codes, &error))
606606 {
607- QtUtils::MessageBoxCritical (this , tr (" Error" ),
608- tr (" Failed to save file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
607+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ),
608+ tr (" Failed to save file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
609609 }
610610
611611 reloadList ();
@@ -651,8 +651,8 @@ void GameCheatSettingsWidget::removeCode(const std::string_view code_name, bool
651651
652652 if (code->from_database )
653653 {
654- QtUtils::MessageBoxCritical (
655- this , tr (" Error" ),
654+ QtUtils::AsyncMessageBox (
655+ this , QMessageBox::Critical, tr (" Error" ),
656656 tr (" This code is from the built-in cheat database, and cannot be removed. To hide this code, "
657657 " uncheck the \" Load Database Cheats\" option." ));
658658 return ;
@@ -670,8 +670,8 @@ void GameCheatSettingsWidget::removeCode(const std::string_view code_name, bool
670670 Error error;
671671 if (!Cheats::UpdateCodeInFile (getPathForSavingCheats ().c_str (), code->name , nullptr , &error))
672672 {
673- QtUtils::MessageBoxCritical (this , tr (" Error" ),
674- tr (" Failed to save file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
673+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ),
674+ tr (" Failed to save file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
675675 return ;
676676 }
677677
@@ -690,8 +690,8 @@ void GameCheatSettingsWidget::onExportClicked()
690690 Error error;
691691 if (!Cheats::ExportCodesToFile (filename.toStdString (), m_codes, &error))
692692 {
693- QtUtils::MessageBoxCritical (
694- this , tr ( " Error " ), tr (" Failed to save cheat file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
693+ QtUtils::AsyncMessageBox ( this , QMessageBox::Critical, tr ( " Error " ),
694+ tr (" Failed to save cheat file:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
695695 }
696696}
697697
@@ -843,14 +843,14 @@ void CheatCodeEditorDialog::saveClicked()
843843 std::string new_name = m_ui.name ->text ().toStdString ();
844844 if (new_name.empty ())
845845 {
846- QtUtils::MessageBoxCritical (this , tr (" Error" ), tr (" Name cannot be empty." ));
846+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ), tr (" Name cannot be empty." ));
847847 return ;
848848 }
849849
850850 std::string new_body = QtUtils::NormalizeLineEndings (m_ui.instructions ->toPlainText ()).trimmed ().toStdString ();
851851 if (new_body.empty ())
852852 {
853- QtUtils::MessageBoxCritical (this , tr (" Error" ), tr (" Instructions cannot be empty." ));
853+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ), tr (" Instructions cannot be empty." ));
854854 return ;
855855 }
856856
@@ -882,8 +882,8 @@ void CheatCodeEditorDialog::saveClicked()
882882 // if the name has changed, then we need to make sure it hasn't already been used
883883 if (new_name != m_code.name && m_parent->hasCodeWithName (new_name))
884884 {
885- QtUtils::MessageBoxCritical (this , tr (" Error" ),
886- tr (" A code with the name '%1' already exists." ).arg (QString::fromStdString (new_name)));
885+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ),
886+ tr (" A code with the name '%1' already exists." ).arg (QString::fromStdString (new_name)));
887887 return ;
888888 }
889889
@@ -923,8 +923,9 @@ void CheatCodeEditorDialog::saveClicked()
923923 std::string path = m_parent->getPathForSavingCheats ();
924924 if (!Cheats::UpdateCodeInFile (path.c_str (), old_name, &m_code, &error))
925925 {
926- QtUtils::MessageBoxCritical (
927- this , tr (" Error" ), tr (" Failed to save cheat code:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
926+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical, tr (" Error" ),
927+ tr (" Failed to save cheat code:\n %1" ).arg (QString::fromStdString (error.GetDescription ())));
928+ return ;
928929 }
929930
930931 accept ();
@@ -1059,7 +1060,7 @@ void GameCheatCodeChoiceEditorDialog::onSaveClicked()
10591060 const int count = m_ui.optionList ->topLevelItemCount ();
10601061 if (count == 0 )
10611062 {
1062- QtUtils::MessageBoxCritical (this , tr (" Error" ), tr (" At least one option must be defined." ));
1063+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical , tr (" Error" ), tr (" At least one option must be defined." ));
10631064 return ;
10641065 }
10651066
@@ -1074,7 +1075,8 @@ void GameCheatCodeChoiceEditorDialog::onSaveClicked()
10741075
10751076 if (m_ui.optionList ->topLevelItem (j)->text (0 ) == this_name)
10761077 {
1077- QtUtils::MessageBoxCritical (this , tr (" Error" ), tr (" The option '%1' is defined twice." ).arg (this_name));
1078+ QtUtils::AsyncMessageBox (this , QMessageBox::Critical, tr (" Error" ),
1079+ tr (" The option '%1' is defined twice." ).arg (this_name));
10781080 return ;
10791081 }
10801082 }
@@ -1083,8 +1085,8 @@ void GameCheatCodeChoiceEditorDialog::onSaveClicked()
10831085 const QString this_value = it->text (1 );
10841086 if (bool ok; this_value.toUInt (&ok), !ok)
10851087 {
1086- QtUtils::MessageBoxCritical (
1087- this , tr ( " Error " ), tr (" The option '%1' does not have a valid value. It must be a number." ).arg (this_name));
1088+ QtUtils::AsyncMessageBox ( this , QMessageBox::Critical, tr ( " Error " ),
1089+ tr (" The option '%1' does not have a valid value. It must be a number." ).arg (this_name));
10881090 return ;
10891091 }
10901092 }
0 commit comments