From 382155e6fe25ede22c8290733acfe50665807828 Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Fri, 17 Feb 2023 04:21:52 +0100 Subject: Add hotkey to toggle screen emphasis Toggles which screen is emphasized when the screen sizing is set to emphasize top or bottom. (Closes issue #1565) --- src/frontend/qt_sdl/Config.cpp | 2 ++ src/frontend/qt_sdl/Config.h | 1 + src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp | 8 +++++--- src/frontend/qt_sdl/main.cpp | 13 +++++++++++++ src/frontend/qt_sdl/main.h | 2 ++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index 8b2f3d4..e93ddc4 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -182,6 +182,7 @@ ConfigEntry ConfigFile[] = {"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, true}, {"HKKey_FullscreenToggle", 0, &HKKeyMapping[HK_FullscreenToggle], -1, true}, {"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, true}, + {"HKKey_SwapScreenEmphasis", 0, &HKKeyMapping[HK_SwapScreenEmphasis], -1, true}, {"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, true}, {"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, true}, {"HKKey_FrameStep", 0, &HKKeyMapping[HK_FrameStep], -1, true}, @@ -194,6 +195,7 @@ ConfigEntry ConfigFile[] = {"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, true}, {"HKJoy_FullscreenToggle", 0, &HKJoyMapping[HK_FullscreenToggle], -1, true}, {"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, true}, + {"HKJoy_SwapScreenEmphasis", 0, &HKJoyMapping[HK_SwapScreenEmphasis], -1, true}, {"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, true}, {"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, true}, {"HKJoy_FrameStep", 0, &HKJoyMapping[HK_FrameStep], -1, true}, diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h index 6ccae5f..1b89cab 100644 --- a/src/frontend/qt_sdl/Config.h +++ b/src/frontend/qt_sdl/Config.h @@ -32,6 +32,7 @@ enum HK_FastForwardToggle, HK_FullscreenToggle, HK_SwapScreens, + HK_SwapScreenEmphasis, HK_SolarSensorDecrease, HK_SolarSensorIncrease, HK_FrameStep, diff --git a/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp b/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp index 92a0186..396da29 100644 --- a/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp +++ b/src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp @@ -60,7 +60,8 @@ const int hk_general[] = HK_FullscreenToggle, HK_Lid, HK_Mic, - HK_SwapScreens + HK_SwapScreens, + HK_SwapScreenEmphasis }; const char* hk_general_labels[] = @@ -73,12 +74,13 @@ const char* hk_general_labels[] = "Toggle fullscreen", "Close/open lid", "Microphone", - "Swap screens" + "Swap screens", + "Swap screen emphasis" }; const int keypad_num = 12; const int hk_addons_num = 2; -const int hk_general_num = 9; +const int hk_general_num = 10; InputConfigDialog::InputConfigDialog(QWidget* parent) : QDialog(parent), ui(new Ui::InputConfigDialog) diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 6c26060..803d1f1 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -426,6 +426,7 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent) connect(this, SIGNAL(screenLayoutChange()), mainWindow->panelWidget, SLOT(onScreenLayoutChanged())); connect(this, SIGNAL(windowFullscreenToggle()), mainWindow, SLOT(onFullscreenToggled())); connect(this, SIGNAL(swapScreensToggle()), mainWindow->actScreenSwap, SLOT(trigger())); + connect(this, SIGNAL(screenEmphasisToggle()), mainWindow, SLOT(onScreenEmphasisToggled())); static_cast(mainWindow->panel)->transferLayout(this); } @@ -596,6 +597,7 @@ void EmuThread::run() if (Input::HotkeyPressed(HK_FullscreenToggle)) emit windowFullscreenToggle(); if (Input::HotkeyPressed(HK_SwapScreens)) emit swapScreensToggle(); + if (Input::HotkeyPressed(HK_SwapScreenEmphasis)) emit screenEmphasisToggle(); if (Input::HotkeyPressed(HK_SolarSensorDecrease)) { @@ -3287,6 +3289,17 @@ void MainWindow::onFullscreenToggled() ToggleFullscreen(this); } +void MainWindow::onScreenEmphasisToggled() { + int currentSizing = Config::ScreenSizing; + if (currentSizing == screenSizing_EmphTop) { + Config::ScreenSizing = screenSizing_EmphBot; + } else if (currentSizing == screenSizing_EmphBot) { + Config::ScreenSizing = screenSizing_EmphTop; + } + + emit screenLayoutChange(); +} + void MainWindow::onEmuStart() { for (int i = 1; i < 9; i++) diff --git a/src/frontend/qt_sdl/main.h b/src/frontend/qt_sdl/main.h index 30af909..f9baea7 100644 --- a/src/frontend/qt_sdl/main.h +++ b/src/frontend/qt_sdl/main.h @@ -85,6 +85,7 @@ signals: void windowFullscreenToggle(); void swapScreensToggle(); + void screenEmphasisToggle(); private: void drawScreenGL(); @@ -331,6 +332,7 @@ private slots: void onUpdateVideoSettings(bool glchange); void onFullscreenToggled(); + void onScreenEmphasisToggled(); private: void closeEvent(QCloseEvent* event); -- cgit v1.2.3