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

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:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-04 09:22:08 +01:00
1 parent efa87f68ce
commit 9b24cf74fc
370 files changed
+29237 -287

No files matched your search

@@ -0,0 +1,72 @@
using Chronos.App.Infrastructure;
using Chronos.Core.Localization;
using Chronos.Ui.Mvvm;
namespace Chronos.App.Settings;
/// <summary>
/// Settings › Workspace (owner review 2, R8): the workspace folder (shown with Open, and Change, which uses another
/// folder after a plan without moving anything; moving it with its projects comes with phase 5c), Sync automatically (a version saved is sent to its home at once, and the home's
/// new versions taken; on by default) and Kept versions (the versions taken from the home a project keeps in the
/// workspace besides its base and those not sent; 20 by default). Each choice is stored and saved at once. A value set
/// elsewhere (an imported or hand-edited settings file) is listed with the presets; one below 1 is shown as 1, as the
/// workspace applies it.
/// </summary>
public sealed class WorkspaceSettingsRows(AppSettings settings, Action save, Func<string> folder, Action open, Func<Task>? change = null) : ObservableObject
{
public static readonly int[] KeptPresets = [5, 10, 20, 50, 100, 200];
/// <summary>The workspace folder in use.</summary>
public string Folder => folder();
/// <summary>Shows the folder in Explorer.</summary>
public RelayCommand OpenCommand { get; } = new(open);
/// <summary>Uses another folder, after its plan (WorkspaceFolderChange); none where the folder cannot change.</summary>
public AsyncRelayCommand ChangeCommand { get; } = new(change ?? (() => Task.CompletedTask), () => change is not null);
public bool CanChange => change is not null;
public bool AutoSync
{
get => settings.WorkspaceAutoSync;
set
{
if (settings.WorkspaceAutoSync == value) return;
settings.WorkspaceAutoSync = value;
save();
OnPropertyChanged();
}
}
public IReadOnlyList<SettingsOption<int>> KeptChoices =>
[.. (KeptPresets.Contains(Kept) ? KeptPresets : KeptPresets.Append(Kept)).Order().Select(n => new SettingsOption<int>(n, Loc.Plural("Settings.Workspace.Versions", n)))];
public SettingsOption<int> SelectedKept
{
get => KeptChoices.First(c => c.Value == Kept);
set
{
if (value is null || value.Value == settings.WorkspaceKeptVersions) return;
settings.WorkspaceKeptVersions = value.Value;
save();
OnPropertyChanged(nameof(KeptChoices));
OnPropertyChanged();
}
}
/// <summary>The defaults of every row (Reset section); the caller saves. The folder stays (Change chooses it, after its plan).</summary>
public void Reset()
{
var defaults = new AppSettings();
settings.WorkspaceAutoSync = defaults.WorkspaceAutoSync;
settings.WorkspaceKeptVersions = defaults.WorkspaceKeptVersions;
Refresh();
}
/// <summary>Labels in the current language, values as the settings have them now.</summary>
internal void Refresh() => OnAllPropertiesChanged();
/// <summary>The value the workspace applies: at least one version.</summary>
private int Kept => Math.Max(1, settings.WorkspaceKeptVersions);
}