feat(workspace): copy originals into the workspace and choose the project Edit opens
Phase 5c P1. A workspace copy of kind "originals" now copies each frame's original beside its proxy, so a later local render has full-quality input: streamed into a .part file, hashed as written, checked against the home's SHA-256, renamed and read back. Archive and server homes both work, a stopped copy resumes (originals: checkpoint), and the space check counts the originals. A frame whose original is gone, damaged or refused keeps its proxy and the job says how many; the copy does not fail. Stale originals are deleted only when the home holds the same SHA-256, otherwise moved to the workspace's trash. Proxies only... plans first (every original hashed against the home's frames), asks for an explicit confirmation, rewrites the media to proxies before it touches a file, refuses a plan that changed since, and trashes what the home no longer holds instead of deleting it. Edit: Open in workspace offers Originals (the settings' default, disabled when the drive lacks room) with the originals' size for archive and server homes; Settings > Workspace > Open project picks Last used, Main or asks which; each open is recorded for the clean-up. The project menu gains Copy originals... and Proxies only..., refused while changes are unsaved or jobs of the sequence run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e1c67f531
commit
0c51d11080
14 files changed
+1397
-70
No files matched your search
@@ -47,8 +47,9 @@ public static class ProjectNames
|
||||
/// <summary>
|
||||
/// "Open in workspace" (owner review 2, R8), asked when a sequence has no project in the workspace yet, and by the project
|
||||
/// menu's Open project: which project of its home (Main, made from the sequence's settings as they are, or another) or a
|
||||
/// new one with its name, and the media to copy (proxies; the originals come in phase 5c). Open queues the copy; the
|
||||
/// sequence opens once it is done.
|
||||
/// new one with its name, and the media to copy: the proxies, or (phase 5c) the originals besides, to render on this PC,
|
||||
/// offered while the workspace's drive has room for them (Settings › Workspace › Media chooses the default). Open queues
|
||||
/// the copy; the sequence opens once it is done.
|
||||
/// </summary>
|
||||
public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
{
|
||||
@@ -56,6 +57,7 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
private readonly bool _server;
|
||||
private ProjectOption? _selected;
|
||||
private bool _isNew;
|
||||
private bool _isOriginals;
|
||||
|
||||
/// <param name="taken">The names a new project cannot take (default: those of <paramref name="projects"/>).</param>
|
||||
/// <param name="copy">What the copy of the media writes and the free space of the workspace's drive; null when not measured (shown as nothing).</param>
|
||||
@@ -63,8 +65,10 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
/// The projects whose copy here this Chronos cannot read (damaged, or a newer Chronos's), with why: listed, never chosen.
|
||||
/// </param>
|
||||
/// <param name="server">The sequence's home is a server (phase 5b): the texts name the server.</param>
|
||||
/// <param name="defaultMedia">The media chosen first (<see cref="AppSettings.WorkspaceDefaultMedia"/>); the proxies when the originals have no room.</param>
|
||||
public OpenInWorkspaceDialogViewModel(string sequenceTitle, IReadOnlyList<SequenceProject> projects, Action<ArchiveDialogViewModel> close,
|
||||
IReadOnlyList<string>? taken = null, WorkspaceCopyFacts? copy = null, IReadOnlyDictionary<Guid, string>? unreadable = null, bool server = false)
|
||||
IReadOnlyList<string>? taken = null, WorkspaceCopyFacts? copy = null, IReadOnlyDictionary<Guid, string>? unreadable = null, bool server = false,
|
||||
string defaultMedia = BundleMedia.Proxies)
|
||||
: base(close)
|
||||
{
|
||||
_server = server;
|
||||
@@ -76,7 +80,11 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
new DialogFact(Loc.L("Editor.OpenWorkspace.Size"), Formatting.Bytes(copy.Bytes), Reason: Loc.L("Tooltips.Editor.OpenWorkspace.Size")),
|
||||
new DialogFact(Loc.L("Editor.OpenWorkspace.Free"), copy.Free is { } free ? Formatting.Bytes(free) : Loc.L("Server.Sync.None"),
|
||||
Reason: Loc.L(copy.TooLittleSpace ? "Errors.Workspace.NoRoom" : "Tooltips.Editor.OpenWorkspace.Free")),
|
||||
.. copy.OriginalsBytes is { } originals
|
||||
? [new DialogFact(Loc.L("Editor.OpenWorkspace.Originals"), Formatting.Bytes(originals), Reason: Loc.L("Tooltips.Editor.OpenWorkspace.OriginalsSize"))]
|
||||
: Array.Empty<DialogFact>(),
|
||||
];
|
||||
_isOriginals = defaultMedia == BundleMedia.Originals && CanCopyOriginals;
|
||||
Projects = [.. projects.OrderByDescending(p => p.IsMain).Select(p => new ProjectOption(p, unreadable?.GetValueOrDefault(p.Id)))];
|
||||
_selected = Projects.FirstOrDefault(p => p.IsAvailable);
|
||||
_isNew = !HasProjects;
|
||||
@@ -97,8 +105,8 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
/// <summary>"Copy size" and "Free space", under the media.</summary>
|
||||
public IReadOnlyList<DialogFact> CopyFacts { get; }
|
||||
|
||||
/// <summary>The drive lacks room for the copy: the free space says so (the copy would stop saying how much is missing).</summary>
|
||||
public bool IsShortOfSpace => Copy?.TooLittleSpace == true;
|
||||
/// <summary>The drive lacks room for the copy of the media chosen: the free space says so (the copy would stop saying how much is missing).</summary>
|
||||
public bool IsShortOfSpace => Copy?.TooLittleSpaceFor(Media) == true;
|
||||
|
||||
public string Heading => Loc.L("Editor.OpenWorkspace.Title");
|
||||
|
||||
@@ -147,11 +155,37 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
|
||||
public string ProxiesToolTip => WorkspaceText.ForHome("Tooltips.Editor.OpenWorkspace.Proxies", _server);
|
||||
|
||||
/// <summary>The proxies, the only media this phase copies.</summary>
|
||||
public bool IsProxies => true;
|
||||
/// <summary>The proxies alone: light to edit, renders run where the originals are.</summary>
|
||||
public bool IsProxies
|
||||
{
|
||||
get => !_isOriginals;
|
||||
set
|
||||
{
|
||||
if (value) IsOriginals = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The originals: offered from phase 5c, to render on this PC.</summary>
|
||||
public bool CanCopyOriginals => false;
|
||||
/// <summary>The proxies and the originals (phase 5c): renders run on this PC.</summary>
|
||||
public bool IsOriginals
|
||||
{
|
||||
get => _isOriginals;
|
||||
set
|
||||
{
|
||||
if (!Set(ref _isOriginals, value && CanCopyOriginals)) return;
|
||||
OnPropertyChanged(nameof(IsProxies));
|
||||
OnPropertyChanged(nameof(IsShortOfSpace));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The media <see cref="Open"/> copies.</summary>
|
||||
public string Media => _isOriginals ? BundleMedia.Originals : BundleMedia.Proxies;
|
||||
|
||||
/// <summary>The originals can be chosen: the drive has room for them besides the proxies (or was not measured: the copy measures again).</summary>
|
||||
public bool CanCopyOriginals => Copy?.TooLittleSpaceFor(BundleMedia.Originals) != true;
|
||||
|
||||
public string OriginalsToolTip => CanCopyOriginals
|
||||
? WorkspaceText.ForHome("Tooltips.Editor.OpenWorkspace.OriginalsReady", _server)
|
||||
: Loc.L("Tooltips.Editor.OpenWorkspace.NoRoomOriginals");
|
||||
|
||||
public ICommand OpenCommand { get; }
|
||||
|
||||
@@ -169,7 +203,7 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
private void Open()
|
||||
{
|
||||
if (!CanOpen) return;
|
||||
_choice.TrySetResult(_isNew ? new OpenChoice(null, NewName.Text.Trim(), BundleMedia.Proxies) : new OpenChoice(_selected!.Project.Id, null, BundleMedia.Proxies));
|
||||
_choice.TrySetResult(_isNew ? new OpenChoice(null, NewName.Text.Trim(), Media) : new OpenChoice(_selected!.Project.Id, null, Media));
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -181,6 +215,69 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A project of the workspace offered by "Open which project?" (Main in the UI language).</summary>
|
||||
public sealed record WorkspaceProjectChoice(WorkspaceEntry Entry)
|
||||
{
|
||||
public string Label => WorkspaceText.ProjectName(Entry.Name, Entry.IsMain);
|
||||
|
||||
public override string ToString() => Label;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Open which project?" (phase 5c, Settings › Workspace › Open project: Ask): Edit asks which of the sequence's projects in
|
||||
/// the workspace opens, the one opened last chosen first.
|
||||
/// </summary>
|
||||
public sealed class OpenProjectDialogViewModel : ArchiveDialogViewModel
|
||||
{
|
||||
private readonly TaskCompletionSource<WorkspaceEntry?> _choice = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
private WorkspaceProjectChoice? _selected;
|
||||
|
||||
/// <param name="projects">The sequence's readable projects in the workspace.</param>
|
||||
/// <param name="last">The project opened last, chosen first; null: Main.</param>
|
||||
public OpenProjectDialogViewModel(string sequenceTitle, IReadOnlyList<WorkspaceEntry> projects, Guid? last, Action<ArchiveDialogViewModel> close)
|
||||
: base(close)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(projects);
|
||||
Message = Loc.L("Editor.OpenProject.Message", sequenceTitle);
|
||||
Projects = [.. projects.OrderByDescending(p => p.IsMain).ThenBy(p => p.Name, StringComparer.CurrentCultureIgnoreCase).Select(p => new WorkspaceProjectChoice(p))];
|
||||
_selected = Projects.FirstOrDefault(p => p.Entry.ProjectId == last) ?? Projects.FirstOrDefault();
|
||||
OpenCommand = new RelayCommand(Open, () => _selected is not null);
|
||||
}
|
||||
|
||||
/// <summary>Completes with the project chosen, or null when the dialog was closed without one.</summary>
|
||||
public Task<WorkspaceEntry?> Choice => _choice.Task;
|
||||
|
||||
public string Heading => Loc.L("Editor.OpenProject.Title");
|
||||
|
||||
public string Message { get; }
|
||||
|
||||
public IReadOnlyList<WorkspaceProjectChoice> Projects { get; }
|
||||
|
||||
public WorkspaceProjectChoice? SelectedProject
|
||||
{
|
||||
get => _selected;
|
||||
set
|
||||
{
|
||||
if (Set(ref _selected, value)) CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenCommand { get; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_choice.TrySetResult(null);
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private void Open()
|
||||
{
|
||||
if (_selected is null) return;
|
||||
_choice.TrySetResult(_selected.Entry);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Names a project: "New project" (made from the open project's last version at the home) or "Rename".</summary>
|
||||
public sealed class ProjectNameDialogViewModel : ArchiveDialogViewModel
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user