1
0
Fork 0
forked from eden-emu/eden

Merge pull request #12380 from flodavid/save-profile

Save configuration profile name used by players
This commit is contained in:
Narr the Reg 2024-01-16 21:27:25 -06:00 committed by GitHub
commit 3910796711
7 changed files with 55 additions and 12 deletions

View file

@ -1650,9 +1650,21 @@ void ConfigureInputPlayer::SaveProfile() {
void ConfigureInputPlayer::UpdateInputProfiles() {
ui->comboProfiles->clear();
for (const auto& profile_name : profiles->GetInputProfileNames()) {
// Set current profile as empty by default
int profile_index = -1;
// Add every available profile and search the player profile to set it as current one
auto& current_profile = Settings::values.players.GetValue()[player_index].profile_name;
std::vector<std::string> profile_names = profiles->GetInputProfileNames();
std::string profile_name;
for (size_t i = 0; i < profile_names.size(); i++) {
profile_name = profile_names[i];
ui->comboProfiles->addItem(QString::fromStdString(profile_name));
if (current_profile == profile_name) {
profile_index = (int)i;
}
}
ui->comboProfiles->setCurrentIndex(-1);
LOG_DEBUG(Frontend, "Setting the current input profile to index {}", profile_index);
ui->comboProfiles->setCurrentIndex(profile_index);
}