From d1e1ea0fef0ddfe914f14a2d547b922b71081695 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sun, 30 Aug 2020 00:07:38 +0200 Subject: Address second batch of reviews --- src/core/frontend/framebuffer_layout.h | 1 + src/input_common/main.h | 4 +--- src/input_common/touch_from_button.cpp | 2 +- src/input_common/touch_from_button.h | 2 -- src/yuzu/configuration/configure_input_advanced.cpp | 2 +- src/yuzu/configuration/configure_motion_touch.cpp | 18 +++++++++--------- src/yuzu/configuration/configure_motion_touch.h | 8 ++++++-- .../configuration/configure_touch_from_button.cpp | 1 - src/yuzu/configuration/configure_touch_from_button.h | 19 ++++++++----------- 9 files changed, 27 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index 91ecc30ab..e2e3bbbb3 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -4,6 +4,7 @@ #pragma once +#include "common/common_types.h" #include "common/math_util.h" namespace Layout { diff --git a/src/input_common/main.h b/src/input_common/main.h index 512215e7e..f3fbf696e 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h @@ -21,9 +21,6 @@ namespace Settings::NativeButton { enum Values : int; } -/// Reloads the input devices -void ReloadInputDevices(); - namespace InputCommon { namespace Polling { @@ -118,6 +115,7 @@ public: /// Retrieves the underlying GameCube button handler. [[nodiscard]] const GCButtonFactory* GetGCButtons() const; + /// Reloads the input devices void ReloadInputDevices(); /// Get all DevicePoller from all backends for a specific device type diff --git a/src/input_common/touch_from_button.cpp b/src/input_common/touch_from_button.cpp index d028dfa0d..98da0ef1a 100644 --- a/src/input_common/touch_from_button.cpp +++ b/src/input_common/touch_from_button.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/frontend/framebuffer_layout.h" #include "core/settings.h" #include "input_common/touch_from_button.h" @@ -43,7 +44,6 @@ private: std::unique_ptr TouchFromButtonFactory::Create( const Common::ParamPackage& params) { - return std::make_unique(); } diff --git a/src/input_common/touch_from_button.h b/src/input_common/touch_from_button.h index cfb82f108..8b4d1aa96 100644 --- a/src/input_common/touch_from_button.h +++ b/src/input_common/touch_from_button.h @@ -5,7 +5,6 @@ #pragma once #include -#include "core/frontend/framebuffer_layout.h" #include "core/frontend/input.h" namespace InputCommon { @@ -17,7 +16,6 @@ class TouchFromButtonFactory final : public Input::Factory { public: /** * Creates a touch device from a list of button devices - * @param unused */ std::unique_ptr Create(const Common::ParamPackage& params) override; }; diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index c00e3faab..81f9dc16c 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp @@ -87,7 +87,7 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent) connect(ui->touchscreen_advanced, &QPushButton::clicked, this, [this] { CallTouchscreenConfigDialog(); }); connect(ui->buttonMotionTouch, &QPushButton::clicked, this, - [this] { CallMotionTouchConfigDialog(); }); + &ConfigureInputAdvanced::CallMotionTouchConfigDialog); LoadConfiguration(); } diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp index 1a4b3c996..c7d085151 100644 --- a/src/yuzu/configuration/configure_motion_touch.cpp +++ b/src/yuzu/configuration/configure_motion_touch.cpp @@ -89,10 +89,10 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent, : QDialog(parent), input_subsystem{input_subsystem_}, ui(std::make_unique()) { ui->setupUi(this); - for (const auto [provider, name] : MotionProviders) { + for (const auto& [provider, name] : MotionProviders) { ui->motion_provider->addItem(tr(name), QString::fromUtf8(provider)); } - for (const auto [provider, name] : TouchProviders) { + for (const auto& [provider, name] : TouchProviders) { ui->touch_provider->addItem(tr(name), QString::fromUtf8(provider)); } @@ -111,10 +111,10 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent, ConfigureMotionTouch::~ConfigureMotionTouch() = default; void ConfigureMotionTouch::SetConfiguration() { - Common::ParamPackage motion_param(Settings::values.motion_device); - Common::ParamPackage touch_param(Settings::values.touch_device); - std::string motion_engine = motion_param.Get("engine", "motion_emu"); - std::string touch_engine = touch_param.Get("engine", "emu_window"); + const Common::ParamPackage motion_param(Settings::values.motion_device); + const Common::ParamPackage touch_param(Settings::values.touch_device); + const std::string motion_engine = motion_param.Get("engine", "motion_emu"); + const std::string touch_engine = touch_param.Get("engine", "emu_window"); ui->motion_provider->setCurrentIndex( ui->motion_provider->findData(QString::fromStdString(motion_engine))); @@ -141,7 +141,7 @@ void ConfigureMotionTouch::SetConfiguration() { void ConfigureMotionTouch::UpdateUiDisplay() { const QString motion_engine = ui->motion_provider->currentData().toString(); const QString touch_engine = ui->touch_provider->currentData().toString(); - QString cemuhook_udp = QStringLiteral("cemuhookudp"); + const QString cemuhook_udp = QStringLiteral("cemuhookudp"); if (motion_engine == QStringLiteral("motion_emu")) { ui->motion_sensitivity_label->setVisible(true); @@ -286,8 +286,8 @@ void ConfigureMotionTouch::ApplyConfiguration() { std::string touch_engine = ui->touch_provider->currentData().toString().toStdString(); Common::ParamPackage motion_param{}, touch_param{}; - motion_param.Set("engine", motion_engine); - touch_param.Set("engine", touch_engine); + motion_param.Set("engine", std::move(motion_engine)); + touch_param.Set("engine", std::move(touch_engine)); if (motion_engine == "motion_emu") { motion_param.Set("sensitivity", static_cast(ui->motion_sensitivity->value())); diff --git a/src/yuzu/configuration/configure_motion_touch.h b/src/yuzu/configuration/configure_motion_touch.h index 0fafb3aed..3d4b5d659 100644 --- a/src/yuzu/configuration/configure_motion_touch.h +++ b/src/yuzu/configuration/configure_motion_touch.h @@ -12,14 +12,18 @@ class QLabel; class QPushButton; class QVBoxLayout; -namespace Ui { -class ConfigureMotionTouch; +namespace InputCommon { +class InputSubsystem; } namespace InputCommon::CemuhookUDP { class CalibrationConfigurationJob; } +namespace Ui { +class ConfigureMotionTouch; +} + /// A dialog for touchpad calibration configuration. class CalibrationConfigurationDialog : public QDialog { Q_OBJECT diff --git a/src/yuzu/configuration/configure_touch_from_button.cpp b/src/yuzu/configuration/configure_touch_from_button.cpp index 0147e2ac3..15557e4b8 100644 --- a/src/yuzu/configuration/configure_touch_from_button.cpp +++ b/src/yuzu/configuration/configure_touch_from_button.cpp @@ -74,7 +74,6 @@ ConfigureTouchFromButton::ConfigureTouchFromButton( : QDialog(parent), ui(std::make_unique()), touch_maps(touch_maps), input_subsystem{input_subsystem_}, selected_index(default_index), timeout_timer(std::make_unique()), poll_timer(std::make_unique()) { - ui->setupUi(this); binding_list_model = new QStandardItemModel(0, 3, this); binding_list_model->setHorizontalHeaderLabels( diff --git a/src/yuzu/configuration/configure_touch_from_button.h b/src/yuzu/configuration/configure_touch_from_button.h index 0ddc54268..d9513e3bc 100644 --- a/src/yuzu/configuration/configure_touch_from_button.h +++ b/src/yuzu/configuration/configure_touch_from_button.h @@ -16,28 +16,26 @@ class QStandardItemModel; class QStandardItem; class QTimer; -namespace InputCommon { -class InputSubsystem; -} - namespace Common { class ParamPackage; } namespace InputCommon { -namespace Polling { -class DevicePoller; +class InputSubsystem; } -} // namespace InputCommon -namespace Ui { -class ConfigureTouchFromButton; +namespace InputCommon::Polling { +class DevicePoller; } namespace Settings { struct TouchFromButtonMap; } +namespace Ui { +class ConfigureTouchFromButton; +} + class ConfigureTouchFromButton : public QDialog { Q_OBJECT @@ -82,9 +80,8 @@ private: std::unique_ptr ui; std::vector touch_maps; QStandardItemModel* binding_list_model; - int selected_index; - InputCommon::InputSubsystem* input_subsystem; + int selected_index; std::unique_ptr timeout_timer; std::unique_ptr poll_timer; -- cgit v1.2.3