feat: owner review 2 phase 5a: workspace and projects with a local home (#14)
CI / Build and test (push) Successful in 9m43s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 27s
CI / PostgreSQL 16 integration (push) Failing after 8m41s
CI / PostgreSQL 17 integration (push) Successful in 12m37s
CI / Docker image (push) Successful in 56s
Release / Build, test and publish (push) Successful in 14m59s
Release / Server image (push) Successful in 1m51s
CI / Build and test (push) Successful in 9m43s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 27s
CI / PostgreSQL 16 integration (push) Failing after 8m41s
CI / PostgreSQL 17 integration (push) Successful in 12m37s
CI / Docker image (push) Successful in 56s
Release / Build, test and publish (push) Successful in 14m59s
Release / Server image (push) Successful in 1m51s
Edit opens a sequence as a project of a workspace folder outside the library. Projects have linear version histories kept as sidecars in .chronos/projects/, Main mirrors the sequence's settings, and sync merges setting by setting. Migration 0009, JobKind.WorkspaceCopy = 20, Settings › Workspace, and 241 new strings in 38 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #14.
This commit is contained in:
1 parent
efa87f68ce
commit
9b24cf74fc
370 files changed
+29237
-287
No files matched your search
@@ -8,6 +8,7 @@ using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Jobs;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Workspace;
|
||||
using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Diagnostics;
|
||||
@@ -89,6 +90,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
/// <summary>The user chose a step since the editor opened.</summary>
|
||||
private bool _stepChosen;
|
||||
|
||||
private Workspace.ProjectMenuViewModel? _project;
|
||||
private bool _disposed;
|
||||
|
||||
public EditorViewModel(ShellViewModel shell, EditorSession session, IReadOnlyList<IVideoEncoderProvider> encoders, EncoderHost host)
|
||||
@@ -147,6 +149,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
session.ContentChanged += OnContentChanged;
|
||||
session.SaveFailed += OnSaveFailed;
|
||||
session.ConflictFound += OnConflictFound;
|
||||
session.EditSetAside += OnEditSetAside;
|
||||
session.Source.JobChanged += OnJobChanged;
|
||||
session.Source.ReadOnlyChanged += OnReadOnlyChanged;
|
||||
shell.Services.Sync.Changed += OnSyncChanged;
|
||||
@@ -175,6 +178,23 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
/// <summary>A server sequence edited with proxies (the header says where it lives).</summary>
|
||||
public bool IsRemote => Session.IsRemote;
|
||||
|
||||
/// <summary>
|
||||
/// The project menu beside the title (owner review 2, R8) when the sequence is open as a workspace project: its state,
|
||||
/// Save version, Sync, History and the rest; null otherwise (a server sequence, a capture's library sequence).
|
||||
/// </summary>
|
||||
public Workspace.ProjectMenuViewModel? Project
|
||||
{
|
||||
get => _project;
|
||||
internal set
|
||||
{
|
||||
_project?.Dispose();
|
||||
Set(ref _project, value);
|
||||
OnPropertyChanged(nameof(HasProject));
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasProject => _project is not null;
|
||||
|
||||
/// <summary>The server a server sequence lives on ("Studio NAS"); null for a sequence of this PC.</summary>
|
||||
public string? ServerName => IsRemote ? Shell.Services.Server.ServerName ?? Loc.L("Server.Label.Server") : null;
|
||||
|
||||
@@ -462,7 +482,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
|
||||
/// <summary>Why the controls that change the project are disabled; null while they are not.</summary>
|
||||
public string? LockedToolTip => IsOutdated ? Loc.L("Tooltips.Editor.Outdated", ServerName)
|
||||
: IsReadOnly ? Loc.L("Tooltips.Editor.ReadOnly")
|
||||
: IsReadOnly ? Loc.L(Session.Source is WorkspaceSequenceSource ? "Errors.Workspace.ReadOnly" : "Tooltips.Editor.ReadOnly")
|
||||
: IsBusy ? Loc.L("Tooltips.Editor.Busy")
|
||||
: null;
|
||||
|
||||
@@ -706,11 +726,13 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
Session.ContentChanged -= OnContentChanged;
|
||||
Session.SaveFailed -= OnSaveFailed;
|
||||
Session.ConflictFound -= OnConflictFound;
|
||||
Session.EditSetAside -= OnEditSetAside;
|
||||
Session.Source.JobChanged -= OnJobChanged;
|
||||
Session.Source.ReadOnlyChanged -= OnReadOnlyChanged;
|
||||
Shell.Services.Sync.Changed -= OnSyncChanged;
|
||||
Shell.Services.SequenceReorganized -= OnSequenceReorganized;
|
||||
foreach (var tab in Tabs) tab.Dispose();
|
||||
_project?.Dispose();
|
||||
base.Dispose();
|
||||
await Session.DisposeAsync();
|
||||
}
|
||||
@@ -1034,17 +1056,43 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"): the
|
||||
/// dialog lists them; Keep mine overwrites the server's, Take server (the safe default, also on Esc) shows theirs as
|
||||
/// one undoable step. Saving waits until then.
|
||||
/// An edit not stored yet met a newer Chronos's settings a sync took (owner review 2, R8): it was kept aside in the
|
||||
/// project's folder, never dropped, and the toast says so; the newer settings show read-only.
|
||||
/// </summary>
|
||||
private void OnEditSetAside(string path) => _dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (_disposed) return;
|
||||
Shell.ShowToast(new Toast { Title = Loc.L("Editor.Workspace.EditSetAside"), Message = Loc.L("Editor.Workspace.EditSetAsideMessage") });
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"), or, for
|
||||
/// a workspace project, that a sync took from the library while the edit waited (owner review 2, R8): the dialog lists
|
||||
/// them; Keep mine overwrites the other side's, Take server or the library's (the safe default, also on Esc) shows theirs
|
||||
/// as one undoable step. Saving waits until then.
|
||||
/// </summary>
|
||||
private void OnConflictFound(ProjectConflictException conflict) => _dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (_disposed || Session.Conflict is null) return;
|
||||
var keepMine = Shell.Services.Dialogs.Confirm(ConflictRequest(conflict, Title, ServerName ?? string.Empty));
|
||||
var request = Session.Source is WorkspaceSequenceSource ? LibraryConflictRequest(conflict, Title) : ConflictRequest(conflict, Title, ServerName ?? string.Empty);
|
||||
var keepMine = Shell.Services.Dialogs.Confirm(request);
|
||||
if (!_disposed) Session.ResolveConflict(keepMine);
|
||||
});
|
||||
|
||||
/// <summary>The conflict prompt of a workspace project: what differs (the editor's value, then the library's) and what each choice keeps.</summary>
|
||||
internal static ConfirmRequest LibraryConflictRequest(ProjectConflictException conflict, string title) => new()
|
||||
{
|
||||
Heading = Loc.L("Editor.Workspace.Conflict.Title"),
|
||||
Message = Loc.L("Editor.Workspace.Edited.Message", title),
|
||||
Detail = string.Join(Environment.NewLine, WorkspaceText.ConflictLines(conflict.Differences, 10)),
|
||||
DetailToolTip = Loc.L("Tooltips.Editor.Workspace.Differences"),
|
||||
SafeText = Loc.L("Editor.Workspace.Conflict.TakeHome"),
|
||||
SafeToolTip = Loc.L("Tooltips.Editor.Workspace.TakeHomeUndo"),
|
||||
ActionText = Loc.L("Server.Sync.Action.KeepMine"),
|
||||
ActionToolTip = Loc.L("Tooltips.Editor.Workspace.KeepMine"),
|
||||
IsDestructive = true,
|
||||
};
|
||||
|
||||
/// <summary>The conflict prompt: what differs (the editor's value, then the server's) and what each choice replaces.</summary>
|
||||
internal static ConfirmRequest ConflictRequest(ProjectConflictException conflict, string title, string server) => new()
|
||||
{
|
||||
@@ -1134,13 +1182,16 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
if (job is { Kind: JobKind.DeepAnalyse, State: JobState.Done }) ClearVisited();
|
||||
// A render this editor followed to its end is said here, with its output, unless the Jobs screen said it first.
|
||||
if (job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render && Shell.Jobs.ClaimRenderToast(job.Id) ? job : null);
|
||||
// An analysis may have written its Auto values into the library's settings (Main): the project takes them or says so.
|
||||
if (job.State == JobState.Done && _project is { } project) _ = project.JobEndedAsync(job);
|
||||
else if (IsRemote && job.State is JobState.Failed or JobState.Cancelled) ReportServerJobEnded(job);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The frames of the server sequence changed while it is open (any thread): everything that changes the project is
|
||||
/// disabled and says why, and a toast offers to fetch the proxies again.
|
||||
/// The frames of the server sequence changed while it is open, or a workspace project's sync took a newer Chronos's
|
||||
/// settings (any thread): everything that changes the project is disabled and says why, and a toast says so (for a
|
||||
/// server sequence, offering to fetch the proxies again).
|
||||
/// </summary>
|
||||
private void OnReadOnlyChanged() => _dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
@@ -1152,6 +1203,12 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
OnPropertyChanged(nameof(RenderChoiceToolTip));
|
||||
OnRenderStateChanged();
|
||||
OnBusyChanged();
|
||||
// A workspace project a sync turned read-only (a newer Chronos saved it): said once, the controls say why too.
|
||||
if (IsReadOnly && Session.Source is WorkspaceSequenceSource)
|
||||
{
|
||||
Shell.ShowToast(new Toast { Title = Loc.L("Editor.Workspace.ReadOnly"), Message = Loc.L("Errors.Workspace.ReadOnly") });
|
||||
return;
|
||||
}
|
||||
if (!IsOutdated) return;
|
||||
var (id, title) = (Session.Content.Sequence.Id, Title);
|
||||
Shell.ShowToast(new Toast
|
||||
|
||||
Reference in new issue
Block a user