misc: Use a method to create window titles.

This commit is contained in:
Evan Husted 2024-10-14 15:01:31 -05:00
parent 40a488799e
commit 5f6d9eef6b
6 changed files with 13 additions and 8 deletions

View file

@ -19,9 +19,14 @@ namespace Ryujinx.Ava
{
public class App : Application
{
internal static string FormatTitle(LocaleKeys? windowTitleKey = null)
=> windowTitleKey is null
? $"Ryujinx {Program.Version}"
: $"Ryujinx {Program.Version} - {LocaleManager.Instance[windowTitleKey.Value]}";
public override void Initialize()
{
Name = $"Ryujinx {Program.Version}";
Name = FormatTitle();
AvaloniaXamlLoader.Load(this);

View file

@ -1705,7 +1705,7 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.InvokeAsync(() =>
{
Title = $"Ryujinx {Program.Version}";
Title = App.FormatTitle();
});
}

View file

@ -18,7 +18,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent();
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
Title = App.FormatTitle(LocaleKeys.Amiibo);
}
public AmiiboWindow()
@ -31,7 +31,7 @@ namespace Ryujinx.Ava.UI.Windows
if (Program.PreviewerDetached)
{
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
Title = App.FormatTitle(LocaleKeys.Amiibo);
}
}

View file

@ -30,7 +30,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent();
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
}
public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath)
@ -95,7 +95,7 @@ namespace Ryujinx.Ava.UI.Windows
DataContext = this;
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
}
public void Save()

View file

@ -79,7 +79,7 @@ namespace Ryujinx.Ava.UI.Windows
UiHandler = new AvaHostUIHandler(this);
ViewModel.Title = $"Ryujinx {Program.Version}";
ViewModel.Title = App.FormatTitle();
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight;

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Ava.UI.Windows
public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
{
Title = $"Ryujinx {Program.Version} - {LocaleManager.Instance[LocaleKeys.Settings]}";
Title = App.FormatTitle(LocaleKeys.Settings);
ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);
DataContext = ViewModel;