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
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:
1 parent
81c303f484
commit
db389a54f2
364 files changed
+17417
-595
No files matched your search
@@ -303,7 +303,7 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
else if (before != JobState.Failed && !IsSelected) _unseenFailures.Add(job.Id);
|
||||
var notice = JobNotices.For(before, job);
|
||||
// A flush can take the end before the editor that follows the render has seen it: the editor says it, with its output.
|
||||
if (notice == JobNotice.Done && job.Kind == JobKind.Render
|
||||
if (notice == JobNotice.Done && job.Kind is JobKind.Render or JobKind.WorkspaceRender or JobKind.WorkspaceSend
|
||||
&& (Shell.Sequence.Editor?.FollowsRender(job.Id) == true || !ClaimRenderToast(job.Id))) return;
|
||||
_endings.Add(notice, job);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,10 @@
|
||||
<MenuItem Header="{l:Loc Editor.Project.Delete}" Command="{Binding Project.DeleteCommand}" ToolTip="{Binding Project.DeleteToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<Separator />
|
||||
<MenuItem Header="{l:Loc Editor.Project.CopyOriginals}" Command="{Binding Project.CopyOriginalsCommand}" ToolTip="{Binding Project.CopyOriginalsToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<MenuItem Header="{l:Loc Editor.Project.ProxiesOnly}" Command="{Binding Project.ProxiesOnlyCommand}" ToolTip="{Binding Project.ProxiesOnlyToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<MenuItem Header="{l:Loc Editor.Project.RemoveCopy}" Command="{Binding Project.RemoveCopyCommand}" ToolTip="{Binding Project.RemoveCopyToolTip}" />
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
|
||||
@@ -608,12 +608,20 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
ImageDecoder decoder, Sequence row)
|
||||
{
|
||||
var request = TakeRequest(row.Id);
|
||||
var entry = request switch
|
||||
WorkspaceEntry? entry;
|
||||
if (request is { ProjectId: { } id }) entry = await workspace.FindAsync(id);
|
||||
else if (request is { Main: true }) entry = (await workspace.ProjectsOfAsync(row.Id)).FirstOrDefault(p => p.IsMain);
|
||||
else
|
||||
{
|
||||
{ ProjectId: { } id } => await workspace.FindAsync(id),
|
||||
{ Main: true } => (await workspace.ProjectsOfAsync(row.Id)).FirstOrDefault(p => p.IsMain),
|
||||
_ => await workspace.LastUsedAsync(row.Id),
|
||||
};
|
||||
var (cancelled, chosen) = await PolicyEntryAsync(services, workspace, row.Id, row.DisplayTitle, _ => true);
|
||||
if (cancelled)
|
||||
{
|
||||
_afterOpen = null;
|
||||
Shell.KeepSequence(OpenSequenceId);
|
||||
return null;
|
||||
}
|
||||
entry = chosen;
|
||||
}
|
||||
// This Chronos cannot read its working state (damaged, or a newer Chronos's): nothing is checked out over it.
|
||||
if (entry is { IsReadable: false } unreadable) throw WorkspaceHost.Unreadable(unreadable);
|
||||
// No project of the sequence here opens, and its Main here is such a copy (never among its projects): said at once,
|
||||
@@ -634,10 +642,12 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
if (entry is { HasMedia: true })
|
||||
{
|
||||
workspace.Remember(row.Id, entry.ProjectId);
|
||||
workspace.RecordOpened(entry.ProjectId);
|
||||
return (new WorkspaceSequenceSource(workspace.Sync, entry.ProjectId, db, decoder, services.Engine), row.DisplayTitle);
|
||||
}
|
||||
var projectId = entry?.ProjectId ?? request?.ProjectId;
|
||||
string? newName = null;
|
||||
var media = DefaultMedia(services);
|
||||
if (entry is null && projectId is { } wanted && (await workspace.HomeProjectsAsync(row.Id)).All(p => p.Id != wanted))
|
||||
{
|
||||
// A project file of a project this home does not have (another PC's workspace): its sequence's Main takes it.
|
||||
@@ -653,12 +663,12 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
Shell.KeepSequence(OpenSequenceId);
|
||||
return null;
|
||||
}
|
||||
(projectId, newName) = (choice.ProjectId, choice.NewName);
|
||||
(projectId, newName, media) = (choice.ProjectId, choice.NewName, choice.Media);
|
||||
}
|
||||
WorkspaceCheckout checkout;
|
||||
try
|
||||
{
|
||||
checkout = await workspace.CheckoutAsync(row.Id, projectId, newName);
|
||||
checkout = await workspace.CheckoutAsync(row.Id, projectId, newName, media);
|
||||
}
|
||||
catch (WorkspaceException ex) when (ex.FolderRefused)
|
||||
{
|
||||
@@ -710,12 +720,20 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
private async Task<ServerOpen?> OpenServerWorkspaceAsync(AppServices services, WorkspaceHost workspace, ChronosDatabase db, ImageDecoder decoder, Guid remoteId)
|
||||
{
|
||||
var request = _requested is { } asked && asked.SequenceId == remoteId ? asked : null;
|
||||
var entry = request switch
|
||||
WorkspaceEntry? entry;
|
||||
if (request is { ProjectId: { } id }) entry = await workspace.FindAsync(id) is { IsServerHome: true } found && found.SequenceId == remoteId ? found : null;
|
||||
else if (request is { Main: true }) entry = (await workspace.ProjectsOfAsync(remoteId)).FirstOrDefault(p => p is { IsMain: true, IsServerHome: true });
|
||||
else
|
||||
{
|
||||
{ ProjectId: { } id } => await workspace.FindAsync(id) is { IsServerHome: true } found && found.SequenceId == remoteId ? found : null,
|
||||
{ Main: true } => (await workspace.ProjectsOfAsync(remoteId)).FirstOrDefault(p => p is { IsMain: true, IsServerHome: true }),
|
||||
_ => await workspace.LastUsedAsync(remoteId) is { IsServerHome: true } last ? last : null,
|
||||
};
|
||||
var (cancelled, chosen) = await PolicyEntryAsync(services, workspace, remoteId, null, p => p.IsServerHome);
|
||||
if (cancelled)
|
||||
{
|
||||
_afterOpen = null;
|
||||
Shell.KeepSequence(OpenSequenceId);
|
||||
return new ServerOpen(null);
|
||||
}
|
||||
entry = chosen;
|
||||
}
|
||||
var sync = services.Sync;
|
||||
if (entry is { IsReadable: false } unreadable)
|
||||
{
|
||||
@@ -726,6 +744,7 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
{
|
||||
TakeRequest(remoteId);
|
||||
workspace.Remember(remoteId, entry.ProjectId);
|
||||
workspace.RecordOpened(entry.ProjectId);
|
||||
// Its analyses and renders travel on a connection of the signed-in session, when that is the project's server:
|
||||
// made again whenever the sign-in changes, so a project opened signed out renders once signed in.
|
||||
var server = entry.Home.Server;
|
||||
@@ -755,6 +774,7 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
}
|
||||
var projectId = entry?.ProjectId ?? request?.ProjectId;
|
||||
string? newName = null;
|
||||
var media = DefaultMedia(services);
|
||||
if (entry is null && projectId is { } wanted && (await workspace.HomeProjectsAsync(home)).All(p => p.Id != wanted))
|
||||
{
|
||||
// A project the server does not have (deleted there, or another server's): the sequence's Main opens instead.
|
||||
@@ -770,12 +790,12 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
Shell.KeepSequence(OpenSequenceId);
|
||||
return new ServerOpen(null);
|
||||
}
|
||||
(projectId, newName) = (choice.ProjectId, choice.NewName);
|
||||
(projectId, newName, media) = (choice.ProjectId, choice.NewName, choice.Media);
|
||||
}
|
||||
WorkspaceCheckout checkout;
|
||||
try
|
||||
{
|
||||
checkout = await workspace.CheckoutAsync(home, projectId, newName);
|
||||
checkout = await workspace.CheckoutAsync(home, projectId, newName, media);
|
||||
}
|
||||
catch (WorkspaceException ex) when (ex.FolderRefused)
|
||||
{
|
||||
@@ -811,25 +831,23 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
|
||||
/// <summary>
|
||||
/// "Open in workspace" for a sequence of <paramref name="home"/> (this PC's archive, or a server): its projects, the
|
||||
/// media, and for this PC's archive what their copy writes and the room the workspace's drive has; null when closed
|
||||
/// without a choice. <paramref name="unreadableMain"/>, the copy of Main here this Chronos cannot read, is listed
|
||||
/// media (Settings › Workspace › Media chosen first), what their copy writes and the room the workspace's drive has; null
|
||||
/// when closed without a choice. <paramref name="unreadableMain"/>, the copy of Main here this Chronos cannot read, is listed
|
||||
/// disabled, why in its tooltip.
|
||||
/// </summary>
|
||||
private async Task<OpenChoice?> AskProjectAsync(WorkspaceHost workspace, BundleHome home, string title, WorkspaceEntry? unreadableMain)
|
||||
{
|
||||
var projects = await workspace.HomeProjectsAsync(home);
|
||||
WorkspaceCopyFacts? copy = null;
|
||||
if (home.IsArchive)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
copy = await workspace.CopyFactsAsync(home.SequenceId);
|
||||
}
|
||||
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or DatabaseException or UnauthorizedAccessException)
|
||||
{
|
||||
// Only shown: the copy measures again before it writes.
|
||||
Log.Info("workspace", $"The copy of sequence {home.SequenceId} could not be measured: {ex.Message}");
|
||||
}
|
||||
copy = await workspace.CopyFactsAsync(home);
|
||||
}
|
||||
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or DatabaseException
|
||||
or UnauthorizedAccessException or ChronosApiException or System.Net.Http.HttpRequestException)
|
||||
{
|
||||
// Only shown: the copy measures again before it writes.
|
||||
Log.Info("workspace", $"The copy of sequence {home.SequenceId} could not be measured: {ex.Message}");
|
||||
}
|
||||
var unreadable = unreadableMain is { } main
|
||||
? new Dictionary<Guid, string>
|
||||
@@ -837,7 +855,8 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
[main.ProjectId] = Loc.L(main.Newer ? "Tooltips.Editor.Workspace.State.NewerCopy" : "Tooltips.Editor.Workspace.State.DamagedCopy"),
|
||||
}
|
||||
: null;
|
||||
var dialog = new OpenInWorkspaceDialogViewModel(title, projects, d => CloseDialog(d), copy: copy, unreadable: unreadable, server: !home.IsArchive);
|
||||
var dialog = new OpenInWorkspaceDialogViewModel(title, projects, d => CloseDialog(d), copy: copy, unreadable: unreadable, server: !home.IsArchive,
|
||||
defaultMedia: DefaultMedia(Shell.Services));
|
||||
// The picker or the open sequence shows behind the dialog meanwhile, not the progress bar.
|
||||
IsLoading = false;
|
||||
OpenDialog(dialog);
|
||||
@@ -851,6 +870,36 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The media a checkout copies unless "Open in workspace" chose: Settings › Workspace › Media.</summary>
|
||||
private static string DefaultMedia(AppServices services) => services.Settings.EffectiveDefaultMedia;
|
||||
|
||||
/// <summary>
|
||||
/// The project of the sequence Edit opens when none was asked for (phase 5c, Settings › Workspace › Open project): the
|
||||
/// one opened last, Main, or the one chosen in "Open which project?" when the workspace holds several (Cancelled: closed
|
||||
/// without a choice). Only projects <paramref name="fits"/> takes count; none here: null.
|
||||
/// </summary>
|
||||
private async Task<(bool Cancelled, WorkspaceEntry? Entry)> PolicyEntryAsync(AppServices services, WorkspaceHost workspace, Guid sequenceId, string? title,
|
||||
Func<WorkspaceEntry, bool> fits)
|
||||
{
|
||||
var last = await workspace.LastUsedAsync(sequenceId) is { } used && fits(used) ? used : null;
|
||||
var policy = services.Settings.EffectiveOpenPolicy;
|
||||
if (policy == WorkspaceOpenPolicy.LastUsed) return (false, last);
|
||||
var here = (await workspace.ProjectsOfAsync(sequenceId)).Where(p => fits(p) && p.IsReadable).ToList();
|
||||
if (policy == WorkspaceOpenPolicy.Main) return (false, here.FirstOrDefault(p => p.IsMain) ?? last);
|
||||
if (here.Count < 2) return (false, last ?? here.FirstOrDefault());
|
||||
var dialog = new OpenProjectDialogViewModel(title ?? here[0].SequenceTitle, here, last?.ProjectId, d => CloseDialog(d));
|
||||
IsLoading = false;
|
||||
OpenDialog(dialog);
|
||||
try
|
||||
{
|
||||
return await dialog.Choice is { } chosen ? (false, chosen) : (true, null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsLoading = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The project the next open of <paramref name="sequenceId"/> takes, taken once; null when none was asked for.</summary>
|
||||
private ProjectRequest? TakeRequest(Guid sequenceId)
|
||||
{
|
||||
@@ -1071,6 +1120,8 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
if (section.Shell.Services.Database is not { } db || await db.Sequences.GetAsync(sequenceId) is not { } row) return;
|
||||
if (section.Shell.Library.Items.FirstOrDefault(i => i.Id == row.Id) is { } item) item.Update(row);
|
||||
}
|
||||
|
||||
public void ShowJobs() => section.Shell.Navigate(SectionKey.Jobs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
</StackPanel>
|
||||
<CheckBox Content="{l:Loc Server.KeepProxies}" IsChecked="{Binding KeepProxiesOffline}" ToolTip="{l:Loc Tooltips.Server.KeepProxies}" Margin="0,0,22,0" />
|
||||
<CheckBox Content="{l:Loc Server.AutoSync}" IsChecked="{Binding SyncSettingsAutomatically}" ToolTip="{l:Loc Tooltips.Server.AutoSync}" Margin="0,0,22,0" />
|
||||
<CheckBox Content="{l:Loc Server.PauseMetered}" IsChecked="{Binding PauseUploadsOnMetered}" ToolTip="{l:Loc Tooltips.Server.PauseMetered}" Margin="0,0,22,0" />
|
||||
<CheckBox Content="{l:Loc Server.PauseMeteredTransfers}" IsChecked="{Binding PauseUploadsOnMetered}" ToolTip="{l:Loc Tooltips.Server.PauseMeteredTransfers}" Margin="0,0,22,0" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -520,32 +520,84 @@
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ================= Workspace (owner review 2, R8) ================= -->
|
||||
<!-- ================= Workspace (owner review 2, R8; phase 5c) ================= -->
|
||||
<StackPanel Style="{StaticResource Page}" Visibility="{Binding Page, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=Workspace}">
|
||||
<!-- The folder is shown, opened and changed here (another folder after its plan; nothing is moved: moving it with its projects comes with phase 5c). -->
|
||||
<!-- The folder is shown, opened, changed (another folder after its plan; nothing is moved) and moved with its projects (after its plan,
|
||||
by the workspace-move job); what it takes of its drive under it. -->
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.Folder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="360" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Path}" IsReadOnly="True" Text="{Binding WorkspaceRows.Folder, Mode=OneWay}" ToolTip="{l:Loc Tooltips.Settings.WorkspaceFolder}"
|
||||
AutomationProperties.Name="{l:Loc Settings.Workspace.Folder}" />
|
||||
<Button Grid.Column="1" Content="{l:Loc Common.Open}" Command="{Binding WorkspaceRows.OpenCommand}" ToolTip="{l:Loc Tooltips.Settings.OpenWorkspace}"
|
||||
Margin="10,0,0,0" />
|
||||
<Button Grid.Column="2" Content="{l:Loc Settings.Workspace.Change}" Command="{Binding WorkspaceRows.ChangeCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.ChangeWorkspace}" Margin="8,0,0,0"
|
||||
Visibility="{Binding WorkspaceRows.CanChange, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="360" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Path}" IsReadOnly="True" Text="{Binding WorkspaceRows.Folder, Mode=OneWay}" ToolTip="{l:Loc Tooltips.Settings.Workspace.Folder}"
|
||||
AutomationProperties.Name="{l:Loc Settings.Workspace.Folder}" />
|
||||
<Button Grid.Column="1" Content="{l:Loc Common.Open}" Command="{Binding WorkspaceRows.OpenCommand}" ToolTip="{l:Loc Tooltips.Settings.OpenWorkspace}"
|
||||
Margin="10,0,0,0" />
|
||||
<Button Grid.Column="2" Content="{l:Loc Settings.Workspace.Change}" Command="{Binding WorkspaceRows.ChangeCommand}"
|
||||
ToolTip="{Binding WorkspaceRows.ChangeToolTip}" ToolTipService.ShowOnDisabled="True" Margin="8,0,0,0"
|
||||
Visibility="{Binding WorkspaceRows.CanChange, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Grid.Column="3" Content="{l:Loc Settings.Workspace.Move}" Command="{Binding WorkspaceRows.MoveCommand}"
|
||||
ToolTip="{Binding WorkspaceRows.MoveToolTip}" ToolTipService.ShowOnDisabled="True" Margin="8,0,0,0"
|
||||
Visibility="{Binding WorkspaceRows.CanMove, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Grid.Column="4" Content="{l:Loc Settings.Workspace.ResumeMove}" Command="{Binding WorkspaceRows.ResumeMoveCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.ResumeMove}" Margin="8,0,0,0"
|
||||
Visibility="{Binding WorkspaceRows.CanResumeMove, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding WorkspaceRows.UsageText}" ToolTip="{l:Loc Tooltips.Settings.Workspace.Used}" Margin="0,6,0,0"
|
||||
Visibility="{Binding WorkspaceRows.HasUsageText, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.SizeLimit}">
|
||||
<ComboBox Width="170" HorizontalAlignment="Left" ItemsSource="{Binding WorkspaceRows.SizeLimitChoices}" SelectedItem="{Binding WorkspaceRows.SelectedSizeLimit}"
|
||||
DisplayMemberPath="Label" ToolTip="{Binding WorkspaceRows.SizeLimitToolTip}" AutomationProperties.Name="{l:Loc Settings.Workspace.SizeLimit}" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.DefaultMedia}">
|
||||
<WrapPanel Margin="0,4,0,0">
|
||||
<RadioButton GroupName="WorkspaceMedia" Content="{l:Loc Settings.Workspace.Proxies}" IsChecked="{Binding WorkspaceRows.IsDefaultProxies}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.Proxies}" Margin="0,0,20,0" />
|
||||
<RadioButton GroupName="WorkspaceMedia" Content="{l:Loc Settings.Workspace.Originals}" IsChecked="{Binding WorkspaceRows.IsDefaultOriginals}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.Originals}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.Sync}">
|
||||
<CheckBox Content="{l:Loc Settings.Workspace.AfterSave}" IsChecked="{Binding WorkspaceRows.AutoSync}" ToolTip="{l:Loc Tooltips.Settings.WorkspaceSync}" Margin="0,4,0,0" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.VersionOnRender}">
|
||||
<CheckBox Content="{l:Loc Settings.Workspace.SaveBeforeRender}" IsChecked="{Binding WorkspaceRows.VersionOnRender}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.VersionOnRender}" Margin="0,4,0,0" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.Kept}">
|
||||
<ComboBox Width="170" HorizontalAlignment="Left" ItemsSource="{Binding WorkspaceRows.KeptChoices}" SelectedItem="{Binding WorkspaceRows.SelectedKept}"
|
||||
DisplayMemberPath="Label" ToolTip="{l:Loc Tooltips.Settings.KeptVersions}" AutomationProperties.Name="{l:Loc Settings.Workspace.Kept}" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.CleanAfter}">
|
||||
<ComboBox Width="170" HorizontalAlignment="Left" ItemsSource="{Binding WorkspaceRows.CleanAfterChoices}" SelectedItem="{Binding WorkspaceRows.SelectedCleanAfter}"
|
||||
DisplayMemberPath="Label" ToolTip="{Binding WorkspaceRows.CleanAfterToolTip}" AutomationProperties.Name="{l:Loc Settings.Workspace.CleanAfter}" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.OpenProject}">
|
||||
<WrapPanel Margin="0,4,0,0">
|
||||
<RadioButton GroupName="WorkspaceOpen" Content="{l:Loc Settings.Workspace.LastUsed}" IsChecked="{Binding WorkspaceRows.IsOpenLastUsed}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.LastUsed}" Margin="0,0,20,0" />
|
||||
<RadioButton GroupName="WorkspaceOpen" Content="{l:Loc Settings.Workspace.Main}" IsChecked="{Binding WorkspaceRows.IsOpenMain}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.Main}" Margin="0,0,20,0" />
|
||||
<RadioButton GroupName="WorkspaceOpen" Content="{l:Loc Settings.Workspace.Ask}" IsChecked="{Binding WorkspaceRows.IsOpenAsk}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Workspace.Ask}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
<!-- What removed copies and the clean-up set aside; only Empty… erases it, after its plan and the typed number of its entries. -->
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Workspace.Trash}">
|
||||
<WrapPanel>
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding WorkspaceRows.TrashText}" ToolTip="{l:Loc Tooltips.Settings.Workspace.Trash}" Margin="0,0,12,0"
|
||||
VerticalAlignment="Center" />
|
||||
<Button Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Workspace.EmptyTrash}" Command="{Binding WorkspaceRows.EmptyTrashCommand}"
|
||||
ToolTip="{Binding WorkspaceRows.EmptyTrashToolTip}" ToolTipService.ShowOnDisabled="True" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ================= Server ================= -->
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user