From ac855e2c93319622d644a99ab5f2ece012338fff Mon Sep 17 00:00:00 2001 From: Michael M Date: Sat, 4 Nov 2017 15:29:15 -0700 Subject: [PATCH] MappingWindow: don't store devq separately from controller default device --- Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp | 4 ++-- Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp | 6 +++--- Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp | 5 ++--- Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h | 1 - Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp | 8 +------- Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h | 2 -- 6 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp b/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp index 2a03c3a227..d03013b736 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp @@ -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); diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp index c121edf43a..fb38472eed 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp @@ -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()))); } diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp index 43960cf762..e1f8bda9f3 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp @@ -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(""); } diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h index 935eb20602..ef3ce7fe54 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h @@ -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); } diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp index 7089c3944d..18d22b706d 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp @@ -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 MappingWindow::GetDevice() const { - return g_controller_interface.FindDevice(m_devq); + return g_controller_interface.FindDevice(GetController()->GetDefaultDevice()); } void MappingWindow::OnDefaultFieldsPressed() diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h index fee581c175..d97b39d576 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h @@ -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 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; };