Permalink
Browse files

Qt/MappingWindow: update devices combo box when hotplugging devices

  • Loading branch information...
ligfx committed Jul 5, 2018
1 parent b689a19 commit ce98a9c71d3bb03bb127601c3d09c647a5d41767
@@ -136,6 +136,8 @@ void MappingWindow::CreateMainLayout()
void MappingWindow::ConnectWidgets()
{
connect(&Settings::Instance(), &Settings::DevicesChanged, this,
&MappingWindow::OnGlobalDevicesChanged);
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@@ -242,11 +244,15 @@ bool MappingWindow::IsMappingAllDevices() const
}
void MappingWindow::RefreshDevices()
{
Core::RunAsCPUThread([&] { g_controller_interface.RefreshDevices(); });
}
void MappingWindow::OnGlobalDevicesChanged()
{
m_devices_combo->clear();
Core::RunAsCPUThread([&] {
g_controller_interface.RefreshDevices();
m_controller->UpdateReferences(g_controller_interface);
const auto default_device = m_controller->GetDefaultDevice().ToString();
@@ -76,6 +76,7 @@ class MappingWindow final : public QDialog
void OnSaveProfilePressed();
void OnDefaultFieldsPressed();
void OnDeviceChanged(int index);
void OnGlobalDevicesChanged();
ControllerEmu::EmulatedController* m_controller = nullptr;

0 comments on commit ce98a9c

Please sign in to comment.