|
@@ -211,7 +211,7 @@ void GMainWindow::ShowTelemetryCallout() {
|
|
|
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
|
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
|
|
"data is collected</a> to help improve yuzu. "
|
|
"data is collected</a> to help improve yuzu. "
|
|
|
"<br/><br/>Would you like to share your usage data with us?");
|
|
"<br/><br/>Would you like to share your usage data with us?");
|
|
|
- if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
|
|
|
|
|
|
|
+ if (!question(this, tr("Telemetry"), telemetry_message)) {
|
|
|
Settings::values.enable_telemetry = false;
|
|
Settings::values.enable_telemetry = false;
|
|
|
system->ApplySettings();
|
|
system->ApplySettings();
|
|
|
}
|
|
}
|
|
@@ -2420,9 +2420,8 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
|
|
|
}
|
|
}
|
|
|
}();
|
|
}();
|
|
|
|
|
|
|
|
- if (QMessageBox::question(this, tr("Remove Entry"), entry_question,
|
|
|
|
|
- QMessageBox::Yes | QMessageBox::No,
|
|
|
|
|
- QMessageBox::No) != QMessageBox::Yes) {
|
|
|
|
|
|
|
+ if (!question(this, tr("Remove Entry"), entry_question, QMessageBox::Yes | QMessageBox::No,
|
|
|
|
|
+ QMessageBox::No)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2521,8 +2520,8 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
|
|
}
|
|
}
|
|
|
}();
|
|
}();
|
|
|
|
|
|
|
|
- if (QMessageBox::question(this, tr("Remove File"), question, QMessageBox::Yes | QMessageBox::No,
|
|
|
|
|
- QMessageBox::No) != QMessageBox::Yes) {
|
|
|
|
|
|
|
+ if (!GMainWindow::question(this, tr("Remove File"), question,
|
|
|
|
|
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3409,10 +3408,13 @@ void GMainWindow::OnRestartGame() {
|
|
|
if (!system->IsPoweredOn()) {
|
|
if (!system->IsPoweredOn()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // Make a copy since ShutdownGame edits game_path
|
|
|
|
|
- const auto current_game = QString(current_game_path);
|
|
|
|
|
- ShutdownGame();
|
|
|
|
|
- BootGame(current_game);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (ConfirmShutdownGame()) {
|
|
|
|
|
+ // Make a copy since ShutdownGame edits game_path
|
|
|
|
|
+ const auto current_game = QString(current_game_path);
|
|
|
|
|
+ ShutdownGame();
|
|
|
|
|
+ BootGame(current_game);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void GMainWindow::OnPauseGame() {
|
|
void GMainWindow::OnPauseGame() {
|
|
@@ -3434,18 +3436,39 @@ void GMainWindow::OnPauseContinueGame() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void GMainWindow::OnStopGame() {
|
|
void GMainWindow::OnStopGame() {
|
|
|
- if (system->GetExitLocked() && !ConfirmForceLockedExit()) {
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ if (ConfirmShutdownGame()) {
|
|
|
|
|
+ play_time_manager->Stop();
|
|
|
|
|
+ // Update game list to show new play time
|
|
|
|
|
+ game_list->PopulateAsync(UISettings::values.game_dirs);
|
|
|
|
|
+ if (OnShutdownBegin()) {
|
|
|
|
|
+ OnShutdownBeginDialog();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ OnEmulationStopped();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- play_time_manager->Stop();
|
|
|
|
|
- // Update game list to show new play time
|
|
|
|
|
- game_list->PopulateAsync(UISettings::values.game_dirs);
|
|
|
|
|
- if (OnShutdownBegin()) {
|
|
|
|
|
- OnShutdownBeginDialog();
|
|
|
|
|
|
|
+bool GMainWindow::ConfirmShutdownGame() {
|
|
|
|
|
+ if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) {
|
|
|
|
|
+ if (system->GetExitLocked()) {
|
|
|
|
|
+ if (!ConfirmForceLockedExit()) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (!ConfirmChangeGame()) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- OnEmulationStopped();
|
|
|
|
|
|
|
+ if (UISettings::values.confirm_before_stopping.GetValue() ==
|
|
|
|
|
+ ConfirmStop::Ask_Based_On_Game &&
|
|
|
|
|
+ system->GetExitLocked()) {
|
|
|
|
|
+ if (!ConfirmForceLockedExit()) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void GMainWindow::OnLoadComplete() {
|
|
void GMainWindow::OnLoadComplete() {
|
|
@@ -3825,22 +3848,11 @@ void GMainWindow::OnTasRecord() {
|
|
|
const bool is_recording = input_subsystem->GetTas()->Record();
|
|
const bool is_recording = input_subsystem->GetTas()->Record();
|
|
|
if (!is_recording) {
|
|
if (!is_recording) {
|
|
|
is_tas_recording_dialog_active = true;
|
|
is_tas_recording_dialog_active = true;
|
|
|
- ControllerNavigation* controller_navigation =
|
|
|
|
|
- new ControllerNavigation(system->HIDCore(), this);
|
|
|
|
|
- // Use QMessageBox instead of question so we can link controller navigation
|
|
|
|
|
- QMessageBox* box_dialog = new QMessageBox();
|
|
|
|
|
- box_dialog->setWindowTitle(tr("TAS Recording"));
|
|
|
|
|
- box_dialog->setText(tr("Overwrite file of player 1?"));
|
|
|
|
|
- box_dialog->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
|
|
|
|
- box_dialog->setDefaultButton(QMessageBox::Yes);
|
|
|
|
|
- connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
|
|
|
|
|
- [box_dialog](Qt::Key key) {
|
|
|
|
|
- QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
|
|
|
|
|
- QCoreApplication::postEvent(box_dialog, event);
|
|
|
|
|
- });
|
|
|
|
|
- int res = box_dialog->exec();
|
|
|
|
|
- controller_navigation->UnloadController();
|
|
|
|
|
- input_subsystem->GetTas()->SaveRecording(res == QMessageBox::Yes);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ bool answer = question(this, tr("TAS Recording"), tr("Overwrite file of player 1?"),
|
|
|
|
|
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
|
|
+
|
|
|
|
|
+ input_subsystem->GetTas()->SaveRecording(answer);
|
|
|
is_tas_recording_dialog_active = false;
|
|
is_tas_recording_dialog_active = false;
|
|
|
}
|
|
}
|
|
|
OnTasStateChanged();
|
|
OnTasStateChanged();
|
|
@@ -4081,6 +4093,29 @@ void GMainWindow::OnLoadAmiibo() {
|
|
|
LoadAmiibo(filename);
|
|
LoadAmiibo(filename);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+bool GMainWindow::question(QWidget* parent, const QString& title, const QString& text,
|
|
|
|
|
+ QMessageBox::StandardButtons buttons,
|
|
|
|
|
+ QMessageBox::StandardButton defaultButton) {
|
|
|
|
|
+
|
|
|
|
|
+ QMessageBox* box_dialog = new QMessageBox(parent);
|
|
|
|
|
+ box_dialog->setWindowTitle(title);
|
|
|
|
|
+ box_dialog->setText(text);
|
|
|
|
|
+ box_dialog->setStandardButtons(buttons);
|
|
|
|
|
+ box_dialog->setDefaultButton(defaultButton);
|
|
|
|
|
+
|
|
|
|
|
+ ControllerNavigation* controller_navigation =
|
|
|
|
|
+ new ControllerNavigation(system->HIDCore(), box_dialog);
|
|
|
|
|
+ connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
|
|
|
|
|
+ [box_dialog](Qt::Key key) {
|
|
|
|
|
+ QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
|
|
|
|
|
+ QCoreApplication::postEvent(box_dialog, event);
|
|
|
|
|
+ });
|
|
|
|
|
+ int res = box_dialog->exec();
|
|
|
|
|
+
|
|
|
|
|
+ controller_navigation->UnloadController();
|
|
|
|
|
+ return res == QMessageBox::Yes;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void GMainWindow::LoadAmiibo(const QString& filename) {
|
|
void GMainWindow::LoadAmiibo(const QString& filename) {
|
|
|
auto* virtual_amiibo = input_subsystem->GetVirtualAmiibo();
|
|
auto* virtual_amiibo = input_subsystem->GetVirtualAmiibo();
|
|
|
const QString title = tr("Error loading Amiibo data");
|
|
const QString title = tr("Error loading Amiibo data");
|
|
@@ -4814,8 +4849,7 @@ bool GMainWindow::ConfirmClose() {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
const auto text = tr("Are you sure you want to close yuzu?");
|
|
const auto text = tr("Are you sure you want to close yuzu?");
|
|
|
- const auto answer = QMessageBox::question(this, tr("yuzu"), text);
|
|
|
|
|
- return answer != QMessageBox::No;
|
|
|
|
|
|
|
+ return question(this, tr("yuzu"), text);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void GMainWindow::closeEvent(QCloseEvent* event) {
|
|
void GMainWindow::closeEvent(QCloseEvent* event) {
|
|
@@ -4908,11 +4942,11 @@ bool GMainWindow::ConfirmChangeGame() {
|
|
|
if (emu_thread == nullptr)
|
|
if (emu_thread == nullptr)
|
|
|
return true;
|
|
return true;
|
|
|
|
|
|
|
|
- const auto answer = QMessageBox::question(
|
|
|
|
|
|
|
+ // Use custom question to link controller navigation
|
|
|
|
|
+ return question(
|
|
|
this, tr("yuzu"),
|
|
this, tr("yuzu"),
|
|
|
tr("Are you sure you want to stop the emulation? Any unsaved progress will be lost."),
|
|
tr("Are you sure you want to stop the emulation? Any unsaved progress will be lost."),
|
|
|
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
|
|
|
|
- return answer != QMessageBox::No;
|
|
|
|
|
|
|
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool GMainWindow::ConfirmForceLockedExit() {
|
|
bool GMainWindow::ConfirmForceLockedExit() {
|
|
@@ -4922,8 +4956,7 @@ bool GMainWindow::ConfirmForceLockedExit() {
|
|
|
const auto text = tr("The currently running application has requested yuzu to not exit.\n\n"
|
|
const auto text = tr("The currently running application has requested yuzu to not exit.\n\n"
|
|
|
"Would you like to bypass this and exit anyway?");
|
|
"Would you like to bypass this and exit anyway?");
|
|
|
|
|
|
|
|
- const auto answer = QMessageBox::question(this, tr("yuzu"), text);
|
|
|
|
|
- return answer != QMessageBox::No;
|
|
|
|
|
|
|
+ return question(this, tr("yuzu"), text);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void GMainWindow::RequestGameExit() {
|
|
void GMainWindow::RequestGameExit() {
|