DolphinQt: Renamed "Range" to "Multiplier" in advanced mapping window. Removed the slider. Moved the spin box.

This commit is contained in:
Jordan Woyak 2022-05-31 00:31:42 -05:00
parent e18053d307
commit 87fb42b64c
2 changed files with 22 additions and 23 deletions

View File

@ -36,8 +36,6 @@
#include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "InputCommon/ControllerInterface/MappingCommon.h" #include "InputCommon/ControllerInterface/MappingCommon.h"
constexpr int SLIDER_TICK_COUNT = 100;
namespace namespace
{ {
// TODO: Make sure these functions return colors that will be visible in the current theme. // TODO: Make sure these functions return colors that will be visible in the current theme.
@ -246,8 +244,7 @@ void IOWindow::CreateMainLayout()
m_test_button = new QPushButton(tr("Test"), this); m_test_button = new QPushButton(tr("Test"), this);
m_button_box = new QDialogButtonBox(); m_button_box = new QDialogButtonBox();
m_clear_button = new QPushButton(tr("Clear")); m_clear_button = new QPushButton(tr("Clear"));
m_range_slider = new QSlider(Qt::Horizontal); m_scalar_spinbox = new QSpinBox();
m_range_spinbox = new QSpinBox();
m_parse_text = new InputStateLineEdit([this] { m_parse_text = new InputStateLineEdit([this] {
const auto lock = m_controller->GetStateLock(); const auto lock = m_controller->GetStateLock();
@ -319,16 +316,20 @@ void IOWindow::CreateMainLayout()
// Devices // Devices
m_main_layout->addWidget(m_devices_combo); m_main_layout->addWidget(m_devices_combo);
// Range // Scalar
auto* range_hbox = new QHBoxLayout(); auto* scalar_hbox = new QHBoxLayout();
range_hbox->addWidget(new QLabel(tr("Range"))); // i18n: Controller input values are multiplied by this percentage value.
range_hbox->addWidget(m_range_slider); scalar_hbox->addWidget(new QLabel(tr("Multiplier")));
range_hbox->addWidget(m_range_spinbox); scalar_hbox->addWidget(m_scalar_spinbox);
m_range_slider->setMinimum(-500);
m_range_slider->setMaximum(500); // Outputs are not bounds checked and greater than 100% has no use case.
m_range_spinbox->setMinimum(-500); // (incoming values are always 0 or 1)
m_range_spinbox->setMaximum(500); // Negative 100% can be used to invert force feedback wheel direction.
m_main_layout->addLayout(range_hbox); const int scalar_min_max = (m_type == Type::Input) ? 1000 : 100;
m_scalar_spinbox->setMinimum(-scalar_min_max);
m_scalar_spinbox->setMaximum(scalar_min_max);
// i18n: Percentage symbol.
m_scalar_spinbox->setSuffix(tr("%"));
// Options (Buttons, Outputs) and action buttons // Options (Buttons, Outputs) and action buttons
@ -387,6 +388,8 @@ void IOWindow::CreateMainLayout()
else else
m_functions_combo->hide(); m_functions_combo->hide();
button_vbox->addLayout(scalar_hbox);
m_main_layout->addLayout(hbox, 2); m_main_layout->addLayout(hbox, 2);
m_main_layout->addWidget(m_expression_text, 1); m_main_layout->addWidget(m_expression_text, 1);
m_main_layout->addWidget(m_parse_text); m_main_layout->addWidget(m_parse_text);
@ -409,8 +412,7 @@ void IOWindow::ConfigChanged()
m_expression_text->setPlainText(QString::fromStdString(m_reference->GetExpression())); m_expression_text->setPlainText(QString::fromStdString(m_reference->GetExpression()));
m_expression_text->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); m_expression_text->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
m_range_spinbox->setValue(m_reference->range * SLIDER_TICK_COUNT); m_scalar_spinbox->setValue(m_reference->range * 100.0);
m_range_slider->setValue(m_reference->range * SLIDER_TICK_COUNT);
if (m_devq.ToString().empty()) if (m_devq.ToString().empty())
m_devq = m_controller->GetDefaultDevice(); m_devq = m_controller->GetDefaultDevice();
@ -436,7 +438,7 @@ void IOWindow::ConnectWidgets()
connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed); connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed);
connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged); connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged);
connect(m_range_spinbox, qOverload<int>(&QSpinBox::valueChanged), this, connect(m_scalar_spinbox, qOverload<int>(&QSpinBox::valueChanged), this,
&IOWindow::OnRangeChanged); &IOWindow::OnRangeChanged);
connect(m_expression_text, &QPlainTextEdit::textChanged, connect(m_expression_text, &QPlainTextEdit::textChanged,
@ -548,9 +550,7 @@ void IOWindow::OnTestButtonPressed()
void IOWindow::OnRangeChanged(int value) void IOWindow::OnRangeChanged(int value)
{ {
m_reference->range = static_cast<double>(value) / SLIDER_TICK_COUNT; m_reference->range = value / 100.0;
m_range_spinbox->setValue(m_reference->range * SLIDER_TICK_COUNT);
m_range_slider->setValue(m_reference->range * SLIDER_TICK_COUNT);
} }
void IOWindow::ReleaseDevices() void IOWindow::ReleaseDevices()

View File

@ -105,9 +105,8 @@ private:
// Options // Options
QTableWidget* m_option_list; QTableWidget* m_option_list;
// Range // Scalar
QSlider* m_range_slider; QSpinBox* m_scalar_spinbox;
QSpinBox* m_range_spinbox;
// Shared actions // Shared actions
QPushButton* m_select_button; QPushButton* m_select_button;