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 "controllerbindingwidgets.h"
|
||||||
#include "controllersettingswindow.h"
|
#include "controllersettingswindow.h"
|
||||||
#include "controllersettingwidgetbinder.h"
|
#include "controllersettingwidgetbinder.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include "qthost.h"
|
#include "qthost.h"
|
||||||
#include "qtutils.h"
|
#include "qtutils.h"
|
||||||
#include "settingswindow.h"
|
#include "settingswindow.h"
|
||||||
|
@ -271,7 +272,10 @@ void ControllerBindingWidget::onAutomaticBindingClicked()
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
bool added = false;
|
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
|
// we set it as data, because the device list could get invalidated while the menu is up
|
||||||
const QString qidentifier = QString::fromStdString(identifier);
|
const QString qidentifier = QString::fromStdString(identifier);
|
||||||
|
|
|
@ -78,7 +78,13 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog->isEditingGameSettings())
|
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(); });
|
connect(m_ui.multitapMode, &QComboBox::currentIndexChanged, this, [this]() { emit bindingSetupChanged(); });
|
||||||
|
|
||||||
|
|
|
@ -481,8 +481,11 @@ void ControllerSettingsWindow::createWidgets()
|
||||||
m_ui.settingsContainer->addWidget(m_global_settings);
|
m_ui.settingsContainer->addWidget(m_global_settings);
|
||||||
connect(m_global_settings, &ControllerGlobalSettingsWidget::bindingSetupChanged, this,
|
connect(m_global_settings, &ControllerGlobalSettingsWidget::bindingSetupChanged, this,
|
||||||
&ControllerSettingsWindow::createWidgets);
|
&ControllerSettingsWindow::createWidgets);
|
||||||
for (const auto& [identifier, device_name] : m_device_list)
|
if (isEditingGlobalSettings())
|
||||||
m_global_settings->addDeviceToList(QString::fromStdString(identifier), QString::fromStdString(device_name));
|
{
|
||||||
|
for (const auto& [identifier, device_name] : m_device_list)
|
||||||
|
m_global_settings->addDeviceToList(QString::fromStdString(identifier), QString::fromStdString(device_name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load mtap settings
|
// load mtap settings
|
||||||
|
|
|
@ -102,6 +102,10 @@ public:
|
||||||
/// Opens the editor for a specific input profile.
|
/// Opens the editor for a specific input profile.
|
||||||
void openInputProfileEditor(const std::string_view name);
|
void openInputProfileEditor(const std::string_view name);
|
||||||
|
|
||||||
|
/// Returns pointer to settings window.
|
||||||
|
SettingsWindow* getSettingsWindow();
|
||||||
|
ControllerSettingsWindow* getControllerSettingsWindow();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// Updates debug menu visibility (hides if disabled).
|
/// Updates debug menu visibility (hides if disabled).
|
||||||
void updateDebugMenuVisibility();
|
void updateDebugMenuVisibility();
|
||||||
|
@ -240,10 +244,7 @@ private:
|
||||||
void updateDisplayWidgetCursor();
|
void updateDisplayWidgetCursor();
|
||||||
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
|
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
|
||||||
|
|
||||||
SettingsWindow* getSettingsWindow();
|
|
||||||
void doSettings(const char* category = nullptr);
|
void doSettings(const char* category = nullptr);
|
||||||
|
|
||||||
ControllerSettingsWindow* getControllerSettingsWindow();
|
|
||||||
void doControllerSettings(ControllerSettingsWindow::Category category = ControllerSettingsWindow::Category::Count);
|
void doControllerSettings(ControllerSettingsWindow::Category category = ControllerSettingsWindow::Category::Count);
|
||||||
|
|
||||||
void updateDebugMenuCPUExecutionMode();
|
void updateDebugMenuCPUExecutionMode();
|
||||||
|
|
Loading…
Reference in New Issue