main.cpp: connect_shortcut now also connects to the secondary window

This commit is contained in:
OpenSauce04 2024-08-02 23:44:08 +01:00
parent 303c67d3c8
commit fc8ef10853

View File

@ -609,7 +609,7 @@ void GMainWindow::InitializeSaveStateMenuActions() {
UpdateSaveStates(); UpdateSaveStates();
} }
void GMainWindow::InitializeHotkeys() { // TODO: This code kind of sucks void GMainWindow::InitializeHotkeys() {
hotkey_registry.LoadHotkeys(); hotkey_registry.LoadHotkeys();
const QString main_window = QStringLiteral("Main Window"); const QString main_window = QStringLiteral("Main Window");
@ -670,7 +670,9 @@ void GMainWindow::InitializeHotkeys() { // TODO: This code kind of sucks
const auto connect_shortcut = [&](const QString& action_name, const auto& function) { const auto connect_shortcut = [&](const QString& action_name, const auto& function) {
const auto* hotkey = hotkey_registry.GetHotkey(main_window, action_name, this); const auto* hotkey = hotkey_registry.GetHotkey(main_window, action_name, this);
const auto* secondary_hotkey = hotkey_registry.GetHotkey(main_window, action_name, secondary_window);
connect(hotkey, &QShortcut::activated, this, function); connect(hotkey, &QShortcut::activated, this, function);
connect(secondary_hotkey, &QShortcut::activated, this, function);
}; };
connect(hotkey_registry.GetHotkey(main_window, toggle_screen_layout, render_window), connect(hotkey_registry.GetHotkey(main_window, toggle_screen_layout, render_window),