This commit is contained in:
Isaac Marovitz 2024-02-24 17:25:40 -07:00 committed by GitHub
commit da08ecf5a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 26 additions and 44 deletions

View file

@ -38,14 +38,17 @@ namespace Ryujinx.Ava
base.OnFrameworkInitializationCompleted();
if (Program.PreviewerDetached)
{
ApplyConfiguredTheme();
ConfigurationState.Instance.UI.BaseStyle.Event += ThemeChanged_Event;
ConfigurationState.Instance.UI.CustomThemePath.Event += ThemeChanged_Event;
ConfigurationState.Instance.UI.EnableCustomTheme.Event += CustomThemeChanged_Event;
if (!Program.PreviewerDetached)
{
ConfigurationState.Initialize();
}
ApplyConfiguredTheme();
ConfigurationState.Instance.UI.BaseStyle.Event += ThemeChanged_Event;
ConfigurationState.Instance.UI.CustomThemePath.Event += ThemeChanged_Event;
ConfigurationState.Instance.UI.EnableCustomTheme.Event += CustomThemeChanged_Event;
}
private void CustomThemeChanged_Event(object sender, ReactiveEventArgs<bool> e)

View file

@ -5,7 +5,6 @@ using Ryujinx.UI.Common.Configuration;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
namespace Ryujinx.Ava.Common.Locale
{
@ -32,21 +31,8 @@ namespace Ryujinx.Ava.Common.Locale
public void Load()
{
// Load the system Language Code.
string localeLanguageCode = CultureInfo.CurrentCulture.Name.Replace('-', '_');
// If the view is loaded with the UI Previewer detached, then override it with the saved one or default.
if (Program.PreviewerDetached)
{
if (!string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value))
{
localeLanguageCode = ConfigurationState.Instance.UI.LanguageCode.Value;
}
else
{
localeLanguageCode = DefaultLanguageCode;
}
}
string localeLanguageCode = string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value) ?
DefaultLanguageCode : ConfigurationState.Instance.UI.LanguageCode.Value;
// Load en_US as default, if the target language translation is incomplete.
LoadDefaultLanguage();

View file

@ -277,10 +277,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
_virtualFileSystem = virtualFileSystem;
_contentManager = contentManager;
if (Program.PreviewerDetached)
{
Task.Run(LoadTimeZones);
}
Task.Run(LoadTimeZones);
}
public SettingsViewModel()
@ -294,11 +291,8 @@ namespace Ryujinx.Ava.UI.ViewModels
Task.Run(CheckSoundBackends);
Task.Run(PopulateNetworkInterfaces);
if (Program.PreviewerDetached)
{
Task.Run(LoadAvailableGpus);
LoadCurrentConfiguration();
}
Task.Run(LoadAvailableGpus);
LoadCurrentConfiguration();
}
public async Task CheckSoundBackends()
@ -407,8 +401,11 @@ namespace Ryujinx.Ava.UI.ViewModels
ShowConfirmExit = config.ShowConfirmExit;
HideCursor = (int)config.HideCursor.Value;
GameDirectories.Clear();
GameDirectories.AddRange(config.UI.GameDirs.Value);
if (Program.PreviewerDetached)
{
GameDirectories.Clear();
GameDirectories.AddRange(config.UI.GameDirs.Value);
}
BaseStyleIndex = config.UI.BaseStyle == "Light" ? 0 : 1;

View file

@ -8,7 +8,7 @@
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
mc:Ignorable="d" d:DesignWidth="1000"
x:Class="Ryujinx.Ava.UI.Views.Main.MainViewControls"
x:DataType="viewModels:MainWindowViewModel">
<Design.DataContext>

View file

@ -29,10 +29,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent();
if (Program.PreviewerDetached)
{
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
}
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
}
public bool IsScanned { get; set; }

View file

@ -78,13 +78,10 @@ namespace Ryujinx.Ava.UI.Windows
Height = ((Height - barHeight) / Program.WindowScaleFactor) + barHeight;
Width /= Program.WindowScaleFactor;
if (Program.PreviewerDetached)
{
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
this.ScalingChanged += OnScalingChanged;
}
this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
this.ScalingChanged += OnScalingChanged;
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

View file

@ -17,6 +17,8 @@
WindowStartupLocation="CenterOwner"
x:DataType="viewModels:SettingsViewModel"
mc:Ignorable="d"
d:DesignHeight="800"
d:DesignWidth="1000"
Focusable="True">
<Design.DataContext>
<viewModels:SettingsViewModel />