Files
Chronos/src/Chronos.App/Editor/EditorTab.cs
T
Alby96andClaude Opus 5.5 f2b58522b9
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
The owner renamed the product and moved the repository to the self-hosted
Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control,
and asked for Actions and a first automatic release with the server package
and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md).

- Chronos everywhere: a byte-exact rename of contents and paths, then a
  per-language review of the forms the old name's ending had dictated.
- Gitea instead of GitHub: the update check, licence, issue and support
  links read ChronosReleasesUrl; the update check takes the highest stable
  version, offers a pre-release build its final release and reports a
  repository it cannot see as a failed check. EULA, security policy and
  Gitea issue forms live at the repository root.
- Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release,
  nightly image and performance gates in the .NET SDK container with git
  checkout and the system SQLite. The release cross-compiles the Windows
  programs, checks their icon, version and DPI manifest, packs installers
  and zips, publishes the Gitea release and pushes the server image
  (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows
  runner (WINDOWS_RUNNER).
- New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the
  docker-exec script, which Gitea's service containers do not allow; the
  throw-away server runs without durability) and pe-check.
- Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR,
  3 on the shared runner; the weekly performance gates keep theirs).

BREAKING CHANGE: programs, settings, data folders, file types, environment
variables and the Docker image use the new name; nothing is migrated from
Titano, which never had a release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
2026-10-23 12:45:18 +02:00

156 lines
6.0 KiB
C#

using System.Windows.Input;
using Chronos.Core.Advice;
using Chronos.Core.Localization;
using Chronos.Ui.Mvvm;
namespace Chronos.App.Editor;
/// <summary>
/// One step of the Edit path (BRIEF §12.3, owner review 1 R7): its measuring tool below the filmstrip and its column
/// on the right, with "Optimise section" and "Reset" for a section the advisor decides. <see cref="Refresh"/> runs after
/// every project change; the editor sets where the step stands (<see cref="SetStep"/>).
/// </summary>
public abstract class EditorTab : LocalizedViewModel
{
private StepState _state = new(StepStatus.Todo, string.Empty);
private bool _isVisited;
protected EditorTab(EditorViewModel editor, string key, AdvisorSection? section)
{
Editor = editor;
Key = key;
Section = section;
OptimiseCommand = new RelayCommand(() =>
{
if (Section is { } s) Editor.Optimise(s);
}, () => CanOptimise && !Editor.IsLocked);
ResetCommand = new RelayCommand(() =>
{
if (Section is { } s) Editor.Session.ResetSection(s);
}, () => CanReset && !Editor.IsLocked);
}
public EditorViewModel Editor { get; }
/// <summary>"Frames", "Exposure"… (resource key suffix and <see cref="EditPath"/> step).</summary>
public string Key { get; }
/// <summary>The advisor section of the step; null for a step the advisor does not decide (Analysis).</summary>
public AdvisorSection? Section { get; }
public string Header => Loc.L("Editor.Tab." + Key);
public string ToolTip => Loc.L("Tooltips.Editor.Tab." + Key);
/// <summary>Settings rows of the right column (empty for tabs with their own panel).</summary>
public IReadOnlyList<SettingRow> Rows { get; protected init; } = [];
/// <summary>The advisor has heavier decisions for this section (stacking and the analysis have none).</summary>
public virtual bool CanOptimise => Section is not null;
public virtual bool CanReset => Section is not null;
/// <summary>What Optimise section does, or why it cannot run now.</summary>
public string OptimiseToolTip => !CanOptimise ? Loc.L("Tooltips.Editor.OptimiseNone") : Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.OptimiseSection");
public string ResetToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.ResetSection");
public ICommand OptimiseCommand { get; }
public ICommand ResetCommand { get; }
// ---- The step ----
/// <summary>Position on the path, from 1.</summary>
public int Number { get; internal set; }
/// <summary>The path's last step (its connector line is not drawn).</summary>
public bool IsLast { get; internal set; }
/// <summary>Alt+1…Alt+9; empty from the tenth step on.</summary>
public string Shortcut => Number is >= 1 and <= 9 ? Loc.L("Editor.Step.Shortcut", Number) : string.Empty;
/// <summary>The user opened the step since the sequence opened (or since the analysis it waited for ended).</summary>
public bool IsVisited
{
get => _isVisited;
internal set => Set(ref _isVisited, value);
}
public StepStatus Status => _state.Status;
/// <summary>"Auto", "3 flagged frames", "Not rendered" (three words at most).</summary>
public string StateText => _state.Text;
/// <summary>A sentence on the state, when there is more to say than <see cref="StateText"/>.</summary>
public string? StateDetail => _state.Detail;
/// <summary>"Exposure · what the step is for · its state · Alt+3": the name first, so a name cut in the step bar can be read whole.</summary>
public string StepToolTip => Shortcut.Length > 0
? Loc.L("Tooltips.Editor.Step", Header, ToolTip, StateDetail ?? StateText, Number)
: string.Join(Loc.Separator, Header, ToolTip, StateDetail ?? StateText);
/// <summary>The measuring area takes more of the height than the preview (the findings, the preset cards).</summary>
public virtual bool PrefersTallMeasure => false;
/// <summary>Where the step stands now; raises only what changed.</summary>
public void SetStep(StepState state)
{
ArgumentNullException.ThrowIfNull(state);
if (state == _state) return;
var old = _state;
_state = state;
if (old.Status != state.Status) OnPropertyChanged(nameof(Status));
if (old.Text != state.Text) OnPropertyChanged(nameof(StateText));
if (old.Detail != state.Detail) OnPropertyChanged(nameof(StateDetail));
OnPropertyChanged(nameof(StepToolTip));
}
/// <summary>Re-reads the project (any change).</summary>
public virtual void Refresh()
{
foreach (var row in Rows) row.Refresh();
}
/// <summary>The sequence was read again: new analyses (charts, findings).</summary>
public virtual void OnContentChanged() => Refresh();
/// <summary>The preview's corrections were prepared for the current settings (target curves).</summary>
public virtual void OnCorrectionsChanged()
{
}
/// <summary>The export plan of the project changed (durations, sizes).</summary>
public virtual void OnPlanChanged()
{
}
/// <summary>The frame on screen changed (playheads, the frame table, keyframe commands).</summary>
public virtual void OnCurrentFrameChanged()
{
}
/// <summary>A job of this sequence started or ended: commands and their tooltips follow.</summary>
public virtual void OnBusyChanged()
{
OnPropertyChanged(nameof(OptimiseToolTip));
OnPropertyChanged(nameof(ResetToolTip));
}
/// <summary>Raises the enabled state of the tab's asynchronous commands (the others follow the command manager).</summary>
public virtual void RefreshCommands()
{
}
/// <summary>Whether this sequence can send its renders to the server changed (<see cref="EditorViewModel.SyncGate"/>).</summary>
public virtual void OnSyncGateChanged()
{
}
public override void Dispose()
{
foreach (var row in Rows) row.Dispose();
base.Dispose();
}
}