forked from ShuriZma/suyu
1
0
Fork 0

Address second batch of reviews

This commit is contained in:
FearlessTobi 2020-08-30 00:07:38 +02:00
parent 0aa6ec4276
commit d1e1ea0fef
9 changed files with 27 additions and 30 deletions

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include "common/common_types.h"
#include "common/math_util.h" #include "common/math_util.h"
namespace Layout { namespace Layout {

View File

@ -21,9 +21,6 @@ namespace Settings::NativeButton {
enum Values : int; enum Values : int;
} }
/// Reloads the input devices
void ReloadInputDevices();
namespace InputCommon { namespace InputCommon {
namespace Polling { namespace Polling {
@ -118,6 +115,7 @@ public:
/// Retrieves the underlying GameCube button handler. /// Retrieves the underlying GameCube button handler.
[[nodiscard]] const GCButtonFactory* GetGCButtons() const; [[nodiscard]] const GCButtonFactory* GetGCButtons() const;
/// Reloads the input devices
void ReloadInputDevices(); void ReloadInputDevices();
/// Get all DevicePoller from all backends for a specific device type /// Get all DevicePoller from all backends for a specific device type

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/frontend/framebuffer_layout.h"
#include "core/settings.h" #include "core/settings.h"
#include "input_common/touch_from_button.h" #include "input_common/touch_from_button.h"
@ -43,7 +44,6 @@ private:
std::unique_ptr<Input::TouchDevice> TouchFromButtonFactory::Create( std::unique_ptr<Input::TouchDevice> TouchFromButtonFactory::Create(
const Common::ParamPackage& params) { const Common::ParamPackage& params) {
return std::make_unique<TouchFromButtonDevice>(); return std::make_unique<TouchFromButtonDevice>();
} }

View File

@ -5,7 +5,6 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include "core/frontend/framebuffer_layout.h"
#include "core/frontend/input.h" #include "core/frontend/input.h"
namespace InputCommon { namespace InputCommon {
@ -17,7 +16,6 @@ class TouchFromButtonFactory final : public Input::Factory<Input::TouchDevice> {
public: public:
/** /**
* Creates a touch device from a list of button devices * Creates a touch device from a list of button devices
* @param unused
*/ */
std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override; std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override;
}; };

View File

@ -87,7 +87,7 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent)
connect(ui->touchscreen_advanced, &QPushButton::clicked, this, connect(ui->touchscreen_advanced, &QPushButton::clicked, this,
[this] { CallTouchscreenConfigDialog(); }); [this] { CallTouchscreenConfigDialog(); });
connect(ui->buttonMotionTouch, &QPushButton::clicked, this, connect(ui->buttonMotionTouch, &QPushButton::clicked, this,
[this] { CallMotionTouchConfigDialog(); }); &ConfigureInputAdvanced::CallMotionTouchConfigDialog);
LoadConfiguration(); LoadConfiguration();
} }

View File

@ -89,10 +89,10 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent,
: QDialog(parent), input_subsystem{input_subsystem_}, : QDialog(parent), input_subsystem{input_subsystem_},
ui(std::make_unique<Ui::ConfigureMotionTouch>()) { ui(std::make_unique<Ui::ConfigureMotionTouch>()) {
ui->setupUi(this); ui->setupUi(this);
for (const auto [provider, name] : MotionProviders) { for (const auto& [provider, name] : MotionProviders) {
ui->motion_provider->addItem(tr(name), QString::fromUtf8(provider)); 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)); ui->touch_provider->addItem(tr(name), QString::fromUtf8(provider));
} }
@ -111,10 +111,10 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent,
ConfigureMotionTouch::~ConfigureMotionTouch() = default; ConfigureMotionTouch::~ConfigureMotionTouch() = default;
void ConfigureMotionTouch::SetConfiguration() { void ConfigureMotionTouch::SetConfiguration() {
Common::ParamPackage motion_param(Settings::values.motion_device); const Common::ParamPackage motion_param(Settings::values.motion_device);
Common::ParamPackage touch_param(Settings::values.touch_device); const Common::ParamPackage touch_param(Settings::values.touch_device);
std::string motion_engine = motion_param.Get("engine", "motion_emu"); const std::string motion_engine = motion_param.Get("engine", "motion_emu");
std::string touch_engine = touch_param.Get("engine", "emu_window"); const std::string touch_engine = touch_param.Get("engine", "emu_window");
ui->motion_provider->setCurrentIndex( ui->motion_provider->setCurrentIndex(
ui->motion_provider->findData(QString::fromStdString(motion_engine))); ui->motion_provider->findData(QString::fromStdString(motion_engine)));
@ -141,7 +141,7 @@ void ConfigureMotionTouch::SetConfiguration() {
void ConfigureMotionTouch::UpdateUiDisplay() { void ConfigureMotionTouch::UpdateUiDisplay() {
const QString motion_engine = ui->motion_provider->currentData().toString(); const QString motion_engine = ui->motion_provider->currentData().toString();
const QString touch_engine = ui->touch_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")) { if (motion_engine == QStringLiteral("motion_emu")) {
ui->motion_sensitivity_label->setVisible(true); ui->motion_sensitivity_label->setVisible(true);
@ -286,8 +286,8 @@ void ConfigureMotionTouch::ApplyConfiguration() {
std::string touch_engine = ui->touch_provider->currentData().toString().toStdString(); std::string touch_engine = ui->touch_provider->currentData().toString().toStdString();
Common::ParamPackage motion_param{}, touch_param{}; Common::ParamPackage motion_param{}, touch_param{};
motion_param.Set("engine", motion_engine); motion_param.Set("engine", std::move(motion_engine));
touch_param.Set("engine", touch_engine); touch_param.Set("engine", std::move(touch_engine));
if (motion_engine == "motion_emu") { if (motion_engine == "motion_emu") {
motion_param.Set("sensitivity", static_cast<float>(ui->motion_sensitivity->value())); motion_param.Set("sensitivity", static_cast<float>(ui->motion_sensitivity->value()));

View File

@ -12,14 +12,18 @@ class QLabel;
class QPushButton; class QPushButton;
class QVBoxLayout; class QVBoxLayout;
namespace Ui { namespace InputCommon {
class ConfigureMotionTouch; class InputSubsystem;
} }
namespace InputCommon::CemuhookUDP { namespace InputCommon::CemuhookUDP {
class CalibrationConfigurationJob; class CalibrationConfigurationJob;
} }
namespace Ui {
class ConfigureMotionTouch;
}
/// A dialog for touchpad calibration configuration. /// A dialog for touchpad calibration configuration.
class CalibrationConfigurationDialog : public QDialog { class CalibrationConfigurationDialog : public QDialog {
Q_OBJECT Q_OBJECT

View File

@ -74,7 +74,6 @@ ConfigureTouchFromButton::ConfigureTouchFromButton(
: QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchFromButton>()), : QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchFromButton>()),
touch_maps(touch_maps), input_subsystem{input_subsystem_}, selected_index(default_index), touch_maps(touch_maps), input_subsystem{input_subsystem_}, selected_index(default_index),
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) { timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) {
ui->setupUi(this); ui->setupUi(this);
binding_list_model = new QStandardItemModel(0, 3, this); binding_list_model = new QStandardItemModel(0, 3, this);
binding_list_model->setHorizontalHeaderLabels( binding_list_model->setHorizontalHeaderLabels(

View File

@ -16,28 +16,26 @@ class QStandardItemModel;
class QStandardItem; class QStandardItem;
class QTimer; class QTimer;
namespace InputCommon {
class InputSubsystem;
}
namespace Common { namespace Common {
class ParamPackage; class ParamPackage;
} }
namespace InputCommon { namespace InputCommon {
namespace Polling { class InputSubsystem;
class DevicePoller;
} }
} // namespace InputCommon
namespace Ui { namespace InputCommon::Polling {
class ConfigureTouchFromButton; class DevicePoller;
} }
namespace Settings { namespace Settings {
struct TouchFromButtonMap; struct TouchFromButtonMap;
} }
namespace Ui {
class ConfigureTouchFromButton;
}
class ConfigureTouchFromButton : public QDialog { class ConfigureTouchFromButton : public QDialog {
Q_OBJECT Q_OBJECT
@ -82,9 +80,8 @@ private:
std::unique_ptr<Ui::ConfigureTouchFromButton> ui; std::unique_ptr<Ui::ConfigureTouchFromButton> ui;
std::vector<Settings::TouchFromButtonMap> touch_maps; std::vector<Settings::TouchFromButtonMap> touch_maps;
QStandardItemModel* binding_list_model; QStandardItemModel* binding_list_model;
int selected_index;
InputCommon::InputSubsystem* input_subsystem; InputCommon::InputSubsystem* input_subsystem;
int selected_index;
std::unique_ptr<QTimer> timeout_timer; std::unique_ptr<QTimer> timeout_timer;
std::unique_ptr<QTimer> poll_timer; std::unique_ptr<QTimer> poll_timer;