mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 15:59:23 +01: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()
|
void ConfigRadioInt::Update()
|
||||||
{
|
{
|
||||||
if (!isChecked())
|
if (isChecked())
|
||||||
return;
|
{
|
||||||
|
Config::SetBaseOrCurrent(m_setting, m_value);
|
||||||
Config::SetBaseOrCurrent(m_setting, m_value);
|
emit OnSelected(m_value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit OnDeselected(m_value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,12 @@ class ConfigRadioInt : public ToolTipRadioButton
|
|||||||
public:
|
public:
|
||||||
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value);
|
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:
|
private:
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
@ -418,12 +418,6 @@ void Settings::SetStateSlot(int slot)
|
|||||||
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), 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
|
Config::ShowCursor Settings::GetCursorVisibility() const
|
||||||
{
|
{
|
||||||
return Config::Get(Config::MAIN_SHOW_CURSOR);
|
return Config::Get(Config::MAIN_SHOW_CURSOR);
|
||||||
|
@ -122,7 +122,6 @@ public:
|
|||||||
void SetUSBKeyboardConnected(bool connected);
|
void SetUSBKeyboardConnected(bool connected);
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
void SetCursorVisibility(Config::ShowCursor hideCursor);
|
|
||||||
Config::ShowCursor GetCursorVisibility() const;
|
Config::ShowCursor GetCursorVisibility() const;
|
||||||
bool GetLockCursor() const;
|
bool GetLockCursor() const;
|
||||||
void SetKeepWindowOnTop(bool top);
|
void SetKeepWindowOnTop(bool top);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||||
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
#include "DolphinQt/Config/ConfigControls/ConfigChoice.h"
|
||||||
|
#include "DolphinQt/Config/ConfigControls/ConfigRadio.h"
|
||||||
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||||
@ -196,14 +197,13 @@ void InterfacePane::CreateInGame()
|
|||||||
auto* m_vboxlayout_hide_mouse = new QVBoxLayout;
|
auto* m_vboxlayout_hide_mouse = new QVBoxLayout;
|
||||||
mouse_groupbox->setLayout(m_vboxlayout_hide_mouse);
|
mouse_groupbox->setLayout(m_vboxlayout_hide_mouse);
|
||||||
|
|
||||||
m_radio_cursor_visible_movement = new QRadioButton(tr("On Movement"));
|
m_radio_cursor_visible_movement =
|
||||||
m_radio_cursor_visible_movement->setToolTip(
|
new ConfigRadioInt(tr("On Movement"), Config::MAIN_SHOW_CURSOR,
|
||||||
tr("Mouse Cursor hides after inactivity and returns upon Mouse Cursor movement."));
|
static_cast<int>(Config::ShowCursor::OnMovement));
|
||||||
m_radio_cursor_visible_never = new QRadioButton(tr("Never"));
|
m_radio_cursor_visible_never = new ConfigRadioInt(tr("Never"), Config::MAIN_SHOW_CURSOR,
|
||||||
m_radio_cursor_visible_never->setToolTip(
|
static_cast<int>(Config::ShowCursor::Never));
|
||||||
tr("Mouse Cursor will never be visible while a game is running."));
|
m_radio_cursor_visible_always = new ConfigRadioInt(
|
||||||
m_radio_cursor_visible_always = new QRadioButton(tr("Always"));
|
tr("Always"), Config::MAIN_SHOW_CURSOR, static_cast<int>(Config::ShowCursor::Constantly));
|
||||||
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_movement);
|
||||||
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_never);
|
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_never);
|
||||||
@ -244,12 +244,12 @@ void InterfacePane::ConnectLayout()
|
|||||||
[this]() { OnLanguageChanged(); });
|
[this]() { OnLanguageChanged(); });
|
||||||
connect(m_checkbox_top_window, &QCheckBox::toggled, &Settings::Instance(),
|
connect(m_checkbox_top_window, &QCheckBox::toggled, &Settings::Instance(),
|
||||||
&Settings::KeepWindowOnTopChanged);
|
&Settings::KeepWindowOnTopChanged);
|
||||||
connect(m_radio_cursor_visible_movement, &QRadioButton::toggled, this,
|
connect(m_radio_cursor_visible_movement, &ConfigRadioInt::OnSelected, &Settings::Instance(),
|
||||||
&InterfacePane::OnCursorVisibleMovement);
|
&Settings::CursorVisibilityChanged);
|
||||||
connect(m_radio_cursor_visible_never, &QRadioButton::toggled, this,
|
connect(m_radio_cursor_visible_never, &ConfigRadioInt::OnSelected, &Settings::Instance(),
|
||||||
&InterfacePane::OnCursorVisibleNever);
|
&Settings::CursorVisibilityChanged);
|
||||||
connect(m_radio_cursor_visible_always, &QRadioButton::toggled, this,
|
connect(m_radio_cursor_visible_always, &ConfigRadioInt::OnSelected, &Settings::Instance(),
|
||||||
&InterfacePane::OnCursorVisibleAlways);
|
&Settings::CursorVisibilityChanged);
|
||||||
connect(m_checkbox_lock_mouse, &QCheckBox::toggled, &Settings::Instance(),
|
connect(m_checkbox_lock_mouse, &QCheckBox::toggled, &Settings::Instance(),
|
||||||
[this]() { Settings::Instance().LockCursorChanged(); });
|
[this]() { Settings::Instance().LockCursorChanged(); });
|
||||||
}
|
}
|
||||||
@ -296,14 +296,6 @@ void InterfacePane::LoadConfig()
|
|||||||
|
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
SignalBlocking(m_combobox_userstyle)->setCurrentIndex(index);
|
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()
|
void InterfacePane::OnSaveConfig()
|
||||||
@ -321,21 +313,6 @@ void InterfacePane::OnSaveConfig()
|
|||||||
Config::Save();
|
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()
|
void InterfacePane::OnLanguageChanged()
|
||||||
{
|
{
|
||||||
ModalMessageBox::information(
|
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 "
|
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."
|
"set a hotkey to unlock it."
|
||||||
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
|
"<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));
|
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_pause_on_focus_lost->SetDescription(tr(TR_PAUSE_ON_FOCUS_LOST_DESCRIPTION));
|
||||||
|
|
||||||
m_checkbox_lock_mouse->SetDescription(tr(TR_LOCK_MOUSE_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>
|
#include <QWidget>
|
||||||
|
|
||||||
class ConfigBool;
|
class ConfigBool;
|
||||||
|
class ConfigRadioInt;
|
||||||
class ConfigStringChoice;
|
class ConfigStringChoice;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QRadioButton;
|
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class ToolTipCheckBox;
|
class ToolTipCheckBox;
|
||||||
|
|
||||||
@ -28,9 +28,6 @@ private:
|
|||||||
void UpdateShowDebuggingCheckbox();
|
void UpdateShowDebuggingCheckbox();
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
void OnSaveConfig();
|
void OnSaveConfig();
|
||||||
void OnCursorVisibleMovement();
|
|
||||||
void OnCursorVisibleNever();
|
|
||||||
void OnCursorVisibleAlways();
|
|
||||||
void OnLanguageChanged();
|
void OnLanguageChanged();
|
||||||
|
|
||||||
QVBoxLayout* m_main_layout;
|
QVBoxLayout* m_main_layout;
|
||||||
@ -51,8 +48,8 @@ private:
|
|||||||
ConfigBool* m_checkbox_enable_osd;
|
ConfigBool* m_checkbox_enable_osd;
|
||||||
ConfigBool* m_checkbox_show_active_title;
|
ConfigBool* m_checkbox_show_active_title;
|
||||||
ConfigBool* m_checkbox_pause_on_focus_lost;
|
ConfigBool* m_checkbox_pause_on_focus_lost;
|
||||||
QRadioButton* m_radio_cursor_visible_movement;
|
ConfigRadioInt* m_radio_cursor_visible_movement;
|
||||||
QRadioButton* m_radio_cursor_visible_never;
|
ConfigRadioInt* m_radio_cursor_visible_never;
|
||||||
QRadioButton* m_radio_cursor_visible_always;
|
ConfigRadioInt* m_radio_cursor_visible_always;
|
||||||
ConfigBool* m_checkbox_lock_mouse;
|
ConfigBool* m_checkbox_lock_mouse;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user