mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-05-04 00:47:44 +02:00

* Refactor * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update src/Ryujinx.Input/ButtonValueType.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Add empty line * Requested renames * Update src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * Make parent models private readonly * Fix ControllerInputView * Make line shorter * Mac keys in locale * Double line break * Fix build * Get rid of _isValid * Fix potential race condition * Rename HasAnyButtonPressed to IsAnyButtonPressed * Use switches * Simplify enumeration --------- Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
225 lines
9.7 KiB
XML
225 lines
9.7 KiB
XML
<UserControl
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
|
|
xmlns:views="clr-namespace:Ryujinx.Ava.UI.Views.Input"
|
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
d:DesignHeight="800"
|
|
d:DesignWidth="800"
|
|
x:Class="Ryujinx.Ava.UI.Views.Input.InputView"
|
|
x:DataType="viewModels:InputViewModel"
|
|
x:CompileBindings="True"
|
|
mc:Ignorable="d"
|
|
Focusable="True">
|
|
<Design.DataContext>
|
|
<viewModels:InputViewModel />
|
|
</Design.DataContext>
|
|
<UserControl.Styles>
|
|
<Style Selector="ToggleButton">
|
|
<Setter Property="Width" Value="90" />
|
|
<Setter Property="Height" Value="27" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
</Style>
|
|
</UserControl.Styles>
|
|
<StackPanel
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Orientation="Vertical">
|
|
<StackPanel
|
|
Margin="0 0 0 5"
|
|
Orientation="Vertical"
|
|
Spacing="5">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="10" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<!-- Player Selection -->
|
|
<Grid
|
|
Grid.Column="0"
|
|
Margin="2"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock
|
|
Margin="5,0,10,0"
|
|
Width="90"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Text="{locale:Locale ControllerSettingsPlayer}" />
|
|
<ComboBox
|
|
Grid.Column="1"
|
|
Name="PlayerIndexBox"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center"
|
|
SelectionChanged="PlayerIndexBox_OnSelectionChanged"
|
|
ItemsSource="{Binding PlayerIndexes}"
|
|
SelectedIndex="{Binding PlayerId}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Name}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
</Grid>
|
|
<!-- Profile Selection -->
|
|
<Grid
|
|
Grid.Column="2"
|
|
Margin="2"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock
|
|
Margin="5,0,10,0"
|
|
Width="90"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Text="{locale:Locale ControllerSettingsProfile}" />
|
|
<ui:FAComboBox
|
|
Grid.Column="1"
|
|
IsEditable="True"
|
|
Name="ProfileBox"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center"
|
|
SelectedIndex="0"
|
|
ItemsSource="{Binding ProfilesList}"
|
|
Text="{Binding ProfileName, Mode=TwoWay}" />
|
|
<Button
|
|
Grid.Column="2"
|
|
MinWidth="0"
|
|
Margin="5,0,0,0"
|
|
VerticalAlignment="Center"
|
|
ToolTip.Tip="{locale:Locale ControllerSettingsLoadProfileToolTip}"
|
|
Command="{Binding LoadProfile}">
|
|
<ui:SymbolIcon
|
|
Symbol="Upload"
|
|
FontSize="15"
|
|
Height="20" />
|
|
</Button>
|
|
<Button
|
|
Grid.Column="3"
|
|
MinWidth="0"
|
|
Margin="5,0,0,0"
|
|
VerticalAlignment="Center"
|
|
ToolTip.Tip="{locale:Locale ControllerSettingsSaveProfileToolTip}"
|
|
Command="{Binding SaveProfile}">
|
|
<ui:SymbolIcon
|
|
Symbol="Save"
|
|
FontSize="15"
|
|
Height="20" />
|
|
</Button>
|
|
<Button
|
|
Grid.Column="4"
|
|
MinWidth="0"
|
|
Margin="5,0,0,0"
|
|
VerticalAlignment="Center"
|
|
ToolTip.Tip="{locale:Locale ControllerSettingsRemoveProfileToolTip}"
|
|
Command="{Binding RemoveProfile}">
|
|
<ui:SymbolIcon
|
|
Symbol="Delete"
|
|
FontSize="15"
|
|
Height="20" />
|
|
</Button>
|
|
</Grid>
|
|
</Grid>
|
|
<Separator />
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="10" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<!-- Input Device -->
|
|
<Grid
|
|
Grid.Column="0"
|
|
Margin="2"
|
|
HorizontalAlignment="Stretch">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock
|
|
Grid.Column="0"
|
|
Margin="5,0,10,0"
|
|
Width="90"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Text="{locale:Locale ControllerSettingsInputDevice}" />
|
|
<ComboBox
|
|
Grid.Column="1"
|
|
Name="DeviceBox"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center"
|
|
ItemsSource="{Binding DeviceList}"
|
|
SelectedIndex="{Binding Device}" />
|
|
<Button
|
|
Grid.Column="2"
|
|
MinWidth="0"
|
|
Margin="5,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Command="{Binding LoadDevices}">
|
|
<ui:SymbolIcon
|
|
Symbol="Refresh"
|
|
FontSize="15"
|
|
Height="20"/>
|
|
</Button>
|
|
</Grid>
|
|
<!-- Controller Type -->
|
|
<Grid
|
|
Grid.Column="2"
|
|
Margin="2"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock
|
|
Margin="5,0,10,0"
|
|
Width="90"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Text="{locale:Locale ControllerSettingsControllerType}" />
|
|
<ComboBox
|
|
Grid.Column="1"
|
|
HorizontalAlignment="Stretch"
|
|
ItemsSource="{Binding Controllers}"
|
|
SelectedIndex="{Binding Controller}">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate DataType="models:ControllerModel">
|
|
<TextBlock Text="{Binding Name}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
</Grid>
|
|
</Grid>
|
|
</StackPanel>
|
|
<ContentControl Content="{Binding ConfigViewModel}" IsVisible="{Binding ShowSettings}">
|
|
<ContentControl.DataTemplates>
|
|
<DataTemplate DataType="viewModels:ControllerInputViewModel">
|
|
<views:ControllerInputView />
|
|
</DataTemplate>
|
|
<DataTemplate DataType="viewModels:KeyboardInputViewModel">
|
|
<views:KeyboardInputView />
|
|
</DataTemplate>
|
|
</ContentControl.DataTemplates>
|
|
</ContentControl>
|
|
</StackPanel>
|
|
</UserControl>
|