feat: owner review 2 phase 5c: originals, local render, clean-up and the workspace settings (#18)
CI / Build and test (push) Successful in 9m26s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 8s
Release / Build, test and publish (push) Successful in 14m31s
CI / PostgreSQL 16 integration (push) Successful in 9m53s
CI / PostgreSQL 17 integration (push) Successful in 9m22s
CI / Docker image (push) Successful in 44s
Release / Server image (push) Successful in 1m36s

Originals in the workspace, local render and send home with provenance, the workspace clean-up, size limit and trash, moving the workspace folder, and the complete Settings › Workspace page (owner review 2, R8, phase 5c). One adversarial review round (35 findings, 32 fixed), a copy-cancel race fixed, 184 strings in all 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 #18.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-04 20:03:52 +01:00
1 parent 81c303f484
commit db389a54f2
364 files changed
+17417 -595

No files matched your search

+39 -38
View File
@@ -87,7 +87,9 @@ public sealed class SettingsViewModel : SectionViewModel
"Settings.Rendering.Hardware", "Settings.Rendering.Encoders"]),
new(SettingsPage.Formats, ["Settings.Formats.Title", "Settings.Formats.Column.Tier", "Settings.Formats.Install"]),
new(SettingsPage.Storage, ["Settings.Storage.Folder", "Settings.Storage.Thumbnails", "Settings.Storage.Limit"]),
new(SettingsPage.Workspace, ["Settings.Workspace.Folder", "Settings.Workspace.Sync", "Settings.Workspace.AfterSave", "Settings.Workspace.Kept"]),
new(SettingsPage.Workspace, ["Settings.Workspace.Folder", "Settings.Workspace.Move", "Settings.Workspace.SizeLimit", "Settings.Workspace.DefaultMedia",
"Settings.Workspace.Sync", "Settings.Workspace.AfterSave", "Settings.Workspace.VersionOnRender", "Settings.Workspace.SaveBeforeRender",
"Settings.Workspace.Kept", "Settings.Workspace.CleanAfter", "Settings.Workspace.OpenProject", "Settings.Workspace.Trash"]),
new(SettingsPage.Server, ["Settings.Server.Default", "Settings.Server.RenderNode", "Settings.Server.Certificates"]),
new(SettingsPage.Updates, ["Settings.General.CheckOnStart", "Settings.Updates.Latest", "About.Update.Check", "About.Releases"]),
new(SettingsPage.Advanced, ["Settings.Advanced.DataFolder", "Settings.Advanced.Logs", "Settings.Advanced.LogLevel", "Settings.Advanced.KeepLogs",
@@ -169,7 +171,9 @@ public sealed class SettingsViewModel : SectionViewModel
Logs = new LogSettingsRows(_s, Save);
// ---- Workspace ----
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => AppEnvironment.Shown(Shell.Services.Workspace.Root), OpenWorkspaceFolder, ChangeWorkspaceFolderAsync);
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => AppEnvironment.Shown(Shell.Services.Workspace.Root), OpenWorkspaceFolder, ChangeWorkspaceFolderAsync,
WorkspaceSettingsServices.For(Shell.Services.Workspace, Shell.Services.Dialogs, (title, message, isError) => Shell.Notify(title, message, isError: isError),
MoveWorkspaceFolderAsync, () => WorkspaceFolderChange.ResumeUnfinishedAsync(Shell)));
// ---- Storage ----
// A capture shows its folders under a sample data folder; what is typed is taken back to the folder it stands for.
@@ -259,6 +263,7 @@ public sealed class SettingsViewModel : SectionViewModel
if (value == SettingsPage.Rendering && Encoders.Count == 0 && !_isDetecting) _ = DetectEncodersAsync();
if (value == SettingsPage.Formats && Formats.Count == 0 && !_isDetectingFormats) _ = DetectFormatsAsync(refresh: false);
if (value == SettingsPage.Storage) _ = UpdateCacheUsageAsync();
if (value == SettingsPage.Workspace) _ = WorkspaceRows.MeasureAsync();
if (value == SettingsPage.Advanced) LoadBackups();
}
}
@@ -726,7 +731,10 @@ public sealed class SettingsViewModel : SectionViewModel
// ---------------- Workspace ----------------
/// <summary>Settings › Workspace (owner review 2, R8): the folder, Sync automatically and Kept versions.</summary>
/// <summary>
/// Settings › Workspace (owner review 2, R8; phase 5c): the folder (Change, Move…, what it takes), Size limit, Default
/// media, Sync automatically, Version on render, Kept versions, Clean after, Open project and Trash.
/// </summary>
public WorkspaceSettingsRows WorkspaceRows { get; }
/// <summary>Shows the workspace folder in Explorer (made, with its manifest, when the workspace was never used).</summary>
@@ -747,8 +755,24 @@ public sealed class SettingsViewModel : SectionViewModel
{
await WorkspaceFolderChange.ChooseAsync(Shell);
WorkspaceRows.Refresh();
await WorkspaceRows.MeasureAsync();
}
/// <summary>The workspace folder moved with its projects, after its plan: the move job takes them, and Edit waits for it.</summary>
private async Task MoveWorkspaceFolderAsync()
{
await WorkspaceFolderChange.MoveAsync(Shell);
WorkspaceRows.Refresh();
}
/// <summary>A move of the workspace folder ended (any thread): the page shows the folder in use, what it takes, and Move… and Change… again.</summary>
private void OnWorkspaceMoveEnded() => System.Windows.Application.Current?.Dispatcher.BeginInvoke(() =>
{
WorkspaceRows.Refresh();
CommandManager.InvalidateRequerySuggested();
if (_page == SettingsPage.Workspace) _ = WorkspaceRows.MeasureAsync();
});
// ---------------- Server ----------------
public EditableField DefaultServer { get; }
@@ -859,6 +883,7 @@ public sealed class SettingsViewModel : SectionViewModel
}
LoadCertificates();
Shell.Services.Server.PropertyChanged += OnServerChanged;
Shell.Services.Workspace.MoveEnded += OnWorkspaceMoveEnded;
if (System.Windows.Application.Current is { } app) _interfacePriority = new InterfacePriority(app, () => _s.BackgroundPriority);
_ = LoadArchiveAsync();
switch (Shell.Services.StagedRestore)
@@ -892,6 +917,7 @@ public sealed class SettingsViewModel : SectionViewModel
{
Loc.CultureChanged -= OnCultureChanged;
Shell.Services.Server.PropertyChanged -= OnServerChanged;
Shell.Services.Workspace.MoveEnded -= OnWorkspaceMoveEnded;
_selfTest?.Cancel();
_interfacePriority?.Dispose();
base.Dispose();
@@ -965,6 +991,8 @@ public sealed class SettingsViewModel : SectionViewModel
UpdateArchiveFree();
ArchiveReload = LoadArchiveAsync();
if (_page == SettingsPage.Advanced) LoadBackups();
// What the workspace takes and holds in its trash may have changed elsewhere (a local copy removed in Edit).
if (_page == SettingsPage.Workspace) _ = WorkspaceRows.MeasureAsync();
}
/// <summary>
@@ -1207,7 +1235,8 @@ public sealed class SettingsViewModel : SectionViewModel
[
JobKind.Render, JobKind.Import, JobKind.Download, JobKind.UploadCommit, JobKind.Scan, JobKind.Rebuild, JobKind.Verify, JobKind.LightAnalyse,
JobKind.DeepAnalyse, JobKind.Thumbs, JobKind.Proxies, JobKind.Maintenance, JobKind.Duplicates, JobKind.Orphans, JobKind.Adopt, JobKind.Move,
JobKind.Backup, JobKind.Cleanup, JobKind.EmptyTrash, JobKind.Convert, JobKind.WorkspaceCopy,
JobKind.Backup, JobKind.Cleanup, JobKind.EmptyTrash, JobKind.Convert, JobKind.WorkspaceCopy, JobKind.WorkspaceRender, JobKind.WorkspaceSend,
JobKind.WorkspaceMove,
];
/// <summary>Stores <paramref name="level"/> for <paramref name="kind"/>, keeping only the levels that differ from the defaults.</summary>
@@ -1632,23 +1661,8 @@ public sealed class SettingsViewModel : SectionViewModel
IsDestructive = true,
});
if (!confirmed) return;
var defaults = new AppSettings
{
LastArchivePath = _s.LastArchivePath,
ServerUrl = _s.ServerUrl,
ServerUsername = _s.ServerUsername,
ProtectedToken = _s.ProtectedToken,
TrustedCertificates = _s.TrustedCertificates,
RecentServers = _s.RecentServers,
Window = _s.Window,
RailCollapsed = _s.RailCollapsed,
LastEditedSequence = _s.LastEditedSequence,
FirstRunCompleted = _s.FirstRunCompleted,
JobsClearedAt = _s.JobsClearedAt,
// The workspace holds this PC's work: its folder stays where it is (moving it is its own operation).
WorkspaceFolder = _s.WorkspaceFolder,
WorkspaceRecent = _s.WorkspaceRecent,
};
// The workspace holds this PC's work: its folder stays where it is (moving it is its own operation).
var defaults = _s.ResetKeepingState();
// Start with Windows lives in the registry, not in the settings file: its default is off.
Startup.SetEnabled(false);
ApplyAll(defaults);
@@ -1690,12 +1704,8 @@ public sealed class SettingsViewModel : SectionViewModel
{
var folder = Shell.Services.Dialogs.PickFolder(Loc.L("Settings.Export.Title"));
if (folder is null) return;
var copy = _s.Clone();
// Secrets and machine-bound values stay on this PC.
copy.ProtectedToken = null;
copy.Window = null;
copy.WorkspaceFolder = null;
copy.WorkspaceRecent = [];
var copy = _s.ForExport();
var path = Path.Combine(folder, $"Chronos settings {DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}.json");
await Task.Run(() => AtomicFile.WriteAllText(path, copy.ToJson()));
Shell.Notify(Loc.L("Settings.Export.Done"), Path.GetFileName(path), Loc.L("Library.Export.Show"), Loc.L("Tooltips.Library.ShowExport"), () => ShellActions.Reveal(path));
@@ -1720,18 +1730,9 @@ public sealed class SettingsViewModel : SectionViewModel
Shell.Notify(Loc.L("Errors.Settings.Import"), isError: true);
return;
}
// Everything but the session, the window and its rail, the sequence edited last (another PC's ids mean nothing here)
// and the first-run flag.
imported.ProtectedToken = _s.ProtectedToken;
imported.ServerUrl = _s.ServerUrl;
imported.Window = _s.Window;
imported.RailCollapsed = _s.RailCollapsed;
imported.LastEditedSequence = _s.LastEditedSequence;
imported.FirstRunCompleted = _s.FirstRunCompleted;
// The workspace is this PC's: its folder and the projects opened last stay.
imported.WorkspaceFolder = _s.WorkspaceFolder;
imported.WorkspaceRecent = _s.WorkspaceRecent;
ApplyAll(imported);
// Everything but the session, the window and its rail, the sequence edited last (another PC's ids mean nothing here),
// the first-run flag and the workspace, which is this PC's (its folder, the projects opened last and when).
ApplyAll(_s.KeepLocalIn(imported));
// Settings of a PC never rewrite the shared archive.json: the imported templates and sizes are the defaults of new
// archives, and the rows show the own settings of the archive at the (possibly imported) archive folder.
_retarget = RetargetArchiveAsync();