Skip to content

Commit

Permalink
Avalonia - Misc changes to UX (#3643)
Browse files Browse the repository at this point in the history
* Change navbar from compact to default and force text overflow globally

* Fix settings window

* Fix right stick control alignment

* Initialize value and add logging for SDL IDs

* Fix alignment of setting text and improve borders

* Clean up padding and size of buttons on controller settings

* Fix right side trigger alignment and correct styling

* Revert axaml alignment

* Fix alignment of volume widget

* Fix timezone autocompletebox dropdown height

* MainWindow: Line up volume status bar item

* Remove margins and add padding to volume widget

* Make volume text localizable.

Co-authored-by: merry <[email protected]>
  • Loading branch information
MutantAura and merryhime authored Sep 19, 2022
1 parent 0cb1e92 commit 41790aa
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 86 deletions.
2 changes: 1 addition & 1 deletion Ryujinx.Ava/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ public void UpdateStatus()

StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
Device.EnableDeviceVsync,
Device.GetVolume(),
LocaleManager.Instance["VolumeShort"] + $": {(int)(Device.GetVolume() * 100)}%",
Renderer.IsVulkan ? "Vulkan" : "OpenGL",
dockedMode,
ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
Expand Down
3 changes: 2 additions & 1 deletion Ryujinx.Ava/Assets/Locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,5 +588,6 @@
"SettingsTabGraphicsPreferredGpuTooltip": "Select the graphics card that will be used with the Vulkan graphics backend.\n\nDoes not affect the GPU that OpenGL will use.\n\nSet to the GPU flagged as \"dGPU\" if unsure. If there isn't one, leave untouched.",
"SettingsAppRequiredRestartMessage": "Ryujinx Restart Required",
"SettingsGpuBackendRestartMessage": "Graphics Backend or Gpu settings have been modified. This will require a restart to be applied",
"SettingsGpuBackendRestartSubMessage": "Do you want to restart now?"
"SettingsGpuBackendRestartSubMessage": "Do you want to restart now?",
"VolumeShort": "Vol"
}
14 changes: 14 additions & 0 deletions Ryujinx.Ava/Assets/Styles/Styles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
<Style Selector="Border.huge">
<Setter Property="Width" Value="200" />
</Style>
<Style Selector="Border.settings">
<Setter Property="Background" Value="{DynamicResource ThemeDarkColor}" />
<Setter Property="BorderBrush" Value="{DynamicResource MenuFlyoutPresenterBorderColor}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="CornerRadius" Value="3" />
</Style>
<Style Selector="Image.small">
<Setter Property="Width" Value="50" />
</Style>
Expand Down Expand Up @@ -193,6 +199,14 @@
<Setter Property="Margin" Value="{DynamicResource TextMargin}" />
<Setter Property="FontSize" Value="{DynamicResource FontSize}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
</Style>
<Style Selector="TextBlock.h1">
<Setter Property="Margin" Value="{DynamicResource TextMargin}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="16" />
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
</Style>
<Style Selector="Separator">
<Setter Property="Background" Value="{DynamicResource ThemeControlBorderColor}" />
Expand Down
6 changes: 3 additions & 3 deletions Ryujinx.Ava/Ui/Models/StatusUpdatedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ namespace Ryujinx.Ava.Ui.Models
internal class StatusUpdatedEventArgs : EventArgs
{
public bool VSyncEnabled { get; }
public float Volume { get; }
public string VolumeStatus { get; }
public string GpuBackend { get; }
public string AspectRatio { get; }
public string DockedMode { get; }
public string FifoStatus { get; }
public string GameStatus { get; }
public string GpuName { get; }

public StatusUpdatedEventArgs(bool vSyncEnabled, float volume, string gpuBackend, string dockedMode, string aspectRatio, string gameStatus, string fifoStatus, string gpuName)
public StatusUpdatedEventArgs(bool vSyncEnabled, string volumeStatus, string gpuBackend, string dockedMode, string aspectRatio, string gameStatus, string fifoStatus, string gpuName)
{
VSyncEnabled = vSyncEnabled;
Volume = volume;
VolumeStatus = volumeStatus;
GpuBackend = gpuBackend;
DockedMode = dockedMode;
AspectRatio = aspectRatio;
Expand Down
24 changes: 22 additions & 2 deletions Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ControllerSettingsViewModel : BaseModel, IDisposable

private PlayerIndex _playerId;
private int _controller;
private int _controllerNumber = 0;
private string _controllerImage;
private int _device;
private object _configuration;
Expand Down Expand Up @@ -439,6 +440,14 @@ private static string GetShortGamepadName(string str)
return str;
}

private static string GetShortGamepadId(string str)
{
const string Hyphen = "-";
const int Offset = 1;

return str.Substring(str.IndexOf(Hyphen) + Offset);
}

public void LoadDevices()
{
lock (Devices)
Expand All @@ -451,22 +460,33 @@ public void LoadDevices()
{
using IGamepad gamepad = _mainWindow.InputManager.KeyboardDriver.GetGamepad(id);

Logger.Info?.Print(LogClass.Configuration, $"{GetShortGamepadName(gamepad.Name)} has been connected with ID: {gamepad.Id}");

if (gamepad != null)
{
Devices.Add((DeviceType.Keyboard, id, $"{GetShortGamepadName(gamepad.Name)} ({id})"));
Devices.Add((DeviceType.Keyboard, id, $"{GetShortGamepadName(gamepad.Name)}"));
}
}

foreach (string id in _mainWindow.InputManager.GamepadDriver.GamepadsIds)
{
using IGamepad gamepad = _mainWindow.InputManager.GamepadDriver.GetGamepad(id);

Logger.Info?.Print(LogClass.Configuration, $"{GetShortGamepadName(gamepad.Name)} has been connected with ID: {gamepad.Id}");

if (gamepad != null)
{
Devices.Add((DeviceType.Controller, id, $"{GetShortGamepadName(gamepad.Name)} ({id})"));
if (Devices.Any(controller => GetShortGamepadId(controller.Id) == GetShortGamepadId(gamepad.Id)))
{
_controllerNumber++;
}

Devices.Add((DeviceType.Controller, id, $"{GetShortGamepadName(gamepad.Name)} ({_controllerNumber})"));
}
}

_controllerNumber = 0;

DeviceList.AddRange(Devices.Select(x => x.Name));
Device = Math.Min(Device, DeviceList.Count);
}
Expand Down
8 changes: 5 additions & 3 deletions Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ internal class MainWindowViewModel : BaseModel
private string _dockedStatusText;
private string _fifoStatusText;
private string _gameStatusText;
private string _volumeStatusText;
private string _gpuStatusText;
private bool _isAmiiboRequested;
private bool _isGameRunning;
Expand Down Expand Up @@ -385,11 +386,12 @@ public string AspectRatioStatusText

public string VolumeStatusText
{
get
get => _volumeStatusText;
set
{
string icon = Volume == 0 ? "🔇" : "🔊";
_volumeStatusText = value;

return $"{icon} {(int)(Volume * 100)}%";
OnPropertyChanged();
}
}

Expand Down
33 changes: 17 additions & 16 deletions Ryujinx.Ava/Ui/Windows/ControllerSettingsWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
Grid.Column="0"
Margin="0,0,2,0"
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1">
BorderThickness="1"
Padding="2,0">
<StackPanel
Margin="2"
HorizontalAlignment="Center"
Expand Down Expand Up @@ -65,7 +66,8 @@
Grid.Column="1"
Margin="0,0,2,0"
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1">
BorderThickness="1"
Padding="2,0">
<StackPanel
Margin="2"
HorizontalAlignment="Stretch"
Expand Down Expand Up @@ -103,7 +105,8 @@
Grid.Column="2"
Margin="0,0,2,0"
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1">
BorderThickness="1"
Padding="2,0">
<Grid
Margin="2"
HorizontalAlignment="Stretch"
Expand Down Expand Up @@ -132,7 +135,8 @@
<Border
Grid.Column="3"
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1">
BorderThickness="1"
Padding="2,0" >
<StackPanel
Margin="2"
HorizontalAlignment="Center"
Expand All @@ -151,7 +155,7 @@
Items="{Binding ProfilesList}"
Text="{Binding ProfileName}" />
<Button
MinWidth="60"
MinWidth="0"
Margin="5,0,0,0"
VerticalAlignment="Center"
ToolTip.Tip="{locale:Locale ControllerSettingsLoadProfileToolTip}"
Expand All @@ -162,7 +166,7 @@
Height="20" />
</Button>
<Button
MinWidth="60"
MinWidth="0"
Margin="5,0,0,0"
VerticalAlignment="Center"
ToolTip.Tip="{locale:Locale ControllerSettingsSaveProfileToolTip}"
Expand All @@ -173,7 +177,7 @@
Height="20" />
</Button>
<Button
MinWidth="60"
MinWidth="0"
Margin="5,0,0,0"
VerticalAlignment="Center"
ToolTip.Tip="{locale:Locale ControllerSettingsRemoveProfileToolTip}"
Expand Down Expand Up @@ -522,7 +526,7 @@
TextAlignment="Center" />
</ToggleButton>
</StackPanel>

<!-- Left DPad Down -->
<StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
<TextBlock
Expand Down Expand Up @@ -583,7 +587,7 @@
</StackPanel>
</Border>
</Grid>

<!-- Triggers And Side Buttons-->
<StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
<Border
Expand Down Expand Up @@ -717,7 +721,7 @@
MinWidth="0"
Grid.Column="0"
IsChecked="{Binding Configuration.EnableMotion, Mode=TwoWay}">
<TextBlock Text="{locale:Locale ControllerSettingsMotion}" TextWrapping="WrapWithOverflow" />
<TextBlock Text="{locale:Locale ControllerSettingsMotion}" />
</CheckBox>
<Button Margin="10" Grid.Column="1" Command="{Binding ShowMotionConfig}">
<TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
Expand All @@ -739,7 +743,7 @@
MinWidth="0"
Grid.Column="0"
IsChecked="{Binding Configuration.EnableRumble, Mode=TwoWay}">
<TextBlock Text="{locale:Locale ControllerSettingsRumble}" TextWrapping="WrapWithOverflow" />
<TextBlock Text="{locale:Locale ControllerSettingsRumble}" />
</CheckBox>
<Button Margin="10" Grid.Column="1" Command="{Binding ShowRumbleConfig}">
<TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
Expand Down Expand Up @@ -780,8 +784,6 @@
Margin="0,0,0,4"
Grid.Column="1"
Grid.Row="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource ThemeDarkColor}"
Orientation="Horizontal">
<TextBlock
Expand Down Expand Up @@ -822,7 +824,7 @@
</ToggleButton>
</StackPanel>
<StackPanel
Margin="0,0,0,4"
Margin="0,0,8,4"
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Right"
Expand Down Expand Up @@ -957,7 +959,6 @@
</Border>
<Border
Grid.Row="2"
Margin="2,0,2,2"
Padding="10"
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1"
Expand Down Expand Up @@ -1139,7 +1140,7 @@
Text="{Binding Configuration.DeadzoneRight, StringFormat=\{0:0.00\}}" />
</StackPanel>
<TextBlock Text="{locale:Locale ControllerSettingsStickRange}" />
<StackPanel
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
Expand Down
8 changes: 4 additions & 4 deletions Ryujinx.Ava/Ui/Windows/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
Command="{ReflectionBinding ChangeLanguage}"
CommandParameter="zh_TW"
Header="繁體中文" />
<MenuItem
<MenuItem
Command="{ReflectionBinding ChangeLanguage}"
CommandParameter="ja_JP"
Header="日本語" />
Expand Down Expand Up @@ -662,12 +662,12 @@
IsVisible="{Binding !ShowLoadProgress}" />
<ui:ToggleSplitButton
Name="VolumeStatus"
Margin="-2,0,-3,0"
Padding="5,0,0,5"
Padding="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Background="{DynamicResource ThemeContentBackgroundColor}"
BorderBrush="{DynamicResource ThemeContentBackgroundColor}"
BorderThickness="0"
Content="{Binding VolumeStatusText}"
IsChecked="{Binding VolumeMuted}"
IsVisible="{Binding !ShowLoadProgress}">
Expand Down
1 change: 1 addition & 0 deletions Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ private void Update_StatusBar(object sender, StatusUpdatedEventArgs args)
ViewModel.DockedStatusText = args.DockedMode;
ViewModel.AspectRatioStatusText = args.AspectRatio;
ViewModel.GameStatusText = args.GameStatus;
ViewModel.VolumeStatusText = args.VolumeStatus;
ViewModel.FifoStatusText = args.FifoStatus;
ViewModel.GpuNameText = args.GpuName;
ViewModel.BackendText = args.GpuBackend;
Expand Down
Loading

0 comments on commit 41790aa

Please sign in to comment.