mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-23 05:49:43 +00:00
Qt: Fix automatic binding button in per-game controller settings
This commit is contained in:
parent
1e119c8e2d
commit
21ec3c1152
@ -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);
|
||||
|
@ -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(); });
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user