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
@@ -9,7 +9,7 @@ using Titano.Ui.Mvvm;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
|
||||
/// <summary>State of the main window: rail, current section, job bar and status strip (BRIEF §12.1).</summary>
|
||||
/// <summary>State of the main window: rail, current section, job bar, status strip and first run (BRIEF §12.1).</summary>
|
||||
public sealed class ShellViewModel : LocalizedViewModel
|
||||
{
|
||||
private readonly AppSettings _settings;
|
||||
@@ -24,18 +24,22 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
private long _totalBytes;
|
||||
private string? _serverName;
|
||||
private int _jobCount;
|
||||
private int _queuedCount;
|
||||
private WelcomeViewModel? _welcome;
|
||||
private Guid? _currentSequenceId;
|
||||
|
||||
public ShellViewModel(AppSettings settings)
|
||||
public ShellViewModel(AppServices services)
|
||||
{
|
||||
_settings = settings;
|
||||
_isRailCollapsed = settings.RailCollapsed;
|
||||
Services = services;
|
||||
_settings = services.Settings;
|
||||
_isRailCollapsed = _settings.RailCollapsed;
|
||||
Library = new LibraryViewModel(this);
|
||||
Import = new ImportViewModel(this);
|
||||
Sequence = new SequenceViewModel(this);
|
||||
Archive = new ArchiveViewModel(this);
|
||||
Jobs = new JobsViewModel(this);
|
||||
Server = new ServerViewModel(this);
|
||||
Settings = new SettingsViewModel(this, settings);
|
||||
Settings = new SettingsViewModel(this);
|
||||
About = new AboutViewModel(this);
|
||||
TopSections = [Library, Import, Sequence, Archive, Jobs, Server];
|
||||
BottomSections = [Settings, About];
|
||||
@@ -49,8 +53,12 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
else if (p is string name && Enum.TryParse<SectionKey>(name, out var key)) Navigate(key);
|
||||
});
|
||||
ToggleRailCommand = new RelayCommand(() => IsRailCollapsed = !IsRailCollapsed);
|
||||
services.Server.PropertyChanged += (_, _) => SetConnection(services.Server.ServerName);
|
||||
if (!_settings.FirstRunCompleted) _welcome = new WelcomeViewModel(this);
|
||||
}
|
||||
|
||||
public AppServices Services { get; }
|
||||
|
||||
public LibraryViewModel Library { get; }
|
||||
public ImportViewModel Import { get; }
|
||||
public SequenceViewModel Sequence { get; }
|
||||
@@ -70,6 +78,18 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
/// <summary>In-window notifications; the window binds its <see cref="ToastHost"/> here.</summary>
|
||||
public ObservableCollection<Toast> PendingToasts { get; } = [];
|
||||
|
||||
/// <summary>First-run choice (Welcome.html); null once made.</summary>
|
||||
public WelcomeViewModel? Welcome
|
||||
{
|
||||
get => _welcome;
|
||||
private set
|
||||
{
|
||||
if (Set(ref _welcome, value)) OnPropertyChanged(nameof(IsWelcomeOpen));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsWelcomeOpen => _welcome is not null;
|
||||
|
||||
public SectionViewModel Current
|
||||
{
|
||||
get => _current;
|
||||
@@ -94,12 +114,54 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
|
||||
public string RailToggleToolTip => Loc.L(IsRailCollapsed ? "Tooltips.Shell.ExpandRail" : "Tooltips.Shell.CollapseRail");
|
||||
|
||||
/// <summary>The sequence the editor opens (set by the Library and the Jobs screen).</summary>
|
||||
public Guid? CurrentSequenceId
|
||||
{
|
||||
get => _currentSequenceId;
|
||||
private set => Set(ref _currentSequenceId, value);
|
||||
}
|
||||
|
||||
/// <summary>Loads the data of every screen once the index is open (or failed to open).</summary>
|
||||
public async Task StartAsync()
|
||||
{
|
||||
if (Services.OpenError is { } error) ReportError(error);
|
||||
Jobs.Attach();
|
||||
await Library.AttachAsync();
|
||||
Settings.Attach();
|
||||
About.Attach();
|
||||
await Server.AttachAsync();
|
||||
}
|
||||
|
||||
/// <summary>Opens a sequence in the editor.</summary>
|
||||
public void OpenSequence(Guid sequenceId)
|
||||
{
|
||||
CurrentSequenceId = sequenceId;
|
||||
Navigate(SectionKey.Sequence);
|
||||
}
|
||||
|
||||
/// <summary>Closes the first-run overlay for good.</summary>
|
||||
public void CompleteWelcome()
|
||||
{
|
||||
_settings.FirstRunCompleted = true;
|
||||
Services.SaveSettings();
|
||||
Welcome?.Dispose();
|
||||
Welcome = null;
|
||||
}
|
||||
|
||||
/// <summary>Shows the first-run overlay again (capture, tests).</summary>
|
||||
public void ShowWelcome() => Welcome ??= new WelcomeViewModel(this);
|
||||
|
||||
// ---- Job bar ----
|
||||
public string JobText => _jobActive && _jobText is not null ? _jobText : Loc.L("Shell.JobBar.Ready", _jobCount);
|
||||
public string JobText => _jobActive && _jobText is not null
|
||||
? _jobText
|
||||
: _queuedCount > 0 ? Loc.L("Shell.JobBar.Ready", _queuedCount) : Loc.L("Shell.JobBar.Idle");
|
||||
|
||||
public double JobProgress { get => _jobProgress; private set => Set(ref _jobProgress, value); }
|
||||
public bool IsJobActive { get => _jobActive; private set => Set(ref _jobActive, value); }
|
||||
public bool IsJobIndeterminate { get => _jobIndeterminate; private set => Set(ref _jobIndeterminate, value); }
|
||||
public ICommand? StopJobCommand { get; set; }
|
||||
|
||||
/// <summary>Pauses the job the bar shows.</summary>
|
||||
public ICommand? StopJobCommand => Jobs.PauseCurrentCommand;
|
||||
|
||||
/// <summary>Updates the global job bar (and the taskbar progress through the window).</summary>
|
||||
public void SetJob(string? text, double progress, bool indeterminate = false)
|
||||
@@ -114,7 +176,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
// ---- Status strip ----
|
||||
public string SequencesText => Loc.Plural("Shell.Status.Sequences", _sequenceCount);
|
||||
public string PhotosText => Loc.Plural("Shell.Status.Photos", _photoCount);
|
||||
public string StorageText => Formatting.Bytes(_totalBytes);
|
||||
public string StorageText => _sequenceCount == 0 && _settings.LastArchivePath is null ? Loc.L("Shell.Status.NoArchive") : Formatting.Bytes(_totalBytes);
|
||||
public string ConnectionText => _serverName is null ? Loc.L("Shell.Status.NotConnected") : Loc.L("Shell.Status.Connected", _serverName);
|
||||
public bool IsConnected => _serverName is not null;
|
||||
public string JobsText => Loc.Plural("Shell.Status.Jobs", _jobCount);
|
||||
@@ -131,14 +193,17 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
|
||||
public void SetConnection(string? serverName)
|
||||
{
|
||||
if (_serverName == serverName) return;
|
||||
_serverName = serverName;
|
||||
OnPropertyChanged(nameof(ConnectionText));
|
||||
OnPropertyChanged(nameof(IsConnected));
|
||||
}
|
||||
|
||||
public void SetJobCount(int count)
|
||||
/// <summary>Active jobs (running + queued) for the status strip, queued ones for the idle job bar.</summary>
|
||||
public void SetJobCount(int active, int queued = 0)
|
||||
{
|
||||
_jobCount = count;
|
||||
_jobCount = active;
|
||||
_queuedCount = queued;
|
||||
OnPropertyChanged(nameof(JobsText));
|
||||
OnPropertyChanged(nameof(JobText));
|
||||
}
|
||||
@@ -152,6 +217,17 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
|
||||
public void ShowToast(Toast toast) => PendingToasts.Add(toast);
|
||||
|
||||
/// <summary>A one-line notice with one action (job done, update available).</summary>
|
||||
public void Notify(string title, string? message = null, string? actionText = null, string? actionToolTip = null, Action? action = null) =>
|
||||
ShowToast(new Toast
|
||||
{
|
||||
Title = title,
|
||||
Message = message,
|
||||
ActionText = actionText,
|
||||
ActionToolTip = actionToolTip,
|
||||
ActionCommand = action is null ? null : new RelayCommand(action),
|
||||
});
|
||||
|
||||
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6).</summary>
|
||||
public void ReportError(Exception ex)
|
||||
{
|
||||
@@ -162,7 +238,18 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
Message = ex.Message,
|
||||
ActionText = Loc.L("Common.OpenLogs"),
|
||||
ActionToolTip = Loc.L("Tooltips.Common.OpenLogs"),
|
||||
ActionCommand = new RelayCommand(() => ShellActions.OpenFolder(App.Current.Environment.LogDirectory)),
|
||||
ActionCommand = new RelayCommand(() => ShellActions.Reveal(Services.Environment.LogDirectory)),
|
||||
});
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Jobs.Dispose();
|
||||
Library.Dispose();
|
||||
Server.Dispose();
|
||||
Settings.Dispose();
|
||||
About.Dispose();
|
||||
Welcome?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user