MappingWindow: don't store devq separately from controller default device
This commit is contained in:
parent
9551fe1c73
commit
ac855e2c93
|
@ -114,7 +114,7 @@ void IOWindow::Update()
|
|||
m_range_spinbox->setValue(m_reference->range * SLIDER_TICK_COUNT);
|
||||
m_range_slider->setValue(m_reference->range * SLIDER_TICK_COUNT);
|
||||
|
||||
m_devq.FromString(m_controller->GetDefaultDevice().ToString());
|
||||
m_devq = m_controller->GetDefaultDevice();
|
||||
|
||||
UpdateDeviceList();
|
||||
UpdateOptionList();
|
||||
|
@ -183,7 +183,7 @@ void IOWindow::OnDetectButtonPressed()
|
|||
btn->setText(QStringLiteral("..."));
|
||||
|
||||
const auto expr = MappingCommon::DetectExpression(
|
||||
m_reference, g_controller_interface.FindDevice(m_devq).get(), m_devq, m_devq);
|
||||
m_reference, g_controller_interface.FindDevice(m_devq).get(), m_devq);
|
||||
|
||||
btn->setText(old_label);
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@ void MappingButton::OnButtonPressed()
|
|||
Common::SleepCurrentThread(100);
|
||||
|
||||
const auto expr = MappingCommon::DetectExpression(
|
||||
m_reference, dev.get(), m_parent->GetParent()->GetDeviceQualifier(),
|
||||
m_parent->GetController()->GetDefaultDevice());
|
||||
m_reference, dev.get(), m_parent->GetController()->GetDefaultDevice());
|
||||
|
||||
releaseMouse();
|
||||
releaseKeyboard();
|
||||
|
@ -90,7 +89,8 @@ void MappingButton::Clear()
|
|||
void MappingButton::Update()
|
||||
{
|
||||
const auto lock = ControllerEmu::EmulatedController::GetStateLock();
|
||||
m_reference->UpdateReference(g_controller_interface, m_parent->GetParent()->GetDeviceQualifier());
|
||||
m_reference->UpdateReference(g_controller_interface,
|
||||
m_parent->GetController()->GetDefaultDevice());
|
||||
setText(EscapeAmpersand(QString::fromStdString(m_reference->GetExpression())));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,15 +35,14 @@ QString GetExpressionForControl(const QString& control_name,
|
|||
}
|
||||
|
||||
QString DetectExpression(ControlReference* reference, ciface::Core::Device* device,
|
||||
const ciface::Core::DeviceQualifier& m_devq,
|
||||
const ciface::Core::DeviceQualifier& default_device)
|
||||
{
|
||||
ciface::Core::Device::Control* const ctrl = reference->Detect(5000, device);
|
||||
|
||||
if (ctrl)
|
||||
{
|
||||
return MappingCommon::GetExpressionForControl(QString::fromStdString(ctrl->GetName()), m_devq,
|
||||
default_device);
|
||||
return MappingCommon::GetExpressionForControl(QString::fromStdString(ctrl->GetName()),
|
||||
default_device, default_device);
|
||||
}
|
||||
return QStringLiteral("");
|
||||
}
|
||||
|
|
|
@ -22,6 +22,5 @@ QString GetExpressionForControl(const QString& control_name,
|
|||
const ciface::Core::DeviceQualifier& control_device,
|
||||
const ciface::Core::DeviceQualifier& default_device);
|
||||
QString DetectExpression(ControlReference* reference, ciface::Core::Device* device,
|
||||
const ciface::Core::DeviceQualifier& m_devq,
|
||||
const ciface::Core::DeviceQualifier& default_device);
|
||||
}
|
||||
|
|
|
@ -210,7 +210,6 @@ void MappingWindow::OnSaveProfilePressed()
|
|||
void MappingWindow::OnDeviceChanged(int index)
|
||||
{
|
||||
const auto device = m_devices_combo->currentText().toStdString();
|
||||
m_devq.FromString(device);
|
||||
m_controller->SetDefaultDevice(device);
|
||||
}
|
||||
|
||||
|
@ -316,14 +315,9 @@ ControllerEmu::EmulatedController* MappingWindow::GetController() const
|
|||
return m_controller;
|
||||
}
|
||||
|
||||
const ciface::Core::DeviceQualifier& MappingWindow::GetDeviceQualifier() const
|
||||
{
|
||||
return m_devq;
|
||||
}
|
||||
|
||||
std::shared_ptr<ciface::Core::Device> MappingWindow::GetDevice() const
|
||||
{
|
||||
return g_controller_interface.FindDevice(m_devq);
|
||||
return g_controller_interface.FindDevice(GetController()->GetDefaultDevice());
|
||||
}
|
||||
|
||||
void MappingWindow::OnDefaultFieldsPressed()
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
explicit MappingWindow(QWidget* parent, Type type, int port_num);
|
||||
|
||||
int GetPort() const;
|
||||
const ciface::Core::DeviceQualifier& GetDeviceQualifier() const;
|
||||
std::shared_ptr<ciface::Core::Device> GetDevice() const;
|
||||
|
||||
ControllerEmu::EmulatedController* GetController() const;
|
||||
|
@ -106,5 +105,4 @@ private:
|
|||
Type m_mapping_type;
|
||||
const int m_port;
|
||||
InputConfig* m_config;
|
||||
ciface::Core::DeviceQualifier m_devq;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue