Merge pull request #7219 from ligfx/mappingwindow_hotplug
Qt/MappingWindow: update devices combo box when hotplugging devices
This commit is contained in:
commit
c7ff141606
|
@ -136,6 +136,8 @@ void MappingWindow::CreateMainLayout()
|
||||||
|
|
||||||
void MappingWindow::ConnectWidgets()
|
void MappingWindow::ConnectWidgets()
|
||||||
{
|
{
|
||||||
|
connect(&Settings::Instance(), &Settings::DevicesChanged, this,
|
||||||
|
&MappingWindow::OnGlobalDevicesChanged);
|
||||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
|
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
|
||||||
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
|
@ -242,11 +244,15 @@ bool MappingWindow::IsMappingAllDevices() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingWindow::RefreshDevices()
|
void MappingWindow::RefreshDevices()
|
||||||
|
{
|
||||||
|
Core::RunAsCPUThread([&] { g_controller_interface.RefreshDevices(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void MappingWindow::OnGlobalDevicesChanged()
|
||||||
{
|
{
|
||||||
m_devices_combo->clear();
|
m_devices_combo->clear();
|
||||||
|
|
||||||
Core::RunAsCPUThread([&] {
|
Core::RunAsCPUThread([&] {
|
||||||
g_controller_interface.RefreshDevices();
|
|
||||||
m_controller->UpdateReferences(g_controller_interface);
|
m_controller->UpdateReferences(g_controller_interface);
|
||||||
|
|
||||||
const auto default_device = m_controller->GetDefaultDevice().ToString();
|
const auto default_device = m_controller->GetDefaultDevice().ToString();
|
||||||
|
|
|
@ -76,6 +76,7 @@ private:
|
||||||
void OnSaveProfilePressed();
|
void OnSaveProfilePressed();
|
||||||
void OnDefaultFieldsPressed();
|
void OnDefaultFieldsPressed();
|
||||||
void OnDeviceChanged(int index);
|
void OnDeviceChanged(int index);
|
||||||
|
void OnGlobalDevicesChanged();
|
||||||
|
|
||||||
ControllerEmu::EmulatedController* m_controller = nullptr;
|
ControllerEmu::EmulatedController* m_controller = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "DolphinQt/GameList/GameListModel.h"
|
#include "DolphinQt/GameList/GameListModel.h"
|
||||||
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
||||||
|
|
||||||
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
#include "InputCommon/InputConfig.h"
|
#include "InputCommon/InputConfig.h"
|
||||||
|
|
||||||
Settings::Settings()
|
Settings::Settings()
|
||||||
|
@ -37,6 +38,9 @@ Settings::Settings()
|
||||||
Config::AddConfigChangedCallback(
|
Config::AddConfigChangedCallback(
|
||||||
[this] { QueueOnObject(this, [this] { emit ConfigChanged(); }); });
|
[this] { QueueOnObject(this, [this] { emit ConfigChanged(); }); });
|
||||||
|
|
||||||
|
g_controller_interface.RegisterDevicesChangedCallback(
|
||||||
|
[this] { QueueOnObject(this, [this] { emit DevicesChanged(); }); });
|
||||||
|
|
||||||
SetCurrentUserStyle(GetCurrentUserStyle());
|
SetCurrentUserStyle(GetCurrentUserStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,7 @@ signals:
|
||||||
void DebugFontChanged(QFont font);
|
void DebugFontChanged(QFont font);
|
||||||
void AutoUpdateTrackChanged(const QString& mode);
|
void AutoUpdateTrackChanged(const QString& mode);
|
||||||
void AnalyticsToggled(bool enabled);
|
void AnalyticsToggled(bool enabled);
|
||||||
|
void DevicesChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_batch = false;
|
bool m_batch = false;
|
||||||
|
|
Loading…
Reference in New Issue