Overhaul setup wizard help pages

the context can now override a virtual method named `CreateHelpContent` which the setup wizard system will automatically try to use when you use the generic overload taking a generic context type. If the return is null, it skips setting entirely (the default impl is null)

additionally made the discord join link a button with code copied from the about window, and made it centered at the bottom.
This commit is contained in:
GreemDev
2025-11-27 02:11:49 -06:00
parent 4bdee89288
commit 211498e060
10 changed files with 229 additions and 40 deletions

View File

@@ -1,7 +1,9 @@
using Avalonia;
using Avalonia.Controls;
using Gommon;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Controls;
using System;
namespace Ryujinx.Ava.UI.SetupWizard
{
@@ -34,6 +36,7 @@ namespace Ryujinx.Ava.UI.SetupWizard
public SetupWizardPage WithHelpContent(object? content)
{
HelpContent = content;
HasHelpContent = content != null;
return this;
}
@@ -44,12 +47,17 @@ namespace Ryujinx.Ava.UI.SetupWizard
return this;
}
public SetupWizardPage WithContent<TControl, TViewModel>(out TViewModel boundViewModel)
where TControl : RyujinxControl<TViewModel>, new()
where TViewModel : SetupWizardPageContext, new()
=> WithContent<TControl>(
boundViewModel = new() { NotificationManager = ownerWizard.NotificationManager }
);
public SetupWizardPage WithContent<TControl, TContext>(out TContext boundContext)
where TControl : RyujinxControl<TContext>, new()
where TContext : SetupWizardPageContext, new()
{
boundContext = new() { NotificationManager = ownerWizard.NotificationManager };
if (boundContext.CreateHelpContent() is { } content)
WithHelpContent(content);
return WithContent<TControl>(boundContext);
}
public SetupWizardPage WithActionContent(LocaleKeys content) =>
WithActionContent(LocaleManager.Instance[content]);