mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 03:45:45 -04:00
GameSettings: Add per-game input bindings from profiles
This just affects the **bindings**. You will still have to set the controller type per game if this is different from the global default.
This commit is contained in:
@ -154,6 +154,9 @@ void GamePropertiesDialog::setupAdditionalUi()
|
||||
m_ui.userControllerType2->addItem(
|
||||
qApp->translate("ControllerType", Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i))));
|
||||
}
|
||||
m_ui.userInputProfile->addItem(tr("(unchanged)"));
|
||||
for (const auto& it : m_host_interface->getInputProfileList())
|
||||
m_ui.userInputProfile->addItem(QString::fromStdString(it.name));
|
||||
|
||||
m_ui.userMemoryCard1Type->addItem(tr("(unchanged)"));
|
||||
for (u32 i = 0; i < static_cast<u32>(MemoryCardType::Count); i++)
|
||||
@ -331,6 +334,18 @@ void GamePropertiesDialog::populateGameSettings()
|
||||
QSignalBlocker sb(m_ui.userControllerType2);
|
||||
m_ui.userControllerType2->setCurrentIndex(static_cast<int>(gs.controller_2_type.value()) + 1);
|
||||
}
|
||||
if (!gs.input_profile_name.empty())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userInputProfile);
|
||||
int index = m_ui.userInputProfile->findText(QString::fromStdString(gs.input_profile_name));
|
||||
if (index < 0)
|
||||
{
|
||||
index = m_ui.userInputProfile->count();
|
||||
m_ui.userInputProfile->addItem(QString::fromStdString(gs.input_profile_name));
|
||||
}
|
||||
|
||||
m_ui.userInputProfile->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
if (gs.memory_card_1_type.has_value())
|
||||
{
|
||||
@ -478,6 +493,14 @@ void GamePropertiesDialog::connectUi()
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
connect(m_ui.userInputProfile, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (index <= 0)
|
||||
m_game_settings.input_profile_name = {};
|
||||
else
|
||||
m_game_settings.input_profile_name = m_ui.userInputProfile->itemText(index).toStdString();
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
connect(m_ui.userMemoryCard1Type, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (index <= 0)
|
||||
m_game_settings.memory_card_1_type.reset();
|
||||
|
@ -447,6 +447,16 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="userControllerType2"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Input Profile For Bindings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="userInputProfile"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Reference in New Issue
Block a user