aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl
diff options
context:
space:
mode:
authorNadia Holmquist Pedersen <nadia@nhp.sh>2023-02-17 04:21:52 +0100
committerNadia Holmquist Pedersen <nadia@nhp.sh>2023-02-17 04:33:26 +0100
commit382155e6fe25ede22c8290733acfe50665807828 (patch)
tree90dc3d5d9e35d2f33f08bb8c284b5c3e64d7ed3b /src/frontend/qt_sdl
parent00edeb3c3c053bc2b3c9ac83e33688626498f2cc (diff)
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)
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r--src/frontend/qt_sdl/Config.cpp2
-rw-r--r--src/frontend/qt_sdl/Config.h1
-rw-r--r--src/frontend/qt_sdl/InputConfig/InputConfigDialog.cpp8
-rw-r--r--src/frontend/qt_sdl/main.cpp13
-rw-r--r--src/frontend/qt_sdl/main.h2
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<ScreenPanelGL*>(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);