Compare commits

...

2 Commits

Author SHA1 Message Date
Evan Husted
9754d247b5 UI: Directly proxy window properties on the view model back to the stored window 2024-12-26 23:32:53 -06:00
Evan Husted
267e9f6350 UI: Redirect IME errors to Debug instead of error 2024-12-26 23:13:35 -06:00
5 changed files with 19 additions and 49 deletions

View File

@@ -34,10 +34,7 @@ namespace Ryujinx.Ava
.MainWindow.Cast<MainWindow>(); .MainWindow.Cast<MainWindow>();
public static bool IsClipboardAvailable(out IClipboard clipboard) public static bool IsClipboardAvailable(out IClipboard clipboard)
{ => (clipboard = MainWindow.Clipboard) != null;
clipboard = MainWindow.Clipboard;
return clipboard != null;
}
public static void SetTaskbarProgress(TaskBarProgressBarState state) => MainWindow.PlatformFeatures.SetTaskBarProgressBarState(state); public static void SetTaskbarProgress(TaskBarProgressBarState state) => MainWindow.PlatformFeatures.SetTaskBarProgressBarState(state);
public static void SetTaskbarProgressValue(ulong current, ulong total) => MainWindow.PlatformFeatures.SetTaskBarProgressBarValue(current, total); public static void SetTaskbarProgressValue(ulong current, ulong total) => MainWindow.PlatformFeatures.SetTaskBarProgressBarValue(current, total);

View File

@@ -19,7 +19,7 @@ namespace Ryujinx.Ava.UI.Helpers
AvaLogger.Sink = new LoggerAdapter(); AvaLogger.Sink = new LoggerAdapter();
} }
private static RyuLogger.Log? GetLog(AvaLogLevel level) private static RyuLogger.Log? GetLog(AvaLogLevel level, string area)
{ {
return level switch return level switch
{ {
@@ -27,7 +27,7 @@ namespace Ryujinx.Ava.UI.Helpers
AvaLogLevel.Debug => RyuLogger.Debug, AvaLogLevel.Debug => RyuLogger.Debug,
AvaLogLevel.Information => RyuLogger.Debug, AvaLogLevel.Information => RyuLogger.Debug,
AvaLogLevel.Warning => RyuLogger.Debug, AvaLogLevel.Warning => RyuLogger.Debug,
AvaLogLevel.Error => RyuLogger.Error, AvaLogLevel.Error => area is "IME" ? RyuLogger.Debug : RyuLogger.Error,
AvaLogLevel.Fatal => RyuLogger.Error, AvaLogLevel.Fatal => RyuLogger.Error,
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null), _ => throw new ArgumentOutOfRangeException(nameof(level), level, null),
}; };
@@ -35,17 +35,17 @@ namespace Ryujinx.Ava.UI.Helpers
public bool IsEnabled(AvaLogLevel level, string area) public bool IsEnabled(AvaLogLevel level, string area)
{ {
return GetLog(level) != null; return GetLog(level, area) != null;
} }
public void Log(AvaLogLevel level, string area, object source, string messageTemplate) public void Log(AvaLogLevel level, string area, object source, string messageTemplate)
{ {
GetLog(level)?.PrintMsg(RyuLogClass.UI, Format(level, area, messageTemplate, source, null)); GetLog(level, area)?.PrintMsg(RyuLogClass.UI, Format(level, area, messageTemplate, source, null));
} }
public void Log(AvaLogLevel level, string area, object source, string messageTemplate, params object[] propertyValues) public void Log(AvaLogLevel level, string area, object source, string messageTemplate, params object[] propertyValues)
{ {
GetLog(level)?.PrintMsg(RyuLogClass.UI, Format(level, area, messageTemplate, source, propertyValues)); GetLog(level, area)?.PrintMsg(RyuLogClass.UI, Format(level, area, messageTemplate, source, propertyValues));
} }
private static string Format(AvaLogLevel level, string area, string template, object source, object[] v) private static string Format(AvaLogLevel level, string area, string template, object source, object[] v)

View File

@@ -109,13 +109,8 @@ namespace Ryujinx.Ava.UI.ViewModels
private bool _areMimeTypesRegistered = FileAssociationHelper.AreMimeTypesRegistered; private bool _areMimeTypesRegistered = FileAssociationHelper.AreMimeTypesRegistered;
private bool _canUpdate = true; private bool _canUpdate = true;
private Cursor _cursor;
private string _title;
private ApplicationData _currentApplicationData; private ApplicationData _currentApplicationData;
private readonly AutoResetEvent _rendererWaitEvent; private readonly AutoResetEvent _rendererWaitEvent;
private WindowState _windowState;
private double _windowWidth;
private double _windowHeight;
private int _customVSyncInterval; private int _customVSyncInterval;
private int _customVSyncIntervalPercentageProxy; private int _customVSyncIntervalPercentageProxy;
@@ -216,7 +211,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool CanUpdate public bool CanUpdate
{ {
get => _canUpdate && EnableNonGameRunningControls && Updater.CanUpdate(false); get => _canUpdate && EnableNonGameRunningControls && Updater.CanUpdate();
set set
{ {
_canUpdate = value; _canUpdate = value;
@@ -226,12 +221,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public Cursor Cursor public Cursor Cursor
{ {
get => _cursor; get => Window.Cursor;
set set => Window.Cursor = value;
{
_cursor = value;
OnPropertyChanged();
}
} }
public ReadOnlyObservableCollection<ApplicationData> AppsObservableList public ReadOnlyObservableCollection<ApplicationData> AppsObservableList
@@ -813,35 +804,23 @@ namespace Ryujinx.Ava.UI.ViewModels
public WindowState WindowState public WindowState WindowState
{ {
get => _windowState; get => Window.WindowState;
internal set internal set
{ {
_windowState = value; Window.WindowState = value;
OnPropertyChanged();
} }
} }
public double WindowWidth public double WindowWidth
{ {
get => _windowWidth; get => Window.Width;
set set => Window.Width = value;
{
_windowWidth = value;
OnPropertyChanged();
}
} }
public double WindowHeight public double WindowHeight
{ {
get => _windowHeight; get => Window.Height;
set set => Window.Height = value;
{
_windowHeight = value;
OnPropertyChanged();
}
} }
public bool IsGrid => Glyph == Glyph.Grid; public bool IsGrid => Glyph == Glyph.Grid;
@@ -889,10 +868,10 @@ namespace Ryujinx.Ava.UI.ViewModels
public string Title public string Title
{ {
get => _title; get => Window.Title;
set set
{ {
_title = value; Window.Title = value;
OnPropertyChanged(); OnPropertyChanged();
} }

View File

@@ -7,7 +7,6 @@
xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup" xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
xmlns:local="clr-namespace:Ryujinx.Ava.UI.Views.Main"
xmlns:config="clr-namespace:Ryujinx.Common.Configuration;assembly=Ryujinx.Common" xmlns:config="clr-namespace:Ryujinx.Common.Configuration;assembly=Ryujinx.Common"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView" x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView"

View File

@@ -9,11 +9,6 @@
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls" xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
xmlns:main="clr-namespace:Ryujinx.Ava.UI.Views.Main" xmlns:main="clr-namespace:Ryujinx.Ava.UI.Views.Main"
Cursor="{Binding Cursor}"
Title="{Binding Title}"
WindowState="{Binding WindowState}"
Width="{Binding WindowWidth}"
Height="{Binding WindowHeight}"
MinWidth="800" MinWidth="800"
MinHeight="500" MinHeight="500"
d:DesignHeight="720" d:DesignHeight="720"