mirror of https://github.com/PCSX2/pcsx2.git
Qt/InputBindingWidget: Reload binds on controller (dis)connect
This commit is contained in:
parent
8deea67dfa
commit
768e716624
|
@ -23,6 +23,8 @@ InputBindingWidget::InputBindingWidget(QWidget* parent)
|
||||||
: QPushButton(parent)
|
: QPushButton(parent)
|
||||||
{
|
{
|
||||||
connect(this, &QPushButton::clicked, this, &InputBindingWidget::onClicked);
|
connect(this, &QPushButton::clicked, this, &InputBindingWidget::onClicked);
|
||||||
|
connect(g_emu_thread, &EmuThread::onInputDeviceConnected, this, &InputBindingWidget::onInputDeviceConnected);
|
||||||
|
connect(g_emu_thread, &EmuThread::onInputDeviceDisconnected, this, &InputBindingWidget::onInputDeviceDisconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
InputBindingWidget::InputBindingWidget(
|
InputBindingWidget::InputBindingWidget(
|
||||||
|
@ -33,6 +35,8 @@ InputBindingWidget::InputBindingWidget(
|
||||||
setMaximumWidth(225);
|
setMaximumWidth(225);
|
||||||
|
|
||||||
connect(this, &QPushButton::clicked, this, &InputBindingWidget::onClicked);
|
connect(this, &QPushButton::clicked, this, &InputBindingWidget::onClicked);
|
||||||
|
connect(g_emu_thread, &EmuThread::onInputDeviceConnected, this, &InputBindingWidget::onInputDeviceConnected);
|
||||||
|
connect(g_emu_thread, &EmuThread::onInputDeviceDisconnected, this, &InputBindingWidget::onInputDeviceDisconnected);
|
||||||
|
|
||||||
initialize(sif, bind_type, std::move(section_name), std::move(key_name));
|
initialize(sif, bind_type, std::move(section_name), std::move(key_name));
|
||||||
}
|
}
|
||||||
|
@ -385,6 +389,16 @@ void InputBindingWidget::inputManagerHookCallback(InputBindingKey key, float val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputBindingWidget::onInputDeviceConnected(const QString& identifier, const QString& device_name)
|
||||||
|
{
|
||||||
|
reloadBinding();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputBindingWidget::onInputDeviceDisconnected(const QString& identifier)
|
||||||
|
{
|
||||||
|
reloadBinding();
|
||||||
|
}
|
||||||
|
|
||||||
void InputBindingWidget::hookInputManager()
|
void InputBindingWidget::hookInputManager()
|
||||||
{
|
{
|
||||||
InputManager::SetHook([this](InputBindingKey key, float value) {
|
InputManager::SetHook([this](InputBindingKey key, float value) {
|
||||||
|
|
|
@ -39,6 +39,9 @@ protected Q_SLOTS:
|
||||||
void onInputListenTimerTimeout();
|
void onInputListenTimerTimeout();
|
||||||
void inputManagerHookCallback(InputBindingKey key, float value);
|
void inputManagerHookCallback(InputBindingKey key, float value);
|
||||||
|
|
||||||
|
void onInputDeviceConnected(const QString& identifier, const QString& device_name);
|
||||||
|
void onInputDeviceDisconnected(const QString& identifier);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue