From ac4f2c1e70b35ad4dada0ea1f9ae93cfc7851d4b Mon Sep 17 00:00:00 2001 From: Ahmad Tantowi Date: Sun, 8 Oct 2023 16:04:41 +0700 Subject: [PATCH] Avalonia: Show aspect ratio popup options in status bar (#5780) * Show aspect ratio selection popup in status bar * Add aspect ratio tooltip * Fix typo --- .../UI/ViewModels/MainWindowViewModel.cs | 5 ++ .../UI/Views/Main/MainStatusBarView.axaml | 48 +++++++++++++++++-- .../UI/Views/Main/MainStatusBarView.axaml.cs | 3 +- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs index bd852710..7a9e4df1 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs @@ -1278,6 +1278,11 @@ namespace Ryujinx.Ava.UI.ViewModels Glyph = Glyph.Grid; } + public void SetAspectRatio(AspectRatio aspectRatio) + { + ConfigurationState.Instance.Graphics.AspectRatio.Value = aspectRatio; + } + public async Task InstallFirmwareFromFile() { var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml index 58e06a1c..32524740 100644 --- a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml +++ b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml @@ -6,6 +6,7 @@ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" + xmlns:config="clr-namespace:Ryujinx.Common.Configuration;assembly=Ryujinx.Common" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView" x:DataType="viewModels:MainWindowViewModel"> @@ -112,15 +113,52 @@ Background="Gray" BorderThickness="1" IsVisible="{Binding !ShowLoadProgress}" /> - + Content="{Binding AspectRatioStatusText}" + Click="AspectRatioStatus_OnClick" + ToolTip.Tip="{locale:Locale AspectRatioTooltip}"> + + + + + + + + + + + + + + Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1; }