mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-11-01 12:57:52 +00:00
Address second batch of reviews
This commit is contained in:
parent
0aa6ec4276
commit
d1e1ea0fef
9 changed files with 27 additions and 30 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/math_util.h"
|
||||
|
||||
namespace Layout {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Input::TouchDevice> TouchFromButtonFactory::Create(
|
||||
const Common::ParamPackage& params) {
|
||||
|
||||
return std::make_unique<TouchFromButtonDevice>();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "core/frontend/framebuffer_layout.h"
|
||||
#include "core/frontend/input.h"
|
||||
|
||||
namespace InputCommon {
|
||||
|
@ -17,7 +16,6 @@ class TouchFromButtonFactory final : public Input::Factory<Input::TouchDevice> {
|
|||
public:
|
||||
/**
|
||||
* Creates a touch device from a list of button devices
|
||||
* @param unused
|
||||
*/
|
||||
std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -89,10 +89,10 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent,
|
|||
: QDialog(parent), input_subsystem{input_subsystem_},
|
||||
ui(std::make_unique<Ui::ConfigureMotionTouch>()) {
|
||||
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<float>(ui->motion_sensitivity->value()));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -74,7 +74,6 @@ ConfigureTouchFromButton::ConfigureTouchFromButton(
|
|||
: QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchFromButton>()),
|
||||
touch_maps(touch_maps), input_subsystem{input_subsystem_}, selected_index(default_index),
|
||||
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) {
|
||||
|
||||
ui->setupUi(this);
|
||||
binding_list_model = new QStandardItemModel(0, 3, this);
|
||||
binding_list_model->setHorizontalHeaderLabels(
|
||||
|
|
|
@ -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::ConfigureTouchFromButton> ui;
|
||||
std::vector<Settings::TouchFromButtonMap> touch_maps;
|
||||
QStandardItemModel* binding_list_model;
|
||||
int selected_index;
|
||||
|
||||
InputCommon::InputSubsystem* input_subsystem;
|
||||
int selected_index;
|
||||
|
||||
std::unique_ptr<QTimer> timeout_timer;
|
||||
std::unique_ptr<QTimer> poll_timer;
|
||||
|
|
Loading…
Reference in a new issue