Implement hotkey for "Exit application"

This commit is contained in:
Kevin M. McCormick 2025-12-24 16:13:41 -08:00
parent 13c6d497a0
commit 0556d5536d
3 changed files with 8 additions and 1 deletions

View File

@ -157,6 +157,7 @@ HotkeySettings::HotkeySettings(wxWindow* parent)
CreateHotkeyRow(_tr("Toggle fullscreen"), s_cfgHotkeys.toggleFullscreen);
CreateHotkeyRow(_tr("Take screenshot"), s_cfgHotkeys.takeScreenshot);
CreateHotkeyRow(_tr("Toggle fast-forward"), s_cfgHotkeys.toggleFastForward);
CreateHotkeyRow(_tr("Exit application"), s_cfgHotkeys.exitApplication);
m_controllerTimer = new wxTimer(this);
Bind(wxEVT_TIMER, &HotkeySettings::OnControllerTimer, this);
@ -192,6 +193,9 @@ void HotkeySettings::Init(MainWindow* mainWindowFrame)
{&s_cfgHotkeys.toggleFastForward, [](void) {
ActiveSettings::SetTimerShiftFactor((ActiveSettings::GetTimerShiftFactor() < 3) ? 3 : 1);
}},
{&s_cfgHotkeys.exitApplication, [](void) {
s_mainWindow->Close(true);
}},
});
s_keyboardHotkeyToFuncMap.reserve(s_cfgHotkeyToFuncMap.size());

View File

@ -115,6 +115,7 @@ void wxCemuConfig::Load(XMLConfigParser& parser)
hotkeys.toggleFullscreenAlt = xml_hotkeys.get("ToggleFullscreenAlt", sHotkeyCfg{uKeyboardHotkey{WXK_CONTROL_M, true}}); // ALT+ENTER
hotkeys.takeScreenshot = xml_hotkeys.get("TakeScreenshot", sHotkeyCfg{uKeyboardHotkey{WXK_F12}});
hotkeys.toggleFastForward = xml_hotkeys.get("ToggleFastForward", sHotkeyCfg{});
hotkeys.exitApplication = xml_hotkeys.get("ExitApplication", sHotkeyCfg{});
}
void wxCemuConfig::Save(XMLConfigParser& config)
@ -182,4 +183,5 @@ void wxCemuConfig::Save(XMLConfigParser& config)
xml_hotkeys.set("ToggleFullscreenAlt", hotkeys.toggleFullscreenAlt);
xml_hotkeys.set("TakeScreenshot", hotkeys.takeScreenshot);
xml_hotkeys.set("ToggleFastForward", hotkeys.toggleFastForward);
xml_hotkeys.set("ExitApplication", hotkeys.exitApplication);
}

View File

@ -127,6 +127,7 @@ struct wxCemuConfig
sHotkeyCfg exitFullscreen;
sHotkeyCfg takeScreenshot;
sHotkeyCfg toggleFastForward;
sHotkeyCfg exitApplication;
} hotkeys{};
void AddRecentlyLaunchedFile(std::string_view file);
@ -148,4 +149,4 @@ inline XMLWxCemuConfig_t& GetWxGuiConfigHandle()
inline wxCemuConfig& GetWxGUIConfig()
{
return GetWxGuiConfigHandle().Data();
}
}