CycleControllers: Localized "Player X", fixed button vertical padding

This commit is contained in:
Barış Hamil 2024-11-17 21:47:53 +03:00
parent 9d02910b67
commit 0a7f7d1ecd
2 changed files with 25 additions and 11 deletions

View file

@ -1,3 +1,4 @@
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid;
namespace Ryujinx.Ava.UI.ViewModels namespace Ryujinx.Ava.UI.ViewModels
@ -29,7 +30,18 @@ namespace Ryujinx.Ava.UI.ViewModels
public CycleController(int v, Key x) public CycleController(int v, Key x)
{ {
Player = $"Player {v}"; Player = v switch
{
1 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer1],
2 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer2],
3 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer3],
4 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer4],
5 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer5],
6 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer6],
7 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer7],
8 => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer8],
_ => LocaleManager.Instance[LocaleKeys.ControllerSettingsPlayer] + " " + v
};
Hotkey = x; Hotkey = x;
} }
} }

View file

@ -29,6 +29,7 @@
<Style Selector="ToggleButton, Button"> <Style Selector="ToggleButton, Button">
<Setter Property="Width" Value="90" /> <Setter Property="Width" Value="90" />
<Setter Property="Height" Value="27" /> <Setter Property="Height" Value="27" />
<Setter Property="Padding" Value="0,5,0,5" /> <!-- Added vertical padding -->
</Style> </Style>
<Style Selector="ToggleButton > TextBlock"> <Style Selector="ToggleButton > TextBlock">
<Setter Property="TextAlignment" Value="Center" /> <Setter Property="TextAlignment" Value="Center" />
@ -114,22 +115,23 @@
<TextBlock <TextBlock
Classes="h1" Classes="h1"
Text="{ext:Locale SettingsTabHotkeysCycleControllers}" /> Text="{ext:Locale SettingsTabHotkeysCycleControllers}" />
<StackPanel Orientation="Horizontal" Spacing="10">
<Button <Button
Content="{ext:Locale SettingsTabGeneralAdd}"
Margin="10,0,0,0" Margin="10,0,0,0"
Content="+"
Command="{Binding KeyboardHotkey.AddCycleController}" /> Command="{Binding KeyboardHotkey.AddCycleController}" />
<Button <Button
Margin="10,0,0,0" Content="{ext:Locale SettingsTabGeneralRemove}"
Content="-"
IsEnabled="{Binding KeyboardHotkey.CanRemoveCycleController}" IsEnabled="{Binding KeyboardHotkey.CanRemoveCycleController}"
Command="{Binding KeyboardHotkey.RemoveCycleController}" /> Command="{Binding KeyboardHotkey.RemoveCycleController}" />
</StackPanel> </StackPanel>
</StackPanel>
<ItemsControl ItemsSource="{Binding KeyboardHotkey.CycleControllers}" <ItemsControl ItemsSource="{Binding KeyboardHotkey.CycleControllers}"
Name="CycleControllers"> Name="CycleControllers">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<StackPanel <StackPanel
Margin="0" Margin="10,0,0,0"
Orientation="Vertical" Orientation="Vertical"
Spacing="10" /> Spacing="10" />
</ItemsPanelTemplate> </ItemsPanelTemplate>