Change SettingsWindow title on dirty

This commit is contained in:
Isaac Marovitz 2024-04-18 16:31:52 -04:00
parent f195198608
commit c141b248a8
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
3 changed files with 32 additions and 4 deletions

View file

@ -91,6 +91,7 @@
"LinuxVmMaxMapCountWarningTextPrimary": "Max amount of memory mappings is lower than recommended.",
"LinuxVmMaxMapCountWarningTextSecondary": "The current value of vm.max_map_count ({0}) is lower than {1}. Some games might try to create more memory mappings than currently allowed. Ryujinx will crash as soon as this limit gets exceeded.\n\nYou might want to either manually increase the limit or install pkexec, which allows Ryujinx to assist with that.",
"Settings": "Settings",
"SettingsDirty": "Unsaved Changes",
"SettingsTabGeneral": "User Interface",
"SettingsTabGeneralGeneral": "General",
"SettingsTabGeneralEnableDiscordRichPresence": "Enable Discord Rich Presence",

View file

@ -49,11 +49,24 @@ namespace Ryujinx.Ava.UI.ViewModels
private int _graphicsBackendIndex;
private int _scalingFilter;
private int _scalingFilterLevel;
private int _networkInterfaceIndex;
private int _multiplayerModeIndex;
private bool _isModified;
public bool IsModified
{
get => _isModified;
set
{
DirtyEvent?.Invoke(value);
_isModified = value;
}
}
public event Action CloseWindow;
public event Action SaveSettingsEvent;
private int _networkInterfaceIndex;
private int _multiplayerModeIndex;
public event Action<bool> DirtyEvent;
public int ResolutionScale
{

View file

@ -10,17 +10,18 @@ namespace Ryujinx.Ava.UI.Windows
{
public partial class SettingsWindow : StyleableWindow
{
internal SettingsViewModel ViewModel { get; set; }
private SettingsViewModel ViewModel { get; }
public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
{
Title = $"Ryujinx {Program.Version} - {LocaleManager.Instance[LocaleKeys.Settings]}";
Title = $"{LocaleManager.Instance[LocaleKeys.Settings]}";
ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);
DataContext = ViewModel;
ViewModel.CloseWindow += Close;
ViewModel.SaveSettingsEvent += SaveSettings;
ViewModel.DirtyEvent += UpdateDirtyTitle;
InitializeComponent();
Load();
@ -35,6 +36,19 @@ namespace Ryujinx.Ava.UI.Windows
Load();
}
public void UpdateDirtyTitle(bool isDirty)
{
if (isDirty)
{
Title = $"{LocaleManager.Instance[LocaleKeys.Settings]} - {LocaleManager.Instance[LocaleKeys.SettingsDirty]}";
}
else
{
Title = $"{LocaleManager.Instance[LocaleKeys.Settings]}";
}
}
public void SaveSettings()
{
InputPage.InputView?.SaveCurrentProfile();