feat(settings): make every Settings row real; archive settings, index backups and restore
Settings (UI-01, UI-02, UI-03, UI-09, RF-4): - New Import, Analysis and Formats pages, in the order of Settings.html. Import holds the defaults of new cards (session rules, subfolders, verification, duplicates, after-import actions); Analysis the deep-analysis width cap, night and star-field thresholds and deep analysis after import or scan; Formats the decode tier of every format on this PC with a notice and Store install link per missing codec extension. - Archive gains thumbnail size and rescan interval; its templates, proxy size and thumbnail size are the open archive's own (archive.json) and new archives' defaults. - Rendering quality, parallelism and background priority now drive the jobs: quality maps to preparation size, read-ahead and default flow quality; parallelism sets the engine's workers live and caps per-job threads; background priority raises the UI thread while Titano is in front. - Advanced gains Restore (daily backups, dry-run summary, destructive confirmation, staged for the next start) and Reset all. - The naming preview's sample title is a catalog string. Engine (ENG-03, ENG-04, ENG-06): - ArchiveService.GetSettingsAsync/UpdateSettingsAsync rewrite archive.json atomically under a lease, then the index row; the server endpoint and the desktop use them, and the desktop creates archives with Settings › Archive. ThumbnailPolicy in archive.json sizes the thumbnails. - DatabaseBackups: daily VACUUM INTO copies kept x3 on the desktop and on a server on SQLite (DatabaseBackupService), staged restore checked and preceded by a fresh copy. - Maintenance vacuums the SQLite index when 10 % or more is free (dry run reports it). - JobEngine.SetWorkers; ProcessingOptions.Tune applies host tuning per job. Archive setup toasts say why in a localized sentence (RF-1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
91 files changed
+2864
-357
No files matched your search
@@ -96,6 +96,61 @@ public sealed class SettingsScreenSmokeTests
|
||||
Assert.True(ServerSession.ForgetRequest(certificate.FullFingerprint).IsDestructive);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task ImportAnalysisAndFormatsAreRealSettings() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||
var shell = app.Shell;
|
||||
await app.Sample.FillAsync();
|
||||
var settings = shell.Settings;
|
||||
// The open archive's own thumbnail size (archive.json) is what Settings › Archive shows.
|
||||
var archive = Assert.NotNull(await Titano.App.Archiving.CurrentArchive.FindAsync(shell.Services.Database!, shell.Services.Settings.LastArchivePath));
|
||||
var manifestPath = new Titano.Core.Archiving.ArchivePaths(archive.RootPath).ManifestPath;
|
||||
var manifest = Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath);
|
||||
Titano.Core.Archiving.ManifestStore.WriteArchive(manifestPath, manifest with { ThumbnailPolicy = new Titano.Core.Archiving.ThumbnailPolicy { LongEdge = 240 } });
|
||||
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
settings.Page = SettingsPage.Archive;
|
||||
await WaitAsync(() => settings.SelectedThumbnailSize.Value == 240, "the archive's thumbnail size is shown");
|
||||
await app.ExpectAsync<SettingsView>("settings-archive");
|
||||
settings.SelectedThumbnailSize = settings.ThumbnailSizes.Single(s => s.Value == 480);
|
||||
await WaitAsync(() => Titano.Core.Archiving.ManifestStore.ReadArchive(manifestPath).ThumbnailPolicy.LongEdge == 480, "written into archive.json");
|
||||
Assert.Equal(480, shell.Services.Settings.ThumbnailLongEdge);
|
||||
|
||||
// Import: the defaults of new cards.
|
||||
settings.Page = SettingsPage.Import;
|
||||
await app.ExpectAsync<SettingsView>("settings-import");
|
||||
settings.SessionGap.Text = "90";
|
||||
Assert.True(settings.SessionGap.Commit());
|
||||
settings.IsFormatCard = true;
|
||||
Assert.Equal((90, Titano.Data.Archiving.AfterImport.FormatCard), (shell.Services.Settings.ImportSessionGapMinutes, shell.Services.Settings.ImportAfter));
|
||||
Assert.True(settings.CanResetSection);
|
||||
settings.ResetSectionCommand.Execute(null);
|
||||
Assert.Equal(("45", true), (settings.SessionGap.Text, settings.IsKeepCard));
|
||||
|
||||
// Analysis: thresholds in the language's own decimals, checked against their range.
|
||||
settings.Page = SettingsPage.Analysis;
|
||||
await app.ExpectAsync<SettingsView>("settings-analysis");
|
||||
Assert.Equal(6.25.ToString("0.##", System.Globalization.CultureInfo.CurrentCulture), settings.NightBrightness.Text);
|
||||
settings.NightBrightness.Text = "80";
|
||||
Assert.True(settings.NightBrightness.HasErrors, "beyond 50 %");
|
||||
settings.NightBrightness.Revert();
|
||||
settings.DeepAnalysisAfterScan = true;
|
||||
Assert.True(shell.Services.Settings.DeepAnalysisAfterScan);
|
||||
|
||||
// Formats: the tier of every format and a notice with Install per missing extension.
|
||||
settings.Page = SettingsPage.Formats;
|
||||
await WaitAsync(() => settings.Formats.Count > 0 && !settings.IsDetectingFormats, "formats listed");
|
||||
await app.ExpectAsync<SettingsView>("settings-formats");
|
||||
Assert.Count(3, settings.MissingExtensions);
|
||||
var installs = app.FindAll<Button>().Where(b => b.IsVisible && b.Content as string == Loc.L("Settings.Formats.Install")).ToList();
|
||||
Assert.Count(3, installs);
|
||||
Assert.True(installs.All(b => AutomationProperties.GetName(b).StartsWith(Loc.L("Settings.Formats.InstallName", string.Empty), StringComparison.Ordinal)), "named after the extension");
|
||||
Assert.Contains(settings.Formats, f => f.Row.Tier == Titano.Core.Imaging.DecodeTier.Native);
|
||||
Assert.False(settings.CanResetSection, "Formats only shows this PC");
|
||||
installs[0].Command.Execute(null);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task TheFirstRunDialogKeepsTheKeyboardInside() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
@@ -166,6 +221,17 @@ public sealed class SettingsScreenSmokeTests
|
||||
Assert.Equal(FlowDirection.LeftToRight, main.FlowDirection);
|
||||
});
|
||||
|
||||
/// <summary>Waits (on the UI thread, letting it run) until <paramref name="condition"/> holds.</summary>
|
||||
private static async Task WaitAsync(Func<bool> condition, string what)
|
||||
{
|
||||
var until = DateTime.UtcNow.AddSeconds(20);
|
||||
while (!condition())
|
||||
{
|
||||
Assert.True(DateTime.UtcNow < until, what);
|
||||
await Task.Delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
private static TextBox Field(ScreenSmokeTests.SampleApp app, string name) =>
|
||||
app.FindAll<TextBox>().First(t => t.IsVisible && AutomationProperties.GetName(t) == name);
|
||||
|
||||
|
||||
Reference in new issue
Block a user