mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-12 09:24:33 +00:00
Qt: Use message box wrapper functions
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "common/error.h"
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "moc_achievementlogindialog.cpp"
|
||||
|
||||
AchievementLoginDialog::AchievementLoginDialog(QWidget* parent, Achievements::LoginRequestReason reason)
|
||||
@@ -74,7 +72,7 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
|
||||
{
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Login Error"),
|
||||
tr("Login failed.\nError: %1\n\nPlease check your username and password, and try again.").arg(message));
|
||||
m_ui.status->setText(tr("Login failed."));
|
||||
@@ -83,10 +81,10 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
|
||||
}
|
||||
|
||||
if (!Host::GetBaseBoolSettingValue("Cheevos", "Enabled", false) &&
|
||||
QMessageBox::question(this, tr("Enable Achievements"),
|
||||
tr("Achievement tracking is not currently enabled. Your login will have no effect until "
|
||||
"after tracking is enabled.\n\nDo you want to enable tracking now?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
QtUtils::MessageBoxQuestion(
|
||||
this, tr("Enable Achievements"),
|
||||
tr("Achievement tracking is not currently enabled. Your login will have no effect until "
|
||||
"after tracking is enabled.\n\nDo you want to enable tracking now?")) == QMessageBox::Yes)
|
||||
{
|
||||
Host::SetBaseBoolSettingValue("Cheevos", "Enabled", true);
|
||||
Host::CommitBaseSettingChanges();
|
||||
@@ -94,12 +92,11 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
|
||||
}
|
||||
|
||||
if (!Host::GetBaseBoolSettingValue("Cheevos", "ChallengeMode", false) &&
|
||||
QMessageBox::question(
|
||||
QtUtils::MessageBoxQuestion(
|
||||
this, tr("Enable Hardcore Mode"),
|
||||
tr("Hardcore mode is not currently enabled. Enabling hardcore mode allows you to set times, scores, and "
|
||||
"participate in game-specific leaderboards.\n\nHowever, hardcore mode also prevents the usage of save "
|
||||
"states, cheats and slowdown functionality.\n\nDo you want to enable hardcore mode?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
"states, cheats and slowdown functionality.\n\nDo you want to enable hardcore mode?")) == QMessageBox::Yes)
|
||||
{
|
||||
Host::SetBaseBoolSettingValue("Cheevos", "ChallengeMode", true);
|
||||
Host::CommitBaseSettingChanges();
|
||||
@@ -112,8 +109,8 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
|
||||
}
|
||||
|
||||
if (has_active_game &&
|
||||
QMessageBox::question(
|
||||
QtUtils::GetRootWidget(this), tr("Reset System"),
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Reset System"),
|
||||
tr("Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?")) ==
|
||||
QMessageBox::Yes)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "common/string_util.h"
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "moc_achievementsettingswidget.cpp"
|
||||
|
||||
@@ -180,8 +179,8 @@ void AchievementSettingsWidget::onHardcoreModeStateChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(
|
||||
QtUtils::GetRootWidget(this), tr("Reset System"),
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Reset System"),
|
||||
tr("Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?")) !=
|
||||
QMessageBox::Yes)
|
||||
{
|
||||
|
||||
@@ -247,7 +247,7 @@ std::string AutoUpdaterWindow::getCurrentUpdateTag() const
|
||||
|
||||
void AutoUpdaterWindow::reportError(const std::string_view msg)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Updater Error"), QtUtils::StringViewToQString(msg));
|
||||
QtUtils::MessageBoxCritical(this, tr("Updater Error"), QtUtils::StringViewToQString(msg));
|
||||
}
|
||||
|
||||
bool AutoUpdaterWindow::ensureHttpReady()
|
||||
@@ -353,8 +353,8 @@ void AutoUpdaterWindow::getLatestTagComplete(s32 status_code, const Error& error
|
||||
{
|
||||
if (display_errors)
|
||||
{
|
||||
QMessageBox::information(this, tr("Automatic Updater"),
|
||||
tr("No updates are currently available. Please try again later."));
|
||||
QtUtils::MessageBoxInformation(this, tr("Automatic Updater"),
|
||||
tr("No updates are currently available. Please try again later."));
|
||||
}
|
||||
|
||||
emit updateCheckCompleted();
|
||||
@@ -804,7 +804,7 @@ void AutoUpdaterWindow::cleanupAfterUpdate()
|
||||
Error error;
|
||||
if (!FileSystem::DeleteFile(updater_path.c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
nullptr, tr("Updater Error"),
|
||||
tr("Failed to remove updater exe after update:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "util/cd_image.h"
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
#include "moc_consolesettingswidget.cpp"
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QScrollArea>
|
||||
#include <QtWidgets/QSpinBox>
|
||||
#include <algorithm>
|
||||
@@ -293,8 +292,8 @@ void ControllerBindingWidget::onAutomaticBindingClicked()
|
||||
|
||||
void ControllerBindingWidget::onClearBindingsClicked()
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
QtUtils::GetRootWidget(this), tr("Clear Mapping"),
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Clear Mapping"),
|
||||
tr("Are you sure you want to clear all mappings for this controller? This action cannot be undone.")) !=
|
||||
QMessageBox::Yes)
|
||||
{
|
||||
@@ -344,8 +343,8 @@ void ControllerBindingWidget::doDeviceAutomaticBinding(const QString& device)
|
||||
InputManager::GetGenericBindingMapping(device.toStdString());
|
||||
if (mapping.empty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::GetRootWidget(this), tr("Automatic Mapping"),
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Automatic Mapping"),
|
||||
tr("No generic bindings were generated for device '%1'. The controller/source may not support automatic mapping.")
|
||||
.arg(device));
|
||||
return;
|
||||
@@ -431,10 +430,11 @@ bool ControllerBindingWidget::doMultipleDeviceAutomaticBinding(QWidget* parent,
|
||||
if (mapping.empty())
|
||||
{
|
||||
lock.unlock();
|
||||
QMessageBox::critical(QtUtils::GetRootWidget(parent), tr("Automatic Mapping"),
|
||||
tr("No generic bindings were generated for device '%1'. The controller/source may not "
|
||||
"support automatic mapping.")
|
||||
.arg(identifier));
|
||||
QtUtils::MessageBoxCritical(
|
||||
parent, tr("Automatic Mapping"),
|
||||
tr("No generic bindings were generated for device '%1'. The controller/source may not "
|
||||
"support automatic mapping.")
|
||||
.arg(identifier));
|
||||
lock.lock();
|
||||
continue;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ bool ControllerBindingWidget::doMultipleDeviceAutomaticBinding(QWidget* parent,
|
||||
|
||||
if (!tried_any)
|
||||
{
|
||||
QMessageBox::information(QtUtils::GetRootWidget(parent), tr("Automatic Mapping"), tr("No devices were selected."));
|
||||
QtUtils::MessageBoxInformation(parent, tr("Automatic Mapping"), tr("No devices were selected."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
||||
g_emu_thread->getInputDeviceListModel()->getDeviceList(),
|
||||
[](const InputDeviceListModel::Device& dev) { return (dev.key.source_type == InputSourceType::SDL); }))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("No SDL devices are currently connected."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("No SDL devices are currently connected."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "common/file_system.h"
|
||||
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <array>
|
||||
|
||||
@@ -177,15 +176,16 @@ void ControllerSettingsWindow::onNewProfileClicked()
|
||||
std::string profile_path = System::GetInputProfilePath(profile_name);
|
||||
if (FileSystem::FileExists(profile_path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("A preset with the name '%1' already exists.").arg(QString::fromStdString(profile_name)));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("A preset with the name '%1' already exists.").arg(QString::fromStdString(profile_name)));
|
||||
return;
|
||||
}
|
||||
|
||||
const int res = QMessageBox::question(this, tr("Create Controller Preset"),
|
||||
tr("Do you want to copy all bindings from the currently-selected preset to "
|
||||
"the new preset? Selecting No will create a completely empty preset."),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
const int res =
|
||||
QtUtils::MessageBoxQuestion(this, tr("Create Controller Preset"),
|
||||
tr("Do you want to copy all bindings from the currently-selected preset to "
|
||||
"the new preset? Selecting No will create a completely empty preset."),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (res == QMessageBox::Cancel)
|
||||
return;
|
||||
|
||||
@@ -195,7 +195,7 @@ void ControllerSettingsWindow::onNewProfileClicked()
|
||||
// copy from global or the current profile
|
||||
if (!m_editing_settings_interface)
|
||||
{
|
||||
const int hkres = QMessageBox::question(
|
||||
const int hkres = QtUtils::MessageBoxQuestion(
|
||||
this, tr("Create Controller Preset"),
|
||||
tr("Do you want to copy the current hotkey bindings from global settings to the new controller preset?"),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
@@ -231,8 +231,8 @@ void ControllerSettingsWindow::onNewProfileClicked()
|
||||
|
||||
if (!temp_si.Save())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save the new preset to '%1'.").arg(QString::fromStdString(temp_si.GetPath())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to save the new preset to '%1'.").arg(QString::fromStdString(temp_si.GetPath())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -242,11 +242,11 @@ void ControllerSettingsWindow::onNewProfileClicked()
|
||||
|
||||
void ControllerSettingsWindow::onApplyProfileClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Load Controller Preset"),
|
||||
tr("Are you sure you want to apply the controller preset named '%1'?\n\n"
|
||||
"All current global bindings will be removed, and the preset bindings loaded.\n\n"
|
||||
"You cannot undo this action.")
|
||||
.arg(m_profile_name)) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Load Controller Preset"),
|
||||
tr("Are you sure you want to apply the controller preset named '%1'?\n\n"
|
||||
"All current global bindings will be removed, and the preset bindings loaded.\n\n"
|
||||
"You cannot undo this action.")
|
||||
.arg(m_profile_name)) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -267,10 +267,10 @@ void ControllerSettingsWindow::onApplyProfileClicked()
|
||||
|
||||
void ControllerSettingsWindow::onDeleteProfileClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Delete Controller Preset"),
|
||||
tr("Are you sure you want to delete the controller preset named '%1'?\n\n"
|
||||
"You cannot undo this action.")
|
||||
.arg(m_profile_name)) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Delete Controller Preset"),
|
||||
tr("Are you sure you want to delete the controller preset named '%1'?\n\n"
|
||||
"You cannot undo this action.")
|
||||
.arg(m_profile_name)) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -278,7 +278,8 @@ void ControllerSettingsWindow::onDeleteProfileClicked()
|
||||
std::string profile_path(System::GetInputProfilePath(m_profile_name.toStdString()));
|
||||
if (!FileSystem::DeleteFile(profile_path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to delete '%1'.").arg(QString::fromStdString(profile_path)));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to delete '%1'.").arg(QString::fromStdString(profile_path)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -289,9 +290,9 @@ void ControllerSettingsWindow::onDeleteProfileClicked()
|
||||
|
||||
void ControllerSettingsWindow::onRestoreDefaultsClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Restore Defaults"),
|
||||
tr("Are you sure you want to restore the default controller configuration?\n\n"
|
||||
"All bindings and configuration will be lost. You cannot undo this action.")) !=
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Restore Defaults"),
|
||||
tr("Are you sure you want to restore the default controller configuration?\n\n"
|
||||
"All bindings and configuration will be lost. You cannot undo this action.")) !=
|
||||
QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
@@ -318,9 +319,10 @@ void ControllerSettingsWindow::onCopyGlobalSettingsClicked()
|
||||
g_emu_thread->reloadGameSettings();
|
||||
createWidgets();
|
||||
|
||||
QMessageBox::information(QtUtils::GetRootWidget(this), tr("DuckStation Controller Settings"),
|
||||
isEditingGameSettings() ? tr("Per-game controller configuration reset to global settings.") :
|
||||
tr("Controller preset reset to global settings."));
|
||||
QtUtils::MessageBoxInformation(QtUtils::GetRootWidget(this), tr("DuckStation Controller Settings"),
|
||||
isEditingGameSettings() ?
|
||||
tr("Per-game controller configuration reset to global settings.") :
|
||||
tr("Controller preset reset to global settings."));
|
||||
}
|
||||
|
||||
bool ControllerSettingsWindow::getBoolValue(const char* section, const char* key, bool default_value) const
|
||||
@@ -581,7 +583,8 @@ void ControllerSettingsWindow::switchProfile(const std::string_view name)
|
||||
std::string path = System::GetInputProfilePath(name);
|
||||
if (!FileSystem::FileExists(path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("The controller preset named '%1' cannot be found.").arg(name_qstr));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("The controller preset named '%1' cannot be found.").arg(name_qstr));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#include "debuggermodels.h"
|
||||
#include "qtutils.h"
|
||||
|
||||
#include "core/cpu_core.h"
|
||||
#include "core/cpu_core_private.h"
|
||||
@@ -13,7 +14,6 @@
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
#include "moc_debuggermodels.cpp"
|
||||
@@ -201,8 +201,8 @@ void DebuggerAddBreakpointDialog::okClicked()
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("DebuggerWindow", "Invalid address. It should be in hex (0x12345678 or 12345678)"));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("DebuggerWindow", "Invalid address. It should be in hex (0x12345678 or 12345678)"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <QtGui/QFontDatabase>
|
||||
#include <QtWidgets/QAbstractScrollArea>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "moc_debuggerwindow.cpp"
|
||||
|
||||
@@ -116,7 +115,7 @@ void DebuggerWindow::onRunToCursorTriggered()
|
||||
std::optional<VirtualMemoryAddress> addr = m_ui.codeView->getSelectedAddress();
|
||||
if (!addr.has_value())
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(), tr("No address selected."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(), tr("No address selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,13 +164,13 @@ void DebuggerWindow::onTraceTriggered()
|
||||
|
||||
if (trace_enabled)
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
win, win->windowTitle(),
|
||||
tr("Trace logging started to cpu_log.txt.\nThis file can be several gigabytes, so be aware of SSD wear."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(win, win->windowTitle(), tr("Trace logging to cpu_log.txt stopped."));
|
||||
QtUtils::MessageBoxCritical(win, win->windowTitle(), tr("Trace logging to cpu_log.txt stopped."));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -264,7 +263,8 @@ void DebuggerWindow::onStepOutActionTriggered()
|
||||
Assert(QtHost::IsSystemPaused());
|
||||
if (!CPU::AddStepOutBreakpoint())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Debugger"), tr("Failed to add step-out breakpoint, are you in a valid function?"));
|
||||
QtUtils::MessageBoxCritical(this, tr("Debugger"),
|
||||
tr("Failed to add step-out breakpoint, are you in a valid function?"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -365,8 +365,8 @@ void DebuggerWindow::onMemorySearchTriggered()
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -392,8 +392,8 @@ void DebuggerWindow::onMemorySearchTriggered()
|
||||
|
||||
if (pattern.empty())
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -733,8 +733,8 @@ void DebuggerWindow::addBreakpoint(CPU::BreakpointType type, u32 address)
|
||||
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(win, win->windowTitle(),
|
||||
tr("Failed to add breakpoint. A breakpoint may already exist at this address."));
|
||||
QtUtils::MessageBoxCritical(win, win->windowTitle(),
|
||||
tr("Failed to add breakpoint. A breakpoint may already exist at this address."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -754,8 +754,8 @@ void DebuggerWindow::removeBreakpoint(CPU::BreakpointType type, u32 address)
|
||||
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(win, win->windowTitle(),
|
||||
tr("Failed to remove breakpoint. This breakpoint may not exist."));
|
||||
QtUtils::MessageBoxCritical(win, win->windowTitle(),
|
||||
tr("Failed to remove breakpoint. This breakpoint may not exist."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "settingswindow.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <limits>
|
||||
|
||||
#include "moc_emulationsettingswidget.cpp"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <algorithm>
|
||||
|
||||
#include "foldersettingswidget.h"
|
||||
#include "settingswindow.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "moc_foldersettingswidget.cpp"
|
||||
|
||||
FolderSettingsWidget::FolderSettingsWidget(SettingsWindow* dialog, QWidget* parent) : QWidget(parent)
|
||||
|
||||
@@ -593,8 +593,8 @@ void GameCheatSettingsWidget::onImportFromFileTriggered()
|
||||
const std::optional<std::string> file_contents = FileSystem::ReadFileToString(filename.toStdString().c_str(), &error);
|
||||
if (!file_contents.has_value())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to read file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to read file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -616,15 +616,15 @@ void GameCheatSettingsWidget::importCodes(const std::string& file_contents)
|
||||
Cheats::CodeInfoList new_codes;
|
||||
if (!Cheats::ImportCodesFromString(&new_codes, file_contents, Cheats::FileFormat::Unknown, true, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to parse file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to parse file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Cheats::SaveCodesToFile(getPathForSavingCheats().c_str(), new_codes, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to save file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
|
||||
reloadList();
|
||||
@@ -671,16 +671,18 @@ void GameCheatSettingsWidget::removeCode(const std::string_view code_name, bool
|
||||
|
||||
if (code->from_database)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("This code is from the built-in cheat database, and cannot be removed. To hide this code, "
|
||||
"uncheck the \"Load Database Cheats\" option."));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"),
|
||||
tr("This code is from the built-in cheat database, and cannot be removed. To hide this code, "
|
||||
"uncheck the \"Load Database Cheats\" option."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this, tr("Confirm Removal"),
|
||||
tr("You are removing the code named '%1'. You cannot undo this action, are you sure you "
|
||||
"wish to delete this code?")
|
||||
.arg(QtUtils::StringViewToQString(code_name))) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Confirm Removal"),
|
||||
tr("You are removing the code named '%1'. You cannot undo this action, are you sure you "
|
||||
"wish to delete this code?")
|
||||
.arg(QtUtils::StringViewToQString(code_name))) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -688,8 +690,8 @@ void GameCheatSettingsWidget::removeCode(const std::string_view code_name, bool
|
||||
Error error;
|
||||
if (!Cheats::UpdateCodeInFile(getPathForSavingCheats().c_str(), code->name, nullptr, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to save file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -708,18 +710,18 @@ void GameCheatSettingsWidget::onExportClicked()
|
||||
Error error;
|
||||
if (!Cheats::ExportCodesToFile(filename.toStdString(), m_codes, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save cheat file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to save cheat file:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
}
|
||||
|
||||
void GameCheatSettingsWidget::onClearClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Confirm Removal"),
|
||||
tr("You are removing all cheats manually added for this game. This action cannot be "
|
||||
"reversed.\n\nAny database cheats will still be loaded and present unless you uncheck "
|
||||
"the \"Load Database Cheats\" option.\n\nAre you sure you want to continue?")) !=
|
||||
QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Confirm Removal"),
|
||||
tr("You are removing all cheats manually added for this game. This action cannot be "
|
||||
"reversed.\n\nAny database cheats will still be loaded and present unless you uncheck "
|
||||
"the \"Load Database Cheats\" option.\n\nAre you sure you want to continue?")) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -861,14 +863,14 @@ void CheatCodeEditorDialog::saveClicked()
|
||||
std::string new_name = m_ui.name->text().toStdString();
|
||||
if (new_name.empty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Name cannot be empty."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("Name cannot be empty."));
|
||||
return;
|
||||
}
|
||||
|
||||
std::string new_body = QtUtils::NormalizeLineEndings(m_ui.instructions->toPlainText()).trimmed().toStdString();
|
||||
if (new_body.empty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Instructions cannot be empty."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("Instructions cannot be empty."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -879,11 +881,11 @@ void CheatCodeEditorDialog::saveClicked()
|
||||
Error error;
|
||||
if (!Cheats::ValidateCodeBody(new_name, new_type, new_activation, new_body, &error))
|
||||
{
|
||||
if (QMessageBox::question(QtUtils::GetRootWidget(this), tr("Error"),
|
||||
tr("The entered cheat code is not valid:\n\n%1\n\nTrying to use this cheat will not work "
|
||||
"as expected. Do you want to continue?")
|
||||
.arg(QString::fromStdString(error.GetDescription())),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Error"),
|
||||
tr("The entered cheat code is not valid:\n\n%1\n\nTrying to use this cheat will not work "
|
||||
"as expected. Do you want to continue?")
|
||||
.arg(QString::fromStdString(error.GetDescription()))) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -900,8 +902,8 @@ void CheatCodeEditorDialog::saveClicked()
|
||||
// if the name has changed, then we need to make sure it hasn't already been used
|
||||
if (new_name != m_code->name && m_parent->hasCodeWithName(new_name))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("A code with the name '%1' already exists.").arg(QString::fromStdString(new_name)));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("A code with the name '%1' already exists.").arg(QString::fromStdString(new_name)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -941,8 +943,8 @@ void CheatCodeEditorDialog::saveClicked()
|
||||
std::string path = m_parent->getPathForSavingCheats();
|
||||
if (!Cheats::UpdateCodeInFile(path.c_str(), old_name, m_code, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save cheat code:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to save cheat code:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
|
||||
accept();
|
||||
@@ -1076,7 +1078,7 @@ void GameCheatCodeChoiceEditorDialog::onSaveClicked()
|
||||
const int count = m_ui.optionList->topLevelItemCount();
|
||||
if (count == 0)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("At least one option must be defined."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("At least one option must be defined."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1091,7 +1093,7 @@ void GameCheatCodeChoiceEditorDialog::onSaveClicked()
|
||||
|
||||
if (m_ui.optionList->topLevelItem(j)->text(0) == this_name)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("The option '%1' is defined twice.").arg(this_name));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("The option '%1' is defined twice.").arg(this_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1100,8 +1102,8 @@ void GameCheatCodeChoiceEditorDialog::onSaveClicked()
|
||||
const QString this_value = it->text(1);
|
||||
if (bool ok; this_value.toUInt(&ok), !ok)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("The option '%1' does not have a valid value. It must be a number.").arg(this_name));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("The option '%1' does not have a valid value. It must be a number.").arg(this_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "common/progress_callback.h"
|
||||
#include "common/timer.h"
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "moc_gamelistrefreshthread.cpp"
|
||||
|
||||
GameListRefreshThread::GameListRefreshThread(bool invalidate_cache) : QThread(), m_invalidate_cache(invalidate_cache)
|
||||
@@ -81,18 +79,18 @@ void GameListRefreshThread::SetProgressValue(u32 value)
|
||||
|
||||
void GameListRefreshThread::ModalError(const std::string_view message)
|
||||
{
|
||||
QMessageBox::critical(nullptr, QStringLiteral("Error"), QtUtils::StringViewToQString(message));
|
||||
QtUtils::MessageBoxCritical(nullptr, QStringLiteral("Error"), QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
bool GameListRefreshThread::ModalConfirmation(const std::string_view message)
|
||||
{
|
||||
return QMessageBox::question(nullptr, QStringLiteral("Question"), QtUtils::StringViewToQString(message)) ==
|
||||
return QtUtils::MessageBoxQuestion(nullptr, QStringLiteral("Question"), QtUtils::StringViewToQString(message)) ==
|
||||
QMessageBox::Yes;
|
||||
}
|
||||
|
||||
void GameListRefreshThread::ModalInformation(const std::string_view message)
|
||||
{
|
||||
QMessageBox::information(nullptr, QStringLiteral("Information"), QtUtils::StringViewToQString(message));
|
||||
QtUtils::MessageBoxInformation(nullptr, QStringLiteral("Information"), QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
void GameListRefreshThread::fireUpdate()
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QHeaderView>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <algorithm>
|
||||
|
||||
#include "moc_gamelistsettingswidget.cpp"
|
||||
@@ -182,13 +181,13 @@ void GameListSettingsWidget::addSearchDirectory(QWidget* parent_widget)
|
||||
if (dir.isEmpty())
|
||||
return;
|
||||
|
||||
QMessageBox::StandardButton selection =
|
||||
QMessageBox::question(this, tr("Scan Recursively?"),
|
||||
tr("Would you like to scan the directory \"%1\" recursively?\n\nScanning recursively takes "
|
||||
"more time, but will identify files in subdirectories.")
|
||||
.arg(dir),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (selection == QMessageBox::Cancel)
|
||||
QMessageBox::StandardButton selection = QtUtils::MessageBoxQuestion(
|
||||
this, tr("Scan Recursively?"),
|
||||
tr("Would you like to scan the directory \"%1\" recursively?\n\nScanning recursively takes "
|
||||
"more time, but will identify files in subdirectories.")
|
||||
.arg(dir),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (selection != QMessageBox::Yes && selection != QMessageBox::No)
|
||||
return;
|
||||
|
||||
const bool recursive = (selection == QMessageBox::Yes);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <QtCore/QStringBuilder>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QDialogButtonBox>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QTextBrowser>
|
||||
|
||||
#include "moc_gamesummarywidget.cpp"
|
||||
@@ -416,8 +415,8 @@ void GameSummaryWidget::onInputProfileChanged(int index)
|
||||
InputManager::CopyConfiguration(sif, *base_sif, true, true, true, false);
|
||||
|
||||
QWidget* dlg_parent = QtUtils::GetRootWidget(this);
|
||||
QMessageBox::information(dlg_parent, dlg_parent->windowTitle(),
|
||||
tr("Per-game controller configuration initialized with global settings."));
|
||||
QtUtils::MessageBoxInformation(dlg_parent, dlg_parent->windowTitle(),
|
||||
tr("Per-game controller configuration initialized with global settings."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,7 +460,7 @@ void GameSummaryWidget::onComputeHashClicked()
|
||||
std::unique_ptr<CDImage> image = CDImage::Open(m_path.c_str(), false, nullptr);
|
||||
if (!image)
|
||||
{
|
||||
QMessageBox::critical(QtUtils::GetRootWidget(this), tr("Error"), tr("Failed to open CD image for hashing."));
|
||||
QtUtils::MessageBoxCritical(QtUtils::GetRootWidget(this), tr("Error"), tr("Failed to open CD image for hashing."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1384,7 +1384,7 @@ void GraphicsSettingsWidget::onTextureReplacementOptionsClicked()
|
||||
if (!FileSystem::WriteStringToFile(QDir::toNativeSeparators(path).toUtf8().constData(),
|
||||
idlg.textValue().toStdString(), &error))
|
||||
{
|
||||
QMessageBox::critical(&dlg, tr("Write Failed"), QString::fromStdString(error.GetDescription()));
|
||||
QtUtils::MessageBoxCritical(&dlg, tr("Write Failed"), QString::fromStdString(error.GetDescription()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <QtWidgets/QGridLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QScrollArea>
|
||||
|
||||
#include "moc_hotkeysettingswidget.cpp"
|
||||
|
||||
@@ -421,10 +421,10 @@ void InputBindingWidget::showEffectBindingDialog()
|
||||
{
|
||||
if (!g_emu_thread->getInputDeviceListModel()->hasEffectsOfType(m_bind_type))
|
||||
{
|
||||
QMessageBox::critical(QtUtils::GetRootWidget(this), tr("Error"),
|
||||
(m_bind_type == InputBindingInfo::Type::Motor) ?
|
||||
tr("No devices with vibration motors were detected.") :
|
||||
tr("No devices with LEDs were detected."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
(m_bind_type == InputBindingInfo::Type::Motor) ?
|
||||
tr("No devices with vibration motors were detected.") :
|
||||
tr("No devices with LEDs were detected."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "moc_isobrowserwindow.cpp"
|
||||
|
||||
@@ -51,8 +50,8 @@ ISOBrowserWindow* ISOBrowserWindow::createAndOpenFile(QWidget* parent, const QSt
|
||||
Error error;
|
||||
if (!ib->tryOpenFile(path, &error))
|
||||
{
|
||||
QMessageBox::critical(parent, tr("Error"),
|
||||
tr("Failed to open %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
parent, tr("Error"), tr("Failed to open %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
|
||||
delete ib;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -92,8 +91,8 @@ void ISOBrowserWindow::onOpenFileClicked()
|
||||
Error error;
|
||||
if (!tryOpenFile(path, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to open %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to open %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -209,8 +208,8 @@ void ISOBrowserWindow::extractFile(const QString& path, IsoReader::ReadMode mode
|
||||
}
|
||||
}
|
||||
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to save %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
|
||||
QTreeWidgetItem* ISOBrowserWindow::findDirectoryItemForPath(const QString& path, QTreeWidgetItem* parent) const
|
||||
|
||||
@@ -247,7 +247,7 @@ void LogWindow::onSaveTriggered()
|
||||
QFile file(path);
|
||||
if (!file.open(QFile::WriteOnly | QFile::Text))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to open file for writing."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("Failed to open file for writing."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include <QtGui/QWindowStateChangeEvent>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QProgressBar>
|
||||
#include <QtWidgets/QStyleFactory>
|
||||
#include <cmath>
|
||||
@@ -209,14 +208,14 @@ QMenu* MainWindow::createPopupMenu()
|
||||
|
||||
void MainWindow::reportError(const QString& title, const QString& message)
|
||||
{
|
||||
QMessageBox::critical(this, title, message, QMessageBox::Ok);
|
||||
QtUtils::MessageBoxCritical(this, title, message);
|
||||
}
|
||||
|
||||
bool MainWindow::confirmMessage(const QString& title, const QString& message)
|
||||
{
|
||||
SystemLock lock(pauseAndLockSystem());
|
||||
|
||||
return (QMessageBox::question(this, title, message) == QMessageBox::Yes);
|
||||
return (QtUtils::MessageBoxQuestion(this, title, message) == QMessageBox::Yes);
|
||||
}
|
||||
|
||||
void MainWindow::onStatusMessage(const QString& message)
|
||||
@@ -332,7 +331,7 @@ std::optional<WindowInfo> MainWindow::acquireRenderWindow(RenderAPI render_api,
|
||||
wi = m_display_widget->getWindowInfo(render_api, error);
|
||||
if (!wi.has_value())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to get window info from widget"));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("Failed to get window info from widget"));
|
||||
destroyDisplayWidget(true);
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -743,9 +742,10 @@ std::string MainWindow::getDeviceDiscPath(const QString& title)
|
||||
auto devices = CDImage::GetDeviceList();
|
||||
if (devices.empty())
|
||||
{
|
||||
QMessageBox::critical(this, title,
|
||||
tr("Could not find any CD-ROM devices. Please ensure you have a CD-ROM drive connected and "
|
||||
"sufficient permissions to access it."));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, title,
|
||||
tr("Could not find any CD-ROM devices. Please ensure you have a CD-ROM drive connected and "
|
||||
"sufficient permissions to access it."));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -965,11 +965,11 @@ void MainWindow::populateGameListContextMenu(const GameList::Entry* entry, QWidg
|
||||
if (has_any_states)
|
||||
{
|
||||
connect(delete_save_states_action, &QAction::triggered, [parent_window, serial = entry->serial] {
|
||||
if (QMessageBox::warning(
|
||||
if (QtUtils::MessageBoxWarning(
|
||||
parent_window, tr("Confirm Save State Deletion"),
|
||||
tr("Are you sure you want to delete all save states for %1?\n\nThe saves will not be recoverable.")
|
||||
.arg(QString::fromStdString(serial)),
|
||||
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
|
||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1227,8 +1227,8 @@ bool MainWindow::openResumeStateDialog(const std::string& path, const std::strin
|
||||
connect(delboot, &QPushButton::clicked, [this, dlg, path, save_state_path]() mutable {
|
||||
if (!FileSystem::DeleteFile(save_state_path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to delete save state file '%1'.").arg(QString::fromStdString(save_state_path)));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to delete save state file '%1'.").arg(QString::fromStdString(save_state_path)));
|
||||
}
|
||||
startFile(std::move(path), std::nullopt, std::nullopt);
|
||||
dlg->accept();
|
||||
@@ -1592,7 +1592,7 @@ void MainWindow::onGameListEntryActivated()
|
||||
// change disc on double click
|
||||
if (!entry->IsDisc())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("You must select a disc to change discs."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("You must select a disc to change discs."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1765,13 +1765,14 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry)
|
||||
{
|
||||
if (QFileInfo(old_filename) == QFileInfo(filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("You must select a different file to the current cover image."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Copy Error"),
|
||||
tr("You must select a different file to the current cover image."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this, tr("Cover Already Exists"),
|
||||
tr("A cover image for this game already exists, do you wish to replace it?"),
|
||||
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Cover Already Exists"),
|
||||
tr("A cover image for this game already exists, do you wish to replace it?"),
|
||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1779,17 +1780,18 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry)
|
||||
|
||||
if (QFile::exists(new_filename) && !QFile::remove(new_filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("Failed to remove existing cover '%1'").arg(new_filename));
|
||||
QtUtils::MessageBoxCritical(this, tr("Copy Error"), tr("Failed to remove existing cover '%1'").arg(new_filename));
|
||||
return;
|
||||
}
|
||||
if (!QFile::copy(filename, new_filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("Failed to copy '%1' to '%2'").arg(filename).arg(new_filename));
|
||||
QtUtils::MessageBoxCritical(this, tr("Copy Error"),
|
||||
tr("Failed to copy '%1' to '%2'").arg(filename).arg(new_filename));
|
||||
return;
|
||||
}
|
||||
if (!old_filename.isEmpty() && old_filename != new_filename && !QFile::remove(old_filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("Failed to remove '%1'").arg(old_filename));
|
||||
QtUtils::MessageBoxCritical(this, tr("Copy Error"), tr("Failed to remove '%1'").arg(old_filename));
|
||||
return;
|
||||
}
|
||||
m_game_list_widget->refreshGridCovers();
|
||||
@@ -1797,7 +1799,7 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry)
|
||||
|
||||
void MainWindow::clearGameListEntryPlayTime(const GameList::Entry* entry)
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Confirm Reset"),
|
||||
tr("Are you sure you want to reset the play time for '%1'?\n\nThis action cannot be undone.")
|
||||
.arg(QtUtils::StringViewToQString(
|
||||
@@ -2778,7 +2780,7 @@ void MainWindow::openGamePropertiesForCurrentGame(const char* category /* = null
|
||||
if (!entry)
|
||||
{
|
||||
lock.unlock();
|
||||
QMessageBox::critical(this, tr("Error"), tr("Game properties is only available for scanned games."));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"), tr("Game properties is only available for scanned games."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3147,18 +3149,18 @@ void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString&
|
||||
{
|
||||
if (!card_path.isEmpty() && !QFile::exists(card_path))
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Memory Card Not Found"),
|
||||
tr("Memory card '%1' does not exist. Do you want to create an empty memory card?").arg(card_path),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
Error error;
|
||||
if (!MemoryCardEditorWindow::createMemoryCard(card_path, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Memory Card Not Found"),
|
||||
tr("Failed to create memory card '%1': %2")
|
||||
.arg(card_path)
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Memory Card Not Found"),
|
||||
tr("Failed to create memory card '%1': %2")
|
||||
.arg(card_path)
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3173,7 +3175,7 @@ void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString&
|
||||
{
|
||||
if (!m_memory_card_editor_window->setCardA(card_a_path))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Memory Card Not Found"),
|
||||
tr("Memory card '%1' could not be found. Try starting the game and saving to create it.").arg(card_a_path));
|
||||
}
|
||||
@@ -3182,7 +3184,7 @@ void MainWindow::openMemoryCardEditor(const QString& card_a_path, const QString&
|
||||
{
|
||||
if (!m_memory_card_editor_window->setCardB(card_b_path))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Memory Card Not Found"),
|
||||
tr("Memory card '%1' could not be found. Try starting the game and saving to create it.").arg(card_b_path));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QStyledItemDelegate>
|
||||
|
||||
#include "moc_memorycardeditorwindow.cpp"
|
||||
@@ -363,8 +362,8 @@ bool MemoryCardEditorWindow::loadCard(const QString& filename, Card* card)
|
||||
std::string filename_str = filename.toStdString();
|
||||
if (!MemoryCardImage::LoadFromFile(&card->data, filename_str.c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to load memory card: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to load memory card: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -516,8 +515,8 @@ void MemoryCardEditorWindow::openCard(Card* card)
|
||||
Error error;
|
||||
if (!MemoryCardImage::LoadFromFile(&card->data, filename.toUtf8().constData(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to load memory card: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to load memory card: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -546,8 +545,8 @@ void MemoryCardEditorWindow::saveCard(Card* card)
|
||||
Error error;
|
||||
if (!MemoryCardImage::SaveToFile(card->data, card->filename.c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to save memory card: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to save memory card: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -561,10 +560,9 @@ void MemoryCardEditorWindow::promptForSave(Card* card)
|
||||
if (card->filename.empty() || !card->dirty)
|
||||
return;
|
||||
|
||||
if (QMessageBox::question(this, tr("Save memory card?"),
|
||||
tr("Memory card '%1' is not saved, do you want to save before closing?")
|
||||
.arg(QString::fromStdString(card->filename)),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Save memory card?"),
|
||||
tr("Memory card '%1' is not saved, do you want to save before closing?")
|
||||
.arg(QString::fromStdString(card->filename))) == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -584,7 +582,7 @@ void MemoryCardEditorWindow::doCopyFile()
|
||||
{
|
||||
if (dst_fi.filename == fi->filename)
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"),
|
||||
tr("Destination memory card already contains a save file with the same name (%1) as the one you are attempting "
|
||||
"to copy. Please delete this file from the destination memory card before copying.")
|
||||
@@ -595,10 +593,10 @@ void MemoryCardEditorWindow::doCopyFile()
|
||||
|
||||
if (dst->blocks_free < fi->num_blocks)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Insufficient blocks, this file needs %1 but only %2 are available.")
|
||||
.arg(fi->num_blocks)
|
||||
.arg(dst->blocks_free));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Insufficient blocks, this file needs %1 but only %2 are available.")
|
||||
.arg(fi->num_blocks)
|
||||
.arg(dst->blocks_free));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -606,19 +604,19 @@ void MemoryCardEditorWindow::doCopyFile()
|
||||
std::vector<u8> buffer;
|
||||
if (!MemoryCardImage::ReadFile(src->data, *fi, &buffer, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to read file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to read file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MemoryCardImage::WriteFile(&dst->data, fi->filename, buffer, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to write file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to write file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -637,7 +635,8 @@ void MemoryCardEditorWindow::doDeleteFile()
|
||||
|
||||
if (!MemoryCardImage::DeleteFile(&card->data, *fi, fi->deleted))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to delete file %1").arg(QString::fromStdString(fi->filename)));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to delete file %1").arg(QString::fromStdString(fi->filename)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -656,7 +655,7 @@ void MemoryCardEditorWindow::doUndeleteFile()
|
||||
|
||||
if (!MemoryCardImage::UndeleteFile(&card->data, *fi))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"),
|
||||
tr("Failed to undelete file %1. The file may have been partially overwritten by another save.")
|
||||
.arg(QString::fromStdString(fi->filename)));
|
||||
@@ -685,10 +684,10 @@ void MemoryCardEditorWindow::doExportSaveFile()
|
||||
Error error;
|
||||
if (!MemoryCardImage::ExportSave(&card->data, *fi, filename.toStdString().c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to export save file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to export save file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -706,10 +705,10 @@ void MemoryCardEditorWindow::doRenameSaveFile()
|
||||
Error error;
|
||||
if (!MemoryCardImage::RenameFile(&card->data, *fi, new_name, &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to rename save file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to rename save file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -733,10 +732,10 @@ void MemoryCardEditorWindow::importCard(Card* card)
|
||||
std::unique_ptr<MemoryCardImage::DataArray> temp = std::make_unique<MemoryCardImage::DataArray>();
|
||||
if (!MemoryCardImage::ImportCard(temp.get(), filename.toStdString().c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to import memory card from %1:\n%2")
|
||||
.arg(QFileInfo(filename).fileName())
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to import memory card from %1:\n%2")
|
||||
.arg(QFileInfo(filename).fileName())
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -754,11 +753,11 @@ void MemoryCardEditorWindow::formatCard(Card* card)
|
||||
{
|
||||
promptForSave(card);
|
||||
|
||||
if (QMessageBox::question(this, tr("Format memory card?"),
|
||||
tr("Formatting the memory card will destroy all saves, and they will not be recoverable. "
|
||||
"The memory card which will be formatted is located at '%1'.")
|
||||
.arg(QString::fromStdString(card->filename)),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Format memory card?"),
|
||||
tr("Formatting the memory card will destroy all saves, and they will not be recoverable. "
|
||||
"The memory card which will be formatted is located at '%1'.")
|
||||
.arg(QString::fromStdString(card->filename))) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -785,10 +784,10 @@ void MemoryCardEditorWindow::importSaveFile(Card* card)
|
||||
Error error;
|
||||
if (!MemoryCardImage::ImportSave(&card->data, filename.toStdString().c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to import save from %1:\n%2")
|
||||
.arg(QFileInfo(filename).fileName())
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to import save from %1:\n%2")
|
||||
.arg(QFileInfo(filename).fileName())
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtWidgets/QAbstractScrollArea>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <bit>
|
||||
|
||||
#include "moc_memoryeditorwindow.cpp"
|
||||
@@ -172,8 +171,8 @@ void MemoryEditorWindow::onMemorySearchTriggered()
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,8 +198,8 @@ void MemoryEditorWindow::onMemorySearchTriggered()
|
||||
|
||||
if (pattern.empty())
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(),
|
||||
tr("Invalid search pattern. It should contain hex digits or question marks."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,7 +211,7 @@ void MemoryEditorWindow::onMemorySearchTriggered()
|
||||
found_address = Bus::SearchMemory(0, pattern.data(), mask.data(), static_cast<u32>(pattern.size()));
|
||||
if (!found_address.has_value())
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(), tr("Pattern not found in memory."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(), tr("Pattern not found in memory."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,13 +227,13 @@ void MemoryEditorWindow::onMemorySearchTriggered()
|
||||
|
||||
if (wrapped_around)
|
||||
{
|
||||
QMessageBox::information(this, windowTitle(),
|
||||
tr("Pattern found at 0x%1 (passed the end of memory).")
|
||||
.arg(static_cast<uint>(found_address.value()), 8, 16, static_cast<QChar>('0')));
|
||||
QtUtils::MessageBoxInformation(this, windowTitle(),
|
||||
tr("Pattern found at 0x%1 (passed the end of memory).")
|
||||
.arg(static_cast<uint>(found_address.value()), 8, 16, static_cast<QChar>('0')));
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(
|
||||
QtUtils::MessageBoxInformation(
|
||||
this, windowTitle(),
|
||||
tr("Pattern found at 0x%1.").arg(static_cast<uint>(found_address.value()), 8, 16, static_cast<QChar>('0')));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QTreeWidgetItemIterator>
|
||||
#include <array>
|
||||
#include <utility>
|
||||
@@ -402,7 +401,7 @@ void MemoryScannerWindow::tryOpenAddressInMemoryEditor(VirtualMemoryAddress addr
|
||||
MemoryEditorWindow* const editor = g_main_window->getMemoryEditorWindow();
|
||||
if (!editor->scrollToMemoryAddress(address))
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(), tr("Failed to open memory editor at specified address."));
|
||||
QtUtils::MessageBoxCritical(this, windowTitle(), tr("Failed to open memory editor at specified address."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -672,7 +671,7 @@ std::string MemoryScannerWindow::getWatchSavePath(bool saving)
|
||||
Error error;
|
||||
if (!FileSystem::CreateDirectory(dir.c_str(), false, &error))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, windowTitle(),
|
||||
tr("Failed to create watches directory: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return ret;
|
||||
@@ -695,8 +694,9 @@ void MemoryScannerWindow::saveWatches()
|
||||
Error error;
|
||||
if (!m_watch.SaveToFile(path.c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Failed to save watches to file: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, windowTitle(),
|
||||
tr("Failed to save watches to file: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ void MemoryScannerWindow::reloadWatches()
|
||||
Error error;
|
||||
if (!m_watch.LoadFromFile(path.c_str(), &error))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, windowTitle(),
|
||||
tr("Failed to load watches from file: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QtWidgets/QGridLayout>
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QSlider>
|
||||
|
||||
#include "moc_postprocessingsettingswidget.cpp"
|
||||
@@ -193,8 +192,8 @@ void PostProcessingChainConfigWidget::onAddButtonClicked()
|
||||
if (!PostProcessing::Config::AddStage(si, m_section, shader, &error))
|
||||
{
|
||||
lock.unlock();
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to add shader: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Error"), tr("Failed to add shader: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -230,8 +229,8 @@ void PostProcessingChainConfigWidget::onRemoveButtonClicked()
|
||||
|
||||
void PostProcessingChainConfigWidget::onClearButtonClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Question"), tr("Are you sure you want to clear all shader stages?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Question"), tr("Are you sure you want to clear all shader stages?")) ==
|
||||
QMessageBox::Yes)
|
||||
{
|
||||
auto lock = Host::GetSettingsLock();
|
||||
SettingsInterface& si = getSettingsInterfaceToUpdate();
|
||||
@@ -630,7 +629,7 @@ void PostProcessingOverlayConfigWidget::onExportCustomConfigClicked()
|
||||
if (!FileSystem::WriteStringToFile(QDir::toNativeSeparators(path).toStdString().c_str(), output.toStdString(),
|
||||
&error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Export Error"),
|
||||
tr("Failed to save file: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(this, tr("Export Error"),
|
||||
tr("Failed to save file: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,9 +417,9 @@ std::optional<bool> QtHost::DownloadFile(QWidget* parent, const QString& title,
|
||||
std::unique_ptr<HTTPDownloader> http = HTTPDownloader::Create(Host::GetHTTPUserAgent(), &error);
|
||||
if (!http)
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Failed to create HTTPDownloader:\n%1")
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Failed to create HTTPDownloader:\n%1")
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -442,18 +442,18 @@ std::optional<bool> QtHost::DownloadFile(QWidget* parent, const QString& title,
|
||||
|
||||
if (status_code != HTTPDownloader::HTTP_STATUS_OK)
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Download failed with HTTP status code %1:\n%2")
|
||||
.arg(status_code)
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Download failed with HTTP status code %1:\n%2")
|
||||
.arg(status_code)
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
download_result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (hdata.empty())
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Download failed: Data is empty.").arg(status_code));
|
||||
QtUtils::MessageBoxCritical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Download failed: Data is empty.").arg(status_code));
|
||||
|
||||
download_result = false;
|
||||
return;
|
||||
@@ -491,10 +491,10 @@ bool QtHost::DownloadFile(QWidget* parent, const QString& title, std::string url
|
||||
!FileSystem::CreateDirectory(directory.c_str(), true, &error)) ||
|
||||
!FileSystem::WriteBinaryFile(path, data, &error))
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Failed to write '%1':\n%2")
|
||||
.arg(QString::fromUtf8(path))
|
||||
.arg(QString::fromUtf8(error.GetDescription())));
|
||||
QtUtils::MessageBoxCritical(parent, qApp->translate("QtHost", "Error"),
|
||||
qApp->translate("QtHost", "Failed to write '%1':\n%2")
|
||||
.arg(QString::fromUtf8(path))
|
||||
.arg(QString::fromUtf8(error.GetDescription())));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1188,12 +1188,12 @@ void EmuThread::confirmActionIfMemoryCardBusy(const QString& action, bool cancel
|
||||
Host::RunOnUIThread([action, cancel_resume_on_accept, callback = std::move(callback)]() mutable {
|
||||
auto lock = g_main_window->pauseAndLockSystem();
|
||||
|
||||
const bool result =
|
||||
(QMessageBox::question(lock.getDialogParent(), tr("Memory Card Busy"),
|
||||
tr("WARNING: Your game is still saving to the memory card. Continuing to %1 may "
|
||||
"IRREVERSIBLY DESTROY YOUR MEMORY CARD. We recommend resuming your game and waiting 5 "
|
||||
"seconds for it to finish saving.\n\nDo you want to %1 anyway?")
|
||||
.arg(action)) != QMessageBox::No);
|
||||
const bool result = (QtUtils::MessageBoxQuestion(
|
||||
lock.getDialogParent(), tr("Memory Card Busy"),
|
||||
tr("WARNING: Your game is still saving to the memory card. Continuing to %1 may "
|
||||
"IRREVERSIBLY DESTROY YOUR MEMORY CARD. We recommend resuming your game and waiting 5 "
|
||||
"seconds for it to finish saving.\n\nDo you want to %1 anyway?")
|
||||
.arg(action)) != QMessageBox::No);
|
||||
|
||||
if (cancel_resume_on_accept && !QtHost::IsFullscreenUIStarted())
|
||||
lock.cancelResume();
|
||||
@@ -1416,7 +1416,7 @@ void EmuThread::startControllerTest()
|
||||
Host::RunOnUIThread([path = std::move(path)]() mutable {
|
||||
{
|
||||
auto lock = g_main_window->pauseAndLockSystem();
|
||||
if (QMessageBox::question(
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
lock.getDialogParent(), tr("Confirm Download"),
|
||||
tr("Your DuckStation installation does not have the padtest application "
|
||||
"available.\n\nThis file is approximately 206KB, do you want to download it now?")) != QMessageBox::Yes)
|
||||
@@ -2152,8 +2152,8 @@ void Host::ConfirmMessageAsync(std::string_view title, std::string_view message,
|
||||
};
|
||||
|
||||
FullscreenUI::OpenConfirmMessageDialog(std::move(title), std::move(message), std::move(final_callback),
|
||||
fmt::format(ICON_FA_CHECK " {}", yes_text),
|
||||
fmt::format(ICON_FA_XMARK " {}", no_text));
|
||||
fmt::format(ICON_FA_CHECK " {}", yes_text),
|
||||
fmt::format(ICON_FA_XMARK " {}", no_text));
|
||||
FullscreenUI::UpdateRunIdleState();
|
||||
});
|
||||
}
|
||||
@@ -2335,7 +2335,7 @@ void QtHost::UpdateApplicationLanguage(QWidget* dialog_parent)
|
||||
QTranslator* base_translator = new QTranslator(qApp);
|
||||
if (!base_translator->load(base_path))
|
||||
{
|
||||
QMessageBox::warning(
|
||||
QtUtils::MessageBoxWarning(
|
||||
dialog_parent, QStringLiteral("Translation Error"),
|
||||
QStringLiteral("Failed to load base translation file for '%1':\n%2").arg(qlanguage).arg(base_path));
|
||||
delete base_translator;
|
||||
@@ -2350,7 +2350,7 @@ void QtHost::UpdateApplicationLanguage(QWidget* dialog_parent)
|
||||
const QString path = QStringLiteral("%1/duckstation-qt_%3.qm").arg(base_dir).arg(qlanguage);
|
||||
if (!QFile::exists(path))
|
||||
{
|
||||
QMessageBox::warning(
|
||||
QtUtils::MessageBoxWarning(
|
||||
dialog_parent, QStringLiteral("Translation Error"),
|
||||
QStringLiteral("Failed to find translation file for language '%1':\n%2").arg(qlanguage).arg(path));
|
||||
return;
|
||||
@@ -2359,7 +2359,7 @@ void QtHost::UpdateApplicationLanguage(QWidget* dialog_parent)
|
||||
QTranslator* translator = new QTranslator(qApp);
|
||||
if (!translator->load(path))
|
||||
{
|
||||
QMessageBox::warning(
|
||||
QtUtils::MessageBoxWarning(
|
||||
dialog_parent, QStringLiteral("Translation Error"),
|
||||
QStringLiteral("Failed to load translation file for language '%1':\n%2").arg(qlanguage).arg(path));
|
||||
delete translator;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <array>
|
||||
|
||||
#include "moc_qtprogresscallback.cpp"
|
||||
@@ -74,18 +73,18 @@ void QtModalProgressCallback::SetProgressValue(u32 value)
|
||||
|
||||
void QtModalProgressCallback::ModalError(const std::string_view message)
|
||||
{
|
||||
QMessageBox::critical(&m_dialog, tr("Error"), QtUtils::StringViewToQString(message));
|
||||
QtUtils::MessageBoxCritical(&m_dialog, tr("Error"), QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
bool QtModalProgressCallback::ModalConfirmation(const std::string_view message)
|
||||
{
|
||||
return (QMessageBox::question(&m_dialog, tr("Question"), QtUtils::StringViewToQString(message), QMessageBox::Yes,
|
||||
QMessageBox::No) == QMessageBox::Yes);
|
||||
return (QtUtils::MessageBoxQuestion(&m_dialog, tr("Question"), QtUtils::StringViewToQString(message)) ==
|
||||
QMessageBox::Yes);
|
||||
}
|
||||
|
||||
void QtModalProgressCallback::ModalInformation(const std::string_view message)
|
||||
{
|
||||
QMessageBox::information(&m_dialog, tr("Information"), QtUtils::StringViewToQString(message));
|
||||
QtUtils::MessageBoxInformation(&m_dialog, tr("Information"), QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
void QtModalProgressCallback::dialogCancelled()
|
||||
@@ -153,18 +152,18 @@ void QtAsyncProgressThread::SetProgressValue(u32 value)
|
||||
|
||||
void QtAsyncProgressThread::ModalError(const std::string_view message)
|
||||
{
|
||||
QMessageBox::critical(parentWidget(), tr("Error"), QtUtils::StringViewToQString(message));
|
||||
QtUtils::MessageBoxCritical(parentWidget(), tr("Error"), QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
bool QtAsyncProgressThread::ModalConfirmation(const std::string_view message)
|
||||
{
|
||||
return (QMessageBox::question(parentWidget(), tr("Question"), QtUtils::StringViewToQString(message), QMessageBox::Yes,
|
||||
QMessageBox::No) == QMessageBox::Yes);
|
||||
return (QtUtils::MessageBoxQuestion(parentWidget(), tr("Question"), QtUtils::StringViewToQString(message)) ==
|
||||
QMessageBox::Yes);
|
||||
}
|
||||
|
||||
void QtAsyncProgressThread::ModalInformation(const std::string_view message)
|
||||
{
|
||||
QMessageBox::information(parentWidget(), tr("Information"), QtUtils::StringViewToQString(message));
|
||||
QtUtils::MessageBoxInformation(parentWidget(), tr("Information"), QtUtils::StringViewToQString(message));
|
||||
}
|
||||
|
||||
void QtAsyncProgressThread::start()
|
||||
|
||||
@@ -135,8 +135,8 @@ void QtUtils::OpenURL(QWidget* parent, const QUrl& qurl)
|
||||
{
|
||||
if (!QDesktopServices::openUrl(qurl))
|
||||
{
|
||||
QMessageBox::critical(parent, QObject::tr("Failed to open URL"),
|
||||
QObject::tr("Failed to open URL.\n\nThe URL was: %1").arg(qurl.toString()));
|
||||
MessageBoxCritical(parent, QObject::tr("Failed to open URL"),
|
||||
QObject::tr("Failed to open URL.\n\nThe URL was: %1").arg(qurl.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ std::optional<unsigned> QtUtils::PromptForAddress(QWidget* parent, const QString
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
QMessageBox::critical(
|
||||
MessageBoxCritical(
|
||||
parent, title,
|
||||
qApp->translate("DebuggerWindow", "Invalid address. It should be in hex (0x12345678 or 12345678)"));
|
||||
return std::nullopt;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "common/log.h"
|
||||
|
||||
#include <QtGui/QWheelEvent>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QScrollBar>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
|
||||
@@ -290,10 +289,9 @@ void SettingsWindow::onCategoryCurrentRowChanged(int row)
|
||||
|
||||
void SettingsWindow::onRestoreDefaultsClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Confirm Restore Defaults"),
|
||||
tr("Are you sure you want to restore the default settings? Any preferences will be "
|
||||
"lost.\n\nYou cannot undo this action."),
|
||||
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(this, tr("Confirm Restore Defaults"),
|
||||
tr("Are you sure you want to restore the default settings? Any preferences will be "
|
||||
"lost.\n\nYou cannot undo this action.")) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -306,11 +304,10 @@ void SettingsWindow::onCopyGlobalSettingsClicked()
|
||||
if (!isPerGameSettings())
|
||||
return;
|
||||
|
||||
if (QMessageBox::question(
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("DuckStation Settings"),
|
||||
tr("The configuration for this game will be replaced by the current global settings.\n\nAny current setting "
|
||||
"values will be overwritten.\n\nDo you want to continue?"),
|
||||
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
|
||||
"values will be overwritten.\n\nDo you want to continue?")) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -325,7 +322,8 @@ void SettingsWindow::onCopyGlobalSettingsClicked()
|
||||
|
||||
reloadPages();
|
||||
|
||||
QMessageBox::information(this, tr("DuckStation Settings"), tr("Per-game configuration copied from global settings."));
|
||||
QtUtils::MessageBoxInformation(this, tr("DuckStation Settings"),
|
||||
tr("Per-game configuration copied from global settings."));
|
||||
}
|
||||
|
||||
void SettingsWindow::onClearSettingsClicked()
|
||||
@@ -333,10 +331,10 @@ void SettingsWindow::onClearSettingsClicked()
|
||||
if (!isPerGameSettings())
|
||||
return;
|
||||
|
||||
if (QMessageBox::question(this, tr("DuckStation Settings"),
|
||||
tr("The configuration for this game will be cleared.\n\nAny current setting values will be "
|
||||
"lost.\n\nDo you want to continue?"),
|
||||
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("DuckStation Settings"),
|
||||
tr("The configuration for this game will be cleared.\n\nAny current setting values will be "
|
||||
"lost.\n\nDo you want to continue?")) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -346,7 +344,7 @@ void SettingsWindow::onClearSettingsClicked()
|
||||
|
||||
reloadPages();
|
||||
|
||||
QMessageBox::information(this, tr("DuckStation Settings"), tr("Per-game configuration cleared."));
|
||||
QtUtils::MessageBoxInformation(this, tr("DuckStation Settings"), tr("Per-game configuration cleared."));
|
||||
}
|
||||
|
||||
void SettingsWindow::registerWidgetHelp(QObject* object, QString title, QString recommended_value, QString text)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QSlider>
|
||||
#include <QtWidgets/QSpinBox>
|
||||
|
||||
@@ -1435,14 +1434,13 @@ inline void BindWidgetToFolderSetting(SettingsInterface* sif, QLineEdit* widget,
|
||||
if (!new_value.empty())
|
||||
{
|
||||
if (FileSystem::DirectoryExists(new_value.c_str()) ||
|
||||
QMessageBox::question(
|
||||
QtUtils::MessageBoxQuestion(
|
||||
QtUtils::GetRootWidget(widget), qApp->translate("SettingWidgetBinder", "Confirm Folder"),
|
||||
qApp
|
||||
->translate(
|
||||
"SettingWidgetBinder",
|
||||
"The chosen directory does not currently exist:\n\n%1\n\nDo you want to create this directory?")
|
||||
.arg(QString::fromStdString(new_value)),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
.arg(QString::fromStdString(new_value))) == QMessageBox::Yes)
|
||||
{
|
||||
if (use_relative)
|
||||
{
|
||||
@@ -1461,8 +1459,8 @@ inline void BindWidgetToFolderSetting(SettingsInterface* sif, QLineEdit* widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(QtUtils::GetRootWidget(widget), qApp->translate("SettingWidgetBinder", "Error"),
|
||||
qApp->translate("SettingWidgetBinder", "Folder path cannot be empty."));
|
||||
QtUtils::MessageBoxCritical(widget, qApp->translate("SettingWidgetBinder", "Error"),
|
||||
qApp->translate("SettingWidgetBinder", "Folder path cannot be empty."));
|
||||
}
|
||||
|
||||
// reset to old value
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "moc_setupwizarddialog.cpp"
|
||||
|
||||
SetupWizardDialog::SetupWizardDialog()
|
||||
@@ -45,7 +43,7 @@ bool SetupWizardDialog::canShowNextPage()
|
||||
{
|
||||
if (!BIOS::HasAnyBIOSImages())
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Warning"),
|
||||
tr("No BIOS images were found. DuckStation WILL NOT be able to run games without a BIOS image.\n\nAre "
|
||||
"you sure you wish to continue without selecting a BIOS image?")) != QMessageBox::Yes)
|
||||
@@ -60,7 +58,7 @@ bool SetupWizardDialog::canShowNextPage()
|
||||
{
|
||||
if (m_ui.searchDirectoryList->rowCount() == 0)
|
||||
{
|
||||
if (QMessageBox::question(
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Warning"),
|
||||
tr("No game directories have been selected. You will have to manually open any game dumps you "
|
||||
"want to play, DuckStation's list will be empty.\n\nAre you sure you want to continue?")) !=
|
||||
@@ -132,9 +130,10 @@ void SetupWizardDialog::updatePageButtons()
|
||||
|
||||
void SetupWizardDialog::confirmCancel()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Cancel Setup"),
|
||||
tr("Are you sure you want to cancel DuckStation setup?\n\nAny changes have been saved, and "
|
||||
"the wizard will run again next time you start DuckStation.")) != QMessageBox::Yes)
|
||||
if (QtUtils::MessageBoxQuestion(
|
||||
this, tr("Cancel Setup"),
|
||||
tr("Are you sure you want to cancel DuckStation setup?\n\nAny changes have been saved, and "
|
||||
"the wizard will run again next time you start DuckStation.")) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -285,12 +284,12 @@ void SetupWizardDialog::onAddSearchDirectoryButtonClicked()
|
||||
return;
|
||||
|
||||
QMessageBox::StandardButton selection =
|
||||
QMessageBox::question(this, tr("Scan Recursively?"),
|
||||
QtUtils::MessageBoxQuestion(this, tr("Scan Recursively?"),
|
||||
tr("Would you like to scan the directory \"%1\" recursively?\n\nScanning recursively takes "
|
||||
"more time, but will identify files in subdirectories.")
|
||||
.arg(dir),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (selection == QMessageBox::Cancel)
|
||||
if (selection != QMessageBox::Yes && selection != QMessageBox::No)
|
||||
return;
|
||||
|
||||
const bool recursive = (selection == QMessageBox::Yes);
|
||||
@@ -473,7 +472,7 @@ void SetupWizardDialog::doDeviceAutomaticBinding(u32 port, QLabel* update_label,
|
||||
InputManager::GetGenericBindingMapping(device.toStdString());
|
||||
if (mapping.empty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Automatic Binding"),
|
||||
tr("No generic bindings were generated for device '%1'. The controller/source may not support automatic "
|
||||
"mapping.")
|
||||
|
||||
Reference in New Issue
Block a user