From 3c0f6a29191ec2dcdf0eae54c21a7ccb9d97d9c2 Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Sat, 29 Aug 2020 22:04:03 +1000 Subject: [PATCH] Used new Qt connect syntax Fixed indenting Renamed click callback argument from 'val'->'checked' Converted m_gui re-usage to just reference ui Removed implicit capture from spinbox lambda Corrected millisecond acronym from mS->ms Removed superfluous QTimer include in gs_frame.cpp --- rpcs3/rpcs3qt/gs_frame.cpp | 5 ++--- rpcs3/rpcs3qt/gs_frame.h | 2 +- rpcs3/rpcs3qt/gui_settings.h | 12 ++++++------ rpcs3/rpcs3qt/settings_dialog.cpp | 10 +++++----- rpcs3/rpcs3qt/settings_dialog.ui | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index d4c9376687..55e06fc42d 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -8,7 +8,6 @@ #include "Emu/Cell/Modules/cellScreenshot.h" #include -#include #include #include #include @@ -74,7 +73,7 @@ gs_frame::gs_frame(const QRect& geometry, const QIcon& appIcon, const std::share connect(this, &QWindow::visibilityChanged, this, &gs_frame::HandleCursor); // Configure the mouse hide on idle timer - connect(&m_mousehide_timer, SIGNAL(timeout()), this, SLOT(MouseHideTimeout())); + connect(&m_mousehide_timer, &QTimer::timeout, &gs_frame::MouseHideTimeout); m_mousehide_timer.setSingleShot(true); if (m_hide_mouse_after_idletime) { @@ -527,7 +526,7 @@ bool gs_frame::event(QEvent* ev) } close(); } - if (ev->type() == QEvent::MouseMove) + else if (ev->type() == QEvent::MouseMove) { // this will make the cursor visible again if it was hidden by the mouse idle timeout gs_frame::HandleCursor(visibility()); diff --git a/rpcs3/rpcs3qt/gs_frame.h b/rpcs3/rpcs3qt/gs_frame.h index 71df75ae5c..aba43e51f4 100644 --- a/rpcs3/rpcs3qt/gs_frame.h +++ b/rpcs3/rpcs3qt/gs_frame.h @@ -38,7 +38,7 @@ private: bool m_disable_kb_hotkeys = false; bool m_show_mouse_in_fullscreen = false; bool m_hide_mouse_after_idletime = false; - u32 m_hide_mouse_idletime = 2000; // 2000 milliseconds) + u32 m_hide_mouse_idletime = 2000; // ms public: gs_frame(const QRect& geometry, const QIcon& appIcon, const std::shared_ptr& gui_settings); diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index 621cb31ce6..2c888e2d3c 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -189,12 +189,12 @@ namespace gui const gui_save m_discordState = gui_save(meta, "discordState", ""); const gui_save m_check_upd_start = gui_save(meta, "checkUpdateStart", true); - const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false); - const gui_save gs_disableKbHotkeys = gui_save(gs_frame, "disableKbHotkeys", false); - const gui_save gs_showMouseFs = gui_save(gs_frame, "showMouseInFullscreen", false); - const gui_save gs_resize = gui_save(gs_frame, "resize", false); - const gui_save gs_width = gui_save(gs_frame, "width", 1280); - const gui_save gs_height = gui_save(gs_frame, "height", 720); + const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false); + const gui_save gs_disableKbHotkeys = gui_save(gs_frame, "disableKbHotkeys", false); + const gui_save gs_showMouseFs = gui_save(gs_frame, "showMouseInFullscreen", false); + const gui_save gs_resize = gui_save(gs_frame, "resize", false); + const gui_save gs_width = gui_save(gs_frame, "width", 1280); + const gui_save gs_height = gui_save(gs_frame, "height", 720); const gui_save gs_hideMouseIdle = gui_save(gs_frame, "hideMouseOnIdle", false); const gui_save gs_hideMouseIdleTime = gui_save(gs_frame, "hideMouseOnIdleTime", 2000); diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 1cf5701a9e..d6488dbec8 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -1269,14 +1269,14 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std }); ui->gs_hideMouseOnIdle->setChecked(m_gui_settings->GetValue(gui::gs_hideMouseIdle).toBool()); - connect(ui->gs_hideMouseOnIdle, &QCheckBox::clicked, [this](bool val) + connect(ui->gs_hideMouseOnIdle, &QCheckBox::clicked, [this](bool checked) { - m_gui_settings->SetValue(gui::gs_hideMouseIdle, val); - ui->gs_hideMouseOnIdleTime->setEnabled(val); + m_gui_settings->SetValue(gui::gs_hideMouseIdle, checked); + ui->gs_hideMouseOnIdleTime->setEnabled(checked); }); - ui->gs_hideMouseOnIdleTime->setEnabled(m_gui_settings->GetValue(gui::gs_hideMouseIdle).toBool()); + ui->gs_hideMouseOnIdleTime->setEnabled(ui->gs_hideMouseOnIdle->checkState() == Qt::CheckState::Checked); ui->gs_hideMouseOnIdleTime->setValue(m_gui_settings->GetValue(gui::gs_hideMouseIdleTime).toUInt()); - connect(ui->gs_hideMouseOnIdleTime, &QSpinBox::editingFinished, [=, this]() + connect(ui->gs_hideMouseOnIdleTime, &QSpinBox::editingFinished, [this]() { m_gui_settings->SetValue(gui::gs_hideMouseIdleTime, ui->gs_hideMouseOnIdleTime->value()); }); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 3d41ea712c..89ff738d3a 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -2370,7 +2370,7 @@ false - mS + ms 200