mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-22 21:57:44 +02:00
parent
417df486b1
commit
361d0c5632
622 changed files with 3080 additions and 2652 deletions
|
@ -59,4 +59,4 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
=> new(action);
|
||||
public static RelayCommand CreateConditional(Func<bool> canExecute, Action action)
|
||||
=> new(action, canExecute);
|
||||
|
||||
|
||||
public static RelayCommand<T> Create<T>(Action<T?> action)
|
||||
=> new(action);
|
||||
public static RelayCommand<T> CreateConditional<T>(Predicate<T?> canExecute, Action<T?> action)
|
||||
|
@ -23,7 +23,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
=> new(action, AsyncRelayCommandOptions.AllowConcurrentExecutions);
|
||||
public static AsyncRelayCommand CreateSilentFail(Func<Task> action)
|
||||
=> new(action, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler);
|
||||
|
||||
|
||||
public static AsyncRelayCommand<T> Create<T>(Func<T?, Task> action)
|
||||
=> new(action, AsyncRelayCommandOptions.None);
|
||||
public static AsyncRelayCommand<T> CreateConcurrent<T>(Func<T?, Task> action)
|
||||
|
@ -37,7 +37,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
=> new(action, canExecute, AsyncRelayCommandOptions.AllowConcurrentExecutions);
|
||||
public static AsyncRelayCommand CreateSilentFailConditional(Func<bool> canExecute, Func<Task> action)
|
||||
=> new(action, canExecute, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler);
|
||||
|
||||
|
||||
public static AsyncRelayCommand<T> CreateConditional<T>(Predicate<T?> canExecute, Func<T?, Task> action)
|
||||
=> new(action, canExecute, AsyncRelayCommandOptions.None);
|
||||
public static AsyncRelayCommand<T> CreateConcurrentConditional<T>(Predicate<T?> canExecute, Func<T?, Task> action)
|
||||
|
|
|
@ -23,13 +23,13 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
private static ContentDialogOverlayWindow _contentDialogOverlayWindow;
|
||||
|
||||
public static ContentDialog ApplyStyles(
|
||||
this ContentDialog contentDialog,
|
||||
double closeButtonWidth = 80,
|
||||
this ContentDialog contentDialog,
|
||||
double closeButtonWidth = 80,
|
||||
HorizontalAlignment buttonSpaceAlignment = HorizontalAlignment.Right)
|
||||
{
|
||||
Style closeButton = new(x => x.Name("CloseButton"));
|
||||
closeButton.Setters.Add(new Setter(Layoutable.WidthProperty, closeButtonWidth));
|
||||
|
||||
|
||||
Style closeButtonParent = new(x => x.Name("CommandSpace"));
|
||||
closeButtonParent.Setters.Add(new Setter(Layoutable.HorizontalAlignmentProperty, buttonSpaceAlignment));
|
||||
|
||||
|
@ -281,7 +281,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
(int)Symbol.Important);
|
||||
|
||||
|
||||
internal static async Task<UserResult> CreateUpdaterUpToDateInfoDialog(string primary, string secondaryText)
|
||||
=> await ShowTextDialog(
|
||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterTitle],
|
||||
|
@ -339,7 +339,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
return response == UserResult.Yes;
|
||||
}
|
||||
|
||||
|
||||
internal static async Task<UserResult> CreateUpdaterChoiceDialog(string title, string primary, string secondaryText)
|
||||
{
|
||||
if (_isChoiceDialogOpen)
|
||||
|
@ -403,7 +403,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
Position = parent.PointToScreen(new Point()),
|
||||
ShowInTaskbar = false,
|
||||
};
|
||||
|
||||
|
||||
#if DEBUG
|
||||
_contentDialogOverlayWindow.AttachDevTools(new KeyGesture(Key.F12, KeyModifiers.Control));
|
||||
#endif
|
||||
|
@ -480,7 +480,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
await dialogWindow.ShowDialog(_contentDialogOverlayWindow ?? mainWindow ?? GetMainWindow());
|
||||
}
|
||||
|
||||
private static Window GetMainWindow()
|
||||
private static MainWindow GetMainWindow()
|
||||
{
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,5 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
{
|
||||
keyString = key.ToString();
|
||||
}
|
||||
|
||||
break;
|
||||
case GamepadInputId gamepadInputId:
|
||||
if (_gamepadInputIdMap.TryGetValue(gamepadInputId, out localeKey))
|
||||
|
@ -160,6 +161,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
{
|
||||
keyString = gamepadInputId.ToString();
|
||||
}
|
||||
|
||||
break;
|
||||
case StickInputId stickInputId:
|
||||
if (_stickInputIdMap.TryGetValue(stickInputId, out localeKey))
|
||||
|
@ -170,6 +172,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
{
|
||||
keyString = stickInputId.ToString();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
{
|
||||
if (value is not ApplicationData { HasLdnGames: true } applicationData)
|
||||
return "";
|
||||
|
||||
|
||||
return new StringBuilder()
|
||||
.AppendLine(
|
||||
LocaleManager.Instance[LocaleKeys.GameListHeaderHostedGames]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
|
@ -15,8 +15,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
public object Convert(object value, Type _, object __, CultureInfo ___)
|
||||
=> value.Cast<LocaleKeys>() switch
|
||||
{
|
||||
LocaleKeys.CompatibilityListNothing or
|
||||
LocaleKeys.CompatibilityListBoots or
|
||||
LocaleKeys.CompatibilityListNothing or
|
||||
LocaleKeys.CompatibilityListBoots or
|
||||
LocaleKeys.CompatibilityListMenus => Brushes.Red,
|
||||
LocaleKeys.CompatibilityListIngame => Brushes.DarkOrange,
|
||||
_ => Brushes.ForestGreen
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
}
|
||||
|
||||
return app.PercentageProgress != null ? String.Empty :
|
||||
app.ProcessingOutcome != OperationOutcome.Successful && app.ProcessingOutcome != OperationOutcome.Undetermined ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusFailedLabel] :
|
||||
app.ProcessingOutcome is not OperationOutcome.Successful and not OperationOutcome.Undetermined ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusFailedLabel] :
|
||||
app.Trimmable & app.Untrimmable ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusPartialLabel] :
|
||||
app.Trimmable ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusTrimmableLabel] :
|
||||
app.Untrimmable ? LocaleManager.Instance[LocaleKeys.TitleXCIStatusUntrimmableLabel] :
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
}
|
||||
|
||||
return app.PercentageProgress != null ? null :
|
||||
app.ProcessingOutcome != OperationOutcome.Successful && app.ProcessingOutcome != OperationOutcome.Undetermined ? app.ProcessingOutcome.ToLocalisedText() :
|
||||
app.ProcessingOutcome is not OperationOutcome.Successful and not OperationOutcome.Undetermined ? app.ProcessingOutcome.ToLocalisedText() :
|
||||
null;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
{
|
||||
SKColor color = GetColor(image);
|
||||
|
||||
|
||||
// We don't want colors that are too dark.
|
||||
// If the color is too dark, make it brighter by reducing the range
|
||||
// and adding a constant color.
|
||||
|
|
|
@ -15,19 +15,20 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
internal class LoggerAdapter : ILogSink
|
||||
{
|
||||
private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog;
|
||||
|
||||
private static bool _avaloniaLogsEnabled = ConfigurationState.Instance.Logger.EnableAvaloniaLog;
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
AvaLogger.Sink = new LoggerAdapter();
|
||||
ConfigurationState.Instance.Logger.EnableAvaloniaLog.Event
|
||||
ConfigurationState.Instance.Logger.EnableAvaloniaLog.Event
|
||||
+= (_, e) => _avaloniaLogsEnabled = e.NewValue;
|
||||
}
|
||||
|
||||
private static RyuLogger.Log? GetLog(AvaLogLevel level, string area)
|
||||
{
|
||||
if (!_avaloniaLogsEnabled) return null;
|
||||
|
||||
if (!_avaloniaLogsEnabled)
|
||||
return null;
|
||||
|
||||
return level switch
|
||||
{
|
||||
AvaLogLevel.Verbose => RyuLogger.Debug,
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
|
||||
public static void ShowError(string message) =>
|
||||
ShowError(
|
||||
LocaleManager.Instance[LocaleKeys.DialogErrorTitle],
|
||||
LocaleManager.Instance[LocaleKeys.DialogErrorTitle],
|
||||
$"{LocaleManager.Instance[LocaleKeys.DialogErrorMessage]}\n\n{message}"
|
||||
);
|
||||
|
||||
|
@ -73,8 +73,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
title,
|
||||
text,
|
||||
NotificationType.Information,
|
||||
waitingExit,
|
||||
onClick,
|
||||
waitingExit,
|
||||
onClick,
|
||||
onClose);
|
||||
|
||||
public static void ShowSuccess(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
|
||||
|
@ -82,8 +82,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
title,
|
||||
text,
|
||||
NotificationType.Success,
|
||||
waitingExit,
|
||||
onClick,
|
||||
waitingExit,
|
||||
onClick,
|
||||
onClose);
|
||||
|
||||
public static void ShowWarning(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
|
||||
|
@ -91,8 +91,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
title,
|
||||
text,
|
||||
NotificationType.Warning,
|
||||
waitingExit,
|
||||
onClick,
|
||||
waitingExit,
|
||||
onClick,
|
||||
onClose);
|
||||
|
||||
public static void ShowError(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
|
||||
|
@ -100,8 +100,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
title,
|
||||
text,
|
||||
NotificationType.Error,
|
||||
waitingExit,
|
||||
onClick,
|
||||
waitingExit,
|
||||
onClick,
|
||||
onClose);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
IdcArrow = 32512,
|
||||
}
|
||||
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
public enum WindowsMessages : uint
|
||||
{
|
||||
NcHitTest = 0x0084,
|
||||
|
|
|
@ -33,4 +33,4 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue