mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Add option for Never Hide Mouse Cursor
Instead of having a single GUI checkbox for "Always Hide Mouse Cursor", I have instead opted to use radio buttons so the user can swap between different states of mouse visibility. "Movement" is the default behavior, "Never" will hide the mouse cursor the entire time the game is running, and "Always" will keep the mouse cursor always visible.
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
@ -169,23 +170,36 @@ void InterfacePane::CreateInGame()
|
||||
m_checkbox_enable_osd = new QCheckBox(tr("Show On-Screen Display Messages"));
|
||||
m_checkbox_show_active_title = new QCheckBox(tr("Show Active Title in Window Title"));
|
||||
m_checkbox_pause_on_focus_lost = new QCheckBox(tr("Pause on Focus Loss"));
|
||||
m_checkbox_hide_mouse = new QCheckBox(tr("Always Hide Mouse Cursor"));
|
||||
m_checkbox_lock_mouse = new QCheckBox(tr("Lock Mouse Cursor"));
|
||||
|
||||
m_checkbox_hide_mouse->setToolTip(
|
||||
tr("Will immediately hide the Mouse Cursor when it hovers on top of the Render Widget, "
|
||||
"otherwise "
|
||||
"there is a delay.\nIf \"Lock Mouse Cursor\" is enabled, it will hide on Mouse locked"));
|
||||
auto* mouse_groupbox = new QGroupBox(tr("Mouse Cursor Visibility"));
|
||||
auto* m_vboxlayout_hide_mouse = new QVBoxLayout;
|
||||
mouse_groupbox->setLayout(m_vboxlayout_hide_mouse);
|
||||
|
||||
m_radio_cursor_visible_movement = new QRadioButton(tr("On Movement"));
|
||||
m_radio_cursor_visible_movement->setToolTip(
|
||||
tr("Mouse Cursor hides after inactivity and returns upon Mouse Cursor movement."));
|
||||
m_radio_cursor_visible_never = new QRadioButton(tr("Never"));
|
||||
m_radio_cursor_visible_never->setToolTip(
|
||||
tr("Mouse Cursor will never be visible while a game is running."));
|
||||
m_radio_cursor_visible_always = new QRadioButton(tr("Always"));
|
||||
m_radio_cursor_visible_always->setToolTip(tr("Mouse Cursor will always be visible."));
|
||||
|
||||
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_movement);
|
||||
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_never);
|
||||
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_always);
|
||||
|
||||
m_checkbox_lock_mouse = new QCheckBox(tr("Lock Mouse Cursor"));
|
||||
m_checkbox_lock_mouse->setToolTip(tr("Will lock the Mouse Cursor to the Render Widget as long as "
|
||||
"it has focus. You can set a hotkey to unlock it."));
|
||||
|
||||
mouse_groupbox->setLayout(m_vboxlayout_hide_mouse);
|
||||
groupbox_layout->addWidget(m_checkbox_top_window);
|
||||
groupbox_layout->addWidget(m_checkbox_confirm_on_stop);
|
||||
groupbox_layout->addWidget(m_checkbox_use_panic_handlers);
|
||||
groupbox_layout->addWidget(m_checkbox_enable_osd);
|
||||
groupbox_layout->addWidget(m_checkbox_show_active_title);
|
||||
groupbox_layout->addWidget(m_checkbox_pause_on_focus_lost);
|
||||
groupbox_layout->addWidget(m_checkbox_hide_mouse);
|
||||
groupbox_layout->addWidget(mouse_groupbox);
|
||||
#ifdef _WIN32
|
||||
groupbox_layout->addWidget(m_checkbox_lock_mouse);
|
||||
#endif
|
||||
@ -211,8 +225,12 @@ void InterfacePane::ConnectLayout()
|
||||
connect(m_checkbox_show_active_title, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_enable_osd, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_pause_on_focus_lost, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_hide_mouse, &QCheckBox::toggled, &Settings::Instance(),
|
||||
&Settings::SetHideCursor);
|
||||
connect(m_radio_cursor_visible_movement, &QRadioButton::toggled, this,
|
||||
&InterfacePane::OnCursorVisibleMovement);
|
||||
connect(m_radio_cursor_visible_never, &QRadioButton::toggled, this,
|
||||
&InterfacePane::OnCursorVisibleNever);
|
||||
connect(m_radio_cursor_visible_always, &QRadioButton::toggled, this,
|
||||
&InterfacePane::OnCursorVisibleAlways);
|
||||
connect(m_checkbox_lock_mouse, &QCheckBox::toggled, &Settings::Instance(),
|
||||
&Settings::SetLockCursor);
|
||||
connect(m_checkbox_use_userstyle, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
@ -250,7 +268,13 @@ void InterfacePane::LoadConfig()
|
||||
m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost);
|
||||
m_checkbox_use_covers->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
|
||||
m_checkbox_focused_hotkeys->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS));
|
||||
m_checkbox_hide_mouse->setChecked(Settings::Instance().GetHideCursor());
|
||||
m_radio_cursor_visible_movement->setChecked(Settings::Instance().GetCursorVisibility() ==
|
||||
SConfig::ShowCursor::OnMovement);
|
||||
m_radio_cursor_visible_always->setChecked(Settings::Instance().GetCursorVisibility() ==
|
||||
SConfig::ShowCursor::Constantly);
|
||||
m_radio_cursor_visible_never->setChecked(Settings::Instance().GetCursorVisibility() ==
|
||||
SConfig::ShowCursor::Never);
|
||||
|
||||
m_checkbox_lock_mouse->setChecked(Settings::Instance().GetLockCursor());
|
||||
m_checkbox_disable_screensaver->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
|
||||
}
|
||||
@ -300,3 +324,18 @@ void InterfacePane::OnSaveConfig()
|
||||
|
||||
settings.SaveSettings();
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleMovement()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::OnMovement);
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleNever()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Never);
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleAlways()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Constantly);
|
||||
}
|
||||
|
Reference in New Issue
Block a user