MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ControllerBindingWidget

Method ControllerBindingWidget

pcsx2-qt/Settings/ControllerBindingWidget.cpp:39–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37#include "ui_USBBindingWidget_TranceVibrator.h"
38
39ControllerBindingWidget::ControllerBindingWidget(QWidget* parent, ControllerSettingsWindow* dialog, u32 port)
40 : QWidget(parent)
41 , m_dialog(dialog)
42 , m_config_section(fmt::format("Pad{}", port + 1))
43 , m_port_number(port)
44{
45 m_ui.setupUi(this);
46
47 const auto [pad_port, pad_slot] = sioConvertPadToPortAndSlot(port);
48 const bool mtap_enabled = m_dialog->getBoolValue("Pad", (pad_port == 0) ? "MultitapPort1" : "MultitapPort2", false);
49 if (mtap_enabled)
50 {
51 static constexpr const std::array<char, 4> s_mtap_slot_names = {{'A', 'B', 'C', 'D'}};
52 m_ui.groupBox->setTitle(tr("Controller Port %1%2").arg(pad_port + 1).arg(s_mtap_slot_names[pad_slot]));
53 }
54 else
55 {
56 m_ui.groupBox->setTitle(tr("Controller Port %1").arg(pad_port + 1));
57 }
58
59 populateControllerTypes();
60 onTypeChanged();
61
62 ControllerSettingWidgetBinder::BindWidgetToInputProfileString(m_dialog->getProfileSettingsInterface(),
63 m_ui.controllerType, m_config_section, "Type", Pad::GetControllerInfo(Pad::GetDefaultPadType(port))->name);
64
65 connect(m_ui.controllerType, &QComboBox::currentIndexChanged, this, &ControllerBindingWidget::onTypeChanged);
66 connect(m_ui.bindings, &QPushButton::clicked, this, &ControllerBindingWidget::onBindingsClicked);
67 connect(m_ui.settings, &QPushButton::clicked, this, &ControllerBindingWidget::onSettingsClicked);
68 connect(m_ui.macros, &QPushButton::clicked, this, &ControllerBindingWidget::onMacrosClicked);
69 connect(m_ui.automaticBinding, &QPushButton::clicked, this, &ControllerBindingWidget::onAutomaticBindingClicked);
70 connect(m_ui.clearBindings, &QPushButton::clicked, this, &ControllerBindingWidget::onClearBindingsClicked);
71}
72
73ControllerBindingWidget::~ControllerBindingWidget() = default;
74

Callers

nothing calls this directly

Calls 7

argMethod · 0.80
formatFunction · 0.50
setupUiMethod · 0.45
getBoolValueMethod · 0.45

Tested by

no test coverage detected