Qt/Mapping: Add option to map all devices at once

This commit is contained in:
spycrab
2018-05-23 23:47:42 +02:00
parent dfb1dbad47
commit 574c609709
3 changed files with 66 additions and 4 deletions

View File

@ -222,10 +222,18 @@ void MappingWindow::OnSaveProfilePressed()
void MappingWindow::OnDeviceChanged(int index)
{
if (IsMappingAllDevices())
return;
const auto device = m_devices_combo->currentText().toStdString();
m_controller->SetDefaultDevice(device);
}
bool MappingWindow::IsMappingAllDevices() const
{
return m_devices_combo->currentIndex() == m_devices_combo->count() - 1;
}
void MappingWindow::RefreshDevices()
{
m_devices_combo->clear();
@ -245,6 +253,8 @@ void MappingWindow::RefreshDevices()
m_devices_combo->addItem(QString::fromStdString(name));
}
m_devices_combo->addItem(tr("All devices"));
m_devices_combo->setCurrentIndex(0);
});
}