feat: owner review 2 phase 1: :latest, Unraid array space, Settings with About, whole-folder import (#9)
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
- :latest follows the highest stable release, or the highest pre-release while none is stable (Chronos.Tools release-channels); bad tags are refused before anything is built. - Unraid: CHRONOS_SPACE_PATH and the template's Array view show the array's free space; the write volume (cache) is shown apart; completions check the archive volume (507). - Settings is a gear, docked at the foot of the admin sidebar; About is the last part of Settings on the desktop and the panel. - Import > Folder > Whole folder: one sequence per format (desktop only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #9.
This commit is contained in:
1 parent
5acdf146c7
commit
1f089888e8
320 files changed
+3030
-927
No files matched your search
+5
-28
@@ -1,26 +1,24 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.About;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.App.Sections;
|
||||
namespace Chronos.App.About;
|
||||
|
||||
/// <summary>
|
||||
/// About (BRIEF §12.9): version and build, licence link, third-party notice (none), translation notice,
|
||||
/// diagnostics bundle and the update notice of <see cref="UpdateFlow"/> (BRIEF §18), which Settings › Updates shows too.
|
||||
/// What Settings › About (BRIEF §12.9: version and build, licence link, third-party notice, translation notice) and
|
||||
/// Settings › Updates (the releases page and the update notice of <see cref="UpdateFlow"/>, BRIEF §18) show. The shell
|
||||
/// owns it, so the update check on start runs whatever screen is open; it is no section of the rail (owner review 2, R5).
|
||||
/// </summary>
|
||||
public sealed class AboutViewModel : SectionViewModel
|
||||
public sealed class AboutViewModel : LocalizedViewModel
|
||||
{
|
||||
private readonly UpdateFlow _update;
|
||||
|
||||
public AboutViewModel(ShellViewModel shell)
|
||||
: base(SectionKey.About, "Icon.About")
|
||||
{
|
||||
Shell = shell;
|
||||
var environment = shell.Services.Environment;
|
||||
@@ -37,8 +35,6 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
OpenReleasesCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Releases));
|
||||
OpenLicenceCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Licence));
|
||||
ReviewTranslationCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Issues));
|
||||
OpenDataFolderCommand = new RelayCommand(() => ShellActions.Reveal(DataFolder));
|
||||
DiagnosticsCommand = new AsyncRelayCommand(DiagnosticsAsync);
|
||||
}
|
||||
|
||||
public ShellViewModel Shell { get; }
|
||||
@@ -53,8 +49,6 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
|
||||
public string OperatingSystem => RuntimeInformation.OSDescription;
|
||||
|
||||
public string DataFolder => Shell.Services.Environment.DataDirectory;
|
||||
|
||||
/// <summary>Every language but English is machine-translated and open to review (BRIEF §16).</summary>
|
||||
public bool IsTranslated => !Loc.Culture.TwoLetterISOLanguageName.Equals("en", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
@@ -65,8 +59,6 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
public ICommand OpenReleasesCommand { get; }
|
||||
public ICommand OpenLicenceCommand { get; }
|
||||
public ICommand ReviewTranslationCommand { get; }
|
||||
public ICommand OpenDataFolderCommand { get; }
|
||||
public ICommand DiagnosticsCommand { get; }
|
||||
|
||||
/// <summary>"Up to date", "Chronos 0.2.0 available", …; null before the first check.</summary>
|
||||
public string? UpdateText => _update.State switch
|
||||
@@ -123,21 +115,6 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
actionToolTip: DownloadToolTip, action: () => DownloadCommand.Execute(null));
|
||||
}
|
||||
|
||||
private async Task DiagnosticsAsync()
|
||||
{
|
||||
var folder = Shell.Services.Dialogs.PickFolder(Loc.L("Settings.Advanced.DiagnosticsTitle"));
|
||||
if (folder is null) return;
|
||||
try
|
||||
{
|
||||
var path = await DiagnosticsBundle.CreateAsync(Shell.Services, folder);
|
||||
Shell.Notify(Loc.L("Settings.Advanced.DiagnosticsDone"), Path.GetFileName(path), Loc.L("Library.Export.Show"), Loc.L("Tooltips.Library.ShowExport"), () => ShellActions.Reveal(path));
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or Chronos.Data.DatabaseException)
|
||||
{
|
||||
Shell.ReportError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void RaiseUpdate()
|
||||
{
|
||||
OnPropertyChanged(nameof(UpdateText));
|
||||
@@ -34,7 +34,7 @@ public sealed record UpdateHost(
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The update notice of About and Settings › Updates (BRIEF §18): checks the latest release, downloads and verifies the
|
||||
/// The update notice of Settings › Updates (BRIEF §18): checks the latest release, downloads and verifies the
|
||||
/// package that upgrades this copy (<see cref="UpdateDownload"/>: the setup, or the portable zip for a portable copy)
|
||||
/// and shows it in Explorer. Running it is left to the user because BRIEF §8.6 lets Chronos only open links and show
|
||||
/// files. A release without that package or without <c>SHA256SUMS</c> only opens its page; a capture run never touches
|
||||
|
||||
@@ -15,13 +15,18 @@ public enum ImportDestinationKind
|
||||
|
||||
/// <summary>
|
||||
/// The Import form (Import.html): scan, sessions, names, duplicates and after-import choices. Remembered per card as
|
||||
/// its <see cref="CardProfile"/>; a session gap of 0 minutes in a profile means "do not split into sessions".
|
||||
/// its <see cref="CardProfile"/>; a session gap of 0 minutes in a profile means "do not split into sessions". The
|
||||
/// grouping is not in a profile: a card always imports by sessions, and a picked folder starts with them.
|
||||
/// </summary>
|
||||
public sealed record ImportChoices
|
||||
{
|
||||
public ImportDestinationKind Destination { get; init; } = ImportDestinationKind.Archive;
|
||||
public string? FolderPath { get; init; }
|
||||
public bool IncludeSubfolders { get; init; } = true;
|
||||
|
||||
/// <summary>"Group" (a picked folder only): its sessions, or the whole folder as one sequence per format.</summary>
|
||||
public ImportGrouping Grouping { get; init; } = ImportGrouping.Sessions;
|
||||
|
||||
public bool SplitSessions { get; init; } = true;
|
||||
public int GapMinutes { get; init; } = 45;
|
||||
public int MinimumFrames { get; init; } = 8;
|
||||
@@ -78,6 +83,7 @@ public sealed record ImportChoices
|
||||
IncludeSubfolders = IncludeSubfolders,
|
||||
VerifyCopies = VerifyCopies,
|
||||
Duplicates = Duplicates,
|
||||
Grouping = Grouping,
|
||||
Titles = titles ?? new Dictionary<string, string>(),
|
||||
SplitBefore = splits ?? new HashSet<string>(),
|
||||
MergeAt = merges ?? new HashSet<string>(),
|
||||
@@ -88,6 +94,7 @@ public sealed record ImportChoices
|
||||
previous.Destination != Destination
|
||||
|| (Destination == ImportDestinationKind.Folder && !string.Equals(previous.FolderPath, FolderPath, StringComparison.OrdinalIgnoreCase))
|
||||
|| previous.IncludeSubfolders != IncludeSubfolders
|
||||
|| previous.Grouping != Grouping
|
||||
|| previous.SplitSessions != SplitSessions
|
||||
|| (SplitSessions && previous.GapMinutes != GapMinutes)
|
||||
|| previous.MinimumFrames != MinimumFrames
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Import;
|
||||
using Chronos.Core.Localization;
|
||||
@@ -40,10 +41,14 @@ public sealed record PlanTotals(int Sessions, int Photos, int CopyCount, long Co
|
||||
}
|
||||
|
||||
/// <summary>One row of the session table: what the planner grouped and where it goes.</summary>
|
||||
/// <param name="DefaultTitle">Title the sequence gets when the user types none (its folder name).</param>
|
||||
/// <param name="Title">The title the user typed; null when none.</param>
|
||||
/// <param name="DefaultTitle">Title the sequence gets when the user types none (a whole folder's name, else its folder name).</param>
|
||||
/// <param name="IsNew">The session starts a new sequence (false: it continues one imported before).</param>
|
||||
/// <param name="FirstPath">Card path of the session's first photo (where a merge joins it to the previous session).</param>
|
||||
/// <param name="MergesInto">Number of the earlier session of the same camera and format it can merge into; null for none.</param>
|
||||
/// <param name="MergesInto">
|
||||
/// Number of the earlier session it can merge into (same camera and format; for a whole folder, same format whatever the
|
||||
/// camera); null for none.
|
||||
/// </param>
|
||||
public sealed record PlanSessionRow(int Number, string SessionKey, string? Title, string DefaultTitle, string TimeText, string FramesText,
|
||||
string SizeText, string CameraText, string TargetText, bool IsNew, string FirstPath, int? MergesInto);
|
||||
|
||||
@@ -116,10 +121,19 @@ public static class ImportPlans
|
||||
],
|
||||
};
|
||||
|
||||
/// <summary>The plan with the typed session titles (when no template uses <c>{title}</c>, so no name changes).</summary>
|
||||
/// <summary>
|
||||
/// The plan with the typed session titles (when no template uses <c>{title}</c>, so no name changes); a session
|
||||
/// without one keeps its default title (a whole folder's name).
|
||||
/// </summary>
|
||||
public static ImportPlan WithTitles(ImportPlan plan, IReadOnlyDictionary<string, string> titles) => plan with
|
||||
{
|
||||
Sessions = [.. plan.Sessions.Select(s => s with { Title = titles.TryGetValue(s.SessionKey, out var t) && !string.IsNullOrWhiteSpace(t) ? t.Trim() : null })],
|
||||
Sessions =
|
||||
[
|
||||
.. plan.Sessions.Select(s => s with
|
||||
{
|
||||
Title = titles.TryGetValue(s.SessionKey, out var t) && !string.IsNullOrWhiteSpace(t) ? t.Trim() : s.DefaultTitle,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
/// <param name="existingFolders">Folders of sequences already in the archive (a session there continues it).</param>
|
||||
@@ -135,20 +149,35 @@ public static class ImportPlans
|
||||
ImportDestinationKind.Folder => s.Folder,
|
||||
_ => Loc.L(isNew ? "Import.Session.New" : "Import.Session.Adds", s.Folder),
|
||||
};
|
||||
return new PlanSessionRow(s.Number, s.SessionKey, s.Title, leaf, TimeText(s), FramesText(s), Formatting.Bytes(s.Items.Sum(i => i.Size)),
|
||||
PathTemplate.CameraName(s.CameraMake, s.CameraModel), target, isNew, s.Items.Count > 0 ? s.Items[0].SourcePath : string.Empty,
|
||||
// The field shows a typed title only; the default (a whole folder's name, else the folder's) is its placeholder.
|
||||
var typed = s.Title is { } title && title != s.DefaultTitle ? title : null;
|
||||
return new PlanSessionRow(s.Number, s.SessionKey, typed, s.DefaultTitle ?? leaf, TimeText(s), FramesText(s),
|
||||
Formatting.Bytes(s.Items.Sum(i => i.Size)), CameraText(plan, s), target, isNew, s.Items.Count > 0 ? s.Items[0].SourcePath : string.Empty,
|
||||
MergeTarget(plan, s)?.Number);
|
||||
}),
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// "Canon EOS R5"; for a whole folder, one row per format, the format too and how many bodies took the photos:
|
||||
/// "Canon EOS R5 · CR3", "2 cameras · JPEG".
|
||||
/// </summary>
|
||||
private static string CameraText(ImportPlan plan, PlannedSession s)
|
||||
{
|
||||
var camera = PathTemplate.CameraName(s.CameraMake, s.CameraModel);
|
||||
if (plan.Grouping != ImportGrouping.WholeFolder) return camera;
|
||||
var bodies = s.Cameras > 1 ? Loc.Plural("Import.Session.Cameras", s.Cameras) : camera;
|
||||
return string.Join(Loc.Separator, new[] { bodies, FormatNames.Of(s.Format) }.Where(t => t.Length > 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The session <paramref name="session"/> joins when the user merges it (BRIEF §13): the one before it of the same
|
||||
/// camera body and format, whose last photo precedes its first; sessions of other cameras or formats never merge.
|
||||
/// A whole folder's parts (split by the user) join the part before them of the same format, whatever the camera.
|
||||
/// </summary>
|
||||
public static PlannedSession? MergeTarget(ImportPlan plan, PlannedSession session) =>
|
||||
plan.Sessions.TakeWhile(s => !ReferenceEquals(s, session))
|
||||
.LastOrDefault(s => s.CameraMake == session.CameraMake && s.CameraModel == session.CameraModel && s.CameraSerial == session.CameraSerial
|
||||
&& s.Format == session.Format);
|
||||
.LastOrDefault(s => s.Format == session.Format && (plan.Grouping == ImportGrouping.WholeFolder
|
||||
|| (s.CameraMake == session.CameraMake && s.CameraModel == session.CameraModel && s.CameraSerial == session.CameraSerial)));
|
||||
|
||||
/// <summary>"Show plan": every file and where it goes, with the conflicts the plan resolved or reports.</summary>
|
||||
public static PlanDetails Details(ImportPlan plan, ImportDestinationKind destination, bool verify)
|
||||
@@ -224,12 +253,15 @@ public static class ImportPlans
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// "28/09/2026 · 18:02 → 20:04". Bidi never mirrors an arrow, so a right-to-left language reads it from its own
|
||||
/// resource with the arrow pointing from the start to the end in its reading order.
|
||||
/// "28/09/2026 · 18:02 → 20:04"; one that ends on another day (a whole folder, often) shows both dates:
|
||||
/// "28/09/2026 18:02 → 06/10/2026 18:00". Bidi never mirrors an arrow, so a right-to-left language reads it from its
|
||||
/// own resource with the arrow pointing from the start to the end in its reading order.
|
||||
/// </summary>
|
||||
private static string TimeText(PlannedSession s) =>
|
||||
Loc.L(Loc.IsRightToLeft ? "Import.Session.TimeRtl" : "Import.Session.Time", Formatting.Date(s.Start), s.Start.ToString("t", Loc.Culture),
|
||||
s.End.ToString("t", Loc.Culture));
|
||||
private static string TimeText(PlannedSession s) => s.End.Date == s.Start.Date
|
||||
? Loc.L(Loc.IsRightToLeft ? "Import.Session.TimeRtl" : "Import.Session.Time", Formatting.Date(s.Start), s.Start.ToString("t", Loc.Culture),
|
||||
s.End.ToString("t", Loc.Culture))
|
||||
: Loc.L(Loc.IsRightToLeft ? "Import.Session.TimeDaysRtl" : "Import.Session.TimeDays", Formatting.Date(s.Start), s.Start.ToString("t", Loc.Culture),
|
||||
Formatting.Date(s.End), s.End.ToString("t", Loc.Culture));
|
||||
|
||||
/// <summary>"3,600 · 2 s": photos and the median interval between them.</summary>
|
||||
private static string FramesText(PlannedSession s)
|
||||
|
||||
@@ -6,8 +6,9 @@ using Chronos.Ui.Mvvm;
|
||||
namespace Chronos.App.Import;
|
||||
|
||||
/// <summary>
|
||||
/// A session of the plan with its editable title (the sequence title; empty keeps the folder name) and its merge into
|
||||
/// the earlier session of the same camera (BRIEF §13). Both can change only while the plan is not running.
|
||||
/// A session of the plan with its editable title (the sequence title; empty keeps the default title) and its merge into
|
||||
/// the earlier session of the same camera and format, or for a whole folder of the same format (BRIEF §13). Both can
|
||||
/// change only while the plan is not running.
|
||||
/// </summary>
|
||||
public sealed class ImportSessionRowViewModel : ObservableObject
|
||||
{
|
||||
|
||||
@@ -13,10 +13,11 @@ namespace Chronos.App.Import;
|
||||
/// protocol's resumable chunks and the hash computed while copying; the server checks that hash before it commits the
|
||||
/// frame, and only then does the photo count as imported. Photos of one plan session share its session key, so the
|
||||
/// server files them in one sequence — the same one when an interrupted import is started again. A typed session
|
||||
/// title is set on that sequence once. A file the server refuses (a hash mismatch, a format it rejects) is listed in
|
||||
/// <see cref="Report"/> and the import goes on (BRIEF §13: errors per file); a failed connection, sign-in or server
|
||||
/// stops it. A file the server already held counts as a duplicate: the server answers so only for a copy that is not
|
||||
/// flagged missing or damaged, and a server import never deletes anything from the card.
|
||||
/// title is set on that sequence once; a whole folder's own name only on a sequence that has no title yet, so a rename
|
||||
/// made on the server survives the next import of the folder. A file the server refuses (a hash mismatch, a format it
|
||||
/// rejects) is listed in <see cref="Report"/> and the import goes on (BRIEF §13: errors per file); a failed connection,
|
||||
/// sign-in or server stops it. A file the server already held counts as a duplicate: the server answers so only for a
|
||||
/// copy that is not flagged missing or damaged, and a server import never deletes anything from the card.
|
||||
/// </summary>
|
||||
public sealed class ServerImportSink(ChronosClient client, string stagingDirectory) : IImportSink
|
||||
{
|
||||
@@ -85,16 +86,20 @@ public sealed class ServerImportSink(ChronosClient client, string stagingDirecto
|
||||
Directory.Delete(folder);
|
||||
}
|
||||
if (committed is { Index: >= 0 } && session.Title is { Length: > 0 } title && _titled.Add(committed.SequenceId))
|
||||
await SetTitleAsync(committed.SequenceId, title, cancellationToken).ConfigureAwait(false);
|
||||
await SetTitleAsync(committed.SequenceId, title, keepExisting: title == session.DefaultTitle, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>A refused title leaves the photos imported under the sequence's own name.</summary>
|
||||
private async Task SetTitleAsync(Guid sequenceId, string title, CancellationToken cancellationToken)
|
||||
/// <summary>
|
||||
/// Names the sequence; with <paramref name="keepExisting"/> (the title the user did not type) only one without a
|
||||
/// title. A refused title leaves the photos imported under the sequence's own name.
|
||||
/// </summary>
|
||||
private async Task SetTitleAsync(Guid sequenceId, string title, bool keepExisting, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (keepExisting && (await client.GetSequenceAsync(sequenceId, cancellationToken).ConfigureAwait(false)).Title is { Length: > 0 }) return;
|
||||
await client.UpdateSequenceAsync(sequenceId, new UpdateSequenceRequest(title, null, null, null, null, null), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (ChronosApiException ex) when (IsRefusal(ex))
|
||||
|
||||
@@ -13,7 +13,7 @@ using Chronos.Data.Sqlite;
|
||||
namespace Chronos.App.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// The diagnostics bundle of About and Settings › Advanced (BRIEF §12.9, §22 Phase 8): an environment report, the codec
|
||||
/// The diagnostics bundle of Settings › Advanced (BRIEF §12.8, §12.9, §22 Phase 8): an environment report, the codec
|
||||
/// and encoder inventory, the settings, the latest failed jobs and the log files, zipped into a folder the user chose.
|
||||
/// Everything passes through <see cref="SecretScrubber"/> (the saved server token, passwords and keys never leave the
|
||||
/// PC) and no photo or archive file is ever included.
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
<UserControl x:Class="Chronos.App.Sections.AboutView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Chronos.Ui.Controls;assembly=Chronos.Ui"
|
||||
xmlns:l="clr-namespace:Chronos.Ui.Localization;assembly=Chronos.Ui"
|
||||
xmlns:infra="clr-namespace:Chronos.App.Infrastructure">
|
||||
<!-- BRIEF §12.9 (no mockup): built from the kit — panel, label column, one primary action. -->
|
||||
<Grid Margin="20,16,20,20">
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="28,24" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="600">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,22">
|
||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" />
|
||||
<StackPanel Margin="16,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Shell.AppName}" Style="{StaticResource Text.PageTitle}" FontSize="22" />
|
||||
<TextBlock Text="{Binding Version}" Style="{StaticResource Text.Secondary}" Margin="0,2,0,0" Typography.NumeralAlignment="Tabular" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="140" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="28" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc About.Build}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Build}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc About.Runtime}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Runtime}" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc About.System}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding OperatingSystem}" ToolTip="{Binding OperatingSystem}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc About.Licence}" />
|
||||
<Button Grid.Row="3" Grid.Column="1" Style="{StaticResource Button.Link}" FontSize="13" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Content="{l:Loc About.LicenceLink}" Command="{Binding OpenLicenceCommand}" ToolTip="{l:Loc Tooltips.About.Licence}" />
|
||||
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc About.ThirdParty}" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{l:Loc About.ThirdPartyNone}" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.About.ThirdParty}" />
|
||||
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc About.Data}" />
|
||||
<!-- A path reads left to right in every language and shows whole in its tooltip when cut. -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding DataFolder}" ToolTip="{Binding DataFolder}" VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
TextTrimming="CharacterEllipsis" FlowDirection="LeftToRight" />
|
||||
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc About.Translation}" Height="28"
|
||||
Visibility="{Binding IsTranslated, Converter={StaticResource BoolToVisibility}}" />
|
||||
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" Height="28" Visibility="{Binding IsTranslated, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{l:Loc About.MachineTranslated}" VerticalAlignment="Center" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Review}"
|
||||
Command="{Binding ReviewTranslationCommand}" ToolTip="{l:Loc Tooltips.About.Review}" />
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Row="7" Style="{StaticResource Text.Label}" Text="{l:Loc About.Updates}" />
|
||||
<StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal">
|
||||
<ui:StatusGlyph Kind="{Binding UpdateKind}" Text="{Binding UpdateText}" FontSize="13" VerticalAlignment="Center"
|
||||
Visibility="{Binding HasUpdateText, Converter={StaticResource BoolToVisibility}}"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding UpdateAnnouncement}" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Update.Download}"
|
||||
Command="{Binding DownloadCommand}" ToolTip="{Binding DownloadToolTip}"
|
||||
Visibility="{Binding IsUpdateAvailable, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Update.Cancel}"
|
||||
Command="{Binding CancelDownloadCommand}" ToolTip="{l:Loc Tooltips.About.CancelDownload}"
|
||||
Visibility="{Binding IsDownloading, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Update.ShowFile}"
|
||||
Command="{Binding ShowPackageCommand}" ToolTip="{Binding ShowPackageToolTip}"
|
||||
Visibility="{Binding IsPackageReady, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<WrapPanel Margin="0,22,0,0">
|
||||
<Button Style="{StaticResource Button.Primary}" Content="{l:Loc About.Update.Check}" Command="{Binding CheckCommand}" ToolTip="{l:Loc Tooltips.About.Check}" Margin="0,0,8,8" />
|
||||
<Button Content="{l:Loc About.Releases}" Command="{Binding OpenReleasesCommand}" ToolTip="{l:Loc Tooltips.About.Releases}" ui:ButtonIcon.Glyph="{StaticResource Icon.ExternalLink}" Margin="0,0,8,8" />
|
||||
<Button Content="{l:Loc About.Diagnostics}" Command="{Binding DiagnosticsCommand}" ToolTip="{l:Loc Tooltips.About.Diagnostics}" ui:ButtonIcon.Glyph="{StaticResource Icon.Export}" Margin="0,0,8,8" />
|
||||
<Button Content="{l:Loc About.OpenData}" Command="{Binding OpenDataFolderCommand}" ToolTip="{l:Loc Tooltips.About.OpenData}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Margin="0,0,8,8" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Chronos.App.Sections;
|
||||
|
||||
public partial class AboutView : UserControl
|
||||
{
|
||||
public AboutView() => InitializeComponent();
|
||||
}
|
||||
@@ -102,13 +102,14 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Up to four digits (gap ≤ 1440) in 56 px: half the usual side padding. -->
|
||||
<!-- Up to four digits (gap ≤ 1440) in 56 px: half the usual side padding. A disabled box still says why in its tooltip. -->
|
||||
<Style x:Key="TextBox.Small" TargetType="TextBox" BasedOn="{StaticResource TextBox.Number}">
|
||||
<Setter Property="Width" Value="56" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="Padding" Value="4,0" />
|
||||
<Setter Property="Margin" Value="6,0" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
</Style>
|
||||
|
||||
<!-- File paths and name templates stay left to right in every language (BRIEF §16). -->
|
||||
@@ -355,17 +356,27 @@
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<!-- A picked folder only: its sessions, or the whole folder as one sequence per format. -->
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Group}"
|
||||
Visibility="{Binding CanGroupFolder, Converter={StaticResource BoolToVisibility}}">
|
||||
<WrapPanel>
|
||||
<RadioButton Content="{l:Loc Import.Group.Sessions}" IsChecked="{Binding GroupBySessions}" ToolTip="{l:Loc Tooltips.Import.GroupSessions}" />
|
||||
<RadioButton Content="{l:Loc Import.Group.WholeFolder}" IsChecked="{Binding GroupWholeFolder}" ToolTip="{l:Loc Tooltips.Import.WholeFolder}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Scan}">
|
||||
<WrapPanel>
|
||||
<CheckBox Content="{l:Loc Import.Scan.Subfolders}" IsChecked="{Binding IncludeSubfolders}" ToolTip="{l:Loc Tooltips.Import.Subfolders}" />
|
||||
<CheckBox Content="{l:Loc Import.Scan.Sessions}" IsChecked="{Binding SplitSessions}" ToolTip="{l:Loc Tooltips.Import.Sessions}" />
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding SplitSessions}">
|
||||
<CheckBox Content="{l:Loc Import.Scan.Sessions}" IsChecked="{Binding SplitSessions}" IsEnabled="{Binding SessionsApply}"
|
||||
ToolTip="{Binding SessionsToolTip}" />
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding GapApplies}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Gap}" Style="{StaticResource Text.Unit}" />
|
||||
<TextBox x:Name="GapBox" Style="{StaticResource TextBox.Small}" Text="{Binding GapMinutes.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding GapMinutes}" ToolTip="{Binding GapMinutes.ToolTip}" AutomationProperties.Name="{l:Loc Import.Scan.GapName}" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minutes}" Style="{StaticResource Text.Unit}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}">
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding SessionsApply}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minimum}" Style="{StaticResource Text.Unit}" />
|
||||
<TextBox Style="{StaticResource TextBox.Small}" Text="{Binding MinimumFrames.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding MinimumFrames}" ToolTip="{Binding MinimumFrames.ToolTip}" AutomationProperties.Name="{l:Loc Import.Scan.MinimumName}" />
|
||||
|
||||
@@ -120,8 +120,10 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
// The path is checked only while Folder is the destination; typing one chooses Folder, as "…" does.
|
||||
FolderPath = new EditableField(string.Empty, text => IsFolderDestination ? ArchiveLocations.Validate(text) : null,
|
||||
text => Choices = _choices with { FolderPath = text, Destination = ImportDestinationKind.Folder }, () => Loc.L("Tooltips.Import.FolderPath"));
|
||||
GapMinutes = NumberField(1, 24 * 60, () => _choices.GapMinutes, n => Choices = _choices with { GapMinutes = n }, "Tooltips.Import.Gap");
|
||||
MinimumFrames = NumberField(1, 1000, () => _choices.MinimumFrames, n => Choices = _choices with { MinimumFrames = n }, "Tooltips.Import.MinimumFrames");
|
||||
GapMinutes = NumberField(1, 24 * 60, () => _choices.GapMinutes, n => Choices = _choices with { GapMinutes = n },
|
||||
() => SessionToolTip("Tooltips.Import.Gap"));
|
||||
MinimumFrames = NumberField(1, 1000, () => _choices.MinimumFrames, n => Choices = _choices with { MinimumFrames = n },
|
||||
() => SessionToolTip("Tooltips.Import.MinimumFrames"));
|
||||
FolderTemplate = new EditableField(_choices.FolderTemplate, t => NamingPreview.Validate(t, isFolder: true),
|
||||
t => Choices = _choices with { FolderTemplate = t }, () => Loc.L("Tooltips.Import.FolderTemplate"));
|
||||
FileTemplate = new EditableField(_choices.FileTemplate, t => NamingPreview.Validate(t, isFolder: false),
|
||||
@@ -264,6 +266,11 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
if (previous == value) return;
|
||||
_choices = value;
|
||||
if (value.Destination != previous.Destination) FolderPath.Refresh();
|
||||
if (value.Grouping != previous.Grouping)
|
||||
{
|
||||
GapMinutes.Refresh();
|
||||
MinimumFrames.Refresh();
|
||||
}
|
||||
OnPropertyChanged(string.Empty);
|
||||
if (value.NeedsNewPlan(previous) || (value.TitlesChangeNames != previous.TitlesChangeNames && _titles.Count > 0)) SchedulePlan();
|
||||
else ApplyPlan();
|
||||
@@ -320,6 +327,37 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
set => Choices = _choices with { IncludeSubfolders = value };
|
||||
}
|
||||
|
||||
/// <summary>"Group" is offered for a picked folder only (BRIEF §12.4): a card or a drive always splits into sessions.</summary>
|
||||
public bool CanGroupFolder => _selected?.Kind == SourceKind.Folder;
|
||||
|
||||
public bool GroupBySessions
|
||||
{
|
||||
get => !IsWholeFolder;
|
||||
set
|
||||
{
|
||||
if (value) SetGrouping(ImportGrouping.Sessions);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The picked folder is one sequence per format: camera bodies and pauses are ignored.</summary>
|
||||
public bool GroupWholeFolder
|
||||
{
|
||||
get => IsWholeFolder;
|
||||
set
|
||||
{
|
||||
if (value && CanGroupFolder) SetGrouping(ImportGrouping.WholeFolder);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsWholeFolder => CanGroupFolder && _choices.Grouping == ImportGrouping.WholeFolder;
|
||||
|
||||
/// <summary>Sessions, their gap and their minimum do not apply to a whole folder.</summary>
|
||||
public bool SessionsApply => !IsWholeFolder;
|
||||
|
||||
public bool GapApplies => SessionsApply && _choices.SplitSessions;
|
||||
|
||||
public string SessionsToolTip => SessionToolTip("Tooltips.Import.Sessions");
|
||||
|
||||
public bool SplitSessions
|
||||
{
|
||||
get => _choices.SplitSessions;
|
||||
@@ -340,6 +378,18 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
public IReadOnlyList<TokenItem> Tokens { get; }
|
||||
public ICommand InsertTokenCommand { get; }
|
||||
|
||||
private void SetGrouping(ImportGrouping grouping)
|
||||
{
|
||||
if (_choices.Grouping == grouping) return;
|
||||
// Splits and merges were made on the other grouping's sessions.
|
||||
_splits.Clear();
|
||||
_merges.Clear();
|
||||
Choices = _choices with { Grouping = grouping };
|
||||
}
|
||||
|
||||
/// <summary>A session control's tooltip, or why it does not apply to a whole folder.</summary>
|
||||
private string SessionToolTip(string key) => IsWholeFolder ? Loc.L("Import.Blocked.WholeFolder") : Loc.L(key);
|
||||
|
||||
/// <summary>The view tells which template field the "{ }" menu writes into.</summary>
|
||||
public void SetActiveTemplate(bool folder) => _activeTemplateIsFolder = folder;
|
||||
|
||||
@@ -966,7 +1016,8 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
{
|
||||
if (!cts.IsCancellationRequested) SetStatus(ImportPhase.Planning, Loc.Plural("Import.Status.ReadingCount", n));
|
||||
});
|
||||
var options = _choices.ToOptions(_titles, _splits, _merges);
|
||||
// A card or a drive is always planned by sessions, whatever a folder chose before.
|
||||
var options = _choices.ToOptions(_titles, _splits, _merges) with { Grouping = IsWholeFolder ? ImportGrouping.WholeFolder : ImportGrouping.Sessions };
|
||||
var cardId = _selected.Kind == SourceKind.Card ? await RegisteredCardIdAsync() : null;
|
||||
try
|
||||
{
|
||||
@@ -1083,7 +1134,10 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
else ApplyPlan();
|
||||
}
|
||||
|
||||
/// <summary>Joins a session to the earlier one of the same camera and format (BRIEF §13: merge in the plan).</summary>
|
||||
/// <summary>
|
||||
/// Joins a session to the earlier one of the same camera and format, or for a whole folder of the same format
|
||||
/// (BRIEF §13: merge in the plan).
|
||||
/// </summary>
|
||||
private void Merge(PlanSessionRow row)
|
||||
{
|
||||
_splits.Remove(row.FirstPath);
|
||||
@@ -1456,11 +1510,11 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
else dispatcher.BeginInvoke(action);
|
||||
}
|
||||
|
||||
private static EditableField NumberField(int min, int max, Func<int> current, Action<int> commit, string toolTipKey) =>
|
||||
private static EditableField NumberField(int min, int max, Func<int> current, Action<int> commit, Func<string> toolTip) =>
|
||||
new(current().ToString(Loc.Culture),
|
||||
text => int.TryParse(text.Trim(), NumberStyles.Integer, Loc.Culture, out var n) && n >= min && n <= max
|
||||
? null
|
||||
: Loc.L("Errors.Number.Range", min.ToString("N0", Loc.Culture), max.ToString("N0", Loc.Culture)),
|
||||
text => commit(int.Parse(text.Trim(), NumberStyles.Integer, Loc.Culture)),
|
||||
() => Loc.L(toolTipKey));
|
||||
toolTip);
|
||||
}
|
||||
@@ -583,6 +583,8 @@
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc About.Update.ShowFile}" Command="{Binding Shell.About.ShowPackageCommand}" ToolTip="{Binding Shell.About.ShowPackageToolTip}"
|
||||
VerticalAlignment="Center" Margin="12,0,0,0" FontSize="13"
|
||||
Visibility="{Binding Shell.About.IsPackageReady, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc About.Releases}" Command="{Binding Shell.About.OpenReleasesCommand}" ToolTip="{l:Loc Tooltips.About.Releases}"
|
||||
VerticalAlignment="Center" Margin="12,0,0,0" FontSize="13" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
@@ -646,6 +648,46 @@
|
||||
ToolTip="{l:Loc Tooltips.Settings.ResetAll}" />
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ================= About ================= -->
|
||||
<!-- BRIEF §12.9, the last page (owner review 2, R5): this copy only. The update check is on Updates, the data folder and the
|
||||
diagnostics bundle on Advanced, so nothing is offered twice. Versions, names and paths read left to right (DESIGN §5). -->
|
||||
<StackPanel Style="{StaticResource Page}" Visibility="{Binding Page, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=About}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
||||
<ui:BrandMarkIcon Width="40" Height="40" ShowPlate="True" />
|
||||
<StackPanel Margin="14,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Shell.AppName}" Style="{StaticResource Text.Title}" />
|
||||
<TextBlock Text="{Binding Shell.About.Version}" Style="{StaticResource Text.Secondary}" Margin="0,2,0,0" HorizontalAlignment="Left" FlowDirection="LeftToRight"
|
||||
Typography.NumeralAlignment="Tabular" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Build}">
|
||||
<TextBlock Text="{Binding Shell.About.Build}" HorizontalAlignment="Left" FlowDirection="LeftToRight" Typography.NumeralAlignment="Tabular" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Runtime}">
|
||||
<TextBlock Text="{Binding Shell.About.Runtime}" HorizontalAlignment="Left" FlowDirection="LeftToRight" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.System}">
|
||||
<TextBlock Text="{Binding Shell.About.OperatingSystem}" ToolTip="{Binding Shell.About.OperatingSystem}" HorizontalAlignment="Left" FlowDirection="LeftToRight"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Licence}">
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" HorizontalAlignment="Left" Content="{l:Loc About.LicenceLink}" Command="{Binding Shell.About.OpenLicenceCommand}"
|
||||
ToolTip="{l:Loc Tooltips.About.Licence}" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.ThirdParty}">
|
||||
<TextBlock Text="{l:Loc About.ThirdPartyNone}" ToolTip="{l:Loc Tooltips.About.ThirdParty}" HorizontalAlignment="Left" />
|
||||
</HeaderedContentControl>
|
||||
<!-- Every language but English is machine-translated (BRIEF §16). -->
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Translation}"
|
||||
Visibility="{Binding Shell.About.IsTranslated, Converter={StaticResource BoolToVisibility}}">
|
||||
<WrapPanel>
|
||||
<TextBlock Text="{l:Loc About.MachineTranslated}" VerticalAlignment="Center" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Review}"
|
||||
Command="{Binding Shell.About.ReviewTranslationCommand}" ToolTip="{l:Loc Tooltips.About.Review}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace Chronos.App.Sections;
|
||||
/// Archive rows show and change the open archive's own settings (archive.json, through the archive engine) and are the
|
||||
/// defaults of new archives; Import and Analysis feed the defaults of new cards and the analysis jobs; Rendering feeds
|
||||
/// the jobs from the next one on; Formats lists the decode tier per format on this PC with the codec extensions to
|
||||
/// install; Advanced restores the index from a daily backup at the next start.
|
||||
/// install; Advanced restores the index from a daily backup at the next start; About, the last page, shows this copy
|
||||
/// (<see cref="ShellViewModel.About"/>, whose update notice Updates shows).
|
||||
/// </summary>
|
||||
public sealed class SettingsViewModel : SectionViewModel
|
||||
{
|
||||
@@ -81,9 +82,12 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
new(SettingsPage.Formats, ["Settings.Formats.Title", "Settings.Formats.Column.Tier", "Settings.Formats.Install"]),
|
||||
new(SettingsPage.Storage, ["Settings.Storage.Folder", "Settings.Storage.Thumbnails", "Settings.Storage.Limit"]),
|
||||
new(SettingsPage.Server, ["Settings.Server.Default", "Settings.Server.RenderNode", "Settings.Server.Certificates"]),
|
||||
new(SettingsPage.Updates, ["Settings.General.CheckOnStart"]),
|
||||
new(SettingsPage.Updates, ["Settings.General.CheckOnStart", "Settings.Updates.Latest", "About.Update.Check", "About.Releases"]),
|
||||
new(SettingsPage.Advanced, ["Settings.Advanced.DataFolder", "Settings.Advanced.Logs", "Settings.Advanced.Diagnostics", "Settings.Advanced.Backup",
|
||||
"Settings.Advanced.Restore", "Settings.Advanced.Reset"]),
|
||||
// The translation row shows outside English only, and the language changes while Settings is open.
|
||||
new(SettingsPage.About, () => ["Shell.AppName", "About.Build", "About.Runtime", "About.System", "About.Licence", "About.ThirdParty",
|
||||
.. Shell.About.IsTranslated ? (string[])["About.Translation"] : []]),
|
||||
];
|
||||
_visiblePages = AllPages;
|
||||
|
||||
@@ -802,8 +806,11 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
|
||||
public ICommand ResetSectionCommand { get; }
|
||||
|
||||
/// <summary>Advanced holds no setting with a default (paths and actions only) and Formats only shows this PC: they have no Reset section.</summary>
|
||||
public bool CanResetSection => _page is not (SettingsPage.Advanced or SettingsPage.Formats);
|
||||
/// <summary>
|
||||
/// Advanced holds no setting with a default (paths and actions only), Formats only shows this PC and About only this
|
||||
/// copy: they have no Reset section.
|
||||
/// </summary>
|
||||
public bool CanResetSection => _page is not (SettingsPage.Advanced or SettingsPage.Formats or SettingsPage.About);
|
||||
public ICommand ExportSettingsCommand { get; }
|
||||
public ICommand ImportSettingsCommand { get; }
|
||||
|
||||
|
||||
@@ -24,11 +24,23 @@ public enum SettingsPage
|
||||
Server,
|
||||
Updates,
|
||||
Advanced,
|
||||
|
||||
/// <summary>Version, build, licence and links (BRIEF §12.9), formerly a section of the rail (owner review 2, R5).</summary>
|
||||
About,
|
||||
}
|
||||
|
||||
/// <summary>An entry of the section list: name, tooltip (what is inside) and the words the search matches.</summary>
|
||||
public sealed class SettingsPageItem(SettingsPage page, string[] keywordKeys) : ObservableObject
|
||||
/// <summary>
|
||||
/// An entry of the section list: name, tooltip (what is inside) and the words the search matches. The words are read at
|
||||
/// each search, so a row shown only in some languages (About's translation row) is found only while it shows.
|
||||
/// </summary>
|
||||
public sealed class SettingsPageItem(SettingsPage page, Func<IEnumerable<string>> keywordKeys) : ObservableObject
|
||||
{
|
||||
/// <summary>An entry whose rows always show.</summary>
|
||||
public SettingsPageItem(SettingsPage page, string[] keywordKeys)
|
||||
: this(page, () => keywordKeys)
|
||||
{
|
||||
}
|
||||
|
||||
public SettingsPage Page { get; } = page;
|
||||
|
||||
public string Label => Loc.L("Settings.Page." + Page);
|
||||
@@ -39,7 +51,7 @@ public sealed class SettingsPageItem(SettingsPage page, string[] keywordKeys) :
|
||||
public bool Matches(string text) =>
|
||||
Label.Contains(text, StringComparison.CurrentCultureIgnoreCase)
|
||||
|| ToolTip.Contains(text, StringComparison.CurrentCultureIgnoreCase)
|
||||
|| keywordKeys.Any(k => Loc.L(k).Contains(text, StringComparison.CurrentCultureIgnoreCase));
|
||||
|| keywordKeys().Any(k => Loc.L(k).Contains(text, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
internal void Refresh() => OnAllPropertiesChanged();
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public static class ScreenCapture
|
||||
await shell.Server.Sync.ReloadAsync();
|
||||
// The server's sequences without a copy here join the Library as remote cards.
|
||||
await shell.Library.RefreshAsync();
|
||||
// Settings › Updates shows the result of a check made without the network.
|
||||
shell.About.SetResult(null);
|
||||
await shell.Settings.DetectEncodersAsync();
|
||||
await shell.Settings.SelfTestAsync();
|
||||
@@ -106,6 +107,7 @@ public static class ScreenCapture
|
||||
shell.Navigate(SectionKey.Server);
|
||||
written += await SaveAsync(window, directory, "server", theme);
|
||||
|
||||
// Every page, About last (owner review 2, R5).
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
foreach (var page in Enum.GetValues<SettingsPage>())
|
||||
{
|
||||
@@ -113,9 +115,6 @@ public static class ScreenCapture
|
||||
written += await SaveAsync(window, directory, "settings-" + page.ToString().ToLowerInvariant(), theme);
|
||||
}
|
||||
|
||||
shell.Navigate(SectionKey.About);
|
||||
written += await SaveAsync(window, directory, "about", theme);
|
||||
|
||||
// Edit with no sequence open: the picker (owner review 1, R7).
|
||||
shell.Navigate(SectionKey.Edit);
|
||||
await shell.Sequence.Picker.Loading;
|
||||
|
||||
@@ -9,5 +9,4 @@
|
||||
<DataTemplate DataType="{x:Type s:JobsViewModel}"><s:JobsView /></DataTemplate>
|
||||
<DataTemplate DataType="{x:Type s:ServerViewModel}"><s:ServerView /></DataTemplate>
|
||||
<DataTemplate DataType="{x:Type s:SettingsViewModel}"><s:SettingsView /></DataTemplate>
|
||||
<DataTemplate DataType="{x:Type s:AboutViewModel}"><s:AboutView /></DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -14,7 +14,6 @@ public enum SectionKey
|
||||
Jobs,
|
||||
Server,
|
||||
Settings,
|
||||
About,
|
||||
}
|
||||
|
||||
/// <summary>A top-level destination of the navigation rail.</summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shell;
|
||||
using Chronos.App.About;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Sections;
|
||||
using Chronos.Core.Diagnostics;
|
||||
@@ -46,7 +47,8 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
Settings = new SettingsViewModel(this);
|
||||
About = new AboutViewModel(this);
|
||||
TopSections = [Library, Import, Sequence, Archive, Jobs, Server];
|
||||
BottomSections = [Settings, About];
|
||||
// About is the last page of Settings (owner review 2, R5): Settings alone docks at the bottom of the rail.
|
||||
BottomSections = [Settings];
|
||||
foreach (var section in AllSections) section.InCollapsedRail = _isRailCollapsed;
|
||||
_current = Library;
|
||||
Library.IsSelected = true;
|
||||
@@ -74,6 +76,8 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
public JobsViewModel Jobs { get; }
|
||||
public ServerViewModel Server { get; }
|
||||
public SettingsViewModel Settings { get; }
|
||||
|
||||
/// <summary>Settings › About and the update notice of Settings › Updates; it runs the update check on start.</summary>
|
||||
public AboutViewModel About { get; }
|
||||
|
||||
public IReadOnlyList<SectionViewModel> TopSections { get; }
|
||||
|
||||
Reference in new issue
Block a user