feat(app): Reorganize existing sequences from the Archive manager, the Library and Settings

Owner review 2, R7 asks to rename and move sequences after import on the desktop too.
The desktop now uses the engine's Reorganize, the same plan and job as the web panel.

- One Reorganize… dialog replaces Rename… and Move… in the Archive manager and Move… in
  the Library. It has three templates: folders, file names and titles. Each one has a
  switch and is checked as it is typed. Folders and file names start on, filled from the
  archive's settings; titles start off as {title}. Renaming only titles is the Titles
  switch alone.
- The dry run stays in the dialog and follows the typing. Each sequence shows its folder,
  title and first file names before and after. Sequences carried along with a folder are
  marked, and photos that keep their names are listed with the reason. A summary counts
  the sequences that change, the files renamed and the names kept.
- Apply no longer changes the archive from the dialog. It queues the engine's move job
  with exactly the plan shown (its fingerprint), so the work can be paused, resumed after
  a restart and followed in Jobs. The job refuses the plan if the archive changed after
  the dry run.
- The Library's Reorganize… works on the selected sequences of one archive. The Archive
  screen reads the archive again when a move job ends.
- After Settings › Archive saves a new folder or file template to an archive that holds
  sequences, a toast offers Reorganize… for every sequence. Its templates are the ones
  changed since; a second change made while the toast is up adds to that toast instead of
  opening another.
- Strings in en and it. The keys of the old Rename and Move were removed and pruned from
  every translation, so the 36 other languages show the new keys as untranslated instead
  of keeping "Move".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7bbf451f737a71b768dcd70a77b998daaef851f3)
This commit is contained in:
Alby96 committed 2026-10-27 14:04:37 +01:00
1 parent 17efb50e11
commit ad72501f11
134 files changed
+998 -888

No files matched your search

-42
View File
@@ -1,6 +1,4 @@
using Chronos.App.Library;
using Chronos.App.Settings;
using Chronos.Core.Archiving;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Core.Naming;
@@ -8,46 +6,6 @@ using Chronos.Data.Repositories;
namespace Chronos.App.Archiving;
/// <summary>What a mass rename changes: the sequence titles (Rename) or the folder layout (Move).</summary>
public enum RenameMode
{
Titles,
Folders,
}
/// <summary>One line of the rename dry run: before → after.</summary>
public sealed record RenameRow(Guid SequenceId, string From, string To);
/// <summary>
/// Mass rename and move of sequences (BRIEF §7, §12.5): the template is checked live, the engine's dry run
/// (<see cref="RenamePlan"/>) is listed line by line, and applying makes exactly those changes.
/// </summary>
public static class MassRename
{
/// <summary>The first problem of a template, localized; null when it can be used.</summary>
public static string? Validate(RenameMode mode, string? template)
{
if (string.IsNullOrWhiteSpace(template)) return Loc.L("Errors.Template.Empty", string.Empty, 1);
if (mode == RenameMode.Folders) return NamingPreview.Validate(template, isFolder: true);
var parsed = PathTemplate.Parse(template);
return parsed.Errors is [var error, ..] ? Loc.L("Errors.Template." + error.Code, error.Token ?? string.Empty, error.Position + 1) : null;
}
/// <summary>The changes of a plan as rows: titles or folders, whichever the mode changes.</summary>
public static IReadOnlyList<RenameRow> Rows(RenamePlan plan, RenameMode mode) =>
[
.. plan.Steps.Select(s => mode == RenameMode.Folders
? new RenameRow(s.SequenceId, s.FromFolder, s.ToFolder)
: new RenameRow(s.SequenceId, s.FromTitle ?? string.Empty, s.ToTitle ?? string.Empty)),
];
/// <summary>
/// "12 of 36 sequences change"; sequences that only move with a folder they are in are listed, not counted, and so are
/// those that change nothing (their files keep their names).
/// </summary>
public static string Summary(RenamePlan plan, int setSize) => Loc.Plural("Archive.Rename.Summary", plan.Steps.Count(s => s.Changes && !s.Carried), setSize);
}
/// <summary>Adding and removing tags on a set of sequences (BRIEF §12.5 Retag).</summary>
public static class Retag
{