fix(editor): optimise lines point the reading way; failed saves and jobs are errors
EditorText.Change picks Editor.Optimise.ChangeRtl ('{0}: {1} ← {2}',
invariant) in right-to-left languages, as Import.Session.TimeRtl and
Jobs.Target.RenderRtl do. A failed save and a failed server job raise error
toasts; a cancelled job stays a notice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
4 files changed
+31
-3
No files matched your search
@@ -159,6 +159,7 @@
|
|||||||
<data name="Editor.Motion.Smoothing" xml:space="preserve"><value>Path smoothing</value></data>
|
<data name="Editor.Motion.Smoothing" xml:space="preserve"><value>Path smoothing</value></data>
|
||||||
<data name="Editor.Motion.Stabilize" xml:space="preserve"><value>Stabilise</value></data>
|
<data name="Editor.Motion.Stabilize" xml:space="preserve"><value>Stabilise</value></data>
|
||||||
<data name="Editor.Optimise.Change" xml:space="preserve"><value>{0}: {1} → {2}</value><comment>invariant</comment></data>
|
<data name="Editor.Optimise.Change" xml:space="preserve"><value>{0}: {1} → {2}</value><comment>invariant</comment></data>
|
||||||
|
<data name="Editor.Optimise.ChangeRtl" xml:space="preserve"><value>{0}: {1} ← {2}</value><comment>invariant; right-to-left languages: the arrow points from the old value to the new one</comment></data>
|
||||||
<data name="Editor.Optimise.Done.one" xml:space="preserve"><value>{0} setting changed</value></data>
|
<data name="Editor.Optimise.Done.one" xml:space="preserve"><value>{0} setting changed</value></data>
|
||||||
<data name="Editor.Optimise.Done.other" xml:space="preserve"><value>{0} settings changed</value></data>
|
<data name="Editor.Optimise.Done.other" xml:space="preserve"><value>{0} settings changed</value></data>
|
||||||
<data name="Editor.Optimise.Nothing" xml:space="preserve"><value>Nothing to change</value></data>
|
<data name="Editor.Optimise.Nothing" xml:space="preserve"><value>Nothing to change</value></data>
|
||||||
|
|||||||
@@ -196,6 +196,14 @@ public static class EditorText
|
|||||||
_ => parameter,
|
_ => parameter,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Deflicker window: 21 frames → 41 frames", one line of the Optimise toast. Bidi never mirrors an arrow, so a
|
||||||
|
/// right-to-left language reads it from its own resource, the arrow pointing from the old value to the new one.
|
||||||
|
/// </summary>
|
||||||
|
public static string Change(SettingChange change) =>
|
||||||
|
Loc.L(Loc.IsRightToLeft ? "Editor.Optimise.ChangeRtl" : "Editor.Optimise.Change", ParameterLabel(change.Parameter), Value(change.Parameter, change.Before),
|
||||||
|
Value(change.Parameter, change.After));
|
||||||
|
|
||||||
/// <summary>A value of an advisor parameter as its control shows it (the "what changed" toast of Optimise).</summary>
|
/// <summary>A value of an advisor parameter as its control shows it (the "what changed" toast of Optimise).</summary>
|
||||||
public static string Value(string parameter, object? value) => (parameter, value) switch
|
public static string Value(string parameter, object? value) => (parameter, value) switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -819,6 +819,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
|||||||
{
|
{
|
||||||
Title = Loc.L("Editor.Save.Failed"),
|
Title = Loc.L("Editor.Save.Failed"),
|
||||||
Message = ex.Message,
|
Message = ex.Message,
|
||||||
|
IsError = true,
|
||||||
ActionText = Loc.L("Editor.Save.Retry"),
|
ActionText = Loc.L("Editor.Save.Retry"),
|
||||||
ActionToolTip = Loc.L("Tooltips.Editor.Save.Retry"),
|
ActionToolTip = Loc.L("Tooltips.Editor.Save.Retry"),
|
||||||
ActionCommand = new RelayCommand(() => _ = Session.FlushAsync()),
|
ActionCommand = new RelayCommand(() => _ = Session.FlushAsync()),
|
||||||
@@ -893,9 +894,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
|||||||
Shell.Notify(Loc.L("Editor.Optimise.Nothing"));
|
Shell.Notify(Loc.L("Editor.Optimise.Nothing"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var lines = changes.Select(c => Loc.L("Editor.Optimise.Change", EditorText.ParameterLabel(c.Parameter), EditorText.Value(c.Parameter, c.Before),
|
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, changes.Select(EditorText.Change)));
|
||||||
EditorText.Value(c.Parameter, c.After)));
|
|
||||||
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, lines));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AnalyseAsync()
|
private async Task AnalyseAsync()
|
||||||
@@ -957,6 +956,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
|||||||
{
|
{
|
||||||
Title = Loc.L("Editor.ServerJob.Ended", JobText.Kind(job.Kind), Loc.L("Jobs.State." + job.State), server),
|
Title = Loc.L("Editor.ServerJob.Ended", JobText.Kind(job.Kind), Loc.L("Jobs.State." + job.State), server),
|
||||||
Message = job.Error ?? job.TargetLabel ?? Title,
|
Message = job.Error ?? job.TargetLabel ?? Title,
|
||||||
|
IsError = job.State == JobState.Failed,
|
||||||
ActionText = Loc.L("Jobs.Action.Retry"),
|
ActionText = Loc.L("Jobs.Action.Retry"),
|
||||||
ActionToolTip = Loc.L("Tooltips.Editor.ServerJob.Retry", server),
|
ActionToolTip = Loc.L("Tooltips.Editor.ServerJob.Retry", server),
|
||||||
ActionCommand = new AsyncRelayCommand(() => Session.Source.RetryJobAsync(job.Id, CancellationToken.None), () => !_disposed),
|
ActionCommand = new AsyncRelayCommand(() => Session.Source.RetryJobAsync(job.Id, CancellationToken.None), () => !_disposed),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Globalization;
|
||||||
using Titano.App.Editor;
|
using Titano.App.Editor;
|
||||||
using Titano.Core.Advice;
|
using Titano.Core.Advice;
|
||||||
using Titano.Core.Imaging;
|
using Titano.Core.Imaging;
|
||||||
@@ -36,6 +37,24 @@ public sealed class EditorTextTests
|
|||||||
Assert.Equal("3 frames", EditorText.Value(AdvisorParameters.Excluded, new[] { 1, 2, 3 }));
|
Assert.Equal("3 frames", EditorText.Value(AdvisorParameters.Excluded, new[] { 1, 2, 3 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void AnOptimiseLinePointsFromTheOldValueToTheNewOneInEitherReadingDirection()
|
||||||
|
{
|
||||||
|
var change = new SettingChange(AdvisorParameters.DeflickerWindow, 21, 41, "reason", []);
|
||||||
|
Assert.Equal("Deflicker window: 21 frames → 41 frames", EditorText.Change(change));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo("ar"));
|
||||||
|
Assert.Equal(Loc.L("Editor.Optimise.ChangeRtl", Loc.L("Editor.Exposure.Window"), Loc.Plural("Editor.Value.Frames", 21), Loc.Plural("Editor.Value.Frames", 41)),
|
||||||
|
EditorText.Change(change), "Arabic reads the old value first, from the right");
|
||||||
|
Assert.Contains("←", EditorText.Change(change));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CropMarginsKeepAtLeastATenthOfTheFrame()
|
public void CropMarginsKeepAtLeastATenthOfTheFrame()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user