Qt/Input: disable config button when device combobox is empty

This commit is contained in:
Unknown 2017-11-29 20:26:44 +01:00 committed by Ivan
parent ae643135b5
commit c2379b8337
1 changed files with 7 additions and 6 deletions

View File

@ -246,20 +246,21 @@ void gamepads_settings_dialog::ChangeInputType(int player)
} }
// Handle empty device list // Handle empty device list
if (list_devices.size() == 0) bool device_found = list_devices.size() > 0;
co_deviceID[player]->setEnabled(device_found);
if (device_found)
{ {
co_deviceID[player]->addItem(tr("No Device Detected"), -1); co_deviceID[player]->setCurrentText(qstr(device));
co_deviceID[player]->setEnabled(false);
} }
else else
{ {
co_deviceID[player]->setEnabled(true); co_deviceID[player]->addItem(tr("No Device Detected"), -1);
co_deviceID[player]->setCurrentText(qstr(device));
} }
// Update view and enable configuration if possible // Update view and enable configuration if possible
resizeComboBoxView(co_deviceID[player]); resizeComboBoxView(co_deviceID[player]);
bu_config[player]->setEnabled(cur_pad_handler->has_config()); bu_config[player]->setEnabled(device_found && cur_pad_handler->has_config());
} }
void gamepads_settings_dialog::ClickConfigButton(int player) void gamepads_settings_dialog::ClickConfigButton(int player)