Set hotkey for screen rotation

This commit is contained in:
Vitor Kiguchi 2020-01-08 18:33:37 -03:00
parent be88d2a59a
commit 5eb9a5b3bc
3 changed files with 8 additions and 2 deletions

View File

@ -57,7 +57,7 @@ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config:
// This must be in alphabetical order according to action name as it must have the same order as // This must be in alphabetical order according to action name as it must have the same order as
// UISetting::values.shortcuts, which is alphabetically ordered. // UISetting::values.shortcuts, which is alphabetically ordered.
// clang-format off // clang-format off
const std::array<UISettings::Shortcut, 20> default_hotkeys{ const std::array<UISettings::Shortcut, 21> default_hotkeys{
{{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral("\\"), Qt::ApplicationShortcut}}, {{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral("\\"), Qt::ApplicationShortcut}},
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}}, {QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}},
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}}, {QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
@ -70,6 +70,7 @@ const std::array<UISettings::Shortcut, 20> default_hotkeys{
{QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WindowShortcut}}, {QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WindowShortcut}},
{QStringLiteral("Remove Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F3"), Qt::ApplicationShortcut}}, {QStringLiteral("Remove Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F3"), Qt::ApplicationShortcut}},
{QStringLiteral("Restart Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F6"), Qt::WindowShortcut}}, {QStringLiteral("Restart Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F6"), Qt::WindowShortcut}},
{QStringLiteral("Rotate Screens Upright"), QStringLiteral("Main Window"), {QStringLiteral("F8"), Qt::WindowShortcut}},
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}}, {QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
{QStringLiteral("Swap Screens"), QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}}, {QStringLiteral("Swap Screens"), QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}}, {QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},

View File

@ -410,6 +410,8 @@ void GMainWindow::InitializeHotkeys() {
}); });
connect(hotkey_registry.GetHotkey("Main Window", "Swap Screens", render_window), connect(hotkey_registry.GetHotkey("Main Window", "Swap Screens", render_window),
&QShortcut::activated, ui.action_Screen_Layout_Swap_Screens, &QAction::trigger); &QShortcut::activated, ui.action_Screen_Layout_Swap_Screens, &QAction::trigger);
connect(hotkey_registry.GetHotkey("Main Window", "Rotate Screens Upright", render_window),
&QShortcut::activated, ui.action_Screen_Layout_Upright_Screens, &QAction::trigger);
connect(hotkey_registry.GetHotkey("Main Window", "Toggle Screen Layout", render_window), connect(hotkey_registry.GetHotkey("Main Window", "Toggle Screen Layout", render_window),
&QShortcut::activated, this, &GMainWindow::ToggleScreenLayout); &QShortcut::activated, this, &GMainWindow::ToggleScreenLayout);
connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window),
@ -607,6 +609,9 @@ void GMainWindow::ConnectMenuEvents() {
ui.action_Screen_Layout_Swap_Screens->setShortcut( ui.action_Screen_Layout_Swap_Screens->setShortcut(
hotkey_registry.GetHotkey("Main Window", "Swap Screens", this)->key()); hotkey_registry.GetHotkey("Main Window", "Swap Screens", this)->key());
ui.action_Screen_Layout_Swap_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut); ui.action_Screen_Layout_Swap_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut);
ui.action_Screen_Layout_Upright_Screens->setShortcut(
hotkey_registry.GetHotkey("Main Window", "Rotate Screens Upright", this)->key());
ui.action_Screen_Layout_Upright_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
connect(ui.action_Screen_Layout_Default, &QAction::triggered, this, connect(ui.action_Screen_Layout_Default, &QAction::triggered, this,
&GMainWindow::ChangeScreenLayout); &GMainWindow::ChangeScreenLayout);

View File

@ -109,8 +109,8 @@
<addaction name="action_Screen_Layout_Large_Screen"/> <addaction name="action_Screen_Layout_Large_Screen"/>
<addaction name="action_Screen_Layout_Side_by_Side"/> <addaction name="action_Screen_Layout_Side_by_Side"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Screen_Layout_Swap_Screens"/>
<addaction name="action_Screen_Layout_Upright_Screens"/> <addaction name="action_Screen_Layout_Upright_Screens"/>
<addaction name="action_Screen_Layout_Swap_Screens"/>
</widget> </widget>
<addaction name="action_Fullscreen"/> <addaction name="action_Fullscreen"/>
<addaction name="action_Single_Window_Mode"/> <addaction name="action_Single_Window_Mode"/>