feat(app): Convert sequences from the Archive manager and the Library, with Undo after a Replace

Owner review 2, R7 asks for mass conversion after import on the desktop too, with a choice at
every run between Replace and New sequence. The desktop now uses the engine's conversion, the
same plan and job as the web panel.

- Convert... in the Archive manager's mass operations (the set) and the Library's mass bar (the
  selection of one archive; server cards are left out, two archives are refused with their own
  reason). The dialog has the format (JPEG, TIFF 16-bit, Linear DNG, the archival default), a
  JPEG's quality (1-100, 95) and the mode, which starts unchosen at every open: Apply waits for
  it. Each choice has a tooltip that says what becomes of the originals.
- The dry run stays in the dialog and follows the choices: each sequence with its photos and
  sizes before and after, the photos that stay as they are with why, the sequences left as they
  are (busy, offline, unreadable), a summary and the free space line; a volume without the space
  blocks Apply. The mode does not change what converts, so choosing it plans nothing again.
- Apply asks to type the number of photos a Replace replaces, then queues the convert job of
  exactly the plan shown; New sequence leaves the originals as they are and asks nothing.
- When a Replace job ends, its toast offers Undo: for each sequence it converted, the newest
  Replaced trash entry made while it ran goes back (a sequence changed since gets its originals
  as a new sequence). Undo runs once and never from the Windows notification.
- The Library and the Archive screen read the sequences again after a conversion; --capture
  renders archive-convert from a sample plan.
- Strings in en and it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 275469284f895fc92e2569339809e18bf59d1d6a)
(cherry picked from commit 76ba41f58983275ae4b1478edd403efb11da7c79)
This commit is contained in:
Alby96 committed 2026-10-27 22:02:04 +01:00
1 parent 2143a093a2
commit a1c1c21ebd
25 files changed
+1409 -19

No files matched your search

@@ -255,6 +255,50 @@ public sealed class ShellNotificationTests
Assert.Null(failures.Message);
});
/// <summary>
/// Owner review 2, R7: a conversion that replaced the photos ends with Undo, which brings the originals back from the
/// trash and never runs from the Windows notification; one into new sequences ends as any other job.
/// </summary>
[Test]
public Task AReplaceConversionThatEndsOffersUndo() => ScreenHost.RunAsync(async () =>
{
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
var shell = app.Shell;
shell.CompleteWelcome();
await JobsLoadedAsync(shell);
var jobs = shell.Jobs;
var raised = new List<Toast>();
shell.PendingToasts.CollectionChanged += (_, e) => raised.AddRange(e.NewItems?.Cast<Toast>() ?? []);
foreach (var mode in new[] { "Replace", "NewSequence" })
{
raised.Clear();
var target = Guid.CreateVersion7();
var convert = Job(JobKind.Convert, JobState.Running, target) with
{
ParametersJson = $$"""{"archiveId":"{{Guid.CreateVersion7()}}","target":"LinearDng","quality":95,"mode":"{{mode}}","sequences":[{"id":"{{target}}","framesVersion":1}],"fingerprint":"fp"}""",
};
jobs.OnJobChanged(convert);
jobs.Flush();
jobs.OnJobChanged(convert with { State = JobState.Done, Finished = DateTimeOffset.UtcNow });
jobs.Flush();
var toast = raised.Single();
if (mode == "Replace")
{
Assert.Equal(Loc.Plural("Archive.Convert.Done", 1), toast.Title);
Assert.Equal(Loc.L("Archive.Delete.Undo"), toast.ActionText);
Assert.Equal(Loc.L("Tooltips.Archive.ConvertUndo"), toast.ActionToolTip);
Assert.False(toast.RunsFromNotification, "a click on the Windows notification never undoes");
Assert.False(toast.IsError);
}
else
{
Assert.Equal(Loc.L("Shell.Job.Done"), toast.Title);
Assert.Equal(Loc.L("Jobs.Action.Open"), toast.ActionText);
}
}
});
[Test]
public Task ToastsBecomeWindowsNotificationsOnlyWhileNobodySeesTheWindow() => ScreenHost.RunAsync(async () =>
{