0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-22 22:45:46 +00:00

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 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() public override void Initialize()
{ {
Name = $"Ryujinx {Program.Version}"; Name = FormatTitle();
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);

View file

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

View file

@ -18,7 +18,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent(); InitializeComponent();
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo]; Title = App.FormatTitle(LocaleKeys.Amiibo);
} }
public AmiiboWindow() public AmiiboWindow()
@ -31,7 +31,7 @@ namespace Ryujinx.Ava.UI.Windows
if (Program.PreviewerDetached) 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(); InitializeComponent();
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle]; Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
} }
public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath) public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath)
@ -95,7 +95,7 @@ namespace Ryujinx.Ava.UI.Windows
DataContext = this; DataContext = this;
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle]; Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
} }
public void Save() public void Save()

View file

@ -79,7 +79,7 @@ namespace Ryujinx.Ava.UI.Windows
UiHandler = new AvaHostUIHandler(this); 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. // NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight; StatusBarHeight = StatusBarView.StatusBar.MinHeight;

View file

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