Merge pull request #549 from ggrtk/qt-rebind-all

Qt: Simplify Rebind All behavior
This commit is contained in:
Connor McLaughlin 2020-06-15 13:26:48 +10:00 committed by GitHub
commit b141042952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View file

@ -124,7 +124,7 @@ void ControllerSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* u
QPushButton* clear_all_button = new QPushButton(tr("Clear All"), ui->widget); QPushButton* clear_all_button = new QPushButton(tr("Clear All"), ui->widget);
clear_all_button->connect(clear_all_button, &QPushButton::clicked, [this, index]() { clear_all_button->connect(clear_all_button, &QPushButton::clicked, [this, index]() {
if (QMessageBox::question(this, tr("Clear Bindings"), if (QMessageBox::question(this, tr("Clear Bindings"),
tr("Are you sure you want to clear all bound controls? This cannot be reversed.")) != tr("Are you sure you want to clear all bound controls? This can not be reversed.")) !=
QMessageBox::Yes) QMessageBox::Yes)
{ {
return; return;
@ -140,15 +140,19 @@ void ControllerSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* u
QPushButton* rebind_all_button = new QPushButton(tr("Rebind All"), ui->widget); QPushButton* rebind_all_button = new QPushButton(tr("Rebind All"), ui->widget);
rebind_all_button->connect(rebind_all_button, &QPushButton::clicked, [this, index]() { rebind_all_button->connect(rebind_all_button, &QPushButton::clicked, [this, index]() {
if (QMessageBox::question(this, tr("Clear Bindings"), tr("Do you want to clear all currently-bound controls?")) == if (QMessageBox::question(this, tr("Rebind All"),
tr("Are you sure you want to rebind all controls? All currently-bound controls will be "
"irreversibly cleared. Rebinding will begin after confirmation.")) !=
QMessageBox::Yes) QMessageBox::Yes)
{ {
InputBindingWidget* widget = m_port_ui[index].first_button; return;
while (widget) }
{
widget->clearBinding(); InputBindingWidget* widget = m_port_ui[index].first_button;
widget = widget->getNextWidget(); while (widget)
} {
widget->clearBinding();
widget = widget->getNextWidget();
} }
if (m_port_ui[index].first_button) if (m_port_ui[index].first_button)

View file

@ -27,8 +27,9 @@ static constexpr std::array<const char*, static_cast<int>(SettingsDialog::Catego
"self-explanatory.", "self-explanatory.",
"<strong>Controller Settings</strong><hr>This page lets you choose the type of controller you wish to simulate for " "<strong>Controller Settings</strong><hr>This page lets you choose the type of controller you wish to simulate for "
"the console, and rebind the keys or host game controller buttons to your choosing. Clicking a binding will start a " "the console, and rebind the keys or host game controller buttons to your choosing. Clicking a binding will start a "
"count-down, in which case you should press the key or controller button/axis you wish to bind. If no button is " "countdown, in which case you should press the key or controller button/axis you wish to bind. (For rumble, press "
"pressed and the timer lapses, the binding will be unchanged. To clear a binding, right-click the button.", "any button/axis on the controller you wish to send rumble to.) If no button is pressed and the timer lapses, "
"the binding will be unchanged. To clear a binding, right-click the button.",
"<strong>Memory Card Settings</strong><hr>This page lets you control what mode the memory card emulation will " "<strong>Memory Card Settings</strong><hr>This page lets you control what mode the memory card emulation will "
"function in, and where the images for these cards will be stored on disk.", "function in, and where the images for these cards will be stored on disk.",
"<strong>GPU Settings</strong><hr>These options control the simulation of the GPU in the console. Various " "<strong>GPU Settings</strong><hr>These options control the simulation of the GPU in the console. Various "