From 14da8232f638f7f0e63c7c668032aabae3047302 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Wed, 31 May 2017 23:16:47 -0700 Subject: [PATCH 1/3] ConfigManager: remove bAutoHideCursor It's not used, and sounds like the same thing as `HideCursor`? --- Source/Core/Core/ConfigManager.cpp | 2 -- Source/Core/Core/ConfigManager.h | 2 +- Source/Core/DolphinQt2/Settings/InterfacePane.cpp | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index b271ea544c..49259a7466 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -152,7 +152,6 @@ void SConfig::SaveInterfaceSettings(IniFile& ini) interface->Set("UsePanicHandlers", bUsePanicHandlers); interface->Set("OnScreenDisplayMessages", bOnScreenDisplayMessages); interface->Set("HideCursor", bHideCursor); - interface->Set("AutoHideCursor", bAutoHideCursor); interface->Set("MainWindowPosX", iPosX); interface->Set("MainWindowPosY", iPosY); interface->Set("MainWindowWidth", iWidth); @@ -458,7 +457,6 @@ void SConfig::LoadInterfaceSettings(IniFile& ini) interface->Get("UsePanicHandlers", &bUsePanicHandlers, true); interface->Get("OnScreenDisplayMessages", &bOnScreenDisplayMessages, true); interface->Get("HideCursor", &bHideCursor, false); - interface->Get("AutoHideCursor", &bAutoHideCursor, false); interface->Get("MainWindowPosX", &iPosX, INT_MIN); interface->Get("MainWindowPosY", &iPosY, INT_MIN); interface->Get("MainWindowWidth", &iWidth, -1); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index af23ba326b..81aaa20370 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -132,7 +132,7 @@ struct SConfig : NonCopyable // Interface settings bool bConfirmStop = false; - bool bHideCursor = false, bAutoHideCursor = false; + bool bHideCursor = false; bool bUsePanicHandlers = true; bool bOnScreenDisplayMessages = true; std::string theme_name; diff --git a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp index fd404fb83c..bae33ad704 100644 --- a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp @@ -131,7 +131,7 @@ void InterfacePane::LoadConfig() m_checkbox_enable_osd->setChecked(startup_params.bOnScreenDisplayMessages); m_checkbox_show_active_title->setChecked(startup_params.m_show_active_title); m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost); - m_checkbox_hide_mouse->setChecked(startup_params.bAutoHideCursor); + m_checkbox_hide_mouse->setChecked(startup_params.bHideCursor); } void InterfacePane::OnSaveConfig() @@ -148,7 +148,7 @@ void InterfacePane::OnSaveConfig() settings.bOnScreenDisplayMessages = m_checkbox_enable_osd->isChecked(); settings.m_show_active_title = m_checkbox_show_active_title->isChecked(); settings.m_PauseOnFocusLost = m_checkbox_pause_on_focus_lost->isChecked(); - settings.bAutoHideCursor = m_checkbox_hide_mouse->isChecked(); + settings.bHideCursor = m_checkbox_hide_mouse->isChecked(); settings.SaveSettings(); } From 833e38ed5646b888d14ff0d513ad60c408240c39 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Wed, 31 May 2017 23:49:06 -0700 Subject: [PATCH 2/3] Settings: emit HideCursorChanged() --- Source/Core/DolphinQt2/Settings.cpp | 11 +++++++++++ Source/Core/DolphinQt2/Settings.h | 3 +++ Source/Core/DolphinQt2/Settings/InterfacePane.cpp | 8 +++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt2/Settings.cpp b/Source/Core/DolphinQt2/Settings.cpp index a1ec7d7b94..824c001b59 100644 --- a/Source/Core/DolphinQt2/Settings.cpp +++ b/Source/Core/DolphinQt2/Settings.cpp @@ -213,6 +213,17 @@ QSize Settings::GetRenderWindowSize() const return value(QStringLiteral("Graphics/RenderWindowSize"), QSize(640, 480)).toSize(); } +void Settings::SetHideCursor(bool hide_cursor) +{ + SConfig::GetInstance().bHideCursor = hide_cursor; + emit HideCursorChanged(); +} + +bool Settings::GetHideCursor() const +{ + return SConfig::GetInstance().bHideCursor; +} + bool& Settings::BannerVisible() const { return SConfig::GetInstance().m_showBannerColumn; diff --git a/Source/Core/DolphinQt2/Settings.h b/Source/Core/DolphinQt2/Settings.h index d7f3dae319..8a8e79196a 100644 --- a/Source/Core/DolphinQt2/Settings.h +++ b/Source/Core/DolphinQt2/Settings.h @@ -71,6 +71,8 @@ public: bool GetRenderToMain() const; bool GetFullScreen() const; QSize GetRenderWindowSize() const; + void SetHideCursor(bool hide_cursor); + bool GetHideCursor() const; // Columns bool& BannerVisible() const; @@ -111,6 +113,7 @@ public: signals: void PathAdded(const QString&); void PathRemoved(const QString&); + void HideCursorChanged(); private: Settings(); diff --git a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp index bae33ad704..20f4e8dd1a 100644 --- a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp @@ -17,6 +17,8 @@ #include "Common/StringUtil.h" #include "Core/ConfigManager.h" +#include "DolphinQt2/Settings.h" + InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent) { CreateLayout(); @@ -113,7 +115,8 @@ void InterfacePane::ConnectLayout() connect(m_checkbox_use_panic_handlers, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_enable_osd, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_pause_on_focus_lost, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_hide_mouse, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_hide_mouse, &QCheckBox::clicked, &Settings::Instance(), + &Settings::SetHideCursor); } void InterfacePane::LoadConfig() @@ -131,7 +134,7 @@ void InterfacePane::LoadConfig() m_checkbox_enable_osd->setChecked(startup_params.bOnScreenDisplayMessages); m_checkbox_show_active_title->setChecked(startup_params.m_show_active_title); m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost); - m_checkbox_hide_mouse->setChecked(startup_params.bHideCursor); + m_checkbox_hide_mouse->setChecked(Settings::Instance().GetHideCursor()); } void InterfacePane::OnSaveConfig() @@ -148,7 +151,6 @@ void InterfacePane::OnSaveConfig() settings.bOnScreenDisplayMessages = m_checkbox_enable_osd->isChecked(); settings.m_show_active_title = m_checkbox_show_active_title->isChecked(); settings.m_PauseOnFocusLost = m_checkbox_pause_on_focus_lost->isChecked(); - settings.bHideCursor = m_checkbox_hide_mouse->isChecked(); settings.SaveSettings(); } From 328333dfb6e0a32cb91ac8464cbaa945e1ca7162 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Wed, 31 May 2017 23:49:21 -0700 Subject: [PATCH 3/3] RenderWidget: hide cursor --- Source/Core/DolphinQt2/RenderWidget.cpp | 10 ++++++++++ Source/Core/DolphinQt2/RenderWidget.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/Source/Core/DolphinQt2/RenderWidget.cpp b/Source/Core/DolphinQt2/RenderWidget.cpp index 7d5d7caeb5..3022e00ec2 100644 --- a/Source/Core/DolphinQt2/RenderWidget.cpp +++ b/Source/Core/DolphinQt2/RenderWidget.cpp @@ -6,6 +6,7 @@ #include "DolphinQt2/Host.h" #include "DolphinQt2/RenderWidget.h" +#include "DolphinQt2/Settings.h" RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent) { @@ -17,6 +18,15 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent) connect(this, &RenderWidget::StateChanged, Host::GetInstance(), &Host::SetRenderFullscreen); connect(this, &RenderWidget::HandleChanged, Host::GetInstance(), &Host::SetRenderHandle); emit HandleChanged((void*)winId()); + + connect(&Settings::Instance(), &Settings::HideCursorChanged, this, + &RenderWidget::OnHideCursorChanged); + OnHideCursorChanged(); +} + +void RenderWidget::OnHideCursorChanged() +{ + setCursor(Settings::Instance().GetHideCursor() ? Qt::BlankCursor : Qt::ArrowCursor); } bool RenderWidget::event(QEvent* event) diff --git a/Source/Core/DolphinQt2/RenderWidget.h b/Source/Core/DolphinQt2/RenderWidget.h index 1225571661..0db0ee4d3c 100644 --- a/Source/Core/DolphinQt2/RenderWidget.h +++ b/Source/Core/DolphinQt2/RenderWidget.h @@ -22,4 +22,7 @@ signals: void HandleChanged(void* handle); void FocusChanged(bool focus); void StateChanged(bool fullscreen); + +private: + void OnHideCursorChanged(); };