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(); base.OnFrameworkInitializationCompleted();
if (Program.PreviewerDetached)
{
ApplyConfiguredTheme();
ConfigurationState.Instance.UI.BaseStyle.Event += ThemeChanged_Event; if (!Program.PreviewerDetached)
ConfigurationState.Instance.UI.CustomThemePath.Event += ThemeChanged_Event; {
ConfigurationState.Instance.UI.EnableCustomTheme.Event += CustomThemeChanged_Event; 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) private void CustomThemeChanged_Event(object sender, ReactiveEventArgs<bool> e)

View file

@ -5,7 +5,6 @@ using Ryujinx.UI.Common.Configuration;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
namespace Ryujinx.Ava.Common.Locale namespace Ryujinx.Ava.Common.Locale
{ {
@ -32,21 +31,8 @@ namespace Ryujinx.Ava.Common.Locale
public void Load() public void Load()
{ {
// Load the system Language Code. string localeLanguageCode = string.IsNullOrEmpty(ConfigurationState.Instance.UI.LanguageCode.Value) ?
string localeLanguageCode = CultureInfo.CurrentCulture.Name.Replace('-', '_'); DefaultLanguageCode : ConfigurationState.Instance.UI.LanguageCode.Value;
// 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;
}
}
// Load en_US as default, if the target language translation is incomplete. // Load en_US as default, if the target language translation is incomplete.
LoadDefaultLanguage(); LoadDefaultLanguage();

View file

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

View file

@ -8,7 +8,7 @@
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" 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:Class="Ryujinx.Ava.UI.Views.Main.MainViewControls"
x:DataType="viewModels:MainWindowViewModel"> x:DataType="viewModels:MainWindowViewModel">
<Design.DataContext> <Design.DataContext>

View file

@ -29,10 +29,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent(); 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; } public bool IsScanned { get; set; }

View file

@ -78,13 +78,10 @@ namespace Ryujinx.Ava.UI.Windows
Height = ((Height - barHeight) / Program.WindowScaleFactor) + barHeight; Height = ((Height - barHeight) / Program.WindowScaleFactor) + barHeight;
Width /= Program.WindowScaleFactor; 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.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
this.ScalingChanged += OnScalingChanged; this.ScalingChanged += OnScalingChanged;
}
} }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

View file

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