From 4c83794254eef1f824e262d6d46d47bba6cd29c6 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Fri, 1 Nov 2024 13:00:56 -0500 Subject: [PATCH] Avalonia: Move LocaleExtension & IconExtension into one namespace to simplify the usage sites in the markup. --- .../Common/{Locale => }/LocaleManager.cs | 0 .../IconExtension.cs | 2 +- .../LocaleExtension.cs | 3 +- .../UI/Applet/ControllerAppletDialog.axaml | 14 +- src/Ryujinx/UI/Applet/ErrorAppletWindow.axaml | 4 +- .../UI/Controls/ApplicationContextMenu.axaml | 109 +++++++------ .../UI/Views/Input/ControllerInputView.axaml | 84 +++++----- src/Ryujinx/UI/Views/Input/InputView.axaml | 16 +- .../UI/Views/Input/KeyboardInputView.axaml | 68 ++++---- .../UI/Views/Input/MotionInputView.axaml | 16 +- .../UI/Views/Input/RumbleInputView.axaml | 6 +- .../UI/Views/Main/MainMenuBarView.axaml | 147 +++++++++--------- .../UI/Views/Main/MainStatusBarView.axaml | 22 +-- .../UI/Views/Main/MainViewControls.axaml | 34 ++-- .../UI/Views/Settings/SettingsAudioView.axaml | 24 +-- .../UI/Views/Settings/SettingsCPUView.axaml | 38 ++--- .../Views/Settings/SettingsGraphicsView.axaml | 138 ++++++++-------- .../Views/Settings/SettingsHotkeysView.axaml | 22 +-- .../UI/Views/Settings/SettingsInputView.axaml | 16 +- .../Views/Settings/SettingsLoggingView.axaml | 64 ++++---- .../Views/Settings/SettingsNetworkView.axaml | 26 ++-- .../Views/Settings/SettingsSystemView.axaml | 110 ++++++------- .../UI/Views/Settings/SettingsUIView.axaml | 58 +++---- .../UI/Views/User/UserEditorView.axaml | 18 +-- .../User/UserFirmwareAvatarSelectorView.axaml | 6 +- .../User/UserProfileImageSelectorView.axaml | 8 +- .../UI/Views/User/UserRecovererView.axaml | 6 +- .../UI/Views/User/UserSaveManagerView.axaml | 16 +- .../UI/Views/User/UserSelectorView.axaml | 8 +- src/Ryujinx/UI/Windows/AboutWindow.axaml | 21 ++- src/Ryujinx/UI/Windows/AmiiboWindow.axaml | 14 +- src/Ryujinx/UI/Windows/CheatWindow.axaml | 9 +- .../DownloadableContentManagerWindow.axaml | 18 +-- src/Ryujinx/UI/Windows/ModManagerWindow.axaml | 16 +- src/Ryujinx/UI/Windows/SettingsWindow.axaml | 26 ++-- .../UI/Windows/TitleUpdateWindow.axaml | 14 +- 36 files changed, 599 insertions(+), 602 deletions(-) rename src/Ryujinx/Common/{Locale => }/LocaleManager.cs (100%) rename src/Ryujinx/Common/{Icon => MarkupExtensions}/IconExtension.cs (96%) rename src/Ryujinx/Common/{Locale => MarkupExtensions}/LocaleExtension.cs (92%) diff --git a/src/Ryujinx/Common/Locale/LocaleManager.cs b/src/Ryujinx/Common/LocaleManager.cs similarity index 100% rename from src/Ryujinx/Common/Locale/LocaleManager.cs rename to src/Ryujinx/Common/LocaleManager.cs diff --git a/src/Ryujinx/Common/Icon/IconExtension.cs b/src/Ryujinx/Common/MarkupExtensions/IconExtension.cs similarity index 96% rename from src/Ryujinx/Common/Icon/IconExtension.cs rename to src/Ryujinx/Common/MarkupExtensions/IconExtension.cs index 41bdf5b02..15b1ad112 100644 --- a/src/Ryujinx/Common/Icon/IconExtension.cs +++ b/src/Ryujinx/Common/MarkupExtensions/IconExtension.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml.MarkupExtensions; using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings; using System; -namespace Ryujinx.Ava.Common.Icon +namespace Ryujinx.Ava.Common.Markup { internal class IconExtension(string iconString) : MarkupExtension { diff --git a/src/Ryujinx/Common/Locale/LocaleExtension.cs b/src/Ryujinx/Common/MarkupExtensions/LocaleExtension.cs similarity index 92% rename from src/Ryujinx/Common/Locale/LocaleExtension.cs rename to src/Ryujinx/Common/MarkupExtensions/LocaleExtension.cs index 54441c4cc..60d435e30 100644 --- a/src/Ryujinx/Common/Locale/LocaleExtension.cs +++ b/src/Ryujinx/Common/MarkupExtensions/LocaleExtension.cs @@ -2,9 +2,10 @@ using Avalonia.Data.Core; using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml.MarkupExtensions; using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings; +using Ryujinx.Ava.Common.Locale; using System; -namespace Ryujinx.Ava.Common.Locale +namespace Ryujinx.Ava.Common.Markup { internal class LocaleExtension(LocaleKeys key) : MarkupExtension { diff --git a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml index e24a1bb1d..038698f9f 100644 --- a/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml +++ b/src/Ryujinx/UI/Applet/ControllerAppletDialog.axaml @@ -4,7 +4,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" + xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:applet="using:Ryujinx.Ava.UI.Applet" mc:Ignorable="d" Width="400" @@ -25,11 +25,11 @@ Spacing="10" Margin="10"> + Text="{ext:Locale ControllerAppletDescription}" /> + Text="{ext:Locale ControllerAppletDocked}" /> + Text="{ext:Locale ControllerAppletControllers}" /> + Text="{ext:Locale ControllerAppletPlayers}" /> - + diff --git a/src/Ryujinx/UI/Applet/ErrorAppletWindow.axaml b/src/Ryujinx/UI/Applet/ErrorAppletWindow.axaml index 709d833b8..c7aa56fb8 100644 --- a/src/Ryujinx/UI/Applet/ErrorAppletWindow.axaml +++ b/src/Ryujinx/UI/Applet/ErrorAppletWindow.axaml @@ -3,9 +3,9 @@ xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" + xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - Title="{locale:Locale ErrorWindowTitle}" + Title="{ext:Locale ErrorWindowTitle}" xmlns:views="using:Ryujinx.Ava.UI.Applet" Width="450" Height="340" diff --git a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml index 4a6c99d1d..926af7686 100644 --- a/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml +++ b/src/Ryujinx/UI/Controls/ApplicationContextMenu.axaml @@ -2,109 +2,108 @@ x:Class="Ryujinx.Ava.UI.Controls.ApplicationContextMenu" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" - xmlns:icon="clr-namespace:Ryujinx.Ava.Common.Icon" + xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" x:DataType="viewModels:MainWindowViewModel"> + Header="{ext:Locale GameListContextMenuRunApplication}" + Icon="{ext:Icon fa-solid fa-play}"/> + Header="{ext:Locale GameListContextMenuToggleFavorite}" + Icon="{ext:Icon fa-solid fa-star}" + ToolTip.Tip="{ext:Locale GameListContextMenuToggleFavoriteToolTip}" /> + Icon="{ext:Icon fa-solid fa-bookmark}" + ToolTip.Tip="{OnPlatform Default={ext:Locale GameListContextMenuCreateShortcutToolTip}, macOS={ext:Locale GameListContextMenuCreateShortcutToolTipMacOS}}" /> + ToolTip.Tip="{ext:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" /> + ToolTip.Tip="{ext:Locale GameListContextMenuOpenDeviceSaveDirectoryToolTip}" /> + ToolTip.Tip="{ext:Locale GameListContextMenuOpenBcatSaveDirectoryToolTip}" /> + Header="{ext:Locale GameListContextMenuManageTitleUpdates}" + Icon="{ext:Icon fa-solid fa-code-compare}" + ToolTip.Tip="{ext:Locale GameListContextMenuManageTitleUpdatesToolTip}" /> + Header="{ext:Locale GameListContextMenuManageDlc}" + Icon="{ext:Icon fa-solid fa-download}" + ToolTip.Tip="{ext:Locale GameListContextMenuManageDlcToolTip}" /> + Header="{ext:Locale GameListContextMenuManageCheat}" + Icon="{ext:Icon fa-solid fa-code}" + ToolTip.Tip="{ext:Locale GameListContextMenuManageCheatToolTip}" /> + Header="{ext:Locale GameListContextMenuManageMod}" + Icon="{ext:Icon mdi-view-module}" + ToolTip.Tip="{ext:Locale GameListContextMenuManageModToolTip}" /> + Header="{ext:Locale GameListContextMenuOpenModsDirectory}" + Icon="{ext:Icon mdi-folder-file}" + ToolTip.Tip="{ext:Locale GameListContextMenuOpenModsDirectoryToolTip}" /> + Header="{ext:Locale GameListContextMenuOpenSdModsDirectory}" + Icon="{ext:Icon mdi-folder-file}" + ToolTip.Tip="{ext:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" /> - + + Header="{ext:Locale GameListContextMenuCacheManagementPurgePptc}" + Icon="{ext:Icon mdi-refresh}" + ToolTip.Tip="{ext:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" /> + Header="{ext:Locale GameListContextMenuCacheManagementPurgeShaderCache}" + Icon="{ext:Icon mdi-delete-alert}" + ToolTip.Tip="{ext:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" /> + Header="{ext:Locale GameListContextMenuCacheManagementOpenPptcDirectory}" + Icon="{ext:Icon mdi-folder-arrow-up-down}" + ToolTip.Tip="{ext:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" /> + Header="{ext:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}" + Icon="{ext:Icon mdi-folder-arrow-up-down}" + ToolTip.Tip="{ext:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" /> - + + Header="{ext:Locale GameListContextMenuExtractDataExeFS}" + ToolTip.Tip="{ext:Locale GameListContextMenuExtractDataExeFSToolTip}" /> + Header="{ext:Locale GameListContextMenuExtractDataRomFS}" + ToolTip.Tip="{ext:Locale GameListContextMenuExtractDataRomFSToolTip}" /> + Header="{ext:Locale GameListContextMenuExtractDataLogo}" + ToolTip.Tip="{ext:Locale GameListContextMenuExtractDataLogoToolTip}" /> diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml index 08bdf90f4..7daf23eb6 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml @@ -1,7 +1,7 @@ + Text="{ext:Locale ControllerSettingsLStick}" /> @@ -139,7 +139,7 @@ Width="120" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsStickButton}" + Text="{ext:Locale ControllerSettingsStickButton}" TextAlignment="Center" /> - + - + - + + Text="{ext:Locale ControllerSettingsStickDeadzone}" /> + Text="{ext:Locale ControllerSettingsStickRange}" /> + Text="{ext:Locale ControllerSettingsDPad}" /> + Text="{ext:Locale ControllerSettingsTriggerThreshold}" /> @@ -363,7 +363,7 @@ Width="20" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsLeftSR}" + Text="{ext:Locale ControllerSettingsLeftSR}" TextAlignment="Center" /> - + @@ -476,13 +476,13 @@ MinWidth="0" Grid.Column="0" IsChecked="{Binding Config.EnableRumble, Mode=TwoWay}"> - + @@ -519,7 +519,7 @@ Width="20" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsTriggerZR}" + Text="{ext:Locale ControllerSettingsTriggerZR}" TextAlignment="Center" /> + Text="{ext:Locale ControllerSettingsButtons}" /> @@ -590,7 +590,7 @@ Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsButtonA}" + Text="{ext:Locale ControllerSettingsButtonA}" TextAlignment="Center" /> + Text="{ext:Locale ControllerSettingsRStick}" /> @@ -675,7 +675,7 @@ Width="120" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsStickButton}" + Text="{ext:Locale ControllerSettingsStickButton}" TextAlignment="Center" /> - + - + - + + Text="{ext:Locale ControllerSettingsStickDeadzone}" /> + Text="{ext:Locale ControllerSettingsStickRange}" /> + Text="{ext:Locale ControllerSettingsPlayer}" /> + Text="{ext:Locale ControllerSettingsProfile}" /> + Text="{ext:Locale ControllerSettingsInputDevice}" /> + Text="{ext:Locale ControllerSettingsControllerType}" /> + Text="{ext:Locale ControllerSettingsLStick}" /> @@ -139,7 +139,7 @@ Width="120" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsStickButton}" + Text="{ext:Locale ControllerSettingsStickButton}" TextAlignment="Center" /> + Text="{ext:Locale ControllerSettingsDPad}" /> + Text="{ext:Locale ControllerSettingsButtons}" /> @@ -504,7 +504,7 @@ Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsButtonA}" + Text="{ext:Locale ControllerSettingsButtonA}" TextAlignment="Center" /> + Text="{ext:Locale ControllerSettingsRStick}" /> @@ -590,7 +590,7 @@ Width="120" HorizontalAlignment="Center" VerticalAlignment="Center" - Text="{locale:Locale ControllerSettingsStickButton}" + Text="{ext:Locale ControllerSettingsStickButton}" TextAlignment="Center" /> - \ No newline at end of file + diff --git a/src/Ryujinx/UI/Views/Input/MotionInputView.axaml b/src/Ryujinx/UI/Views/Input/MotionInputView.axaml index 0d018e297..9096a06d1 100644 --- a/src/Ryujinx/UI/Views/Input/MotionInputView.axaml +++ b/src/Ryujinx/UI/Views/Input/MotionInputView.axaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" - xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" + xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input" mc:Ignorable="d" x:Class="Ryujinx.Ava.UI.Views.Input.MotionInputView" @@ -23,7 +23,7 @@ + Text="{ext:Locale ControllerSettingsMotionGyroSensitivity}" /> + Text="{ext:Locale ControllerSettingsMotionGyroDeadzone}" /> + Text="{ext:Locale ControllerSettingsMotionUseCemuhookCompatibleMotion}" /> + Text="{ext:Locale ControllerSettingsMotionServerHost}" /> + Text="{ext:Locale ControllerSettingsMotionControllerSlot}" /> + Text="{ext:Locale ControllerSettingsMotionRightJoyConSlot}" /> + Text="{ext:Locale ControllerSettingsMotionMirrorInput}" /> diff --git a/src/Ryujinx/UI/Views/Input/RumbleInputView.axaml b/src/Ryujinx/UI/Views/Input/RumbleInputView.axaml index 1beb1f06e..5f6cde5b5 100644 --- a/src/Ryujinx/UI/Views/Input/RumbleInputView.axaml +++ b/src/Ryujinx/UI/Views/Input/RumbleInputView.axaml @@ -4,7 +4,7 @@ xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" + xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input" mc:Ignorable="d" x:Class="Ryujinx.Ava.UI.Views.Input.RumbleInputView" @@ -21,7 +21,7 @@ Width="100" TextWrapping="WrapWithOverflow" HorizontalAlignment="Center" - Text="{locale:Locale ControllerSettingsRumbleStrongMultiplier}" /> + Text="{ext:Locale ControllerSettingsRumbleStrongMultiplier}" /> + Text="{ext:Locale ControllerSettingsRumbleWeakMultiplier}" /> - + + ToolTip.Tip="{ext:Locale LoadApplicationFileTooltip}" /> + ToolTip.Tip="{ext:Locale LoadApplicationFolderTooltip}" /> + ToolTip.Tip="{ext:Locale LoadDlcFromFolderTooltip}" /> - + ToolTip.Tip="{ext:Locale LoadTitleUpdatesFromFolderTooltip}" /> + + Icon="{ext:Icon fa-solid fa-person}" + ToolTip.Tip="{ext:Locale MenuBarFileOpenAppletOpenMiiAppletToolTip}" /> + Header="{ext:Locale MenuBarFileOpenEmuFolder}" + ToolTip.Tip="{ext:Locale OpenRyujinxFolderTooltip}" /> + Header="{ext:Locale MenuBarFileOpenLogsFolder}" + ToolTip.Tip="{ext:Locale OpenRyujinxLogsTooltip}" /> + Header="{ext:Locale MenuBarFileExit}" + Icon="{ext:Icon fa-solid fa-xmark}" + ToolTip.Tip="{ext:Locale ExitTooltip}" /> - +