feat(app): library, jobs, settings, server, welcome and about screens
Local-mode composition root (SQLite index, one JobEngine fed by a single handler registration list), keyset-paged library with thumbnail cache and hover scrub, live job list with throttled updates and the shell job bar, settings with live template validation and encoder self-test, server connection with trust-on-first-use and DPAPI token, first-run welcome, About with update check, and --capture screenshots with synthetic data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
94 files changed
+10130
-374
No files matched your search
@@ -3,64 +3,134 @@ using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Settings;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Ui.Theming;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// <c>Titano.exe --capture <dir></c>: renders every section at 1440×900 in dark and light themes to PNG for
|
||||
/// visual regression and phase reports (BRIEF §20.2), then exits.
|
||||
/// <c>Titano.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
||||
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
|
||||
/// one), for visual review and phase reports (BRIEF §20.2), then exits.
|
||||
/// </summary>
|
||||
public static class ScreenCapture
|
||||
{
|
||||
public static void Run(MainWindow window, ShellViewModel shell, string directory)
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
window.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
window.Left = -20000;
|
||||
window.Top = -20000;
|
||||
window.Width = 1440;
|
||||
window.Height = 900;
|
||||
window.ShowActivated = false;
|
||||
window.ShowInTaskbar = false;
|
||||
window.Show();
|
||||
private static readonly AppTheme[] Themes = [AppTheme.Dark, AppTheme.Light];
|
||||
|
||||
window.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, () =>
|
||||
public static async Task RunAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
|
||||
{
|
||||
var written = 0;
|
||||
try
|
||||
{
|
||||
var written = 0;
|
||||
try
|
||||
Directory.CreateDirectory(directory);
|
||||
window.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
window.Left = -20000;
|
||||
window.Top = -20000;
|
||||
window.Width = 1440;
|
||||
window.Height = 900;
|
||||
window.ShowActivated = false;
|
||||
window.ShowInTaskbar = false;
|
||||
window.Show();
|
||||
|
||||
// First run: empty index, nothing connected, the welcome dialog over the empty Library.
|
||||
await sample.OpenEmptyAsync();
|
||||
await shell.StartAsync();
|
||||
foreach (var theme in Themes)
|
||||
{
|
||||
foreach (var theme in new[] { AppTheme.Dark, AppTheme.Light })
|
||||
ThemeManager.Apply(theme);
|
||||
shell.Navigate(SectionKey.Library);
|
||||
shell.ShowWelcome();
|
||||
shell.Welcome!.ShowDiscovered(new Server.DiscoveredServer("Studio NAS", "https://nas.local:8443"));
|
||||
written += await SaveAsync(window, directory, "welcome", theme);
|
||||
shell.CompleteWelcome();
|
||||
written += await SaveAsync(window, directory, "library-empty", theme);
|
||||
shell.Navigate(SectionKey.Server);
|
||||
written += await SaveAsync(window, directory, "server-signedout", theme);
|
||||
}
|
||||
|
||||
// A populated archive, jobs in every state and a signed-in server.
|
||||
await sample.FillAsync();
|
||||
await shell.Library.RefreshAsync();
|
||||
await shell.Jobs.ReloadAsync();
|
||||
await shell.Services.Server.RestoreAsync();
|
||||
shell.About.SetResult(null);
|
||||
await shell.Settings.DetectEncodersAsync();
|
||||
await shell.Settings.SelfTestAsync();
|
||||
|
||||
foreach (var theme in Themes)
|
||||
{
|
||||
ThemeManager.Apply(theme);
|
||||
|
||||
shell.Library.LayoutIndex = 0;
|
||||
shell.Library.ClearSelectionCommand.Execute(null);
|
||||
shell.Navigate(SectionKey.Library);
|
||||
written += await SaveAsync(window, directory, "library", theme, waitForThumbnails: shell);
|
||||
if (shell.Library.Items.Count > 0) shell.Library.Items[0].IsSelected = true;
|
||||
written += await SaveAsync(window, directory, "library-selection", theme, waitForThumbnails: shell);
|
||||
shell.Library.LayoutIndex = 1;
|
||||
written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell);
|
||||
shell.Library.LayoutIndex = 0;
|
||||
shell.Library.ClearSelectionCommand.Execute(null);
|
||||
|
||||
shell.Navigate(SectionKey.Jobs);
|
||||
if (shell.Jobs.Rows.Count > 0) shell.Jobs.Rows[0].IsExpanded = true;
|
||||
written += await SaveAsync(window, directory, "jobs", theme);
|
||||
|
||||
shell.Navigate(SectionKey.Server);
|
||||
written += await SaveAsync(window, directory, "server", theme);
|
||||
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
foreach (var page in Enum.GetValues<SettingsPage>())
|
||||
{
|
||||
ThemeManager.Apply(theme);
|
||||
foreach (var section in shell.AllSections)
|
||||
{
|
||||
shell.Navigate(section.Key);
|
||||
Settle(window);
|
||||
if (Save(window, Path.Combine(directory, $"{section.Key}-{theme.ToString().ToLowerInvariant()}.png"))) written++;
|
||||
}
|
||||
shell.Settings.Page = page;
|
||||
written += await SaveAsync(window, directory, "settings-" + page.ToString().ToLowerInvariant(), theme);
|
||||
}
|
||||
|
||||
shell.Navigate(SectionKey.About);
|
||||
written += await SaveAsync(window, directory, "about", theme);
|
||||
|
||||
foreach (var key in new[] { SectionKey.Import, SectionKey.Sequence, SectionKey.Archive })
|
||||
{
|
||||
shell.Navigate(key);
|
||||
written += await SaveAsync(window, directory, key.ToString().ToLowerInvariant(), theme);
|
||||
}
|
||||
Log.Info("capture", $"{written} screenshot(s) written to {Path.GetFullPath(directory)}");
|
||||
if (written == 0) Environment.ExitCode = 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("capture", "Capture failed", ex);
|
||||
Environment.ExitCode = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
});
|
||||
Log.Info("capture", $"{written} screenshot(s) written to {Path.GetFullPath(directory)}");
|
||||
if (written == 0) Environment.ExitCode = 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("capture", "Capture failed", ex);
|
||||
Environment.ExitCode = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private static void Settle(Window window)
|
||||
private static async Task<int> SaveAsync(Window window, string directory, string screen, AppTheme theme, ShellViewModel? waitForThumbnails = null)
|
||||
{
|
||||
await Settle(window);
|
||||
if (waitForThumbnails?.Services.Thumbnails is { } thumbnails)
|
||||
{
|
||||
// Thumbnails decode on the thread pool; give them a moment, then settle again.
|
||||
for (var i = 0; i < 40 && thumbnails.PendingLoads > 0; i++) await Task.Delay(50);
|
||||
await Task.Delay(100);
|
||||
await Settle(window);
|
||||
}
|
||||
return Save(window, Path.Combine(directory, $"{screen}-{theme.ToString().ToLowerInvariant()}.png")) ? 1 : 0;
|
||||
}
|
||||
|
||||
private static async Task Settle(Window window)
|
||||
{
|
||||
window.UpdateLayout();
|
||||
// Let bindings, templates and deferred renders complete.
|
||||
window.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, () => { });
|
||||
// Let bindings, templates, async continuations and deferred renders complete.
|
||||
await window.Dispatcher.InvokeAsync(() => { }, DispatcherPriority.ApplicationIdle);
|
||||
await Task.Delay(30);
|
||||
await window.Dispatcher.InvokeAsync(() => { }, DispatcherPriority.ApplicationIdle);
|
||||
window.UpdateLayout();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user