Qt: Move pressure modifiers to settings tab

This commit is contained in:
Connor McLaughlin 2022-08-07 16:37:25 +10:00 committed by refractionpcsx2
parent dfc3fd8e58
commit 2e303da384
4 changed files with 31 additions and 47 deletions

View File

@ -1192,28 +1192,6 @@
<string>Pressure Modifier</string>
</property>
<layout class="QGridLayout" name="gridLayout_34">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="PressureModifier">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="suffix">
<string>x</string>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="InputBindingWidget" name="Pressure">
<property name="sizePolicy">

View File

@ -483,14 +483,14 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
for (u32 i = 0; i < cinfo->num_settings; i++)
{
const PAD::ControllerSettingInfo& si = cinfo->settings[i];
std::string key_name = si.key;
std::string key_name = si.name;
switch (si.type)
{
case PAD::ControllerSettingInfo::Type::Boolean:
{
QCheckBox* cb = new QCheckBox(qApp->translate(cinfo->name, si.visible_name), widget_parent);
cb->setObjectName(QString::fromUtf8(si.key));
QCheckBox* cb = new QCheckBox(qApp->translate(cinfo->name, si.display_name), widget_parent);
cb->setObjectName(QString::fromUtf8(si.name));
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, cb, section, std::move(key_name),
si.BooleanDefaultValue());
layout->addWidget(cb, current_row, 0, 1, 4);
@ -501,12 +501,12 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
case PAD::ControllerSettingInfo::Type::Integer:
{
QSpinBox* sb = new QSpinBox(widget_parent);
sb->setObjectName(QString::fromUtf8(si.key));
sb->setObjectName(QString::fromUtf8(si.name));
sb->setMinimum(si.IntegerMinValue());
sb->setMaximum(si.IntegerMaxValue());
sb->setSingleStep(si.IntegerStepValue());
SettingWidgetBinder::BindWidgetToIntSetting(sif, sb, section, std::move(key_name), si.IntegerDefaultValue());
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.visible_name), widget_parent), current_row, 0);
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.display_name), widget_parent), current_row, 0);
layout->addWidget(sb, current_row, 1, 1, 3);
current_row++;
}
@ -515,12 +515,12 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
case PAD::ControllerSettingInfo::Type::Float:
{
QDoubleSpinBox* sb = new QDoubleSpinBox(widget_parent);
sb->setObjectName(QString::fromUtf8(si.key));
sb->setObjectName(QString::fromUtf8(si.name));
sb->setMinimum(si.FloatMinValue());
sb->setMaximum(si.FloatMaxValue());
sb->setSingleStep(si.FloatStepValue());
SettingWidgetBinder::BindWidgetToFloatSetting(sif, sb, section, std::move(key_name), si.FloatDefaultValue());
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.visible_name), widget_parent), current_row, 0);
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.display_name), widget_parent), current_row, 0);
layout->addWidget(sb, current_row, 1, 1, 3);
current_row++;
}
@ -529,9 +529,9 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
case PAD::ControllerSettingInfo::Type::String:
{
QLineEdit* le = new QLineEdit(widget_parent);
le->setObjectName(QString::fromUtf8(si.key));
le->setObjectName(QString::fromUtf8(si.name));
SettingWidgetBinder::BindWidgetToStringSetting(sif, le, section, std::move(key_name), si.StringDefaultValue());
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.visible_name), widget_parent), current_row, 0);
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.display_name), widget_parent), current_row, 0);
layout->addWidget(le, current_row, 1, 1, 3);
current_row++;
}
@ -540,7 +540,7 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
case PAD::ControllerSettingInfo::Type::Path:
{
QLineEdit* le = new QLineEdit(widget_parent);
le->setObjectName(QString::fromUtf8(si.key));
le->setObjectName(QString::fromUtf8(si.name));
QPushButton* browse_button = new QPushButton(tr("Browse..."), widget_parent);
SettingWidgetBinder::BindWidgetToStringSetting(sif, le, section, std::move(key_name), si.StringDefaultValue());
connect(browse_button, &QPushButton::clicked, [this, le]() {
@ -553,7 +553,7 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
hbox->addWidget(le, 1);
hbox->addWidget(browse_button);
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.visible_name), widget_parent), current_row, 0);
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.display_name), widget_parent), current_row, 0);
layout->addLayout(hbox, current_row, 1, 1, 3);
current_row++;
}
@ -577,13 +577,13 @@ void ControllerCustomSettingsWidget::restoreDefaults()
for (u32 i = 0; i < cinfo->num_settings; i++)
{
const PAD::ControllerSettingInfo& si = cinfo->settings[i];
const QString key(QString::fromStdString(si.key));
const QString key(QString::fromStdString(si.name));
switch (si.type)
{
case PAD::ControllerSettingInfo::Type::Boolean:
{
QCheckBox* widget = findChild<QCheckBox*>(QString::fromStdString(si.key));
QCheckBox* widget = findChild<QCheckBox*>(QString::fromStdString(si.name));
if (widget)
widget->setChecked(si.BooleanDefaultValue());
}
@ -591,7 +591,7 @@ void ControllerCustomSettingsWidget::restoreDefaults()
case PAD::ControllerSettingInfo::Type::Integer:
{
QSpinBox* widget = findChild<QSpinBox*>(QString::fromStdString(si.key));
QSpinBox* widget = findChild<QSpinBox*>(QString::fromStdString(si.name));
if (widget)
widget->setValue(si.IntegerDefaultValue());
}
@ -599,7 +599,7 @@ void ControllerCustomSettingsWidget::restoreDefaults()
case PAD::ControllerSettingInfo::Type::Float:
{
QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QString::fromStdString(si.key));
QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QString::fromStdString(si.name));
if (widget)
widget->setValue(si.FloatDefaultValue());
}
@ -607,7 +607,7 @@ void ControllerCustomSettingsWidget::restoreDefaults()
case PAD::ControllerSettingInfo::Type::String:
{
QLineEdit* widget = findChild<QLineEdit*>(QString::fromStdString(si.key));
QLineEdit* widget = findChild<QLineEdit*>(QString::fromStdString(si.name));
if (widget)
widget->setText(QString::fromUtf8(si.StringDefaultValue()));
}
@ -615,7 +615,7 @@ void ControllerCustomSettingsWidget::restoreDefaults()
case PAD::ControllerSettingInfo::Type::Path:
{
QLineEdit* widget = findChild<QLineEdit*>(QString::fromStdString(si.key));
QLineEdit* widget = findChild<QLineEdit*>(QString::fromStdString(si.name));
if (widget)
widget->setText(QString::fromUtf8(si.StringDefaultValue()));
}
@ -724,8 +724,6 @@ void ControllerBindingWidget_Base::initBindingWidgets()
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "SmallMotorScale", PAD::DEFAULT_MOTOR_SCALE);
if (QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QStringLiteral("LargeMotorScale")); widget)
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "LargeMotorScale", PAD::DEFAULT_MOTOR_SCALE);
if (QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QStringLiteral("PressureModifier")); widget)
ControllerSettingWidgetBinder::BindWidgetToInputProfileFloat(sif, widget, config_section, "PressureModifier", PAD::DEFAULT_PRESSURE_MODIFIER);
}
ControllerBindingWidget_DualShock2::ControllerBindingWidget_DualShock2(ControllerBindingWidget* parent)

