diff options
author | Florian <fl.david.53@gmail.com> | 2023-08-26 21:23:02 +0200 |
---|---|---|
committer | flodavid <fl.david.53@gmail.com> | 2023-10-12 01:51:53 +0200 |
commit | 6c246f2ac5ce2ede656bf0d2def3b32f87e620b3 (patch) | |
tree | d6f9fd1a9965f95cd3f22102b79b02f09340ac04 /src/yuzu | |
parent | a34565727b6eba66cf20d32f3ec2ad073f29f9e1 (diff) |
yuzu: Use new setting method for stop emulation
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/configuration/shared_translation.cpp | 9 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/uisettings.h | 16 |
3 files changed, 24 insertions, 9 deletions
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 9e65525ca..3fe448f27 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -157,7 +157,7 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) { INSERT(UISettings, select_user_on_boot, "Prompt for user on game boot", ""); INSERT(UISettings, pause_when_in_background, "Pause emulation when in background", ""); INSERT(UISettings, confirm_before_closing, "Confirm exit while emulation is running", ""); - INSERT(UISettings, confirm_before_stopping, "Confirm stopping emulation", ""); + INSERT(UISettings, confirm_before_stopping, "Confirm before stopping emulation", ""); INSERT(UISettings, hide_mouse, "Hide mouse on inactivity", ""); INSERT(UISettings, controller_applet_disabled, "Disable controller applet", ""); @@ -384,6 +384,13 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) { translations->insert( {Settings::EnumMetadata<Settings::ConsoleMode>::Index(), {PAIR(ConsoleMode, Docked, "Docked"), PAIR(ConsoleMode, Handheld, "Handheld")}}); + translations->insert( + {Settings::EnumMetadata<Settings::ConfirmStop>::Index(), + { + PAIR(ConfirmStop, Ask_Always, "Always ask (Default)"), + PAIR(ConfirmStop, Ask_Based_On_Game, "Only if game specifies not to stop"), + PAIR(ConfirmStop, Ask_Never, "Never ask"), + }}); #undef PAIR #undef CTX_PAIR diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 26fa3e191..2727f9d06 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -3426,7 +3426,7 @@ void GMainWindow::OnPauseContinueGame() { void GMainWindow::OnStopGame() { // Open (or not) the right confirm dialog based on current setting and game exit lock - if (UISettings::values.confirm_before_stopping.GetValue() == UISettings::AskStopIndex::Always) { + if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) { if (system->GetExitLocked()) { if (!ConfirmForceLockedExit()) { return; @@ -3438,7 +3438,7 @@ void GMainWindow::OnStopGame() { } } else { if (UISettings::values.confirm_before_stopping.GetValue() == - UISettings::AskStopIndex::Game && + ConfirmStop::Ask_Based_On_Game && system->GetExitLocked()) { if (!ConfirmForceLockedExit()) { return; @@ -4081,13 +4081,15 @@ void GMainWindow::OnLoadAmiibo() { bool GMainWindow::question(QWidget* parent, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - ControllerNavigation* controller_navigation = new ControllerNavigation(system->HIDCore(), this); 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); diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 1216c4efa..b62ff620c 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -16,7 +16,9 @@ #include "common/settings_enums.h" using Settings::Category; +using Settings::ConfirmStop; using Settings::Setting; +using Settings::SwitchableSetting; #ifndef CANNOT_EXPLICITLY_INSTANTIATE namespace Settings { @@ -56,8 +58,6 @@ enum class Theme { MidnightBlueColorful, }; -enum AskStopIndex : int { Always, Game, Never }; - using Themes = std::array<std::pair<const char*, const char*>, 6>; extern const Themes themes; @@ -96,9 +96,15 @@ struct Values { Setting<bool> confirm_before_closing{ linkage, true, "confirmClose", Category::UiGeneral, Settings::Specialization::Default, true, true}; - Setting<bool> confirm_before_stopping{ - linkage, true, "confirmStop", Category::UiGeneral, Settings::Specialization::Default, - true, true}; + + SwitchableSetting<ConfirmStop> confirm_before_stopping{linkage, + ConfirmStop::Ask_Always, + "confirmStop", + Category::UiGeneral, + Settings::Specialization::Default, + true, + true}; + Setting<bool> first_start{linkage, true, "firstStart", Category::Ui}; Setting<bool> pause_when_in_background{linkage, false, |