Merge pull request #12363 from luc-git/mouse_ir

DolphinQt/Mapping: Add "Use Mouse Controlled Pointing" button.
This commit is contained in:
Admiral H. Curtiss 2023-12-29 20:47:20 +01:00 committed by GitHub
commit 2beaaf608d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -3,6 +3,8 @@
#include "DolphinQt/Config/Mapping/MappingWidget.h"
#include <fmt/core.h>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QFormLayout>
@ -25,6 +27,7 @@
#include "InputCommon/ControllerEmu/ControllerEmu.h"
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
#include "InputCommon/ControllerEmu/StickGate.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
MappingWidget::MappingWidget(MappingWindow* parent) : m_parent(parent)
{
@ -160,6 +163,26 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
[this, group] { ShowAdvancedControlGroupDialog(group); });
}
if (group->type == ControllerEmu::GroupType::Cursor)
{
QPushButton* mouse_button = new QPushButton(tr("Use Mouse Controlled Pointing"));
form_layout->insertRow(2, mouse_button);
connect(mouse_button, &QCheckBox::clicked, [this, group] {
std::string default_device = g_controller_interface.GetDefaultDeviceString() + ":";
const std::string controller_device = GetController()->GetDefaultDevice().ToString() + ":";
if (default_device == controller_device)
{
default_device.clear();
}
group->SetControlExpression(0, fmt::format("`{}Cursor Y-`", default_device));
group->SetControlExpression(1, fmt::format("`{}Cursor Y+`", default_device));
group->SetControlExpression(2, fmt::format("`{}Cursor X-`", default_device));
group->SetControlExpression(3, fmt::format("`{}Cursor X+`", default_device));
emit ConfigChanged();
GetController()->UpdateReferences(g_controller_interface);
});
}
return group_box;
}