Match the Controls summary to the chosen scope

This commit is contained in:
Kurt Himebauch committed 2026-12-04 17:14:29 -05:00
1 parent 593538582c
commit bf2f2404ae
1 file changed
+5 -4
@@ -48,8 +48,9 @@ internal fun DrawerControlsGroup(host: MenuHost, a: DrawerActions, track: (Strin
.onFailure { failure = it.message ?: context.getString(R.string.input_save_failed) }
}
val gameKey = game?.first
val active = library.profile(library.activeId(a.desktop, gameKey))
val changes = gameKey?.let { library.gameChanges(a.desktop, it) } ?: 0
val scopeKey = gameKey.takeIf { gameScope }
val active = library.profile(library.activeId(a.desktop, scopeKey))
val changes = scopeKey?.let { library.gameChanges(a.desktop, it) } ?: 0
val own = gameKey?.let { library.games[it] }
val named = library.profiles.map { it.id to profileLabel(context, it) }
// For one game the first choice follows whatever all games use; for all games the profile itself is the choice.
@@ -69,12 +70,12 @@ internal fun DrawerControlsGroup(host: MenuHost, a: DrawerActions, track: (Strin
}
val physical = if (gameScope && gameKey != null && own?.parts?.containsKey(InputRole.PHYSICAL) == true)
stringResource(R.string.flow_game_changes, game.second, library.gameChanges(a.desktop, gameKey, InputRole.PHYSICAL))
else profileLabel(context, if (gameScope) active else library.profile(library.activeId(a.desktop)))
else profileLabel(context, active)
ActionRow(stringResource(R.string.flow_buttons), physical, stringResource(R.string.ctrl_edit), a.onEditButtons,
modifier = track("input-buttons").testTag("input-edit-buttons"))
a.onEditLayout?.let { edit ->
val layoutName = if (a.oscMode == SessionPrefs.OSC_STEAM_TOUCH && a.steam) stringResource(R.string.osc_steam_layout)
else library.activeLayout(a.desktop, InputRole.PRIMARY, gameKey.takeIf { gameScope })?.name
else library.activeLayout(a.desktop, InputRole.PRIMARY, scopeKey)?.name
ActionRow(stringResource(R.string.flow_layout), layoutName, stringResource(R.string.ctrl_edit), edit,
modifier = track("input-layout").testTag("input-edit-layout"))
}