summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2025-01-22 13:22:33 -0600
committerGitHub <noreply@github.com>2025-01-22 13:22:33 -0600
commit4b4a58623b8475ab6f5ac11603d27bbf53f4356f (patch)
tree5258da97537a3bfbe31e5225c34e8a9aa8a5c916 /Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp
parent76c613c8cd4cb9c0eab501da92156ede89fc3e89 (diff)
parentae72a781d40c33a55d3cf4965812d50129019f67 (diff)
Merge pull request #13283 from jordan-woyak/button-indicators
DolphinQt: Replace MappingButton bold text with graphical indicators.
Diffstat (limited to 'Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp
index 30f0e41e86..82fe042f9a 100644
--- a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp
+++ b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp
@@ -173,19 +173,19 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
form_layout->insertRow(2, mouse_button);
using ControllerEmu::Cursor;
- connect(mouse_button, &QCheckBox::clicked, [this, group = static_cast<Cursor*>(group)] {
+ connect(mouse_button, &QCheckBox::clicked, [this, grp = static_cast<Cursor*>(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));
+ grp->SetControlExpression(0, fmt::format("`{}Cursor Y-`", default_device));
+ grp->SetControlExpression(1, fmt::format("`{}Cursor Y+`", default_device));
+ grp->SetControlExpression(2, fmt::format("`{}Cursor X-`", default_device));
+ grp->SetControlExpression(3, fmt::format("`{}Cursor X+`", default_device));
- group->SetRelativeInput(false);
+ grp->SetRelativeInput(false);
emit ConfigChanged();
GetController()->UpdateReferences(g_controller_interface);
@@ -313,14 +313,29 @@ QGroupBox* MappingWidget::CreateControlsBox(const QString& name, ControllerEmu::
void MappingWidget::CreateControl(const ControllerEmu::Control* control, QFormLayout* layout,
bool indicator)
{
- auto* button = new MappingButton(this, control->control_ref.get(), indicator);
-
+ auto* const button = new MappingButton(this, control->control_ref.get());
button->setMinimumWidth(100);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+
const bool translate = control->translate == ControllerEmu::Translatability::Translate;
const QString translated_name =
translate ? tr(control->ui_name.c_str()) : QString::fromStdString(control->ui_name);
- layout->addRow(translated_name, button);
+
+ if (indicator && control->control_ref->IsInput())
+ {
+ auto* const button_indicator = new ButtonIndicator{control->control_ref.get()};
+ connect(this, &MappingWidget::Update, button_indicator, qOverload<>(&MappingIndicator::update));
+
+ auto* const hbox = new QHBoxLayout;
+ hbox->setSpacing(0);
+ hbox->addWidget(button_indicator);
+ hbox->addWidget(button);
+ layout->addRow(translated_name, hbox);
+ }
+ else
+ {
+ layout->addRow(translated_name, button);
+ }
}
ControllerEmu::EmulatedController* MappingWidget::GetController() const