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)
This commit is contained in:
Nadia Holmquist Pedersen 2023-02-17 04:21:52 +01:00
parent 00edeb3c3c
commit 382155e6fe
5 changed files with 23 additions and 3 deletions

View File

@ -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},

View File

@ -32,6 +32,7 @@ enum
HK_FastForwardToggle,
HK_FullscreenToggle,
HK_SwapScreens,
HK_SwapScreenEmphasis,
HK_SolarSensorDecrease,
HK_SolarSensorIncrease,
HK_FrameStep,

View File

@ -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)

View File

@ -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++)

View File

@ -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);