fix: wire the phase 5 parcels together

The seven parcels merged without textual conflicts; this connects what each
left to the others:

- Save frame renders through the Core still path (RenderTarget.StillFrame)
  instead of the interim one-frame project in a hidden folder, and is named by
  ExportNaming.StillPath; a missing encoder reports its own notice.
- Render progress counts the output program's entries, so loops, boomerang
  and fades no longer overshoot; the Export panel shows RenderSetup.Program
  (the boomerang-over-star-trails fallback included).
- A videos trash entry is titled by its sequence and carries the path it was
  deleted from, as the panel's restore message and the desktop row expect.
- The desktop sets the videos library's protected folders (workspace) and its
  server connection; the server protects its data folder for copy jobs too.
- Render menu and Export footer open Videos filtered on the sequence; the
  Videos section implements IVideosSection; the editor's group states are kept
  in AppSettings.EditorGroups and survive a restart.
- Rail tooltips and the shortcut test follow the Videos shift (Ctrl+4 Videos,
  Archive/Jobs/Server Ctrl+5..7); the trash Restore button binds its row tooltip.

Refs #21

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-05 02:45:27 +01:00
1 parent c4301eb6d3
commit c4924c122e
49 files changed
+178 -193

No files matched your search

+1 -1
View File
@@ -367,7 +367,7 @@
<DataTemplate DataType="{x:Type ar:TrashRowViewModel}">
<DockPanel Height="48">
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Content="{l:Loc Archive.Trash.Restore}" Command="{Binding RestoreCommand}"
ToolTip="{l:Loc Tooltips.Archive.TrashRestore}" />
ToolTip="{Binding RestoreToolTip}" />
<TextBlock DockPanel.Dock="Right" Text="{Binding DeletedText}" Style="{StaticResource Text.Secondary}" VerticalAlignment="Center" Margin="12,0"
Typography.NumeralAlignment="Tabular" />
<StackPanel VerticalAlignment="Center">
+3 -13
View File
@@ -132,7 +132,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
if (p is string id) SelectedRenderChoice = RenderChoices.FirstOrDefault(c => string.Equals((string)c.Value, id, StringComparison.OrdinalIgnoreCase));
});
ShowVideosCommand = new RelayCommand(ShowVideos, () => VideosSection is not null);
ShowVideosCommand = new RelayCommand(ShowVideos);
_cancelServerJob = new AsyncRelayCommand(CancelServerJobAsync, () => ServerJob is not null);
UndoCommand = new RelayCommand(() => Session.Undo(), () => !IsLocked && Session.History.CanUndo);
RedoCommand = new RelayCommand(() => Session.Redo(), () => !IsLocked && Session.History.CanRedo);
@@ -725,10 +725,6 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private string? RenderPresetId(bool basis) =>
(IsReadOnly ? _renderPreset : null) ?? (basis ? Plan?.Export.BasePresetId : Plan?.Export.PresetId) ?? EditorSettings.ExportPreset.Effective(Session.Project, null);
/// <summary>The Videos section of this Chronos (owner review 1, R9; P7 adds it); null while there is none.</summary>
private SectionKey? VideosSection =>
Enum.TryParse<SectionKey>("Videos", out var key) && Shell.AllSections.Any(s => s.Key == key) ? key : null;
/// <summary>Why the project's export cannot be rendered now, localised; null when it can.</summary>
public string? RenderBlockedReason => Plan switch
{
@@ -844,14 +840,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
else Shell.Notify(Loc.L("Editor.Still.Queued"), label, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
}
/// <summary>
/// The videos of this sequence (Render ▾ › Videos). Until the Videos section takes a sequence filter (P7), it opens the
/// section as it is.
/// </summary>
private void ShowVideos()
{
if (VideosSection is { } key) Shell.Navigate(key);
}
/// <summary>The videos of this sequence (Render ▾ › Videos): the Videos section filtered on it.</summary>
private void ShowVideos() => Shell.OpenVideos(Session.Content.Sequence.Id, Title);
/// <summary>Re-reads the enabled state of every command (the async ones keep their own event).</summary>
public void RefreshCommands()
+2 -2
View File
@@ -100,8 +100,8 @@ public sealed class ExportPlanner(SequenceContent content, IReadOnlyList<IVideoE
var (name, error) = FileName(export.NameTemplate, resolved, setup);
// The estimates follow the setup, which renders the adapted size the encoder may cap (RenderSetup.Create).
var size = RenderSize.Of(input.Project.Camera, resolved, content.SourceWidth, content.SourceHeight, RenderOptions.Default.MaxWorkingLongEdge);
var program = OutputProgram.Build(setup.Plan, export.Playback, setup.Plan.FrameRate);
return new ExportPlan(resolved, setup, setup.Estimate(model), name, error) { OutputSize = size, Program = program };
// The program the render will play (RenderSetup.Program): playback applied, a boomerang over star trails played forward.
return new ExportPlan(resolved, setup, setup.Estimate(model), name, error) { OutputSize = size, Program = setup.Program };
}
/// <summary>The first problem of a name template, localised; null when it is valid.</summary>
+1 -1
View File
@@ -977,7 +977,7 @@ public sealed class ExportTab : EditorTab
});
}
private void OpenVideos() => VideosLink.Open(Editor.Shell.AllSections, Editor.Shell.Navigate, Editor.Session.Content.Sequence.Id);
private void OpenVideos() => Editor.Shell.OpenVideos(Editor.Session.Content.Sequence.Id, Editor.Title);
private void Select(PresetRow? row)
{
@@ -69,6 +69,8 @@ public sealed class AppServices : IAsyncDisposable
Settings = settings;
SaveSettingsAction = saveSettings;
Dialogs = dialogs;
// The editor's open and closed groups survive a restart (owner review 1, R3).
Chronos.App.Editor.EditorSettings.Groups.Bind(settings.EditorGroups, saveSettings);
_renderNode = new RenderNodeHost(StartRenderNode);
ArchiveSetup = new EngineArchiveSetup(this);
Sync = new SyncHost(this);
@@ -495,6 +497,9 @@ public sealed class AppServices : IAsyncDisposable
},
};
Archives = new ArchiveService(database, archive);
// The videos folder may not lie in the workspace either, and a copy of a server's renders downloads through its connection (phase 5).
Archives.Videos.ProtectedFolders = () => [Workspace.Root];
Archives.Videos.Servers = Sync;
Processing = new ProcessingService(database, ProcessingOptions(archive));
Sync.Open(database, Archives, archive);
var handlers = CreateJobHandlers(this);
@@ -85,6 +85,12 @@ public sealed class AppSettings
public AppTheme Theme { get; set; } = AppTheme.Dark;
public bool RailCollapsed { get; set; }
/// <summary>
/// The editor's collapsible groups this user opened or closed, by group key ("export.encoding" → false; owner review 1,
/// R3): kept like the rail's state, never in a project (<see cref="Chronos.App.Editor.EditorSettings.Groups"/>).
/// </summary>
public Dictionary<string, bool> EditorGroups { get; set; } = new(StringComparer.Ordinal);
/// <summary>The sequence opened in Edit last; the picker selects it first (owner review 1, R7).</summary>
public Guid? LastEditedSequence { get; set; }
@@ -367,6 +373,7 @@ public sealed class AppSettings
RecentServers = RecentServers,
Window = Window,
RailCollapsed = RailCollapsed,
EditorGroups = EditorGroups,
LastEditedSequence = LastEditedSequence,
FirstRunCompleted = FirstRunCompleted,
JobsClearedAt = JobsClearedAt,
@@ -402,6 +409,7 @@ public sealed class AppSettings
imported.ServerUrl = ServerUrl;
imported.Window = Window;
imported.RailCollapsed = RailCollapsed;
imported.EditorGroups = EditorGroups;
imported.LastEditedSequence = LastEditedSequence;
imported.FirstRunCompleted = FirstRunCompleted;
imported.WorkspaceFolder = WorkspaceFolder;
+4 -1
View File
@@ -28,7 +28,7 @@ namespace Chronos.App.Sections;
/// by hash, Copy on server, Delete… into the trash after a dry run, Open in Edit, and Send for the workspace's renders.
/// An older server, or none, leaves this PC's videos with the reason.
/// </summary>
public sealed class VideosViewModel : SectionViewModel
public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVideosSection
{
private IReadOnlyList<VideoEntry> _entries = [];
private IReadOnlyList<VideoRowViewModel> _rows = [];
@@ -260,6 +260,9 @@ public sealed class VideosViewModel : SectionViewModel
Apply();
}
/// <summary>The editor's links to this section (<see cref="Chronos.App.Editor.VideosLink"/>) narrow it the same way.</summary>
void Chronos.App.Editor.IVideosSection.ShowSequence(Guid? sequenceId) => ShowSequence(sequenceId);
// ---- Server ----
/// <summary>How the signed-in server's videos reach the list.</summary>
+27 -55
View File
@@ -98,13 +98,14 @@ internal sealed class SequenceRender : IAsyncDisposable
outcomes.Add(new TargetOutcome(target, null, Reason(ex)));
continue;
}
if (setup.Encoder.IsReady && setup.Plan.Frames.Count > 0) ready.Add((index, target, setup));
if (setup.Encoder.IsReady && setup.Program.Count > 0) ready.Add((index, target, setup));
else outcomes.Add(new TargetOutcome(target, null, Reason(setup)));
}
if (ready.Count == 0) return outcomes;
var preparing = ready[0].Setup.NeedsPreparation ? ready[0].Setup.Plan.IncludedFrames.Count : 0;
var total = preparing + ready.Sum(r => (long)r.Setup.Plan.Frames.Count);
// Rendered pictures are counted in the output program's entries (loops, a boomerang and fades add to the plan's).
var total = preparing + ready.Sum(r => (long)r.Setup.Program.Count);
var stage = Loc.L("Export.Job.Preparing");
var chain = new ProgressChain(progress);
var corrections = await RenderPreparation.PrepareAsync(Input, _options, Stage(chain, 0, preparing, total, stage), cancellationToken).ConfigureAwait(false);
@@ -119,7 +120,7 @@ internal sealed class SequenceRender : IAsyncDisposable
try
{
var result = await Pipeline(target.Export).RenderAsync(Input, corrections, new RenderTarget(target.Export, output), _options,
Stage(chain, done, setup.Plan.Frames.Count, total, target.PresetName), cancellationToken).ConfigureAwait(false);
Stage(chain, done, setup.Program.Count, total, target.PresetName), cancellationToken).ConfigureAwait(false);
await chain.FlushAsync().ConfigureAwait(false);
await finished(index, target, result).ConfigureAwait(false);
outcomes.Add(new TargetOutcome(target, result, null));
@@ -129,7 +130,7 @@ internal sealed class SequenceRender : IAsyncDisposable
Core.Diagnostics.Log.Warning("processing", $"Render of {target.PresetName} to {output} failed", ex);
outcomes.Add(new TargetOutcome(target, null, Reason(ex)));
}
done += setup.Plan.Frames.Count;
done += setup.Program.Count;
}
return outcomes;
}
@@ -137,11 +138,10 @@ internal sealed class SequenceRender : IAsyncDisposable
/// <summary>
/// Saves frame <paramref name="frameIndex"/> as one image ("Save frame", owner review 1, R8): the sequence prepared whole
/// as for a video (so its exposure, colour and stabilisation corrections are the ones the video gives that frame), then
/// that frame alone rendered at the export's output size with every correction and the look, without interpolation,
/// motion blur or playback, through the image encoder of <paramref name="target"/>'s codec (PNG, JPEG or TIFF 16-bit). It
/// is written into a hidden working folder beside the output (<c>.&lt;name&gt;.&lt;random&gt;.tmp</c>, which
/// leftover clean-ups find) and moved to <paramref name="name"/>'s path once complete. The result's path is the image's,
/// its duration 0 and its frame count 1.
/// that frame rendered by the pipeline's still path (<see cref="RenderTarget.StillFrame"/>) at the export's output size
/// with every correction and the look, without stacking, interpolation, motion blur or playback, through the image
/// encoder of <paramref name="target"/>'s codec (PNG, JPEG or TIFF 16-bit). The encoder writes a temporary name and
/// renames it once complete, so a cancelled or failed still leaves nothing behind.
/// </summary>
/// <param name="name">The output path of the still from its setup.</param>
/// <param name="starting">Runs with that path before anything is written (checkpoints).</param>
@@ -151,63 +151,35 @@ internal sealed class SequenceRender : IAsyncDisposable
{
ArgumentNullException.ThrowIfNull(target);
ArgumentNullException.ThrowIfNull(name);
if ((uint)frameIndex >= (uint)Input.Frames.Count) throw new RenderException("Export.Render.NoFrames", $"Frame {frameIndex} is not in the sequence.");
// That frame alone, one output period long, whatever the timing would have made of it.
var project = Input.Project with
{
ExcludedFrames = [.. Enumerable.Range(0, Input.Frames.Count).Where(i => i != frameIndex)],
Timing = Input.Project.Timing with { Mode = Input.Project.Timing.Mode.WithManual(TimingMode.Constant), FitToSeconds = null },
Motion = Input.Project.Motion with { MotionBlur = Input.Project.Motion.MotionBlur.WithManual(false) },
};
var still = Input with { Project = project };
var pipeline = Pipeline(target.Export);
var setup = pipeline.Setup(still, new RenderTarget(target.Export, ExportNaming.FallbackName), _options);
if (!setup.Encoder.IsReady || setup.Plan.Frames.Count == 0) throw new RenderException("Export.Render.NoFrames", Reason(setup));
var setup = pipeline.Setup(Input, new RenderTarget(target.Export, ExportNaming.FallbackName, frameIndex), _options);
if (!setup.Encoder.IsReady)
{
var notice = setup.Encoder.Notices.LastOrDefault() ?? new EncoderNotice(EncoderNotices.NoEncoder, setup.Encoder.Settings.Codec.ToString());
throw new RenderException(notice.Key, $"No encoder can save {target.Export.Codec} here ({setup.Encoder.Status})", notice.Args);
}
var output = name(setup);
await starting(output).ConfigureAwait(false);
var chain = new ProgressChain(progress);
var whole = pipeline.Setup(Input, new RenderTarget(target.Export, ExportNaming.FallbackName), _options);
var preparing = whole.NeedsPreparation ? whole.Plan.IncludedFrames.Count : 0;
var preparing = setup.NeedsPreparation ? setup.Plan.IncludedFrames.Count : 0;
var total = preparing + 1L;
// The corrections of the whole sequence, indexed by source frame: the frame gets what the video gives it.
var corrections = await RenderPreparation.PrepareAsync(Input, _options, Stage(chain, 0, preparing, total, Loc.L("Export.Job.Preparing")), cancellationToken)
.ConfigureAwait(false);
var work = Path.Combine(Path.GetDirectoryName(output)!, "." + Path.GetFileName(output) + "." + Guid.NewGuid().ToString("N")[..8] + ".tmp");
Directory.CreateDirectory(work);
try
{
var result = await pipeline.RenderAsync(still, corrections, new RenderTarget(target.Export, Path.Combine(work, "still")), _options,
Stage(chain, preparing, 1, total, target.PresetName), cancellationToken).ConfigureAwait(false);
await chain.FlushAsync().ConfigureAwait(false);
var image = Directory.EnumerateFiles(result.OutputPath).Order(StringComparer.Ordinal).FirstOrDefault()
?? throw new RenderException("Export.Render.NoFrames", "The still was not written.");
File.Move(image, output, overwrite: false);
return result with { OutputPath = output, Bytes = new FileInfo(output).Length, DurationSeconds = 0, FrameCount = 1 };
}
finally
{
try
{
Directory.Delete(work, recursive: true);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
Core.Diagnostics.Log.Warning("processing", $"The still's working folder {work} could not be removed", ex);
}
}
await chain.FlushAsync().ConfigureAwait(false);
var result = await pipeline.RenderAsync(Input, corrections, new RenderTarget(target.Export, output, frameIndex), _options,
Stage(chain, preparing, 1, total, target.PresetName), cancellationToken).ConfigureAwait(false);
await chain.FlushAsync().ConfigureAwait(false);
return result;
}
/// <summary>
/// The path of a still of frame <paramref name="frameIndex"/> (0-based) in <paramref name="folder"/>: the export's name
/// template expanded, then " - " and the 1-based frame number in four digits, with the codec's extension
/// ("2026-09-28 Harbour sunset - PNG - 0124.png"); " (2)" and so on when taken.
/// The path of a still of frame <paramref name="frameIndex"/> (0-based) in <paramref name="folder"/> (or the export's own
/// folder): <see cref="ExportNaming.StillPath(ExportSettings, string, ExportNameContext, int, Func{string, bool}?)"/>,
/// "2026-09-28 Harbour sunset - PNG - 0124.png"; " (2)" and so on when taken.
/// </summary>
public static string StillPath(ExportSettings export, string folder, ExportNameContext context, int frameIndex, Func<string, bool>? taken = null)
{
ArgumentNullException.ThrowIfNull(export);
var name = ExportNaming.Expand(export.NameTemplate, context).Name + " - " + (frameIndex + 1).ToString("0000", System.Globalization.CultureInfo.InvariantCulture);
return ExportNaming.Unique(string.IsNullOrWhiteSpace(export.Folder) ? folder : export.Folder, name, Core.Video.VideoCodecInfo.FileExtension(context.Codec), taken);
}
public static string StillPath(ExportSettings export, string folder, ExportNameContext context, int frameIndex, Func<string, bool>? taken = null) =>
ExportNaming.StillPath(export, folder, context, frameIndex, taken);
/// <summary>
/// The frame a still job saves (<see cref="Protocol.RenderJobParameters.StillFrame"/>, <see cref="Protocol.RenderJobParameters.StillPhoto"/>):
@@ -259,7 +231,7 @@ internal sealed class SequenceRender : IAsyncDisposable
private static string Reason(RenderSetup setup)
{
if (setup.Plan.Frames.Count == 0) return Loc.L("Export.Render.NoFrames");
if (setup.Program.Count == 0) return Loc.L("Export.Render.NoFrames");
var notice = setup.Encoder.Notices.LastOrDefault() ?? new EncoderNotice(EncoderNotices.NoEncoder, setup.Encoder.Settings.Codec.ToString());
return Loc.L(notice.Key, [.. notice.Args]);
}
+7 -3
View File
@@ -412,11 +412,15 @@ internal sealed class VideoTrash(ChronosDatabase db, SequenceWriter writer)
private static string DiskName(string name) =>
Path.GetFileName(name.StartsWith(VideoTrashNames.Prefix, StringComparison.Ordinal) ? name[VideoTrashNames.Prefix.Length..] : name);
/// <summary>
/// A videos entry as the trash lists it: titled by its sequence, with the path the render was deleted from (its file
/// name last, which the panel's restore message and the desktop's row show).
/// </summary>
private static TrashEntry Entry(Guid archiveId, string name, VideoTrashRecord record)
{
var stored = record.Render.OutputPath.Replace('\\', '/');
var cut = stored.LastIndexOf('/');
return new TrashEntry(archiveId, name, record.SequenceId, record.Name, cut < 0 ? string.Empty : stored[..cut], 0, record.FileCount, record.Bytes,
var stored = record.Render.OutputPath.Replace('\\', '/').TrimEnd('/');
var title = string.IsNullOrWhiteSpace(record.SequenceTitle) ? record.Name : record.SequenceTitle;
return new TrashEntry(archiveId, name, record.SequenceId, title, stored, 0, record.FileCount, record.Bytes,
record.DeletedAt, record.DeletedBy, TrashKind.Videos);
}
+4 -1
View File
@@ -38,7 +38,7 @@ public static class ArchiveModule
var events = sp.GetRequiredService<EventHub>();
var volumes = sp.GetService<VolumeSpace>();
// Photos the running job processes at once: the settings' value as it is when each sequence starts (owner review 1).
return new ArchiveService(db, new ArchiveServiceOptions
var service = new ArchiveService(db, new ArchiveServiceOptions
{
// A Reorganize or a conversion tells connected clients of every sequence it changed or made (BRIEF §14.3).
SequenceChanged = async (id, change, ct) =>
@@ -72,6 +72,9 @@ public static class ArchiveModule
// Next to the index in the data folder, where the daily backups always went.
BackupDirectory = Path.Combine(options.DataPath, DatabaseBackups.DirectoryName),
});
// A copy job checks its folder again when it runs: the data folder is refused there too, as the settings refuse it.
service.Videos.ProtectedFolders = () => [options.DataPath];
return service;
});
services.AddSingleton<IArchiveIngest>(sp => sp.GetRequiredService<ArchiveService>().Ingest);
services.AddSingleton<IJobHandlerProvider>(sp => sp.GetRequiredService<ArchiveService>());