diff --git a/src/duckstation-qt/controllerbindingwidgets.cpp b/src/duckstation-qt/controllerbindingwidgets.cpp index 8122e9be4..d06b0d5b2 100644 --- a/src/duckstation-qt/controllerbindingwidgets.cpp +++ b/src/duckstation-qt/controllerbindingwidgets.cpp @@ -4,6 +4,7 @@ #include "controllerbindingwidgets.h" #include "controllersettingswindow.h" #include "controllersettingwidgetbinder.h" +#include "mainwindow.h" #include "qthost.h" #include "qtutils.h" #include "settingswindow.h" @@ -271,7 +272,10 @@ void ControllerBindingWidget::onAutomaticBindingClicked() QMenu menu(this); bool added = false; - for (const auto& [identifier, device_name] : m_dialog->getDeviceList()) + const auto& device_list = m_dialog->isEditingGameSettings() ? + g_main_window->getControllerSettingsWindow()->getDeviceList() : + m_dialog->getDeviceList(); + for (const auto& [identifier, device_name] : device_list) { // we set it as data, because the device list could get invalidated while the menu is up const QString qidentifier = QString::fromStdString(identifier); diff --git a/src/duckstation-qt/controllerglobalsettingswidget.cpp b/src/duckstation-qt/controllerglobalsettingswidget.cpp index aa5bb9e91..9c1f58f1c 100644 --- a/src/duckstation-qt/controllerglobalsettingswidget.cpp +++ b/src/duckstation-qt/controllerglobalsettingswidget.cpp @@ -78,7 +78,13 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, } if (dialog->isEditingGameSettings()) - m_ui.deviceListGroup->setEnabled(false); + { + m_ui.mainLayout->removeWidget(m_ui.deviceListGroup); + delete m_ui.deviceList; + m_ui.deviceList = nullptr; + delete m_ui.deviceListGroup; + m_ui.deviceListGroup = nullptr; + } connect(m_ui.multitapMode, &QComboBox::currentIndexChanged, this, [this]() { emit bindingSetupChanged(); }); diff --git a/src/duckstation-qt/controllersettingswindow.cpp b/src/duckstation-qt/controllersettingswindow.cpp index be5030902..f5217f0d9 100644 --- a/src/duckstation-qt/controllersettingswindow.cpp +++ b/src/duckstation-qt/controllersettingswindow.cpp @@ -481,8 +481,11 @@ void ControllerSettingsWindow::createWidgets() m_ui.settingsContainer->addWidget(m_global_settings); connect(m_global_settings, &ControllerGlobalSettingsWidget::bindingSetupChanged, this, &ControllerSettingsWindow::createWidgets); - for (const auto& [identifier, device_name] : m_device_list) - m_global_settings->addDeviceToList(QString::fromStdString(identifier), QString::fromStdString(device_name)); + if (isEditingGlobalSettings()) + { + for (const auto& [identifier, device_name] : m_device_list) + m_global_settings->addDeviceToList(QString::fromStdString(identifier), QString::fromStdString(device_name)); + } } // load mtap settings diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 039ebddff..d3afec21d 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -102,6 +102,10 @@ public: /// Opens the editor for a specific input profile. void openInputProfileEditor(const std::string_view name); + /// Returns pointer to settings window. + SettingsWindow* getSettingsWindow(); + ControllerSettingsWindow* getControllerSettingsWindow(); + public Q_SLOTS: /// Updates debug menu visibility (hides if disabled). void updateDebugMenuVisibility(); @@ -240,10 +244,7 @@ private: void updateDisplayWidgetCursor(); void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen); - SettingsWindow* getSettingsWindow(); void doSettings(const char* category = nullptr); - - ControllerSettingsWindow* getControllerSettingsWindow(); void doControllerSettings(ControllerSettingsWindow::Category category = ControllerSettingsWindow::Category::Count); void updateDebugMenuCPUExecutionMode();