mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
InterfacePane: Add BalloonTip to cursor visible radio buttons
This commit is contained in:
parent
a581fa2bfa
commit
33b64d6c91
@ -27,8 +27,13 @@ ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& se
|
||||
|
||||
void ConfigRadioInt::Update()
|
||||
{
|
||||
if (!isChecked())
|
||||
return;
|
||||
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
if (isChecked())
|
||||
{
|
||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||
emit OnSelected(m_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit OnDeselected(m_value);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,12 @@ class ConfigRadioInt : public ToolTipRadioButton
|
||||
public:
|
||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value);
|
||||
|
||||
signals:
|
||||
// Since selecting a new radio button deselects the old one, ::toggled will generate two signals.
|
||||
// These are convenience functions so you can receive only one signal if desired.
|
||||
void OnSelected(int new_value);
|
||||
void OnDeselected(int old_value);
|
||||
|
||||
private:
|
||||
void Update();
|
||||
|
||||
|
@ -418,12 +418,6 @@ void Settings::SetStateSlot(int slot)
|
||||
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), slot);
|
||||
}
|
||||
|
||||
void Settings::SetCursorVisibility(Config::ShowCursor hideCursor)
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::MAIN_SHOW_CURSOR, hideCursor);
|
||||
emit CursorVisibilityChanged();
|
||||
}
|
||||
|
||||
Config::ShowCursor Settings::GetCursorVisibility() const
|
||||
{
|
||||
return Config::Get(Config::MAIN_SHOW_CURSOR);
|
||||
|
@ -122,7 +122,6 @@ public:
|
||||
void SetUSBKeyboardConnected(bool connected);
|
||||
|
||||
// Graphics
|
||||
void SetCursorVisibility(Config::ShowCursor hideCursor);
|
||||
Config::ShowCursor GetCursorVisibility() const;
|
||||
bool GetLockCursor() const;
|
||||
void SetKeepWindowOnTop(bool top);
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
|
||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
@ -196,14 +197,13 @@ void InterfacePane::CreateInGame()
|
||||
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_radio_cursor_visible_movement =
|
||||
new ConfigRadioInt(tr("On Movement"), Config::MAIN_SHOW_CURSOR,
|
||||
static_cast<int>(Config::ShowCursor::OnMovement));
|
||||
m_radio_cursor_visible_never = new ConfigRadioInt(tr("Never"), Config::MAIN_SHOW_CURSOR,
|
||||
static_cast<int>(Config::ShowCursor::Never));
|
||||
m_radio_cursor_visible_always = new ConfigRadioInt(
|
||||
tr("Always"), Config::MAIN_SHOW_CURSOR, static_cast<int>(Config::ShowCursor::Constantly));
|
||||
|
||||
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_movement);
|
||||
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_never);
|
||||
@ -244,12 +244,12 @@ void InterfacePane::ConnectLayout()
|
||||
[this]() { OnLanguageChanged(); });
|
||||
connect(m_checkbox_top_window, &QCheckBox::toggled, &Settings::Instance(),
|
||||
&Settings::KeepWindowOnTopChanged);
|
||||
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_radio_cursor_visible_movement, &ConfigRadioInt::OnSelected, &Settings::Instance(),
|
||||
&Settings::CursorVisibilityChanged);
|
||||
connect(m_radio_cursor_visible_never, &ConfigRadioInt::OnSelected, &Settings::Instance(),
|
||||
&Settings::CursorVisibilityChanged);
|
||||
connect(m_radio_cursor_visible_always, &ConfigRadioInt::OnSelected, &Settings::Instance(),
|
||||
&Settings::CursorVisibilityChanged);
|
||||
connect(m_checkbox_lock_mouse, &QCheckBox::toggled, &Settings::Instance(),
|
||||
[this]() { Settings::Instance().LockCursorChanged(); });
|
||||
}
|
||||
@ -296,14 +296,6 @@ void InterfacePane::LoadConfig()
|
||||
|
||||
if (index > 0)
|
||||
SignalBlocking(m_combobox_userstyle)->setCurrentIndex(index);
|
||||
|
||||
// Render Window Options
|
||||
SignalBlocking(m_radio_cursor_visible_movement)
|
||||
->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement);
|
||||
SignalBlocking(m_radio_cursor_visible_always)
|
||||
->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Constantly);
|
||||
SignalBlocking(m_radio_cursor_visible_never)
|
||||
->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never);
|
||||
}
|
||||
|
||||
void InterfacePane::OnSaveConfig()
|
||||
@ -321,21 +313,6 @@ void InterfacePane::OnSaveConfig()
|
||||
Config::Save();
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleMovement()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(Config::ShowCursor::OnMovement);
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleNever()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Never);
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleAlways()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Constantly);
|
||||
}
|
||||
|
||||
void InterfacePane::OnLanguageChanged()
|
||||
{
|
||||
ModalMessageBox::information(
|
||||
@ -393,6 +370,16 @@ void InterfacePane::AddDescriptions()
|
||||
QT_TR_NOOP("Locks the Mouse Cursor to the Render Widget as long as it has focus. You can "
|
||||
"set a hotkey to unlock it."
|
||||
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
|
||||
static constexpr char TR_CURSOR_VISIBLE_MOVEMENT_DESCRIPTION[] =
|
||||
QT_TR_NOOP("Shows the Mouse Cursor briefly whenever it has recently moved, then hides it."
|
||||
"<br><br><dolphin_emphasis>If unsure, select this mode.</dolphin_emphasis>");
|
||||
static constexpr char TR_CURSOR_VISIBLE_NEVER_DESCRIPTION[] = QT_TR_NOOP(
|
||||
"Hides the Mouse Cursor whenever it is inside the render window and the render window is "
|
||||
"focused."
|
||||
"<br><br><dolphin_emphasis>If unsure, select "On Movement".</dolphin_emphasis>");
|
||||
static constexpr char TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION[] = QT_TR_NOOP(
|
||||
"Shows the Mouse Cursor at all times."
|
||||
"<br><br><dolphin_emphasis>If unsure, select "On Movement".</dolphin_emphasis>");
|
||||
|
||||
m_checkbox_use_builtin_title_database->SetDescription(tr(TR_TITLE_DATABASE_DESCRIPTION));
|
||||
|
||||
@ -421,4 +408,10 @@ void InterfacePane::AddDescriptions()
|
||||
m_checkbox_pause_on_focus_lost->SetDescription(tr(TR_PAUSE_ON_FOCUS_LOST_DESCRIPTION));
|
||||
|
||||
m_checkbox_lock_mouse->SetDescription(tr(TR_LOCK_MOUSE_DESCRIPTION));
|
||||
|
||||
m_radio_cursor_visible_movement->SetDescription(tr(TR_CURSOR_VISIBLE_MOVEMENT_DESCRIPTION));
|
||||
|
||||
m_radio_cursor_visible_never->SetDescription(tr(TR_CURSOR_VISIBLE_NEVER_DESCRIPTION));
|
||||
|
||||
m_radio_cursor_visible_always->SetDescription(tr(TR_CURSOR_VISIBLE_ALWAYS_DESCRIPTION));
|
||||
}
|
||||
|
@ -6,10 +6,10 @@
|
||||
#include <QWidget>
|
||||
|
||||
class ConfigBool;
|
||||
class ConfigRadioInt;
|
||||
class ConfigStringChoice;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class QVBoxLayout;
|
||||
class ToolTipCheckBox;
|
||||
|
||||
@ -28,9 +28,6 @@ private:
|
||||
void UpdateShowDebuggingCheckbox();
|
||||
void LoadConfig();
|
||||
void OnSaveConfig();
|
||||
void OnCursorVisibleMovement();
|
||||
void OnCursorVisibleNever();
|
||||
void OnCursorVisibleAlways();
|
||||
void OnLanguageChanged();
|
||||
|
||||
QVBoxLayout* m_main_layout;
|
||||
@ -51,8 +48,8 @@ private:
|
||||
ConfigBool* m_checkbox_enable_osd;
|
||||
ConfigBool* m_checkbox_show_active_title;
|
||||
ConfigBool* m_checkbox_pause_on_focus_lost;
|
||||
QRadioButton* m_radio_cursor_visible_movement;
|
||||
QRadioButton* m_radio_cursor_visible_never;
|
||||
QRadioButton* m_radio_cursor_visible_always;
|
||||
ConfigRadioInt* m_radio_cursor_visible_movement;
|
||||
ConfigRadioInt* m_radio_cursor_visible_never;
|
||||
ConfigRadioInt* m_radio_cursor_visible_always;
|
||||
ConfigBool* m_checkbox_lock_mouse;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user