Files
Chronos/src/Chronos.App/Editor/AnalysisTab.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.6 KiB
C#

using Chronos.Core.Analysis;
using Chronos.Core.Analysis.Deep;
using Chronos.Core.Localization;
using Chronos.Ui.Controls;
namespace Chronos.App.Editor;
/// <summary>A finding of the analyses on the Analysis step: what it says, the frame it starts at and the step that deals with it.</summary>
public sealed class AnalysisFinding
{
private readonly EditorViewModel _editor;
internal AnalysisFinding(EditorViewModel editor, FindingItem item, string? stepKey)
{
_editor = editor;
Kind = item.Kind;
Text = item.Text;
Frame = item.Frame;
StepKey = stepKey;
}
public StatusKind Kind { get; }
public string Text { get; }
/// <summary>The first frame it concerns; null for a finding about the whole sequence.</summary>
public int? Frame { get; }
/// <summary>The <see cref="EditPath"/> step that deals with it; null when no step does.</summary>
public string? StepKey { get; }
/// <summary>The step that deals with it (looked up when shown: the steps exist once the editor does).</summary>
public EditorTab? Step => StepKey is null ? null : _editor.Tabs.FirstOrDefault(t => t.Key == StepKey);
/// <summary>"Open Exposure, the step that deals with this · Alt+3".</summary>
public string? GoToToolTip => Step is { } step ? Loc.L("Tooltips.Editor.Analysis.GoTo", step.Header, step.Number) : null;
/// <summary>The sentence (what UI Automation reads for a row the list has not realised).</summary>
public override string ToString() => Text;
}
/// <summary>
/// The first step of the Edit path (owner review 1, R7): every finding of the analyses with the step that deals with it,
/// what the deep analysis measured (light, flicker, exposure steps received, shake, flagged frames) and where each later
/// step stands. Analyse runs from here as from the header.
/// </summary>
public sealed class AnalysisTab : EditorTab
{
private IReadOnlyList<AnalysisFinding> _findings = [];
private AnalysisFinding? _selected;
public AnalysisTab(EditorViewModel editor)
: base(editor, EditPath.Analysis, null)
{
Rows =
[
new InfoRow("Editor.Analysis.Light", "Tooltips.Editor.Analysis.Light", () => Measured(d => LightText(d.Sky.Light))),
// The finding's and the deflicker reason's measure (the deviation from the smooth course), rounded as they are.
new InfoRow("Editor.Analysis.Flicker", "Tooltips.Editor.Analysis.Flicker",
() => Measured(d => Loc.L("Editor.Value.Ev", double.Round(d.Flicker.AmplitudeEv, 3, MidpointRounding.AwayFromZero).ToString("0.###", Loc.Culture)))),
new InfoRow("Editor.Analysis.Steps", "Tooltips.Editor.Analysis.Steps",
() => Measured(d => Loc.L("Editor.Analysis.StepsValue", d.Exposure.ReceivedSteps, d.Exposure.MetadataSteps))),
new InfoRow("Editor.Analysis.Shake", "Tooltips.Editor.Analysis.Shake", ShakeValue),
new InfoRow("Editor.Analysis.Flagged", "Tooltips.Editor.Analysis.Flagged",
() => Measured(d => Loc.Plural("Editor.Value.Frames", d.Issues.Excludable().Length))),
];
Load();
Refresh();
}
/// <summary>The findings, the most severe first.</summary>
public IReadOnlyList<AnalysisFinding> Findings
{
get => _findings;
private set
{
if (Set(ref _findings, value)) OnPropertyChanged(nameof(HasFindings));
}
}
public bool HasFindings => _findings.Count > 0;
/// <summary>The finding chosen in the list: the preview seeks its first frame.</summary>
public AnalysisFinding? SelectedFinding
{
get => _selected;
set
{
if (!Set(ref _selected, value) || value?.Frame is not { } frame) return;
Editor.CurrentIndex = frame;
}
}
/// <summary>Instead of an empty list: the analysis running, not run yet, or nothing found.</summary>
public string EmptyText => StateText.Length > 0 && Status == StepStatus.Running ? StateText
: Editor.Session.Content.Deep is null ? Loc.L("Editor.Chart.NotAnalysed")
: Loc.L("Editor.Frames.NoWarnings");
/// <summary>The glyph beside the step's state in its panel.</summary>
public StatusKind StateKind => Status switch
{
StepStatus.Done => StatusKind.Analysed,
StepStatus.Running => StatusKind.Analysing,
StepStatus.Attention => StatusKind.Warning,
_ => StatusKind.NotAnalysed,
};
/// <summary>The path's other steps, each with where it stands.</summary>
public IEnumerable<EditorTab> PathSteps => Editor.Tabs.Where(t => !ReferenceEquals(t, this));
public override bool PrefersTallMeasure => true;
public override void OnContentChanged()
{
Load();
base.OnContentChanged();
}
/// <summary>The step's state changed: the panel's glyph and the empty list's sentence follow.</summary>
internal void OnStepChanged()
{
OnPropertyChanged(nameof(StateKind));
OnPropertyChanged(nameof(EmptyText));
}
private void Load()
{
Findings = [.. Editor.Session.Advice.Findings.OrderByDescending(f => f.Severity)
.Select(f => new AnalysisFinding(Editor, FramesTab.ToItem(f), EditPath.StepOf(f.Key)))];
_selected = null;
OnPropertyChanged(nameof(SelectedFinding));
OnPropertyChanged(nameof(EmptyText));
}
/// <summary>The camera's wobble, or n/a when too few frame pairs could be measured (the Motion step asks for it then).</summary>
private (string? Value, string? NotApplicableReason) ShakeValue()
{
if (Editor.Session.Content.Deep is { Shake: { MeasuredFraction: < ShakeSummary.MinMeasuredFraction } shake })
return (null, Loc.L("Advisor.Missing.Shake", (100 * shake.MeasuredFraction).ToString("0", Loc.Culture)));
return Measured(d => Loc.L("Editor.Value.Pixels", d.Shake.RmsPx.ToString("0.#", Loc.Culture)));
}
/// <summary>A value of the deep analysis, or n/a saying it needs the analysis.</summary>
private (string? Value, string? NotApplicableReason) Measured(Func<DeepAnalysisReport, string> value) =>
Editor.Session.Content.Deep is { } deep ? (value(deep), null) : (null, Loc.L("Tooltips.Editor.NotApplicable.NeedsAnalysis"));
private static string LightText(DayNight light) => Loc.L(light switch
{
DayNight.Day => "Editor.Analysis.Light.Day",
DayNight.Night => "Editor.Analysis.Light.Night",
DayNight.DayToNight => "Editor.Analysis.Light.DayToNight",
DayNight.NightToDay => "Editor.Analysis.Light.NightToDay",
_ => "Editor.Analysis.Light.Unknown",
});
}