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

Method createSettingWidgets

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

Source from the content-addressed store, hash-verified

603}
604
605void ControllerCustomSettingsWidget::createSettingWidgets(const char* translation_ctx, QWidget* widget_parent, QGridLayout* layout)
606{
607 SettingsInterface* sif = m_dialog->getProfileSettingsInterface();
608 int current_row = 0;
609
610 for (const SettingInfo& si : m_settings)
611 {
612 std::string key_name = m_config_prefix + si.name;
613
614 switch (si.type)
615 {
616 case SettingInfo::Type::Boolean:
617 {
618 QCheckBox* cb = new QCheckBox(qApp->translate(translation_ctx, si.display_name), widget_parent);
619 cb->setObjectName(QString::fromUtf8(si.name));
620 ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(
621 sif, cb, m_config_section, std::move(key_name), si.BooleanDefaultValue());
622 layout->addWidget(cb, current_row, 0, 1, 4);
623 current_row++;
624 }
625 break;
626
627 case SettingInfo::Type::Integer:
628 {
629 QSpinBox* sb = new QSpinBox(widget_parent);
630 sb->setObjectName(QString::fromUtf8(si.name));
631 sb->setMinimum(si.IntegerMinValue());
632 sb->setMaximum(si.IntegerMaxValue());
633 sb->setSingleStep(si.IntegerStepValue());
634 if (si.format)
635 {
636 const auto [prefix, suffix] = getPrefixAndSuffixForIntFormat(qApp->translate(translation_ctx, si.format));
637 sb->setPrefix(prefix);
638 sb->setSuffix(suffix);
639 }
640 ControllerSettingWidgetBinder::BindWidgetToInputProfileInt(
641 sif, sb, m_config_section, std::move(key_name), si.IntegerDefaultValue());
642 layout->addWidget(new QLabel(qApp->translate(translation_ctx, si.display_name), widget_parent), current_row, 0);
643 layout->addWidget(sb, current_row, 1, 1, 3);
644 current_row++;
645 }
646 break;
647
648 case SettingInfo::Type::IntegerList:
649 {
650 QComboBox* cb = new QComboBox(widget_parent);
651 cb->setObjectName(QString::fromUtf8(si.name));
652 for (u32 i = 0; si.options[i] != nullptr; i++)
653 cb->addItem(qApp->translate(translation_ctx, si.options[i]));
654 ControllerSettingWidgetBinder::BindWidgetToInputProfileInt(
655 sif, cb, m_config_section, std::move(key_name), si.IntegerDefaultValue(), si.IntegerMinValue());
656 layout->addWidget(new QLabel(qApp->translate(translation_ctx, si.display_name), widget_parent), current_row, 0);
657 layout->addWidget(cb, current_row, 1, 1, 3);
658 current_row++;
659 }
660 break;
661
662 case SettingInfo::Type::Float:

Callers

nothing calls this directly

Calls 15

setObjectNameMethod · 0.80
BooleanDefaultValueMethod · 0.80
addWidgetMethod · 0.80
IntegerMinValueMethod · 0.80
IntegerMaxValueMethod · 0.80

Tested by

no test coverage detected