Skip to content

Commit

Permalink
misc: Use a method to create window titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Oct 14, 2024
1 parent 40a4887 commit 5f6d9ee
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/Ryujinx/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ public void AppHost_AppExit(object sender, EventArgs e)

Dispatcher.UIThread.InvokeAsync(() =>
{
Title = $"Ryujinx {Program.Version}";
Title = App.FormatTitle();
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public AmiiboWindow(bool showAll, string lastScannedAmiiboId, string titleId)

InitializeComponent();

Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
Title = App.FormatTitle(LocaleKeys.Amiibo);
}

public AmiiboWindow()
Expand All @@ -31,7 +31,7 @@ public AmiiboWindow()

if (Program.PreviewerDetached)
{
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
Title = App.FormatTitle(LocaleKeys.Amiibo);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx/UI/Windows/CheatWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public CheatWindow()

InitializeComponent();

Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
}

public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath)
Expand Down Expand Up @@ -95,7 +95,7 @@ public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string t

DataContext = this;

Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
}

public void Save()
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx/UI/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public MainWindow()

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;
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx/UI/Windows/SettingsWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class SettingsWindow : StyleableWindow

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;
Expand Down

0 comments on commit 5f6d9ee

Please sign in to comment.