feat: owner review 2 phase 5b: the server as a project home (#17)
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s

A Chronos Server keeps its sequences' projects, as a PC's archive does: Main and named projects with versions under /api/v1/sequences/{id}/projects, the projects capability and the projectChanged event. The desktop opens a server's sequences in the workspace (proxies downloaded, hash-checked, resumable) with Save version, Sync, conflicts, History, Restore and the project actions against the server. Renders can be of a project version. The admin panel lists a sequence's projects and versions. 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 #17.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-04 14:58:11 +01:00
1 parent 255e149087
commit 81c303f484
325 files changed
+11477 -516

No files matched your search

@@ -26,6 +26,7 @@ namespace Chronos.App.Sections;
public sealed class SequencePickerViewModel : LocalizedViewModel
{
private readonly SequenceViewModel _section;
private readonly Dispatcher _dispatcher;
private readonly DispatcherTimer _searchDelay;
private readonly RemoteMerge _merge = new();
private readonly AsyncRelayCommand _open;
@@ -46,8 +47,10 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
public SequencePickerViewModel(SequenceViewModel section)
{
_section = section;
_dispatcher = Dispatcher.CurrentDispatcher;
_searchDelay = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(250) };
_searchDelay.Tick += (_, _) => _ = ReloadAsync();
section.Shell.Services.Workspace.HomeChanged += OnHomeChanged;
_open = new AsyncRelayCommand(() => (Selected ?? Items.FirstOrDefault()) is { } item ? _section.PickAsync(item) : Task.CompletedTask, () => Items.Count > 0);
OpenItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? _section.PickAsync(item) : Task.CompletedTask);
OpenProjectCommand = new AsyncRelayCommand((p, _) => (p as WorkspaceProjectItem ?? SelectedProject) is { } item ? _section.PickProjectAsync(item) : Task.CompletedTask);
@@ -172,11 +175,34 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
{
_searchDelay.Stop();
_pager?.Cancel();
_section.Shell.Services.Workspace.HomeChanged -= OnHomeChanged;
// The projects' states still being read stop asking.
_generation++;
base.Dispose();
}
/// <summary>
/// A project's home told it changed there (any thread; phase 5b: a server's <c>projectChanged</c>), or that changes may
/// have been missed: the listed projects it concerns read their state again (Server newer, Deleted).
/// </summary>
private void OnHomeChanged(WorkspaceHomeChange change) => _dispatcher.BeginInvoke(async () =>
{
var generation = _generation;
foreach (var item in WorkspaceItems.Where(i => change.ProjectId is { } id ? i.ProjectId == id
: i.Entry.IsServerHome && string.Equals(i.Entry.Home.Server, change.Server, StringComparison.OrdinalIgnoreCase)).ToList())
{
if (generation != _generation) return;
try
{
item.Status = await Shell.Services.Workspace.StatusAsync(item.ProjectId);
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
Log.Info("workspace", $"The state of project {item.ProjectId} could not be read: {ex.Message}");
}
}
});
private async Task OpenFromSearchAsync()
{
await SettleAsync();
@@ -271,8 +297,13 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
{
foreach (var entry in (await services.Workspace.ListAsync()).OrderByDescending(e => e.Saved))
{
var row = await db.Sequences.GetAsync(entry.SequenceId);
var item = new WorkspaceProjectItem(entry, row is null ? null : new SequenceItem(row, services.Thumbnails));
var row = entry.IsServerHome ? null : await db.Sequences.GetAsync(entry.SequenceId);
// A server's sequence as the Library lists it (phase 5b), with the server's thumbnail; none while signed out.
var remote = row is null ? Shell.Library.RemoteSequences.FirstOrDefault(s => s.Id == entry.SequenceId) : null;
var sequence = row is not null ? new SequenceItem(row, services.Thumbnails)
: remote is not null ? new SequenceItem(remote, Shell.Library.RemoteThumbnails)
: null;
var item = new WorkspaceProjectItem(entry, sequence);
if (text.Length > 0 && !item.Name.Contains(text, StringComparison.CurrentCultureIgnoreCase)
&& !item.SequenceTitle.Contains(text, StringComparison.CurrentCultureIgnoreCase))
continue;
+5 -5
View File
@@ -123,11 +123,11 @@
<Separator />
<MenuItem Header="{l:Loc Editor.Project.Open}" Command="{Binding Project.OpenProjectCommand}" ToolTip="{l:Loc Tooltips.Editor.Project.Open}" />
<MenuItem Header="{l:Loc Editor.Project.New}" Command="{Binding Project.NewProjectCommand}" ToolTip="{l:Loc Tooltips.Editor.Project.New}" />
<MenuItem Header="{l:Loc Editor.Project.Rename}" Command="{Binding Project.RenameCommand}" ToolTip="{l:Loc Tooltips.Editor.Project.Rename}" />
<MenuItem Header="{l:Loc Editor.Project.Rename}" Command="{Binding Project.RenameCommand}" ToolTip="{Binding Project.RenameToolTip}" />
<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.RemoveCopy}" Command="{Binding Project.RemoveCopyCommand}" ToolTip="{l:Loc Tooltips.Editor.Project.RemoveCopy}" />
<MenuItem Header="{l:Loc Editor.Project.RemoveCopy}" Command="{Binding Project.RemoveCopyCommand}" ToolTip="{Binding Project.RemoveCopyToolTip}" />
</ContextMenu>
</Button.ContextMenu>
</Button>
@@ -164,13 +164,13 @@
</StackPanel>
</Grid>
<!-- Owner review 2, R8: the library's frames moved past the workspace's; Update media copies them again (positions follow their photos). -->
<!-- Owner review 2, R8: the home's frames (the library's or the server's) moved past the workspace's; Update media copies them again (positions follow their photos). -->
<Border Grid.Row="1" Style="{StaticResource Border.Card}" Padding="12,6" Margin="0,0,0,8"
Visibility="{Binding Project.HasMediaUpdate, Converter={StaticResource BoolToVisibility}, FallbackValue=Collapsed}">
<DockPanel>
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Compact}" Content="{l:Loc Editor.Workspace.UpdateMedia}" Command="{Binding Project.UpdateMediaCommand}"
ToolTip="{l:Loc Tooltips.Editor.Workspace.UpdateMedia}" ToolTipService.ShowOnDisabled="True" />
<ui:StatusGlyph Kind="Warning" Text="{Binding Project.MediaUpdateText}" ToolTip="{l:Loc Tooltips.Editor.Workspace.MediaChanged}" VerticalAlignment="Center"
ToolTip="{Binding Project.UpdateMediaToolTip}" ToolTipService.ShowOnDisabled="True" />
<ui:StatusGlyph Kind="Warning" Text="{Binding Project.MediaUpdateText}" ToolTip="{Binding Project.MediaChangedToolTip}" VerticalAlignment="Center"
infra:LiveRegion.Text="{Binding Project.MediaUpdateText}" AutomationProperties.LiveSetting="Polite" />
</DockPanel>
</Border>
+152 -24
View File
@@ -14,8 +14,10 @@ using Chronos.Core.Imaging;
using Chronos.Core.Imaging.Decoders;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Core.Project;
using Chronos.Data;
using Chronos.Data.Jobs;
using Chronos.Data.Projects;
using Chronos.Data.Sync;
using Chronos.Protocol.Client;
using Chronos.Ui.Mvvm;
@@ -27,9 +29,11 @@ namespace Chronos.App.Sections;
/// Server screen or its own picker chose into an <see cref="EditorViewModel"/>. A sequence of this PC's archive opens as a
/// project of the workspace (owner review 2, R8: editing never happens inside the library): the project of that sequence
/// opened last here; else, after "Open in workspace" asked which project (Main, another of its home, or a new one) and
/// which media, the project is checked out and its media copied by a job, and it opens once they are here. A server
/// sequence opens with this PC's proxies (the workspace takes server homes in phase 5b), and a capture (sample data
/// without an engine) opens the library as before. The next sequence is read first; only then does the open one close,
/// which media, the project is checked out and its media copied by a job, and it opens once they are here. A sequence of
/// a server that keeps projects opens the same way as a project whose home is that server (phase 5b: its media downloaded
/// into the workspace; a project already there opens from it, the server reachable or not); one of an older server opens
/// with this PC's proxies, and a capture (sample data without an engine) opens the library as before. The next sequence
/// is read first; only then does the open one close,
/// after its last edit is stored. Without a sequence, or after Change sequence, it shows the picker (the editor stays
/// open behind it until another sequence opens). A server sequence whose proxies are missing or out of date fetches them
/// first and opens once they are here, the open sequence staying open meanwhile; a workspace copy is followed the same
@@ -540,9 +544,10 @@ public sealed class SequenceViewModel : SectionViewModel
/// <summary>
/// Where <paramref name="sequenceId"/> lives: this PC's index (opened as a workspace project,
/// <see cref="OpenWorkspaceAsync"/>; in a capture, the library itself), else a sequence of the signed-in server whose
/// proxies this PC keeps (Server screen, "Open with proxies"), edited through the server (BRIEF §14.5), or only shown
/// when the account may not change it. Null when it cannot open yet: its proxies are being fetched
/// <see cref="OpenWorkspaceAsync"/>; in a capture, the library itself), else a server's sequence: a workspace project
/// whose home is that server (<see cref="OpenServerWorkspaceAsync"/>), or, for a server that keeps no projects, one
/// whose proxies this PC keeps (Server screen, "Open with proxies"), edited through the server (BRIEF §14.5), or only
/// shown when the account may not change it. Null when it cannot open yet: its proxies are being fetched
/// (<see cref="FetchProxiesAsync"/>), its workspace copy runs, or the user closed "Open in workspace".
/// </summary>
private async Task<(ISequenceSource Source, string Title)?> OpenSourceAsync(AppServices services, Guid sequenceId)
@@ -557,14 +562,19 @@ public sealed class SequenceViewModel : SectionViewModel
local.HeroChanged += OnHeroChanged;
return (local, row.DisplayTitle);
}
// A workspace project whose sequence left the index (its trash emptied, its folder gone): not a server's sequence to
// fetch; its local copy can only be removed (the picker's Remove local copy).
// A workspace project of this PC's archive whose sequence left the index (its trash emptied, its folder gone): not a
// server's sequence to fetch; its local copy can only be removed (the picker's Remove local copy).
if (_requested is { ProjectId: { } projectId } asked && asked.SequenceId == sequenceId && services.Workspace.IsEnabled
&& await services.Workspace.FindAsync(projectId) is not null)
&& await services.Workspace.FindAsync(projectId) is { IsServerHome: false })
{
_requested = null;
throw new InvalidOperationException(Loc.L("Errors.Workspace.SequenceGone"));
}
// A server sequence (owner review 2, R8, phase 5b): a project of it in the workspace opens from there, the server
// reachable or not; one of a server that keeps projects is checked out (asked which); an older server's opens with
// proxies as before.
if (services.Workspace.IsEnabled && await OpenServerWorkspaceAsync(services, services.Workspace, db, decoder, sequenceId) is { } project)
return project.Opened;
var sync = services.Sync;
if (sync.Server is not { } server || sync.Service is not { } service || sync.ConnectEditor() is not { } api)
throw new InvalidOperationException(Loc.L("Editor.Error.SignedOut"));
@@ -610,7 +620,7 @@ public sealed class SequenceViewModel : SectionViewModel
// with Remove local copy for a damaged one, when nothing else could be chosen (Main asked for, or the home has no
// other project); otherwise "Open in workspace" lists Main as it is, disabled, and offers the others.
WorkspaceEntry? unreadableMain = null;
if (entry is null && request?.ProjectId is null && await UnreadableMainAsync(workspace, row.Id) is { } main)
if (entry is null && request?.ProjectId is null && await UnreadableMainAsync(workspace, WorkspaceHost.ArchiveHome(row.Id)) is { } main)
{
if (request is { Main: true } || (await workspace.HomeProjectsAsync(row.Id)).All(p => p.IsMain))
{
@@ -664,10 +674,10 @@ public sealed class SequenceViewModel : SectionViewModel
return null;
}
/// <summary>The workspace's copy of the sequence's Main when this Chronos cannot read it (damaged, or a newer Chronos's); null otherwise.</summary>
private static async Task<WorkspaceEntry?> UnreadableMainAsync(WorkspaceHost workspace, Guid sequenceId)
/// <summary>The workspace's copy of the Main of <paramref name="home"/>'s sequence when this Chronos cannot read it (damaged, or a newer Chronos's); null otherwise.</summary>
private static async Task<WorkspaceEntry?> UnreadableMainAsync(WorkspaceHost workspace, BundleHome home)
{
if ((await workspace.HomeProjectsAsync(sequenceId)).FirstOrDefault(p => p.IsMain) is not { } main) return null;
if ((await workspace.HomeProjectsAsync(home)).FirstOrDefault(p => p.IsMain) is not { } main) return null;
return await workspace.FindAsync(main.Id) is { IsReadable: false } copy ? copy : null;
}
@@ -689,22 +699,137 @@ public sealed class SequenceViewModel : SectionViewModel
}
/// <summary>
/// "Open in workspace": the projects of the sequence's home, the media, 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.
/// A sequence of a server opens as a project of the workspace whose home is that server (phase 5b): the project asked
/// for, else the one of the sequence opened last here. One the workspace holds the media of opens from there, whether
/// this PC can reach the server or not (its sync, analyses and renders wait for it). Otherwise, signed in to a server
/// that keeps projects, the project is checked out, after "Open in workspace" asked which (when the sequence has none
/// here), and its media downloaded by a job; it opens once they are here. A copy this Chronos cannot read is refused as
/// for this PC's archive. Null when the server keeps no projects, or this PC is not signed in to it: the sequence then
/// opens with proxies as before (or says to connect).
/// </summary>
private async Task<OpenChoice?> AskProjectAsync(WorkspaceHost workspace, Sequence row, WorkspaceEntry? unreadableMain = null)
private async Task<ServerOpen?> OpenServerWorkspaceAsync(AppServices services, WorkspaceHost workspace, ChronosDatabase db, ImageDecoder decoder, Guid remoteId)
{
var projects = await workspace.HomeProjectsAsync(row.Id);
WorkspaceCopyFacts? copy = null;
var request = _requested is { } asked && asked.SequenceId == remoteId ? asked : null;
var entry = request switch
{
{ 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 sync = services.Sync;
if (entry is { IsReadable: false } unreadable)
{
TakeRequest(remoteId);
throw WorkspaceHost.Unreadable(unreadable);
}
if (entry is { HasMedia: true })
{
TakeRequest(remoteId);
workspace.Remember(remoteId, 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;
var editorHome = new WorkspaceServerHome(() => string.Equals(sync.Server, server, StringComparison.OrdinalIgnoreCase) ? sync.ConnectEditor() : null,
() => sync.Session);
return new ServerOpen((new WorkspaceSequenceSource(workspace.Sync, entry.ProjectId, db, decoder, services.Engine, editorHome), entry.SequenceTitle));
}
// An account that may not edit checks nothing out: it is shown with proxies, read-only, as on an older server.
if (!sync.Policy.CanEdit || sync.ServerHome(remoteId) is not { } home) return null;
TakeRequest(remoteId);
try
{
copy = await workspace.CopyFactsAsync(row.Id);
var reached = workspace.Reachable(home);
var title = (await Task.Run(() => reached.SequenceAsync(CancellationToken.None))).Sequence.Title ?? entry?.SequenceTitle ?? string.Empty;
// No project of the sequence here opens and its Main here cannot be read: refused, or listed disabled, as for this PC's archive.
WorkspaceEntry? unreadableMain = null;
if (entry is null && request?.ProjectId is null && await UnreadableMainAsync(workspace, home) is { } main)
{
if (request is { Main: true } || (await workspace.HomeProjectsAsync(home)).All(p => p.IsMain))
{
RefuseUnreadable(main);
_afterOpen = null;
Shell.KeepSequence(OpenSequenceId);
return new ServerOpen(null);
}
unreadableMain = main;
}
var projectId = entry?.ProjectId ?? request?.ProjectId;
string? newName = null;
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.
Log.Info("workspace", $"Project {wanted} is not a project of server sequence {remoteId}; its Main opens instead");
projectId = null;
if (_afterOpen is { } pending && pending.Request.SequenceId == remoteId) _afterOpen = (ProjectRequest.MainOf(remoteId), pending.Action);
}
else if (entry is null && projectId is null && request is not { Main: true })
{
if (await AskProjectAsync(workspace, home, title, unreadableMain) is not { } choice)
{
_afterOpen = null;
Shell.KeepSequence(OpenSequenceId);
return new ServerOpen(null);
}
(projectId, newName) = (choice.ProjectId, choice.NewName);
}
WorkspaceCheckout checkout;
try
{
checkout = await workspace.CheckoutAsync(home, projectId, newName);
}
catch (WorkspaceException ex) when (ex.FolderRefused)
{
// Nothing was written: the way on is another workspace folder, offered from the refusal.
Log.Info("workspace", $"Server sequence {remoteId} not checked out: {ex.Message}");
Shell.Notify(Loc.L("Editor.Workspace.OpenFailed"), ex.Message, Loc.L("Editor.Workspace.ChooseFolder"), Loc.L("Tooltips.Editor.Workspace.ChooseFolder"),
() => _ = WorkspaceFolderChange.ChooseAsync(Shell), isError: true);
_afterOpen = null;
Shell.KeepSequence(OpenSequenceId);
return new ServerOpen(null);
}
await FollowCopyAsync(remoteId, title, checkout.Project.Id, checkout.Copy);
return new ServerOpen(null);
}
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or DatabaseException or UnauthorizedAccessException)
catch (ProjectException ex) when (ex.Reason == ProjectError.SequenceNotFound)
{
// Only shown: the copy measures again before it writes.
Log.Info("workspace", $"The copy of sequence {row.Id} could not be measured: {ex.Message}");
throw new InvalidOperationException(Loc.L("Editor.Error.Missing"), ex);
}
catch (ProjectException ex) when (ex.Reason == ProjectError.SequenceEmpty)
{
throw new InvalidOperationException(Loc.L("Editor.Error.Empty"), ex);
}
catch (HomeUnavailableException ex)
{
// Said of the server, not of this PC's library.
throw new WorkspaceException(WorkspaceText.ForHome("Errors.Workspace.Offline", server: true), ex);
}
}
/// <summary>"Open in workspace" for a sequence of this PC's archive; null when closed without a choice.</summary>
private Task<OpenChoice?> AskProjectAsync(WorkspaceHost workspace, Sequence row, WorkspaceEntry? unreadableMain = null) =>
AskProjectAsync(workspace, WorkspaceHost.ArchiveHome(row.Id), row.DisplayTitle, unreadableMain);
/// <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
/// 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
{
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}");
}
}
var unreadable = unreadableMain is { } main
? new Dictionary<Guid, string>
@@ -712,7 +837,7 @@ 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(row.DisplayTitle, projects, d => CloseDialog(d), copy: copy, unreadable: unreadable);
var dialog = new OpenInWorkspaceDialogViewModel(title, projects, d => CloseDialog(d), copy: copy, unreadable: unreadable, server: !home.IsArchive);
// The picker or the open sequence shows behind the dialog meanwhile, not the progress bar.
IsLoading = false;
OpenDialog(dialog);
@@ -888,6 +1013,9 @@ public sealed class SequenceViewModel : SectionViewModel
}
}
/// <summary>What the open of a server sequence as a workspace project came to: its source, or null while it waits (its copy runs, the dialog was closed).</summary>
private sealed record ServerOpen((ISequenceSource Source, string Title)? Opened);
/// <summary>
/// A job an open waits on, with its engine subscription: a server sequence's proxy download, or the workspace copy of a
/// project's media (<see cref="ProjectId"/>: the project that opens when it is done).
+4 -4
View File
@@ -214,7 +214,7 @@
ToolTipService.ShowOnDisabled="True" Height="30" Margin="10,0,0,0" />
</Grid>
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The list always
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The actions column is at least wide enough for a row's three actions (Open with proxies, Download originals and an older server's disabled Open in workspace) on one line. The list always
keeps its 10 px scroll-bar gutter and the header the same on its right, so the columns line up with or without scrolling. -->
<Border Grid.Row="1" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,1" Padding="14,8,24,8">
<Grid>
@@ -223,7 +223,7 @@
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="1.4*" MinWidth="280" />
<ColumnDefinition Width="1.4*" MinWidth="400" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Sequence}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Local}" Margin="10,0,0,0" />
@@ -247,7 +247,7 @@
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="1.4*" MinWidth="280" />
<ColumnDefinition Width="1.4*" MinWidth="400" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Title}" ToolTip="{Binding Title}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding LocalText}" ToolTip="{Binding LocalText}" Margin="10,0,0,0" />
@@ -260,7 +260,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type srv:SyncRowAction}">
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}"
AutomationProperties.Name="{Binding AccessibleName}" FontSize="12" Margin="0,2,6,2" />
ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{Binding AccessibleName}" FontSize="12" Margin="0,2,6,2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
+13 -12
View File
@@ -169,12 +169,13 @@ public sealed class SettingsViewModel : SectionViewModel
Logs = new LogSettingsRows(_s, Save);
// ---- Workspace ----
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => Shell.Services.Workspace.Root, OpenWorkspaceFolder, ChangeWorkspaceFolderAsync);
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => AppEnvironment.Shown(Shell.Services.Workspace.Root), OpenWorkspaceFolder, ChangeWorkspaceFolderAsync);
// ---- Storage ----
CacheFolder = new EditableField(CacheStore.Folder(shell.Services.Environment, _s), v => ArchiveLocations.Validate(v), v =>
// A capture shows its folders under a sample data folder; what is typed is taken back to the folder it stands for.
CacheFolder = new EditableField(AppEnvironment.Shown(CacheStore.Folder(shell.Services.Environment, _s)), v => ArchiveLocations.Validate(AppEnvironment.Actual(v)), v =>
{
var full = Path.GetFullPath(v);
var full = Path.GetFullPath(AppEnvironment.Actual(v));
_s.CacheFolder = full.Equals(Shell.Services.Environment.CacheDirectory, StringComparison.OrdinalIgnoreCase) ? null : full;
Save();
_ = UpdateCacheUsageAsync();
@@ -222,8 +223,8 @@ public sealed class SettingsViewModel : SectionViewModel
RedetectCommand = new AsyncRelayCommand(DetectEncodersAsync, () => !_isDetecting && !_isTesting);
SelfTestCommand = new AsyncRelayCommand(SelfTestAsync, () => !_isDetecting && !_isTesting && Encoders.Any(e => e.Row.CanSelfTest));
ClearCacheCommand = new AsyncRelayCommand(ClearCacheAsync);
OpenDataFolderCommand = new RelayCommand(() => ShellActions.Reveal(DataFolder));
OpenLogsCommand = new RelayCommand(() => ShellActions.Reveal(LogsFolder));
OpenDataFolderCommand = new RelayCommand(() => ShellActions.Reveal(Shell.Services.Environment.DataDirectory));
OpenLogsCommand = new RelayCommand(() => ShellActions.Reveal(Shell.Services.Environment.LogDirectory));
ExportDiagnosticsCommand = new AsyncRelayCommand(ExportDiagnosticsAsync);
BackupDatabaseCommand = new AsyncRelayCommand(BackupDatabaseAsync, () => Shell.Services.Database is not null);
RedetectFormatsCommand = new AsyncRelayCommand(() => DetectFormatsAsync(refresh: true), () => !_isDetectingFormats);
@@ -785,8 +786,8 @@ public sealed class SettingsViewModel : SectionViewModel
// ---------------- Advanced ----------------
public string DataFolder => Shell.Services.Environment.DataDirectory;
public string LogsFolder => Shell.Services.Environment.LogDirectory;
public string DataFolder => AppEnvironment.Shown(Shell.Services.Environment.DataDirectory);
public string LogsFolder => AppEnvironment.Shown(Shell.Services.Environment.LogDirectory);
public string PortableText => Loc.L(Shell.Services.Environment.IsPortable ? "Settings.Advanced.PortableOn" : "Settings.Advanced.PortableOff");
/// <summary>Level, retention, size limits and rotation of the log files, and the diagnostics bundle's share of each.</summary>
@@ -877,10 +878,10 @@ public sealed class SettingsViewModel : SectionViewModel
var environment = Shell.Services.Environment;
if (environment.SyncedFolder is not null)
Shell.Notify(Loc.L("Settings.Advanced.DataInOneDrive"), Formatting.LeftToRight(DataFolder), Loc.L("Common.Open"),
Loc.L("Tooltips.Settings.DataInOneDrive"), () => ShellActions.Reveal(DataFolder), isError: true);
Loc.L("Tooltips.Settings.DataInOneDrive"), () => ShellActions.Reveal(Shell.Services.Environment.DataDirectory), isError: true);
else if (environment.PortableSyncRoot is not null)
Shell.Notify(Loc.L("Settings.Advanced.DataOutsideOneDrive"), Formatting.LeftToRight(DataFolder), Loc.L("Common.Open"),
Loc.L("Tooltips.Settings.OpenDataFolder"), () => ShellActions.Reveal(DataFolder));
Loc.L("Tooltips.Settings.OpenDataFolder"), () => ShellActions.Reveal(Shell.Services.Environment.DataDirectory));
if (environment.EarlierPortableData is { } earlier)
Shell.Notify(Loc.L("Settings.Advanced.EarlierData"), Formatting.LeftToRight(earlier), Loc.L("Common.Open"),
Loc.L("Tooltips.Settings.EarlierData"), () => ShellActions.Reveal(earlier));
@@ -1338,7 +1339,7 @@ public sealed class SettingsViewModel : SectionViewModel
{
Heading = Loc.L("Settings.Storage.ClearTitle"),
Message = Loc.L("Settings.Storage.ClearMessage"),
Detail = Formatting.LeftToRight(folder),
Detail = Formatting.LeftToRight(AppEnvironment.Shown(folder)),
DetailToolTip = Loc.L("Tooltips.Settings.CacheFolder"),
SafeText = Loc.L("Settings.Storage.Keep"),
SafeToolTip = Loc.L("Tooltips.Settings.KeepCache"),
@@ -1553,7 +1554,7 @@ public sealed class SettingsViewModel : SectionViewModel
_s.CacheFolder = null;
_s.ThumbnailMemoryItems = defaults.ThumbnailMemoryItems;
_s.CacheLimitGb = defaults.CacheLimitGb;
CacheFolder.Load(CacheStore.Folder(Shell.Services.Environment, _s));
CacheFolder.Load(AppEnvironment.Shown(CacheStore.Folder(Shell.Services.Environment, _s)));
ThumbnailMemory.Load(_s.ThumbnailMemoryItems.ToString(CultureInfo.CurrentCulture));
CacheLimit.Load(_s.CacheLimitGb.ToString(CultureInfo.CurrentCulture));
if (Shell.Services.Thumbnails is { } thumbs) thumbs.Capacity = _s.ThumbnailMemoryItems;
@@ -1670,7 +1671,7 @@ public sealed class SettingsViewModel : SectionViewModel
LoadImportFields();
LoadAnalysisFields();
Parallelism.Load(EffectiveParallelism.ToString(CultureInfo.CurrentCulture));
CacheFolder.Load(CacheStore.Folder(Shell.Services.Environment, _s));
CacheFolder.Load(AppEnvironment.Shown(CacheStore.Folder(Shell.Services.Environment, _s)));
ThumbnailMemory.Load(_s.ThumbnailMemoryItems.ToString(CultureInfo.CurrentCulture));
CacheLimit.Load(_s.CacheLimitGb.ToString(CultureInfo.CurrentCulture));
if (Shell.Services.Thumbnails is { } thumbs) thumbs.Capacity = _s.ThumbnailMemoryItems;