View File

@ -409,17 +409,23 @@ static const PAD::ControllerBindingInfo s_dualshock2_binds[] = {
static const PAD::ControllerSettingInfo s_dualshock2_settings[] = {
{PAD::ControllerSettingInfo::Type::Float, "Deadzone", "Analog Deadzone",
"Sets the analog stick deadzone, i.e. the fraction of the stick movement which will be ignored.",
"0.00", "0.00", "1.00", "0.01"},
"0.00", "0.00", "1.00", "0.01", "%.0f%%", 100.0f},
{PAD::ControllerSettingInfo::Type::Float, "AxisScale", "Analog Sensitivity",
"Sets the analog stick axis scaling factor. A value between 1.30 and 1.40 is recommended when using recent "
"controllers, e.g. DualShock 4, Xbox One Controller.",
"1.33", "0.01", "2.00", "0.01"},
"1.33", "0.01", "2.00", "0.01", "%.0f%%", 100.0f},
{PAD::ControllerSettingInfo::Type::Float, "LargeMotorScale", "Large Motor Vibration Scale",
"Increases or decreases the intensity of low frequency vibration sent by the game.",
"1.00", "0.00", "2.00", "0.01"},
"1.00", "0.00", "2.00", "0.01", "%.0f%%", 100.0f},
{PAD::ControllerSettingInfo::Type::Float, "SmallMotorScale", "Small Motor Vibration Scale",
"Increases or decreases the intensity of high frequency vibration sent by the game.",
"1.00", "0.00", "2.00", "0.01"},
"1.00", "0.00", "2.00", "0.01", "%.0f%%", 100.0f},
/*{PAD::ControllerSettingInfo::Type::Float, "InitialPressure", "Initial Pressure",
"Sets the pressure when the modifier button isn't held.",
"1.00", "0.01", "1.00", "0.01", "%.0f%%", 100.0f},*/
{PAD::ControllerSettingInfo::Type::Float, "PressureModifier", "Modifier Pressure",
"Sets the pressure when the modifier button is held.",
"0.50", "0.01", "1.00", "0.01", "%.0f%%", 100.0f},
};
static const PAD::ControllerInfo s_controller_info[] = {

View File

@ -83,13 +83,15 @@ namespace PAD
};
Type type;
const char* key;
const char* visible_name;
const char* name;
const char* display_name;
const char* description;
const char* default_value;
const char* min_value;
const char* max_value;
const char* step_value;
const char* format;
float multiplier;
const char* StringDefaultValue() const;
bool BooleanDefaultValue() const;