merge: integration branch into the shared fixes; every window takes its reading direction from TitanoWindow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
286 files changed
+18007
-738
No files matched your search
@@ -0,0 +1,17 @@
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.App.Import;
|
||||
|
||||
/// <summary>
|
||||
/// Paths, volume serials and other left-to-right fragments inside a sentence of a right-to-left language (BRIEF §16):
|
||||
/// without an embedding, a path that starts with a digit or ends in a separator is reordered and reads garbled.
|
||||
/// </summary>
|
||||
public static class BidiText
|
||||
{
|
||||
private const char LeftToRightEmbedding = '';
|
||||
private const char PopDirectionalFormatting = '';
|
||||
|
||||
/// <summary><paramref name="text"/> kept left to right in a right-to-left UI language; unchanged otherwise.</summary>
|
||||
public static string Ltr(string text) =>
|
||||
Loc.IsRightToLeft && text.Length > 0 ? LeftToRightEmbedding + text + PopDirectionalFormatting : text;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public sealed record CardActions(ImportDestinationKind Destination, bool IsKnown
|
||||
|
||||
/// <summary>Why each kept photo stays on the card ("IMG_0042.CR2 · the archive copy no longer matches").</summary>
|
||||
public IReadOnlyList<string> KeptReasons =>
|
||||
Erase is null ? [] : [.. Erase.Items.Where(i => i.Verdict != EraseVerdict.Delete).Select(i => Loc.L("Import.Erase.Reason", i.Candidate.SourcePath, Verdict(i.Verdict)))];
|
||||
Erase is null ? [] : [.. Erase.Items.Where(i => i.Verdict != EraseVerdict.Delete).Select(i => Loc.L("Import.Erase.Reason", BidiText.Ltr(i.Candidate.SourcePath), Verdict(i.Verdict)))];
|
||||
|
||||
public static string Verdict(EraseVerdict verdict) => Loc.L("Import.Erase.Verdict." + verdict);
|
||||
}
|
||||
@@ -55,7 +55,11 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
{
|
||||
public bool IsInserted => Device is not null || FolderPath is not null;
|
||||
|
||||
public bool IsKnown => Card is not null;
|
||||
/// <summary>
|
||||
/// The card has a nickname (BRIEF §12.4: known cards show their nickname, unknown ones ask for it). A card is
|
||||
/// remembered as soon as its first plan reads it, but stays new until it is named.
|
||||
/// </summary>
|
||||
public bool IsKnown => Card is { Nickname.Length: > 0 };
|
||||
|
||||
/// <summary>Where the photos are read from; null for a remembered card that is not inserted.</summary>
|
||||
public string? Root => Device?.Root ?? FolderPath;
|
||||
@@ -63,12 +67,13 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
/// <summary>"EOS R5 · card A", the volume label, or the drive.</summary>
|
||||
public string Title => Card?.Nickname is { Length: > 0 } nickname ? nickname
|
||||
: Device is { Label.Length: > 0 } labelled ? labelled.Label
|
||||
: Device?.Root ?? FolderPath ?? Card?.Label ?? string.Empty;
|
||||
: (Device?.Root ?? FolderPath) is { } path ? BidiText.Ltr(path)
|
||||
: Card?.Label ?? string.Empty;
|
||||
|
||||
/// <summary>"128 GB · 96.2 GB used · 4,812 photos", "no DCIM · 1.8 TB free", "Canon EOS R5 · not inserted".</summary>
|
||||
public string Subtitle => Kind switch
|
||||
{
|
||||
SourceKind.Folder => FolderPath ?? string.Empty,
|
||||
SourceKind.Folder => BidiText.Ltr(FolderPath ?? string.Empty),
|
||||
SourceKind.Drive => Loc.L("Import.Device.NoDcim", Formatting.Bytes(Device!.FreeBytes)),
|
||||
_ when Device is not null && Contents is { } contents => Loc.L("Import.Device.CardPhotos", Formatting.Bytes(Device.TotalBytes),
|
||||
Formatting.Bytes(Device.UsedBytes), Loc.Plural("Shell.Status.Photos", contents.Photos)),
|
||||
@@ -86,6 +91,12 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
_ => "Import.Device.State.New",
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// "Known card · 128 GB · 96.2 GB used · 4,812 photos": the entry's tooltip, with what its subtitle may have to cut
|
||||
/// (a drive's subtitle already says it has no DCIM).
|
||||
/// </summary>
|
||||
public string ToolTip => Kind == SourceKind.Drive ? Subtitle : string.Join(" · ", new[] { StateText, Subtitle }.Where(t => t.Length > 0));
|
||||
|
||||
/// <summary>"Canon EOS R5 · 4,812 photos": the insertion toast's line; "not yet known to Titano" for a new card.</summary>
|
||||
public string ToastText
|
||||
{
|
||||
@@ -108,7 +119,7 @@ public sealed record ImportSource(string Key, SourceKind Kind, CardDevice? Devic
|
||||
var capacity = Device?.TotalBytes ?? Card?.Capacity ?? 0;
|
||||
if (capacity > 0) parts.Add(Formatting.Bytes(capacity));
|
||||
var serial = Device?.SerialNumber ?? Card?.VolumeSerial;
|
||||
if (serial is { } s && Kind != SourceKind.Folder) parts.Add(Loc.L("Import.Device.Serial", SerialText(s)));
|
||||
if (serial is { } s && Kind != SourceKind.Folder) parts.Add(Loc.L("Import.Device.Serial", BidiText.Ltr(SerialText(s))));
|
||||
if (CameraText(Card) is { Length: > 0 } camera) parts.Add(Card?.CameraSerial is { Length: > 0 } body ? Loc.L("Import.Device.Body", camera, body) : camera);
|
||||
return string.Join(" · ", parts);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public sealed record ImportChoices
|
||||
/// <summary>True when a choice changes which photos form which session or where they go, so the card must be planned again.</summary>
|
||||
public bool NeedsNewPlan(ImportChoices previous) =>
|
||||
previous.Destination != Destination
|
||||
|| !string.Equals(previous.FolderPath, FolderPath, StringComparison.OrdinalIgnoreCase)
|
||||
|| (Destination == ImportDestinationKind.Folder && !string.Equals(previous.FolderPath, FolderPath, StringComparison.OrdinalIgnoreCase))
|
||||
|| previous.IncludeSubfolders != IncludeSubfolders
|
||||
|| previous.SplitSessions != SplitSessions
|
||||
|| (SplitSessions && previous.GapMinutes != GapMinutes)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Protocol.Client;
|
||||
|
||||
namespace Titano.App.Import;
|
||||
|
||||
/// <summary>
|
||||
/// What the Import screen says when an import or its plan stops (BRIEF §0.2 rule 6: one sentence saying what
|
||||
/// happened): a localized sentence chosen by cause. The exception's own text, which may hold full paths or several
|
||||
/// sentences, goes to the tooltip and the log only.
|
||||
/// </summary>
|
||||
public static class ImportFailures
|
||||
{
|
||||
private const int DiskFull = unchecked((int)0x80070070);
|
||||
private const int HandleDiskFull = unchecked((int)0x80070027);
|
||||
|
||||
/// <param name="source">The card or folder as the Devices list names it.</param>
|
||||
public static string Import(Exception ex, string source) => ex switch
|
||||
{
|
||||
ImportSourceUnavailableException => Loc.L("Import.Failed.SourceGone", source),
|
||||
IOException { HResult: DiskFull or HandleDiskFull } => Loc.L("Import.Failed.Full"),
|
||||
UnauthorizedAccessException => Loc.L("Import.Failed.Access"),
|
||||
TitanoApiException or HttpRequestException or UntrustedCertificateException => Loc.L("Import.Failed.Server"),
|
||||
_ => Loc.L("Import.Failed.Other"),
|
||||
};
|
||||
|
||||
/// <summary>Why the card or folder could not be planned.</summary>
|
||||
public static string Plan(Exception ex, string source) => ex switch
|
||||
{
|
||||
DirectoryNotFoundException or DriveNotFoundException or ImportSourceUnavailableException => Loc.L("Import.Failed.SourceGone", source),
|
||||
IOException or UnauthorizedAccessException => Loc.L("Import.Status.Unreadable", source),
|
||||
_ => Loc.L("Import.Status.PlanError"),
|
||||
};
|
||||
}
|
||||
@@ -13,11 +13,13 @@ public sealed record PlanTotals(int Sessions, int Photos, int CopyCount, long Co
|
||||
public bool HasEnoughSpace => FreeAfter is not < 0;
|
||||
|
||||
/// <summary>"3 sessions · 4,812 photos · 96.2 GB · about 12 min".</summary>
|
||||
public string Text => string.Join(" · ",
|
||||
public string Text => SummaryText + " · " + Loc.L("Import.Plan.About", Formatting.Duration(Estimate));
|
||||
|
||||
/// <summary>"3 sessions · 4,812 photos · 96.2 GB": the plan without its time estimate.</summary>
|
||||
public string SummaryText => string.Join(" · ",
|
||||
Loc.Plural("Import.Plan.Sessions", Sessions),
|
||||
Loc.Plural("Shell.Status.Photos", Photos),
|
||||
Formatting.Bytes(CopyBytes),
|
||||
Loc.L("Import.Plan.About", Formatting.Duration(Estimate)));
|
||||
Formatting.Bytes(CopyBytes));
|
||||
|
||||
/// <summary>"0 duplicates" (already in the archive by hash).</summary>
|
||||
public string DuplicatesText => Loc.Plural("Import.Plan.Duplicates", Duplicates);
|
||||
@@ -51,9 +53,21 @@ public enum PlanRowKind
|
||||
File,
|
||||
}
|
||||
|
||||
/// <summary>A line of "Show plan": a session heading or one file and its destination.</summary>
|
||||
/// <summary>A line of "Show plan": a session heading and its folder, or one file (card path) and its destination path.</summary>
|
||||
/// <param name="CanSplit">A file that is not the first of its session: a new session can start there.</param>
|
||||
public sealed record PlanDetailRow(PlanRowKind Kind, string Source, string Destination, string ActionText, string SizeText, bool IsSkipped, bool CanSplit);
|
||||
public sealed record PlanDetailRow(PlanRowKind Kind, string Source, string Destination, string ActionText, string SizeText, bool IsSkipped, bool CanSplit)
|
||||
{
|
||||
/// <summary>A file's name on the card (its session heading shows the rest); the heading itself for a session.</summary>
|
||||
public string SourceText => Kind == PlanRowKind.File ? NameOf(Source) : Source;
|
||||
|
||||
/// <summary>The file's new name (its session shows the folder); the folder for a session.</summary>
|
||||
public string DestinationText => Kind == PlanRowKind.File ? NameOf(Destination) : Destination;
|
||||
|
||||
/// <summary>"Split at IMG_0042.JPG": the row's split button as screen readers announce it.</summary>
|
||||
public string SplitName => Loc.L("Import.Details.SplitName", SourceText);
|
||||
|
||||
private static string NameOf(string path) => path[(path.LastIndexOf('/') + 1)..];
|
||||
}
|
||||
|
||||
/// <summary>Everything "Show plan" lists: every file to its destination, the totals and the conflicts.</summary>
|
||||
public sealed record PlanDetails(IReadOnlyList<PlanDetailRow> Rows, string TotalsText, IReadOnlyList<string> Conflicts);
|
||||
@@ -154,7 +168,7 @@ public static class ImportPlans
|
||||
}
|
||||
var totals = Totals(plan, verify);
|
||||
var conflicts = new List<string>();
|
||||
foreach (var problem in plan.Problems) conflicts.Add(Loc.L("Import.Details.Unreadable", problem.RelativePath, problem.Message));
|
||||
foreach (var problem in plan.Problems) conflicts.Add(Loc.L("Import.Details.Unreadable", BidiText.Ltr(problem.RelativePath), problem.Message));
|
||||
if (totals.Duplicates > 0) conflicts.Add(totals.DuplicatesText);
|
||||
if (!totals.HasEnoughSpace) conflicts.Add(totals.SpaceText);
|
||||
var text = string.Join(" · ", new[]
|
||||
@@ -209,9 +223,13 @@ public static class ImportPlans
|
||||
_ => Loc.L("Import.Action.Copy"),
|
||||
};
|
||||
|
||||
/// <summary>"28/09/2026 · 18:02 → 20:04".</summary>
|
||||
/// <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.
|
||||
/// </summary>
|
||||
private static string TimeText(PlannedSession s) =>
|
||||
Loc.L("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.TimeRtl" : "Import.Session.Time", Formatting.Date(s.Start), s.Start.ToString("t", Loc.Culture),
|
||||
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)
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
|
||||
_device = device;
|
||||
Outcome = outcome;
|
||||
_actions = new CardActions(choices.Destination, card is not null, device is not null, device?.IsRemovable == true, outcome, null, null);
|
||||
Failures = [.. outcome.Failures.Take(ListedFailures).Select(f => Loc.L("Import.Result.Failure", f.SourcePath, f.Message))];
|
||||
Failures = [.. outcome.Failures.Take(ListedFailures).Select(f => Loc.L("Import.Result.Failure", BidiText.Ltr(f.SourcePath), f.Message))];
|
||||
CheckCommand = new AsyncRelayCommand(CheckAsync, () => _actions.CanCheck && !_isBusy);
|
||||
DeleteCommand = new AsyncRelayCommand(DeleteAsync, () => _actions.CanDelete && !_isBusy);
|
||||
FormatCommand = new AsyncRelayCommand(FormatAsync, () => _actions.CanFormat && !_isBusy);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Titano.App.Sections;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Data;
|
||||
|
||||
namespace Titano.App.Import;
|
||||
@@ -28,6 +27,8 @@ public static class ImportScenes
|
||||
switch (state)
|
||||
{
|
||||
case "inserted":
|
||||
// Each theme pass starts as the first: the new card of "newcard" is not remembered yet.
|
||||
await ForgetAsync(shell, SampleCards.NewCard(data).Identity);
|
||||
await ShowPlanAsync(import, SampleCards.Card(data));
|
||||
await import.CardInsertedAsync(SampleCards.Card(data));
|
||||
break;
|
||||
@@ -43,7 +44,7 @@ public static class ImportScenes
|
||||
import.ShowRunning(new ImportProgress(31, plan.FileCount, plan.CopyBytes * 31 / plan.FileCount, plan.CopyBytes, 31, 0, 0, null));
|
||||
break;
|
||||
case "failed":
|
||||
import.ShowFailed(Loc.L("Archive.Error.SourceGone", SampleCards.Card(data).Root));
|
||||
import.ShowFailed(new ImportSourceUnavailableException(SampleCards.Card(data).Root));
|
||||
break;
|
||||
case "done":
|
||||
await ShowPlanAsync(import, SampleCards.Card(data));
|
||||
@@ -83,7 +84,7 @@ public static class ImportScenes
|
||||
|
||||
private static ImportPlan Plan(ImportViewModel import) => import.Plan ?? throw new InvalidOperationException("The sample card has no plan.");
|
||||
|
||||
/// <summary>The new card stays new in every theme: an earlier state registered it on its first plan.</summary>
|
||||
/// <summary>The new card stays new in every theme: its first plan in an earlier pass registered it.</summary>
|
||||
private static async Task ForgetAsync(ShellViewModel shell, string identity)
|
||||
{
|
||||
if (shell.Services.Database is not { } db || await db.MediaCards.FindByIdentityAsync(identity) is not { } known) return;
|
||||
|
||||
@@ -51,4 +51,10 @@ public sealed class ImportSessionRowViewModel : ObservableObject
|
||||
public string MergeToolTip => !IsEditable ? Loc.L("Import.Blocked.Copying")
|
||||
: Row.MergesInto is { } target ? Loc.L("Tooltips.Import.Merge", target)
|
||||
: string.Empty;
|
||||
|
||||
/// <summary>"Sequence of session 2": the title field as screen readers announce it, one per row.</summary>
|
||||
public string TitleName => Loc.L("Import.Session.TitleName", Row.Number);
|
||||
|
||||
/// <summary>"Merge session 2".</summary>
|
||||
public string MergeName => Loc.L("Import.Session.MergeName", Row.Number);
|
||||
}
|
||||
@@ -56,4 +56,10 @@ public static class Formatting
|
||||
|
||||
/// <summary>Camera wall-clock date in the culture's short format.</summary>
|
||||
public static string Date(DateTime wallClock) => wallClock.ToString("d", Loc.Culture);
|
||||
|
||||
/// <summary>
|
||||
/// A path, address or fingerprint kept left to right inside right-to-left text (a Unicode left-to-right embedding),
|
||||
/// so its separators and digits stay in place; it reads unchanged in left-to-right languages.
|
||||
/// </summary>
|
||||
public static string LeftToRight(string text) => "" + text + "";
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.App.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// A status line screen readers announce when it changes (a live region): <c>LiveRegion.Text</c> becomes the element's
|
||||
/// accessible name and every later change raises <see cref="AutomationEvents.LiveRegionChanged"/>. The element's
|
||||
/// <see cref="AutomationProperties.LiveSettingProperty"/> (Polite, or Assertive for errors) must be set as well.
|
||||
/// </summary>
|
||||
public static class LiveRegion
|
||||
{
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached(
|
||||
"Text", typeof(string), typeof(LiveRegion), new PropertyMetadata(null, OnTextChanged));
|
||||
|
||||
/// <summary>
|
||||
/// The data and language the last text came from: a recycled list row showing another item, or every status
|
||||
/// relabelled by a language switch, is not news.
|
||||
/// </summary>
|
||||
private static readonly DependencyProperty SourceProperty = DependencyProperty.RegisterAttached(
|
||||
"Source", typeof(Origin), typeof(LiveRegion), new PropertyMetadata(null));
|
||||
|
||||
public static string? GetText(DependencyObject element) => (string?)element.GetValue(TextProperty);
|
||||
|
||||
public static void SetText(DependencyObject element, string? value) => element.SetValue(TextProperty, value);
|
||||
|
||||
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is not FrameworkElement element) return;
|
||||
AutomationProperties.SetName(element, (string?)e.NewValue ?? string.Empty);
|
||||
var origin = new Origin(element.DataContext, Loc.Culture);
|
||||
var sameSource = element.GetValue(SourceProperty) is Origin last && ReferenceEquals(last.Data, origin.Data) && last.Culture.Equals(origin.Culture);
|
||||
element.SetValue(SourceProperty, origin);
|
||||
// The first value arrives with the screen: only what changes while it is shown is announced, once layout has shown
|
||||
// it (a status that appears with its text is still collapsed when the text arrives).
|
||||
if (!sameSource || !element.IsLoaded || e.NewValue is null || !AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged)) return;
|
||||
element.Dispatcher.InvokeAsync(() => UIElementAutomationPeer.CreatePeerForElement(element)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged),
|
||||
DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
private sealed record Origin(object? Data, CultureInfo Culture);
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Switches the UI language at run time without restart (BRIEF §16). A <see cref="Ui.Controls.TitanoWindow"/> takes
|
||||
/// the language's direction when it is created and follows each switch, so right-to-left languages mirror windows
|
||||
/// opened before and after this call alike.
|
||||
/// Switches the UI language at run time without restart (BRIEF §16). A <see cref="TitanoWindow"/> takes the
|
||||
/// language's direction when it is created and follows each switch, so right-to-left languages mirror windows opened
|
||||
/// before and after this call alike; plain windows (the full-screen preview) take it when they load.
|
||||
/// </summary>
|
||||
public static class UiLanguage
|
||||
{
|
||||
static UiLanguage()
|
||||
{
|
||||
EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent, new RoutedEventHandler((sender, _) => ((Window)sender).FlowDirection = Bidi.UiDirection));
|
||||
}
|
||||
|
||||
/// <summary>Applies <paramref name="code"/> (or the OS language when null) and returns the culture in use.</summary>
|
||||
public static CultureInfo Apply(string? code)
|
||||
{
|
||||
|
||||
@@ -132,6 +132,9 @@ public sealed class JobListModel
|
||||
|
||||
public int RunningCount => _entries.Values.Count(e => e.State == JobState.Running);
|
||||
|
||||
/// <summary>Running jobs claimed by this machine's workers (<paramref name="localWorkerId"/>), not by render nodes or other PCs.</summary>
|
||||
public int RunningOn(string localWorkerId) => _entries.Values.Count(e => e.State == JobState.Running && JobText.IsLocal(e.Job.NodeId, localWorkerId));
|
||||
|
||||
public int QueuedCount => _entries.Values.Count(e => e.State == JobState.Queued);
|
||||
|
||||
/// <summary>Same order as <c>JobRepository.ClaimNextAsync</c>: priority descending, then creation time and id.</summary>
|
||||
|
||||
@@ -8,8 +8,8 @@ using Titano.Ui.Mvvm;
|
||||
|
||||
namespace Titano.App.Jobs;
|
||||
|
||||
/// <summary>A row action: label, tooltip and command (26-px row buttons, DESIGN §4 tables).</summary>
|
||||
public sealed record JobAction(string Text, string ToolTip, ICommand Command, bool IsDestructive = false);
|
||||
/// <summary>A row action: label, tooltip, the name screen readers hear (label and row) and command (26-px row buttons, DESIGN §4 tables).</summary>
|
||||
public sealed record JobAction(string Text, string ToolTip, string AccessibleName, ICommand Command);
|
||||
|
||||
/// <summary>One row of the Jobs table (Jobs.html): kind, target, progress, speed, left, where, state, actions, log.</summary>
|
||||
public sealed class JobRowViewModel : ObservableObject
|
||||
@@ -36,6 +36,9 @@ public sealed class JobRowViewModel : ObservableObject
|
||||
|
||||
public string Target => _entry.Job.TargetLabel ?? string.Empty;
|
||||
|
||||
/// <summary>"Render · Harbour sunset → 4K HEVC": the row's name for screen readers.</summary>
|
||||
public string AccessibleName => JobText.Name(_entry.Job);
|
||||
|
||||
/// <summary>Progress 0…1 (0 while unknown).</summary>
|
||||
public double Progress => _entry.State == JobState.Done ? 1 : _entry.Fraction ?? 0;
|
||||
|
||||
@@ -50,6 +53,9 @@ public sealed class JobRowViewModel : ObservableObject
|
||||
|
||||
public string StateText => JobText.State(_entry);
|
||||
|
||||
/// <summary>"Render · Harbour sunset: done · 3:00": what a screen reader announces when the state changes (not progress).</summary>
|
||||
public string StateAnnouncement => Loc.L("Jobs.Row.State", AccessibleName, StateText);
|
||||
|
||||
/// <summary>Glyph and colour of the state (paired with the word, never colour alone).</summary>
|
||||
public StatusKind StateKind => _entry.State switch
|
||||
{
|
||||
@@ -81,12 +87,16 @@ public sealed class JobRowViewModel : ObservableObject
|
||||
{
|
||||
if (!Set(ref _isExpanded, value)) return;
|
||||
OnPropertyChanged(nameof(ToggleToolTip));
|
||||
OnPropertyChanged(nameof(ToggleName));
|
||||
if (value) _ = _actions.LoadLogAsync(this);
|
||||
}
|
||||
}
|
||||
|
||||
public string ToggleToolTip => Loc.L(_isExpanded ? "Tooltips.Jobs.HideLog" : "Tooltips.Jobs.ShowLog");
|
||||
|
||||
/// <summary>"Show log: Render · Harbour sunset": the expander names its row.</summary>
|
||||
public string ToggleName => Loc.L("Jobs.ActionFor", Loc.L(_isExpanded ? "Jobs.Log.Hide" : "Jobs.Log.Show"), AccessibleName);
|
||||
|
||||
/// <summary>The last lines of the job log, plus the live message while it runs.</summary>
|
||||
public string LogText
|
||||
{
|
||||
@@ -124,6 +134,7 @@ public sealed class JobRowViewModel : ObservableObject
|
||||
OnPropertyChanged(nameof(LeftText));
|
||||
OnPropertyChanged(nameof(WhereText));
|
||||
OnPropertyChanged(nameof(StateText));
|
||||
OnPropertyChanged(nameof(StateAnnouncement));
|
||||
if (_isExpanded) OnPropertyChanged(nameof(LogText));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,21 @@ public static class JobText
|
||||
public static string Where(string? nodeId, string localWorkerId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(nodeId)) return string.Empty;
|
||||
return IsLocal(nodeId, localWorkerId) ? Loc.L("Jobs.Where.ThisPc") : NodeName(nodeId);
|
||||
}
|
||||
|
||||
/// <summary>The job was claimed by one of this machine's numbered workers ("node#0", "node#1", …).</summary>
|
||||
public static bool IsLocal(string? nodeId, string localWorkerId) =>
|
||||
!string.IsNullOrEmpty(nodeId) && NodeName(nodeId).Equals(localWorkerId, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>"Kind: target" ("Render: Harbour sunset → 4K HEVC"), what a row is called for screen readers.</summary>
|
||||
public static string Name(Job job) =>
|
||||
string.IsNullOrWhiteSpace(job.TargetLabel) ? Kind(job.Kind) : Loc.L("Jobs.Row.Name", Kind(job.Kind), job.TargetLabel);
|
||||
|
||||
private static string NodeName(string nodeId)
|
||||
{
|
||||
var hash = nodeId.IndexOf('#', StringComparison.Ordinal);
|
||||
var name = hash < 0 ? nodeId : nodeId[..hash];
|
||||
return name.Equals(localWorkerId, StringComparison.OrdinalIgnoreCase) ? Loc.L("Jobs.Where.ThisPc") : name;
|
||||
return hash < 0 ? nodeId : nodeId[..hash];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui">
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:infra="clr-namespace:Titano.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" />
|
||||
<!-- The mark keeps its clockwise ring and its sun on the right in every reading direction. -->
|
||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" FlowDirection="LeftToRight" />
|
||||
<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" />
|
||||
@@ -35,14 +37,16 @@
|
||||
<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}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<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}" />
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding DataFolder}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<!-- 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}}">
|
||||
@@ -53,7 +57,8 @@
|
||||
<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}}" />
|
||||
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}}" />
|
||||
|
||||
@@ -81,6 +81,9 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>What screen readers announce: each new state, not each percent of a download.</summary>
|
||||
public string? UpdateAnnouncement => _update.State == UpdateState.Downloading ? Loc.L("About.Update.InProgress") : UpdateText;
|
||||
|
||||
public StatusKind UpdateKind => _update.State switch
|
||||
{
|
||||
UpdateState.Checking or UpdateState.Downloading => StatusKind.Running,
|
||||
@@ -137,6 +140,7 @@ public sealed class AboutViewModel : SectionViewModel
|
||||
private void RaiseUpdate()
|
||||
{
|
||||
OnPropertyChanged(nameof(UpdateText));
|
||||
OnPropertyChanged(nameof(UpdateAnnouncement));
|
||||
OnPropertyChanged(nameof(UpdateKind));
|
||||
OnPropertyChanged(nameof(HasUpdateText));
|
||||
OnPropertyChanged(nameof(IsUpdateAvailable));
|
||||
|
||||
@@ -9,14 +9,28 @@
|
||||
<KeyBinding Key="Enter" Modifiers="Control" Command="{Binding StartCommand}" />
|
||||
</UserControl.InputBindings>
|
||||
<UserControl.Resources>
|
||||
<!-- Devices list entry (Import.html): 54 px, Surface fill, Stroke border; selected = accent border. -->
|
||||
<!-- Keyboard focus drawn inside the element: an outer ring would be clipped by the scroll viewer around lists. -->
|
||||
<Style x:Key="Focus.Inset">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="2" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Devices list entry (Import.html): 54 px, Surface fill, Stroke border; selected = accent border; disabled while copying. -->
|
||||
<Style x:Key="ListBoxItem.Device" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||
<Setter Property="Height" Value="54" />
|
||||
<Setter Property="Margin" Value="0,0,0,8" />
|
||||
<Setter Property="Padding" Value="12,0" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Surface}" />
|
||||
<Setter Property="ToolTip" Value="{Binding StateText}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.HelpText" Value="{Binding ToolTip}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
@@ -32,10 +46,18 @@
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="ToolTip" Value="{l:Loc Import.Blocked.Copying}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- One form line: a label column at least 116 px wide, as wide as the longest label of the form, then the controls (Import.html grid). -->
|
||||
@@ -68,15 +90,82 @@
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
|
||||
<Setter Property="Margin" Value="0,4,18,4" />
|
||||
</Style>
|
||||
|
||||
<!-- Unit words beside a field ("gap … min"): dimmed with the field they belong to. -->
|
||||
<Style x:Key="Text.Unit" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--
|
||||
Up to four digits (gap ≤ 1440). The kit's text box applies its padding twice (reported to the shared controls),
|
||||
so the side padding is halved here: four digits fit before and after that fix.
|
||||
-->
|
||||
<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" />
|
||||
</Style>
|
||||
|
||||
<!-- Session table columns, shared by header and rows. -->
|
||||
<!-- File paths and name templates stay left to right in every language (BRIEF §16). -->
|
||||
<Style x:Key="TextBox.NameTemplate" TargetType="TextBox" BasedOn="{StaticResource TextBox.Mono}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
</Style>
|
||||
|
||||
<!-- The folder path is in use only with the Folder destination (Import.html: faint text otherwise). -->
|
||||
<Style x:Key="TextBox.FolderPath" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||
<Setter Property="Width" Value="190" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsFolderDestination}" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextFaint}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- A path or file name in a cell: left to right, at the start of the cell in either direction. -->
|
||||
<Style x:Key="Text.CellPath" TargetType="TextBlock" BasedOn="{StaticResource Text.Cell}">
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
</Style>
|
||||
|
||||
<!-- Numbers stay right-aligned in tables in both directions. -->
|
||||
<Style x:Key="Text.CellNumberLtr" TargetType="TextBlock" BasedOn="{StaticResource Text.CellNumber}">
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
</Style>
|
||||
<Style x:Key="Text.HeaderNumber" TargetType="TextBlock" BasedOn="{StaticResource Text.Header}">
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter Property="TextAlignment" Value="Right" />
|
||||
</Style>
|
||||
|
||||
<!-- Row actions (DESIGN §4 tables): revealed on the row it acts on, still in the tab order. -->
|
||||
<Style x:Key="Button.RowAction" TargetType="Button" BasedOn="{StaticResource Button.Row}">
|
||||
<Setter Property="Opacity" Value="0" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Session table rows (36 px). -->
|
||||
<Style x:Key="Session.Grid" TargetType="Grid">
|
||||
<Setter Property="Height" Value="34" />
|
||||
<Setter Property="Height" Value="36" />
|
||||
</Style>
|
||||
<Style x:Key="ListBoxItem.Session" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Row.TimeText}" />
|
||||
@@ -84,15 +173,19 @@
|
||||
<!-- Show plan and failure rows: focusable, so the arrow keys move through a long list. -->
|
||||
<Style x:Key="ListBoxItem.PlanRow" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Source}" />
|
||||
<Setter Property="AutomationProperties.HelpText" Value="{Binding Destination}" />
|
||||
</Style>
|
||||
<Style x:Key="ListBoxItem.Failure" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding}" />
|
||||
</Style>
|
||||
|
||||
<!-- "Folder…" (Import.html): transparent, 1 px dashed Stroke border. -->
|
||||
<Style x:Key="Button.Dashed" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
@@ -104,9 +197,6 @@
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Edge" Property="Fill" Value="{DynamicResource Brush.Card}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter TargetName="Edge" Property="Stroke" Value="{DynamicResource Brush.Accent}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4" />
|
||||
</Trigger>
|
||||
@@ -124,18 +214,19 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- ===================== Devices ===================== -->
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top" Height="32" Margin="0,0,0,8">
|
||||
<!-- ===================== Devices (declared top to bottom: the tab order follows) ===================== -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel Height="32" Margin="0,0,0,8">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Icon}" ui:ButtonIcon.Glyph="{StaticResource Icon.Refresh}" Command="{Binding RefreshCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Import.Refresh}" AutomationProperties.Name="{l:Loc Import.Devices.Refresh}" />
|
||||
<TextBlock Text="{l:Loc Import.Devices.Title}" Style="{StaticResource Text.Section}" VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
<CheckBox DockPanel.Dock="Bottom" Margin="0,8,0,0" IsChecked="{Binding AutoImport}" IsEnabled="{Binding CanAutoImport}" ToolTip="{Binding AutoImportToolTip}"
|
||||
VerticalContentAlignment="Top">
|
||||
<TextBlock Text="{l:Loc Import.Devices.Auto}" TextWrapping="Wrap" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</CheckBox>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Focusable="False" IsEnabled="{Binding CanChangeSource}">
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" Focusable="False" IsEnabled="{Binding CanChangeSource}">
|
||||
<StackPanel>
|
||||
<ListBox ItemsSource="{Binding Sources}" SelectedItem="{Binding SelectedSource}" ItemContainerStyle="{StaticResource ListBoxItem.Device}"
|
||||
AutomationProperties.Name="{l:Loc Import.Devices.Title}">
|
||||
@@ -158,7 +249,7 @@
|
||||
<TextBlock Text="{Binding Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{Binding Subtitle}" Style="{StaticResource Text.Secondary}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" />
|
||||
</StackPanel>
|
||||
<ui:StatusGlyph x:Name="State" Grid.Column="2" Kind="Online" Margin="8,0,0,0" VerticalAlignment="Center" ToolTip="{Binding StateText}" />
|
||||
<ui:StatusGlyph x:Name="State" Grid.Column="2" Kind="Online" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Kind}" Value="Drive">
|
||||
@@ -181,7 +272,8 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Button Style="{StaticResource Button.Dashed}" Height="44" HorizontalContentAlignment="Left" Command="{Binding PickFolderCommand}" ToolTip="{l:Loc Tooltips.Import.Folder}">
|
||||
<Button x:Name="FolderSourceButton" Style="{StaticResource Button.Dashed}" Height="44" HorizontalContentAlignment="Left" Command="{Binding PickFolderCommand}"
|
||||
ToolTip="{Binding FolderSourceToolTip}" AutomationProperties.Name="{l:Loc Import.Devices.Folder}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:Icon Glyph="{StaticResource Icon.Folder}" Margin="0,0,10,0" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<TextBlock Text="{l:Loc Import.Devices.Folder}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
@@ -189,7 +281,11 @@
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
<CheckBox Grid.Row="2" Margin="0,8,0,0" IsChecked="{Binding AutoImport}" IsEnabled="{Binding CanAutoImport}" ToolTip="{Binding AutoImportToolTip}"
|
||||
VerticalContentAlignment="Top" AutomationProperties.Name="{l:Loc Import.Devices.Auto}">
|
||||
<TextBlock Text="{l:Loc Import.Devices.Auto}" TextWrapping="Wrap" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
|
||||
<!-- ===================== Profile, form and plan ===================== -->
|
||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="20,16">
|
||||
@@ -200,9 +296,22 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Profile header: nickname (or its field for a new card), identity, Edit ▾. -->
|
||||
<DockPanel Margin="0,0,0,14" MinHeight="32">
|
||||
<Button x:Name="EditButton" DockPanel.Dock="Right" Click="OnOpenMenu" IsEnabled="{Binding CanEditProfile}" ToolTip="{Binding EditToolTip}">
|
||||
<!-- Profile header: nickname (or its field for a new card), identity, Edit ▾ (declared in reading order for Tab). -->
|
||||
<Grid Margin="0,0,0,14" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding SourceTitle}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" MaxWidth="320" TextTrimming="CharacterEllipsis"
|
||||
Visibility="{Binding IsNicknameOpen, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<TextBox x:Name="NicknameBox" Width="240" Text="{Binding Nickname.Text, UpdateSourceTrigger=PropertyChanged}" shell:EditBehavior.Field="{Binding Nickname}"
|
||||
ui:Field.Placeholder="{l:Loc Import.Profile.Nickname}" ToolTip="{Binding Nickname.ToolTip}" AutomationProperties.Name="{l:Loc Import.Profile.Nickname}"
|
||||
Visibility="{Binding IsNicknameOpen, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding IdentityText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="12,0,12,0"
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding IdentityText}" />
|
||||
<Button x:Name="EditButton" Grid.Column="2" Click="OnOpenMenu" IsEnabled="{Binding CanEditProfile}" ToolTip="{Binding EditToolTip}"
|
||||
AutomationProperties.Name="{l:Loc Import.Profile.Edit}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{l:Loc Import.Profile.Edit}" VerticalAlignment="Center" />
|
||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
|
||||
@@ -226,16 +335,7 @@
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding SourceTitle}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" MaxWidth="320" TextTrimming="CharacterEllipsis"
|
||||
Visibility="{Binding IsNicknameOpen, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<TextBox x:Name="NicknameBox" Width="240" Text="{Binding Nickname.Text, UpdateSourceTrigger=PropertyChanged}" shell:EditBehavior.Field="{Binding Nickname}"
|
||||
ui:Field.Placeholder="{l:Loc Import.Profile.Nickname}" ToolTip="{Binding Nickname.ToolTip}" AutomationProperties.Name="{l:Loc Import.Profile.Nickname}"
|
||||
Visibility="{Binding IsNicknameOpen, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding IdentityText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="12,0,12,0"
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding IdentityText}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- The form (Import.html grid). -->
|
||||
<StackPanel Grid.Row="1" IsEnabled="{Binding IsFormEnabled}" Grid.IsSharedSizeScope="True">
|
||||
@@ -245,12 +345,14 @@
|
||||
IsEnabled="{Binding CanUseArchive}" ToolTip="{Binding ArchiveToolTip}" />
|
||||
<RadioButton GroupName="Destination" Content="{l:Loc Import.Destination.Folder}" IsChecked="{Binding IsFolderDestination}"
|
||||
ToolTip="{l:Loc Tooltips.Import.FolderDestination}" Margin="0,4,8,4" />
|
||||
<TextBox Width="190" Height="30" Text="{Binding FolderPath.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding FolderPath}" ToolTip="{Binding FolderPath.ToolTip}" AutomationProperties.Name="{l:Loc Import.Destination.Folder}"
|
||||
<TextBox x:Name="FolderPathBox" Style="{StaticResource TextBox.FolderPath}"
|
||||
Text="{Binding FolderPath.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding FolderPath}"
|
||||
ToolTip="{Binding FolderPath.ToolTip}" AutomationProperties.Name="{l:Loc Import.Destination.FolderPlaceholder}"
|
||||
ui:Field.Placeholder="{l:Loc Import.Destination.FolderPlaceholder}" />
|
||||
<Button Style="{StaticResource Button.Icon}" Width="30" MinWidth="30" Height="30" Margin="6,0,18,0" Content="…" Command="{Binding ChooseDestinationCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Import.ChooseFolder}" AutomationProperties.Name="{l:Loc Import.Destination.Choose}" />
|
||||
<RadioButton GroupName="Destination" IsChecked="{Binding IsServerDestination}" IsEnabled="{Binding CanUseServer}" ToolTip="{Binding ServerToolTip}">
|
||||
<RadioButton GroupName="Destination" IsChecked="{Binding IsServerDestination}" IsEnabled="{Binding CanUseServer}" ToolTip="{Binding ServerToolTip}"
|
||||
AutomationProperties.Name="{Binding ServerChoiceName}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{l:Loc Import.Destination.Server}" />
|
||||
<ui:Icon Glyph="{StaticResource Icon.Server}" Margin="10,0,6,0" Foreground="{DynamicResource Brush.Accent}" />
|
||||
@@ -265,16 +367,16 @@
|
||||
<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}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Gap}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
<TextBox Style="{StaticResource TextBox.Small}" Text="{Binding GapMinutes.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<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}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minutes}" Style="{StaticResource Text.Unit}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minimum}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
<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}" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Frames}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Frames}" Style="{StaticResource Text.Unit}" />
|
||||
</StackPanel>
|
||||
<CheckBox Content="{l:Loc Import.Scan.Verify}" IsChecked="{Binding VerifyCopies}" ToolTip="{l:Loc Tooltips.Import.Verify}" />
|
||||
</WrapPanel>
|
||||
@@ -289,11 +391,11 @@
|
||||
<ColumnDefinition Width="*" MinWidth="140" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Mono}" Height="30" Text="{Binding FolderTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<TextBox Style="{StaticResource TextBox.NameTemplate}" Text="{Binding FolderTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding FolderTemplate}" ToolTip="{Binding FolderTemplate.ToolTip}" GotKeyboardFocus="OnFolderTemplateFocus"
|
||||
AutomationProperties.Name="{l:Loc Import.Names.Folder}" />
|
||||
<TextBlock Grid.Column="1" Text="/" Foreground="{DynamicResource Brush.TextFaint}" Margin="10,0" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="2" Style="{StaticResource TextBox.Mono}" Height="30"
|
||||
<TextBlock Grid.Column="1" Text="/" Style="{StaticResource Text.Unit}" Foreground="{DynamicResource Brush.TextFaint}" Margin="10,0" />
|
||||
<TextBox Grid.Column="2" Style="{StaticResource TextBox.NameTemplate}"
|
||||
Text="{Binding FileTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding FileTemplate}"
|
||||
ToolTip="{Binding FileTemplate.ToolTip}" GotKeyboardFocus="OnFileTemplateFocus" AutomationProperties.Name="{l:Loc Import.Names.File}" />
|
||||
<Button x:Name="TokensButton" Grid.Column="3" Style="{StaticResource Button.Icon}" Width="30" MinWidth="30" Height="30" Margin="10,0,0,0" Content="{}{ }"
|
||||
@@ -313,7 +415,7 @@
|
||||
</Button>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding NamePreview}" Style="{StaticResource Text.Secondary}" Foreground="{DynamicResource Brush.TextFaint}" Margin="0,6,0,0"
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding NamePreview}" />
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding NamePreview}" FlowDirection="LeftToRight" HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
@@ -361,11 +463,15 @@
|
||||
Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" ToolTip="{Binding TotalsText}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- No source, reading the card, or the reason no plan can be made. -->
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding ShowsStatus, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding StatusText}" Foreground="{DynamicResource Brush.TextMuted}" TextAlignment="Center" TextWrapping="Wrap" MaxWidth="420" />
|
||||
<ProgressBar IsIndeterminate="{Binding IsBusyPlanning}" Width="240" Margin="0,12,0,0"
|
||||
<!-- No source, reading the card, or the reason no plan can be made: one sentence and one action. -->
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" MaxWidth="420"
|
||||
Visibility="{Binding ShowsStatus, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock x:Name="StatusLine" Text="{Binding StatusText, NotifyOnTargetUpdated=True}" ToolTip="{Binding StatusDetail}" Foreground="{DynamicResource Brush.TextMuted}"
|
||||
TextAlignment="Center" TextWrapping="Wrap" AutomationProperties.LiveSetting="Polite" />
|
||||
<ProgressBar IsIndeterminate="{Binding IsBusyPlanning}" Width="240" Margin="0,12,0,0" AutomationProperties.LabeledBy="{Binding ElementName=StatusLine}"
|
||||
Visibility="{Binding IsBusyPlanning, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button x:Name="StatusActionButton" Content="{Binding StatusActionText}" Command="{Binding StatusActionCommand}" ToolTip="{Binding StatusActionToolTip}"
|
||||
HorizontalAlignment="Center" Margin="0,12,0,0" Visibility="{Binding HasStatusAction, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Sessions of the plan with editable titles. -->
|
||||
@@ -374,53 +480,59 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid TextElement.FontSize="12" Margin="0,0,0,4">
|
||||
<!-- The right margin is the list's scroll bar (always shown, 10 px), so header and cells line up. -->
|
||||
<Grid TextElement.FontSize="12" Margin="0,0,10,4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.35*" MinWidth="110" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="110" SharedSizeGroup="SessionTime" />
|
||||
<ColumnDefinition Width="0.85*" MinWidth="70" />
|
||||
<ColumnDefinition Width="0.6*" MinWidth="56" />
|
||||
<ColumnDefinition Width="0.8*" MinWidth="64" />
|
||||
<ColumnDefinition Width="1.9*" MinWidth="150" />
|
||||
<ColumnDefinition Width="0.9*" MinWidth="64" />
|
||||
<ColumnDefinition Width="1.6*" MinWidth="150" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="SessionAction" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Session}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Frames}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Size}" Margin="10,0,0,0" TextAlignment="Right" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.HeaderNumber}" Text="{l:Loc Import.Session.Column.Size}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Camera}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Sequence}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Sessions}" ItemContainerStyle="{StaticResource ListBoxItem.Session}" AutomationProperties.Name="{l:Loc Import.Plan.Title}"
|
||||
KeyboardNavigation.TabNavigation="Continue">
|
||||
<ListBox x:Name="SessionRows" Grid.Row="1" ItemsSource="{Binding Sessions}" ItemContainerStyle="{StaticResource ListBoxItem.Session}"
|
||||
AutomationProperties.Name="{l:Loc Import.Plan.Title}" KeyboardNavigation.TabNavigation="Continue" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type imp:ImportSessionRowViewModel}">
|
||||
<Grid Style="{StaticResource Session.Grid}" TextElement.FontSize="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.35*" MinWidth="110" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="110" SharedSizeGroup="SessionTime" />
|
||||
<ColumnDefinition Width="0.85*" MinWidth="70" />
|
||||
<ColumnDefinition Width="0.6*" MinWidth="56" />
|
||||
<ColumnDefinition Width="0.8*" MinWidth="64" />
|
||||
<ColumnDefinition Width="1.9*" MinWidth="150" />
|
||||
<ColumnDefinition Width="0.9*" MinWidth="64" />
|
||||
<ColumnDefinition Width="1.6*" MinWidth="150" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="SessionAction" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Row.TimeText}" ToolTip="{Binding Row.TimeText}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Row.FramesText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.CellNumber}" Text="{Binding Row.SizeText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.CellNumberLtr}" Text="{Binding Row.SizeText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Cell}" Text="{Binding Row.CameraText}" Margin="10,0,0,0" ToolTip="{Binding Row.CameraText}" />
|
||||
<DockPanel Grid.Column="4" Margin="10,0,0,0">
|
||||
<TextBlock x:Name="Target" DockPanel.Dock="Right" Text="{l:Loc Import.Session.NewShort}" Foreground="{DynamicResource Brush.Accent}"
|
||||
VerticalAlignment="Center" Margin="8,0,0,0" ToolTip="{Binding Row.TargetText}" />
|
||||
<TextBox Height="26" Padding="8,0" Text="{Binding Title.Text, UpdateSourceTrigger=PropertyChanged}" shell:EditBehavior.Field="{Binding Title}"
|
||||
IsEnabled="{Binding IsEditable}" ui:Field.Placeholder="{Binding Placeholder}" ToolTip="{Binding TitleToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Import.Session.Column.Sequence}" />
|
||||
AutomationProperties.Name="{Binding TitleName}" />
|
||||
</DockPanel>
|
||||
<Button Grid.Column="5" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{l:Loc Import.Session.Merge}" Command="{Binding MergeCommand}"
|
||||
ToolTip="{Binding MergeToolTip}" Visibility="{Binding HasMerge, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button x:Name="Merge" Grid.Column="5" Style="{StaticResource Button.RowAction}" Margin="8,0,0,0" Content="{l:Loc Import.Session.Merge}"
|
||||
Command="{Binding MergeCommand}" ToolTip="{Binding MergeToolTip}" AutomationProperties.Name="{Binding MergeName}"
|
||||
AutomationProperties.HelpText="{Binding MergeToolTip}" Visibility="{Binding HasMerge, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Row.IsNew}" Value="False">
|
||||
<Setter TargetName="Target" Property="Text" Value="{l:Loc Import.Session.AddsShort}" />
|
||||
<Setter TargetName="Target" Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
</DataTrigger>
|
||||
<!-- While copying the plan is fixed: no row action to reveal. -->
|
||||
<DataTrigger Binding="{Binding IsEditable}" Value="False">
|
||||
<Setter TargetName="Merge" Property="Visibility" Value="Hidden" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
@@ -436,7 +548,10 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:StatusGlyph Kind="{Binding ResultKind}" Text="{Binding ResultText}" FontSize="16" FontWeight="SemiBold" ToolTip="{l:Loc Tooltips.Import.Result}" />
|
||||
<!-- The glyph colours the result; the text beside it is what screen readers announce. -->
|
||||
<ui:StatusGlyph x:Name="ResultGlyph" Kind="{Binding ResultKind}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding ResultText, NotifyOnTargetUpdated=True}" Foreground="{Binding Foreground, ElementName=ResultGlyph}" FontSize="16" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Import.Result}" AutomationProperties.LiveSetting="Polite" />
|
||||
<TextBlock Text="{Binding DetailText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="14,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Failures}" Margin="0,8,0,0" ItemContainerStyle="{StaticResource ListBoxItem.Failure}"
|
||||
@@ -449,8 +564,8 @@
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="2" Margin="0,10,0,0" Visibility="{Binding OffersCheck, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding EraseText}" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0"
|
||||
Visibility="{Binding BusyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
<TextBlock Text="{Binding BusyText, NotifyOnTargetUpdated=True}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0"
|
||||
AutomationProperties.LiveSetting="Polite" Visibility="{Binding BusyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
<ItemsControl ItemsSource="{Binding KeptReasons}" Focusable="False" MaxHeight="80" Margin="0,4,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -466,25 +581,28 @@
|
||||
Margin="0,0,8,0" Visibility="{Binding OffersDelete, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Destructive}" Content="{l:Loc Import.Result.Format}" Command="{Binding FormatCommand}" ToolTip="{Binding FormatToolTip}"
|
||||
Margin="0,0,8,0" Visibility="{Binding OffersFormat, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Command="{Binding EjectCommand}" ToolTip="{Binding EjectToolTip}" Margin="0,0,8,0">
|
||||
<Button Command="{Binding EjectCommand}" ToolTip="{Binding EjectToolTip}" Margin="0,0,8,0" AutomationProperties.Name="{l:Loc Import.Result.Eject}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:Icon Glyph="{StaticResource Icon.Eject}" Margin="0,0,6,0" />
|
||||
<TextBlock Text="{l:Loc Import.Result.Eject}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Content="{l:Loc Import.Result.Library}" Command="{Binding OpenLibraryCommand}" ToolTip="{l:Loc Tooltips.Import.Library}" Margin="0,0,8,0" />
|
||||
<Button Content="{l:Loc Import.Result.New}" Command="{Binding DataContext.NewImportCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
<Button x:Name="NewImportButton" Content="{l:Loc Import.Result.New}" Command="{Binding DataContext.NewImportCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
ToolTip="{l:Loc Tooltips.Import.New}" />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- The import failed or was cancelled. -->
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding IsFailed, Converter={StaticResource BoolToVisibility}}">
|
||||
<ui:StatusGlyph Kind="Failed" Text="{Binding ErrorText}" FontSize="13" HorizontalAlignment="Center" ToolTip="{l:Loc Tooltips.Import.Failed}" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,12,0,0">
|
||||
<Button Content="{l:Loc Import.Failed.Retry}" Command="{Binding RetryCommand}" ToolTip="{l:Loc Tooltips.Import.Retry}" Margin="0,0,8,0" />
|
||||
<Button Content="{l:Loc Shell.Nav.Jobs}" Command="{Binding Shell.NavigateCommand}" CommandParameter="Jobs" ToolTip="{l:Loc Tooltips.Nav.Jobs}" />
|
||||
</StackPanel>
|
||||
<!-- The import failed or was cancelled: what happened in one sentence (its full text in the tooltip), and Retry. -->
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" MaxWidth="520" Visibility="{Binding IsFailed, Converter={StaticResource BoolToVisibility}}">
|
||||
<DockPanel>
|
||||
<ui:Icon DockPanel.Dock="Left" Glyph="{StaticResource Icon.Cross}" Size="12" Foreground="{DynamicResource Brush.Error}" VerticalAlignment="Top" Margin="0,3,6,0" />
|
||||
<TextBlock x:Name="FailureLine" Text="{Binding ErrorText, NotifyOnTargetUpdated=True}" Foreground="{DynamicResource Brush.Error}" TextWrapping="Wrap"
|
||||
TextTrimming="CharacterEllipsis" LineHeight="18" LineStackingStrategy="BlockLineHeight" MaxHeight="54" ToolTip="{Binding FailureToolTip}"
|
||||
AutomationProperties.LiveSetting="Assertive" />
|
||||
</DockPanel>
|
||||
<Button x:Name="RetryButton" Content="{l:Loc Import.Failed.Retry}" Command="{Binding RetryCommand}" ToolTip="{l:Loc Tooltips.Import.Retry}"
|
||||
HorizontalAlignment="Center" Margin="0,12,0,0" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Footer: Show plan and Import, or the progress while copying. -->
|
||||
@@ -493,15 +611,16 @@
|
||||
Visibility="{Binding IsRunning, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Content="{Binding StartText}" Command="{Binding StartCommand}"
|
||||
ToolTip="{Binding StartToolTip}" Visibility="{Binding IsRunning, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Import.Progress.Cancel}" Command="{Binding CancelCommand}" ToolTip="{l:Loc Tooltips.Import.Cancel}" Margin="12,0,0,0"
|
||||
<Button x:Name="CancelButton" DockPanel.Dock="Right" Content="{l:Loc Import.Progress.Cancel}" Command="{Binding CancelCommand}" ToolTip="{l:Loc Tooltips.Import.Cancel}" Margin="12,0,0,0"
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Grid Visibility="{Binding IsRunning, Converter={StaticResource BoolToVisibility}}" VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar Maximum="1" Value="{Binding Progress, Mode=OneWay}" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding ProgressText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="12,0,0,0" Typography.NumeralAlignment="Tabular" />
|
||||
<ProgressBar Maximum="1" Value="{Binding Progress, Mode=OneWay}" VerticalAlignment="Center" AutomationProperties.LabeledBy="{Binding ElementName=ProgressLine}" />
|
||||
<TextBlock x:Name="ProgressLine" Grid.Column="1" Text="{Binding ProgressText, NotifyOnTargetUpdated=True}" Foreground="{DynamicResource Brush.TextMuted}" Margin="12,0,0,0"
|
||||
Typography.NumeralAlignment="Tabular" AutomationProperties.LiveSetting="Polite" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
@@ -527,7 +646,7 @@
|
||||
AutomationProperties.Name="{l:Loc Import.Details.Close}" />
|
||||
<TextBlock Text="{l:Loc Import.Details.Title}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding TotalsText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="14,0,0,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
|
||||
Typography.NumeralAlignment="Tabular" />
|
||||
Typography.NumeralAlignment="Tabular" ToolTip="{Binding TotalsText}" />
|
||||
</DockPanel>
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding Conflicts}" Focusable="False" Margin="0,8,0,0" MaxHeight="96">
|
||||
<ItemsControl.ItemTemplate>
|
||||
@@ -536,7 +655,8 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Grid.Row="2" Margin="0,10,0,4" TextElement.FontSize="12">
|
||||
<!-- The right margin is the list's scroll bar (always shown, 10 px), so header and cells line up. -->
|
||||
<Grid Grid.Row="2" Margin="0,10,10,4" TextElement.FontSize="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.2*" MinWidth="140" />
|
||||
<ColumnDefinition Width="1.8*" MinWidth="180" />
|
||||
@@ -547,13 +667,18 @@
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Import.Details.Column.Source}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Details.Column.Destination}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Details.Column.Action}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Size}" Margin="10,0,0,0" TextAlignment="Right" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.HeaderNumber}" Text="{l:Loc Import.Session.Column.Size}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
<ListBox x:Name="PlanRows" Grid.Row="3" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.PlanRow}" AutomationProperties.Name="{l:Loc Import.Details.Title}"
|
||||
KeyboardNavigation.TabNavigation="Continue">
|
||||
KeyboardNavigation.TabNavigation="Continue" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<ListBox.ItemTemplate>
|
||||
<!-- A file: its name on the card, its new name, what happens, its size. A session: its heading over two columns, its folder below. -->
|
||||
<DataTemplate DataType="{x:Type imp:PlanDetailRow}">
|
||||
<Grid x:Name="Row" Height="30" TextElement.FontSize="12">
|
||||
<Grid x:Name="Row" Height="36" TextElement.FontSize="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.2*" MinWidth="140" />
|
||||
<ColumnDefinition Width="1.8*" MinWidth="180" />
|
||||
@@ -561,21 +686,32 @@
|
||||
<ColumnDefinition Width="0.5*" MinWidth="64" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="PlanAction" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="Source" Style="{StaticResource Text.Cell}" Text="{Binding Source}" ToolTip="{Binding Source}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Destination}" Margin="10,0,0,0" ToolTip="{Binding Destination}" />
|
||||
<TextBlock x:Name="Source" Style="{StaticResource Text.Cell}" Text="{Binding SourceText}" ToolTip="{Binding Source}" />
|
||||
<TextBlock x:Name="Destination" Grid.Column="1" Style="{StaticResource Text.CellPath}" Text="{Binding DestinationText}" Margin="10,0,0,0"
|
||||
ToolTip="{Binding Destination}" />
|
||||
<TextBlock x:Name="Action" Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding ActionText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.CellNumber}" Text="{Binding SizeText}" Margin="10,0,0,0" />
|
||||
<Button x:Name="Split" Grid.Column="4" Style="{StaticResource Button.Row}" Margin="10,0,4,0" Content="{l:Loc Import.Details.Split}"
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.CellNumberLtr}" Text="{Binding SizeText}" Margin="10,0,0,0" />
|
||||
<Button x:Name="Split" Grid.Column="4" Style="{StaticResource Button.RowAction}" Margin="10,0,4,0" Content="{l:Loc Import.Details.Split}"
|
||||
Command="{Binding DataContext.SplitCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
|
||||
ToolTip="{l:Loc Tooltips.Import.Split}" Visibility="Hidden" />
|
||||
ToolTip="{l:Loc Tooltips.Import.Split}" AutomationProperties.Name="{Binding SplitName}" Visibility="Hidden" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding CanSplit}" Value="True">
|
||||
<Setter TargetName="Split" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Kind}" Value="File">
|
||||
<Setter TargetName="Source" Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter TargetName="Source" Property="HorizontalAlignment" Value="Left" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Kind}" Value="Session">
|
||||
<Setter TargetName="Row" Property="Height" Value="50" />
|
||||
<Setter TargetName="Source" Property="FontWeight" Value="SemiBold" />
|
||||
<Setter TargetName="Row" Property="Height" Value="34" />
|
||||
<Setter TargetName="Source" Property="Grid.ColumnSpan" Value="2" />
|
||||
<Setter TargetName="Destination" Property="Grid.Row" Value="1" />
|
||||
<Setter TargetName="Destination" Property="Grid.Column" Value="0" />
|
||||
<Setter TargetName="Destination" Property="Grid.ColumnSpan" Value="4" />
|
||||
<Setter TargetName="Destination" Property="Margin" Value="0,2,0,8" />
|
||||
<Setter TargetName="Destination" Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsSkipped}" Value="True">
|
||||
<Setter TargetName="Row" Property="Opacity" Value="0.6" />
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
|
||||
@@ -9,12 +12,19 @@ namespace Titano.App.Sections;
|
||||
|
||||
public partial class ImportView : UserControl
|
||||
{
|
||||
/// <summary>A polite text that keeps changing (copy progress) is announced at most this often.</summary>
|
||||
private static readonly TimeSpan PoliteInterval = TimeSpan.FromSeconds(3);
|
||||
|
||||
private readonly Dictionary<UIElement, DateTime> _announced = [];
|
||||
private readonly HashSet<UIElement> _pending = [];
|
||||
private bool _nicknameOpen;
|
||||
private bool _restoreFocus;
|
||||
|
||||
public ImportView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContextChanged += OnDataContextChanged;
|
||||
AddHandler(Binding.TargetUpdatedEvent, new EventHandler<DataTransferEventArgs>(OnTargetUpdated));
|
||||
}
|
||||
|
||||
private ImportViewModel? Model => DataContext as ImportViewModel;
|
||||
@@ -42,7 +52,9 @@ public partial class ImportView : UserControl
|
||||
|
||||
/// <summary>
|
||||
/// Keyboard focus follows what opens: the nickname field when it appears (a new card, Rename), and "Show plan"
|
||||
/// (focus returns to its button when it closes).
|
||||
/// (focus returns to its button when it closes). A change of phase that hides the focused button (Import, Retry,
|
||||
/// New import, the status action, "Split here" closing the plan) moves focus to what replaced it, once the card
|
||||
/// is planned again.
|
||||
/// </summary>
|
||||
private void OnModelChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
@@ -54,9 +66,62 @@ public partial class ImportView : UserControl
|
||||
if (opened && IsVisible) FocusLater(NicknameBox);
|
||||
}
|
||||
if (e.PropertyName is nameof(ImportViewModel.IsDetailsOpen) && IsVisible)
|
||||
FocusLater(model.IsDetailsOpen ? ClosePlanButton : ShowPlanButton);
|
||||
{
|
||||
if (model.IsDetailsOpen) FocusLater(ClosePlanButton);
|
||||
else _restoreFocus = true;
|
||||
}
|
||||
if (e.PropertyName is nameof(ImportViewModel.IsDetailsOpen) or "" && IsVisible) Dispatcher.BeginInvoke(DispatcherPriority.Input, RestoreFocus);
|
||||
}
|
||||
|
||||
private void RestoreFocus()
|
||||
{
|
||||
if (Model is not { } model || model.IsBusyPlanning) return;
|
||||
var lost = Keyboard.FocusedElement is UIElement { IsVisible: false } focused && IsAncestorOf(focused);
|
||||
if (!_restoreFocus && !lost) return;
|
||||
_restoreFocus = false;
|
||||
UIElement? target = model.IsRunning ? CancelButton
|
||||
: model.IsDone ? NewImportButton
|
||||
: model.IsFailed ? RetryButton
|
||||
: model.HasPlan ? ShowPlanButton
|
||||
: model.HasStatusAction ? StatusActionButton
|
||||
: null;
|
||||
target?.Focus();
|
||||
}
|
||||
|
||||
/// <summary>After layout: an element that just became visible cannot take focus yet.</summary>
|
||||
private void FocusLater(UIElement element) => Dispatcher.BeginInvoke(DispatcherPriority.Input, () => element.Focus());
|
||||
|
||||
/// <summary>
|
||||
/// Live texts (AutomationProperties.LiveSetting in XAML, their binding with NotifyOnTargetUpdated) tell screen
|
||||
/// readers that they changed: planning status, copy progress, the result and the failure. WPF raises nothing by itself.
|
||||
/// </summary>
|
||||
private void OnTargetUpdated(object? sender, DataTransferEventArgs e)
|
||||
{
|
||||
if (e.TargetObject is not UIElement element || AutomationProperties.GetLiveSetting(element) is var setting && setting == AutomationLiveSetting.Off) return;
|
||||
if (AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged)) Announce(element, setting);
|
||||
}
|
||||
|
||||
/// <summary>Polite texts at most every <see cref="PoliteInterval"/>, ending with their latest value; assertive ones at once.</summary>
|
||||
private void Announce(UIElement element, AutomationLiveSetting setting)
|
||||
{
|
||||
var wait = setting == AutomationLiveSetting.Polite && _announced.TryGetValue(element, out var last) ? last + PoliteInterval - DateTime.UtcNow : TimeSpan.Zero;
|
||||
if (wait > TimeSpan.Zero)
|
||||
{
|
||||
if (_pending.Add(element)) _ = AnnounceLaterAsync(element, setting, wait);
|
||||
return;
|
||||
}
|
||||
_announced[element] = DateTime.UtcNow;
|
||||
// After the bindings of the same change: a text that is being hidden is not announced.
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background, () =>
|
||||
{
|
||||
if (element.IsVisible) UIElementAutomationPeer.CreatePeerForElement(element)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task AnnounceLaterAsync(UIElement element, AutomationLiveSetting setting, TimeSpan wait)
|
||||
{
|
||||
await Task.Delay(wait);
|
||||
_pending.Remove(element);
|
||||
Announce(element, setting);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,18 @@ public enum ImportPhase
|
||||
Failed,
|
||||
}
|
||||
|
||||
/// <summary>The one action offered with the Plan panel's status sentence (BRIEF §0.2 rule 6).</summary>
|
||||
public enum StatusAction
|
||||
{
|
||||
None,
|
||||
PickSource,
|
||||
Refresh,
|
||||
OpenLibrary,
|
||||
ChooseDestination,
|
||||
OpenServer,
|
||||
Replan,
|
||||
}
|
||||
|
||||
/// <summary>A template token offered by the "{ }" menu.</summary>
|
||||
public sealed record TokenItem(string Text, string ToolTip);
|
||||
|
||||
@@ -65,6 +77,8 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
private ImportChoices _choices = new();
|
||||
private ImportPhase _phase;
|
||||
private string? _statusText;
|
||||
private string? _statusDetail;
|
||||
private StatusAction _statusAction;
|
||||
private ImportPlan? _rawPlan;
|
||||
private ImportPlan? _plan;
|
||||
private PlanTotals? _totals;
|
||||
@@ -78,6 +92,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
private string? _progressText;
|
||||
private ImportResultViewModel? _result;
|
||||
private string? _errorText;
|
||||
private string? _errorDetail;
|
||||
private Guid? _jobId;
|
||||
private string? _jobSourceKey;
|
||||
private Guid? _jobCardId;
|
||||
@@ -98,11 +113,13 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
_planDelay.Tick += (_, _) =>
|
||||
{
|
||||
_planDelay.Stop();
|
||||
Replan();
|
||||
// A finished import keeps its result; "New import" plans again.
|
||||
if (_phase != ImportPhase.Done) Replan();
|
||||
};
|
||||
Nickname = new EditableField(string.Empty, _ => null, text => _ = SaveCardAsync(text, null), () => Loc.L("Tooltips.Import.Nickname"));
|
||||
FolderPath = new EditableField(string.Empty, ArchiveLocations.Validate, text => Choices = _choices with { FolderPath = text },
|
||||
() => Loc.L("Tooltips.Import.FolderPath"));
|
||||
// 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");
|
||||
FolderTemplate = new EditableField(_choices.FolderTemplate, t => NamingPreview.Validate(t, isFolder: true),
|
||||
@@ -136,6 +153,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
Replan();
|
||||
});
|
||||
RetryCommand = new AsyncRelayCommand(RetryAsync, () => _phase == ImportPhase.Failed);
|
||||
StatusActionCommand = new RelayCommand(RunStatusAction, () => HasStatusAction);
|
||||
|
||||
shell.Services.Devices.Arrived += device => Dispatch(() => _ = CardInsertedAsync(device));
|
||||
shell.Services.Devices.Removed += removed => Dispatch(() => _ = OnRemovedAsync());
|
||||
@@ -168,6 +186,8 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
/// <summary>The source of a running import stays selected.</summary>
|
||||
public bool CanChangeSource => _phase != ImportPhase.Running;
|
||||
|
||||
public string FolderSourceToolTip => CanChangeSource ? Loc.L("Tooltips.Import.Folder") : Loc.L("Import.Blocked.Copying");
|
||||
|
||||
/// <summary>Start the import with the card's profile as soon as this card is inserted (per card, BRIEF §12.4).</summary>
|
||||
public bool AutoImport
|
||||
{
|
||||
@@ -243,6 +263,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
var previous = _choices;
|
||||
if (previous == value) return;
|
||||
_choices = value;
|
||||
if (value.Destination != previous.Destination) FolderPath.Refresh();
|
||||
OnPropertyChanged(string.Empty);
|
||||
if (value.NeedsNewPlan(previous) || (value.TitlesChangeNames != previous.TitlesChangeNames && _titles.Count > 0)) SchedulePlan();
|
||||
else ApplyPlan();
|
||||
@@ -278,12 +299,15 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
|
||||
public bool CanUseArchive => _archive is not null && Services.Archives is not null;
|
||||
|
||||
public string ArchiveToolTip => CanUseArchive ? Loc.L("Tooltips.Import.Archive", _archive!.RootPath) : Loc.L("Import.Blocked.NoArchive");
|
||||
public string ArchiveToolTip => CanUseArchive ? Loc.L("Tooltips.Import.Archive", BidiText.Ltr(_archive!.RootPath)) : Loc.L("Import.Blocked.NoArchive");
|
||||
|
||||
public bool CanUseServer => Services.Server.IsConnected;
|
||||
|
||||
public string ServerName => Services.Server.ServerName ?? Loc.L("Import.Destination.NotConnected");
|
||||
|
||||
/// <summary>"Server · Studio NAS": the Server choice as screen readers announce it.</summary>
|
||||
public string ServerChoiceName => Loc.L("Import.Destination.Server") + " · " + ServerName;
|
||||
|
||||
public string ServerToolTip => CanUseServer ? Loc.L("Tooltips.Import.Server") : Loc.L("Import.Blocked.NoServer");
|
||||
|
||||
public EditableField FolderPath { get; }
|
||||
@@ -409,8 +433,11 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
|
||||
public bool IsBusyPlanning => _phase == ImportPhase.Planning;
|
||||
|
||||
/// <summary>The form is fixed while copying, and behind "Show plan" while it is open.</summary>
|
||||
public bool IsFormEnabled => _phase != ImportPhase.Running && _details is null;
|
||||
/// <summary>
|
||||
/// The form is fixed while copying and once the import finished ("New import" plans again, so the verification
|
||||
/// result is never replaced by a silent new plan), and behind "Show plan" while it is open.
|
||||
/// </summary>
|
||||
public bool IsFormEnabled => _phase is not (ImportPhase.Running or ImportPhase.Done) && _details is null;
|
||||
|
||||
public bool IsPlanPanelEnabled => _details is null;
|
||||
public bool HasPlan => _plan is not null && _phase is ImportPhase.Ready or ImportPhase.Running;
|
||||
@@ -422,13 +449,48 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
/// <summary>"Reading 1,240 photos", "Choose a card or a folder", or why nothing can be planned.</summary>
|
||||
public string? StatusText => _statusText;
|
||||
|
||||
public string TotalsText => _totals?.Text ?? string.Empty;
|
||||
/// <summary>The cause behind a status sentence (an exception's own text), for its tooltip; null when there is none.</summary>
|
||||
public string? StatusDetail => _statusDetail;
|
||||
|
||||
/// <summary>The status sentence comes with one action: Folder…, Refresh, Library, Choose folder, Server or Retry.</summary>
|
||||
public bool HasStatusAction => _statusAction != StatusAction.None && _phase == ImportPhase.NoSource;
|
||||
|
||||
public string StatusActionText => _statusAction switch
|
||||
{
|
||||
StatusAction.PickSource => Loc.L("Import.Devices.Folder"),
|
||||
StatusAction.Refresh => Loc.L("Import.Devices.Refresh"),
|
||||
StatusAction.OpenLibrary => Loc.L("Shell.Nav.Library"),
|
||||
StatusAction.ChooseDestination => Loc.L("Import.Destination.Choose"),
|
||||
StatusAction.OpenServer => Loc.L("Shell.Nav.Server"),
|
||||
StatusAction.Replan => Loc.L("Import.Failed.Retry"),
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
public string StatusActionToolTip => _statusAction switch
|
||||
{
|
||||
StatusAction.PickSource => Loc.L("Tooltips.Import.Folder"),
|
||||
StatusAction.Refresh => Loc.L("Tooltips.Import.Refresh"),
|
||||
StatusAction.OpenLibrary => Loc.L("Tooltips.Nav.Library"),
|
||||
StatusAction.ChooseDestination => Loc.L("Tooltips.Import.ChooseFolder"),
|
||||
StatusAction.OpenServer => Loc.L("Tooltips.Nav.Server"),
|
||||
StatusAction.Replan => Loc.L("Tooltips.Import.New"),
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
public ICommand StatusActionCommand { get; }
|
||||
|
||||
/// <summary>"3 sessions · 4,812 photos · 96.2 GB · about 12 min"; without the estimate once the import finished.</summary>
|
||||
public string TotalsText => (IsDone ? _totals?.SummaryText : _totals?.Text) ?? string.Empty;
|
||||
|
||||
public string DuplicatesText => _totals?.DuplicatesText ?? string.Empty;
|
||||
public bool HasDuplicates => _totals?.Duplicates > 0;
|
||||
public StatusKind DuplicatesKind => HasDuplicates ? StatusKind.Warning : StatusKind.Done;
|
||||
public string ImportedBeforeText => _totals?.ImportedBeforeText ?? string.Empty;
|
||||
public string SpaceText => _totals?.SpaceText ?? string.Empty;
|
||||
public bool IsSpaceShort => _totals is { HasEnoughSpace: false };
|
||||
|
||||
/// <summary>Plan figures that no longer hold once the import finished are not shown then.</summary>
|
||||
public string ImportedBeforeText => IsDone ? string.Empty : _totals?.ImportedBeforeText ?? string.Empty;
|
||||
|
||||
public string SpaceText => IsDone ? string.Empty : _totals?.SpaceText ?? string.Empty;
|
||||
public bool IsSpaceShort => !IsDone && _totals is { HasEnoughSpace: false };
|
||||
|
||||
public ObservableCollection<ImportSessionRowViewModel> Sessions { get; } = [];
|
||||
|
||||
@@ -490,8 +552,12 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Why the import stopped, in one sentence.</summary>
|
||||
public string? ErrorText { get => _errorText; private set => Set(ref _errorText, value); }
|
||||
|
||||
/// <summary>The failure's own text when it says more than <see cref="ErrorText"/>, else what was kept.</summary>
|
||||
public string FailureToolTip => _errorDetail is { Length: > 0 } detail && detail != _errorText ? detail : Loc.L("Tooltips.Import.Failed");
|
||||
|
||||
// ---------------- Lifecycle ----------------
|
||||
|
||||
protected override void OnActivated()
|
||||
@@ -595,8 +661,8 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
ShowProgress(progress);
|
||||
}
|
||||
|
||||
/// <summary>Shows an import that stopped with <paramref name="message"/>, without running it (capture).</summary>
|
||||
public void ShowFailed(string message) => Fail(message);
|
||||
/// <summary>Shows an import that stopped with <paramref name="error"/>, without running it (capture).</summary>
|
||||
public void ShowFailed(Exception error) => Fail(ImportFailures.Import(error, SourceTitle), error.Message);
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
@@ -844,6 +910,14 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>Where the user removes the destination's blocker: the Library (create or adopt an archive), the folder picker, the Server screen.</summary>
|
||||
private StatusAction DestinationAction() => _choices.Destination switch
|
||||
{
|
||||
ImportDestinationKind.Archive => StatusAction.OpenLibrary,
|
||||
ImportDestinationKind.Folder => StatusAction.ChooseDestination,
|
||||
_ => StatusAction.OpenServer,
|
||||
};
|
||||
|
||||
private IImportDestination? Destination() => DestinationBlocker() is not null ? null : _choices.Destination switch
|
||||
{
|
||||
ImportDestinationKind.Archive => new ArchiveDestination(Services.Archives!, _archive!),
|
||||
@@ -867,12 +941,13 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
Sessions.Clear();
|
||||
if (_selected?.Root is not { } root)
|
||||
{
|
||||
SetStatus(ImportPhase.NoSource, Loc.L(_selected is null ? "Import.Status.Choose" : "Import.Status.NotInserted"));
|
||||
if (_selected is null) SetStatus(ImportPhase.NoSource, Loc.L("Import.Status.Choose"), StatusAction.PickSource);
|
||||
else SetStatus(ImportPhase.NoSource, Loc.L("Import.Status.NotInserted"), StatusAction.Refresh);
|
||||
return;
|
||||
}
|
||||
if (Destination() is not { } destination)
|
||||
{
|
||||
SetStatus(ImportPhase.NoSource, DestinationBlocker());
|
||||
SetStatus(ImportPhase.NoSource, DestinationBlocker(), DestinationAction());
|
||||
return;
|
||||
}
|
||||
SetStatus(ImportPhase.Planning, Loc.L("Import.Status.Reading"));
|
||||
@@ -908,7 +983,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException or ArgumentException or InvalidOperationException)
|
||||
{
|
||||
Log.Warning("import", $"Planning the import of {root} failed", ex);
|
||||
SetStatus(ImportPhase.NoSource, Loc.L("Import.Status.PlanFailed", ex.Message));
|
||||
SetStatus(ImportPhase.NoSource, ImportFailures.Plan(ex, SourceTitle), StatusAction.Replan, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,11 +1089,43 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
Replan();
|
||||
}
|
||||
|
||||
private void SetStatus(ImportPhase phase, string? text)
|
||||
private void SetStatus(ImportPhase phase, string? text, StatusAction action = StatusAction.None, string? detail = null)
|
||||
{
|
||||
_statusText = text;
|
||||
_statusAction = action;
|
||||
_statusDetail = detail;
|
||||
Phase = phase;
|
||||
OnPropertyChanged(nameof(StatusText));
|
||||
OnPropertyChanged(nameof(StatusDetail));
|
||||
OnPropertyChanged(nameof(HasStatusAction));
|
||||
OnPropertyChanged(nameof(StatusActionText));
|
||||
OnPropertyChanged(nameof(StatusActionToolTip));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
|
||||
private void RunStatusAction()
|
||||
{
|
||||
switch (_statusAction)
|
||||
{
|
||||
case StatusAction.PickSource:
|
||||
PickSourceFolder();
|
||||
break;
|
||||
case StatusAction.Refresh:
|
||||
_ = RefreshSourcesAsync();
|
||||
break;
|
||||
case StatusAction.OpenLibrary:
|
||||
Shell.Navigate(SectionKey.Library);
|
||||
break;
|
||||
case StatusAction.ChooseDestination:
|
||||
ChooseDestinationFolder();
|
||||
break;
|
||||
case StatusAction.OpenServer:
|
||||
Shell.Navigate(SectionKey.Server);
|
||||
break;
|
||||
case StatusAction.Replan:
|
||||
Replan();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- Running ----------------
|
||||
@@ -1033,7 +1140,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
_jobSourceKey = source.Key;
|
||||
if (source.Card is { } card) await SaveProfileAsync(card, choices);
|
||||
Details = null;
|
||||
ErrorText = null;
|
||||
ClearFailure();
|
||||
Progress = 0;
|
||||
ProgressText = Loc.L("Import.Progress.Starting");
|
||||
Phase = ImportPhase.Running;
|
||||
@@ -1046,9 +1153,16 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
return;
|
||||
}
|
||||
var progress = new Progress<ImportProgress>(ShowProgress);
|
||||
var outcome = choices.Destination == ImportDestinationKind.Folder
|
||||
? await Task.Run(() => LocalImport.RunAsync(plan, new FolderImportSink(choices.FolderPath!), choices.VerifyCopies, progress, cts.Token), cts.Token)
|
||||
: await RunServerAsync(plan, choices, progress, cts.Token);
|
||||
ImportOutcome outcome;
|
||||
if (choices.Destination == ImportDestinationKind.Folder)
|
||||
outcome = await Task.Run(() => LocalImport.RunAsync(plan, new FolderImportSink(choices.FolderPath!), choices.VerifyCopies, progress, cts.Token), cts.Token);
|
||||
else if (Services.Server.Flow is { Address: { } address, Token: { } token })
|
||||
outcome = await RunServerAsync(plan, choices, address, token, progress, cts.Token);
|
||||
else
|
||||
{
|
||||
Fail(Loc.L("Import.Blocked.NoServer"));
|
||||
return;
|
||||
}
|
||||
Finish(plan, outcome);
|
||||
}
|
||||
catch (OperationCanceledException) when (cts.IsCancellationRequested)
|
||||
@@ -1059,14 +1173,13 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
{
|
||||
// Whatever stopped it, the screen leaves Running: the form, the sources and Retry come back.
|
||||
Log.Warning("import", $"Import of {root} failed", ex);
|
||||
Fail(ex.Message);
|
||||
Fail(ImportFailures.Import(ex, source.Title), ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<ImportOutcome> RunServerAsync(ImportPlan plan, ImportChoices choices, IProgress<ImportProgress> progress, CancellationToken ct)
|
||||
private async Task<ImportOutcome> RunServerAsync(ImportPlan plan, ImportChoices choices, Uri address, string token, IProgress<ImportProgress> progress,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var flow = Services.Server.Flow;
|
||||
if (flow.Address is not { } address || flow.Token is not { } token) throw new InvalidOperationException(Loc.L("Import.Blocked.NoServer"));
|
||||
var staging = Path.Combine(ServerStagingRoot, plan.Id.ToString("N"));
|
||||
using var client = new TitanoClient(address, new CertificatePinning(Services.Server.Fingerprints), $"Titano ({Environment.MachineName})") { Token = token };
|
||||
try
|
||||
@@ -1147,7 +1260,8 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
await QueueDeepAnalysisAsync(plan);
|
||||
break;
|
||||
case JobState.Failed:
|
||||
Fail(job.Error ?? Loc.L("Jobs.State.Failed"));
|
||||
// The engine wrote the job's error (a localized sentence for the archive's own failures); the full text stays in the tooltip.
|
||||
Fail(job.Error ?? Loc.L("Import.Failed.Other"), job.Error);
|
||||
break;
|
||||
case JobState.Cancelled:
|
||||
_jobId = null;
|
||||
@@ -1227,13 +1341,22 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
_ = Result.AutoEjectAsync();
|
||||
}
|
||||
|
||||
private void Fail(string message)
|
||||
private void Fail(string message, string? detail = null)
|
||||
{
|
||||
_runCts = null;
|
||||
_errorDetail = detail;
|
||||
ErrorText = message;
|
||||
OnPropertyChanged(nameof(FailureToolTip));
|
||||
Phase = ImportPhase.Failed;
|
||||
}
|
||||
|
||||
private void ClearFailure()
|
||||
{
|
||||
_errorDetail = null;
|
||||
ErrorText = null;
|
||||
OnPropertyChanged(nameof(FailureToolTip));
|
||||
}
|
||||
|
||||
private async Task CancelAsync()
|
||||
{
|
||||
if (_jobId is { } id && Services.Jobs is { } jobs) await jobs.CancelAsync(id);
|
||||
@@ -1245,7 +1368,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
{
|
||||
if (_jobId is { } id && Services.Jobs is { } jobs)
|
||||
{
|
||||
ErrorText = null;
|
||||
ClearFailure();
|
||||
Phase = ImportPhase.Running;
|
||||
await jobs.ResumeAsync(id);
|
||||
return;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:s="clr-namespace:Titano.App.Sections"
|
||||
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||
xmlns:j="clr-namespace:Titano.App.Jobs">
|
||||
<UserControl.Resources>
|
||||
<!-- Column layout shared by the header and the rows (Jobs.html grid-template-columns). -->
|
||||
<Style x:Key="Text.Muted" TargetType="TextBlock" BasedOn="{StaticResource Text.Cell}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsDimmed}" Value="True">
|
||||
@@ -14,8 +14,14 @@
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- Numbers stay right-aligned in both reading directions (DESIGN §4 tables). -->
|
||||
<Style x:Key="Text.MutedNumber" TargetType="TextBlock" BasedOn="{StaticResource Text.Muted}">
|
||||
<Setter Property="TextAlignment" Value="Right" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
</Style>
|
||||
<Style x:Key="Text.HeaderNumber" TargetType="TextBlock" BasedOn="{StaticResource Text.Header}">
|
||||
<Setter Property="TextAlignment" Value="Right" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
</Style>
|
||||
<Style x:Key="ProgressBar.Job" TargetType="ProgressBar" BasedOn="{StaticResource {x:Type ProgressBar}}">
|
||||
<Style.Triggers>
|
||||
@@ -30,35 +36,70 @@
|
||||
<ItemsPanelTemplate x:Key="Panel.Row">
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
<ItemsPanelTemplate x:Key="Panel.Wrap">
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
<!-- Filter chip (Jobs.html, aria-pressed): one of a group, so screen readers hear which filter is on. -->
|
||||
<Style x:Key="RadioButton.Chip" TargetType="RadioButton" BasedOn="{StaticResource Button.Base}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="Padding" Value="12,0" />
|
||||
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
|
||||
<Setter Property="ui:ControlState.CornerRadius" Value="15" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- A row reads as its job and state; Tab goes to its buttons. -->
|
||||
<Style x:Key="ListBoxItem.Job" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding AccessibleName}" />
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding StateText}" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="56" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Toolbar: state chips · search · workers, Pause all, Clear done. -->
|
||||
<DockPanel Margin="20,0" LastChildFill="False">
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Jobs.ClearDone}" Command="{Binding ClearDoneCommand}" ToolTip="{l:Loc Tooltips.Jobs.ClearDone}" Margin="8,0,0,0" />
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Jobs.PauseAll}" Command="{Binding PauseAllCommand}" ToolTip="{l:Loc Tooltips.Jobs.PauseAll}" Margin="12,0,0,0" />
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding WorkersText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center"
|
||||
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Jobs.Workers}" />
|
||||
<ItemsControl ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False" VerticalAlignment="Center">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type s:JobFilterChip}">
|
||||
<Button Style="{StaticResource Button.Chip}" Content="{Binding Text}" Tag="{Binding IsSelected}" Command="{Binding SelectCommand}"
|
||||
ToolTip="{Binding ToolTip}" Margin="0,0,8,0" Typography.NumeralAlignment="Tabular" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="6,0,14,0" VerticalAlignment="Center" />
|
||||
<TextBox Width="240" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Jobs.Search}" ToolTip="{l:Loc Tooltips.Jobs.Search}" AutomationProperties.Name="{l:Loc Jobs.Search}" />
|
||||
</DockPanel>
|
||||
<!-- Toolbar in visual (and Tab) order: state chips · search, then workers, Pause all, Clear done. The search moves under
|
||||
the chips before anything is cut (+40 % text at 1200 px). -->
|
||||
<Grid Margin="20,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<ItemsControl ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Wrap}" Focusable="False" VerticalAlignment="Center">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type s:JobFilterChip}">
|
||||
<RadioButton Style="{StaticResource RadioButton.Chip}" GroupName="JobFilters" Content="{Binding Text}" IsChecked="{Binding IsSelected, Mode=OneWay}"
|
||||
Command="{Binding SelectCommand}" ToolTip="{Binding ToolTip}" Margin="0,1,8,1" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,1,0,1">
|
||||
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="6,0,14,0" VerticalAlignment="Center" />
|
||||
<TextBox Width="240" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Jobs.Search}" ToolTip="{l:Loc Tooltips.Jobs.Search}" AutomationProperties.Name="{l:Loc Jobs.Search}" />
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
<TextBlock Grid.Column="1" Text="{Binding WorkersText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="12,0,0,0"
|
||||
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Jobs.Workers}" Visibility="{Binding HasWorkers, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Grid.Column="2" Content="{l:Loc Jobs.PauseAll}" Command="{Binding PauseAllCommand}" ToolTip="{l:Loc Tooltips.Jobs.PauseAll}" Margin="12,0,0,0" VerticalAlignment="Center" />
|
||||
<Button Grid.Column="3" Content="{l:Loc Jobs.ClearDone}" Command="{Binding ClearDoneCommand}" ToolTip="{l:Loc Tooltips.Jobs.ClearDone}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1" Style="{StaticResource Border.Panel}" Margin="20,0,20,12" Visibility="{Binding HasRows, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid>
|
||||
<!-- Header and rows share their columns (Jobs.html grid-template-columns): the same 14 px padding, the actions column sized
|
||||
by its widest row in every row, and the list's scroll-bar gutter always kept (10 px), mirrored on the header's right. -->
|
||||
<Grid Grid.IsSharedSizeScope="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -66,7 +107,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,8">
|
||||
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,8,24,8">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="28" />
|
||||
@@ -77,67 +118,75 @@
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="150" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="150" SharedSizeGroup="JobActions" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Kind}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Target}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Progress}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Speed}" Margin="10,0,0,0" TextAlignment="Right" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Left}" Margin="10,0,0,0" TextAlignment="Right" />
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.HeaderNumber}" Text="{l:Loc Jobs.Column.Speed}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.HeaderNumber}" Text="{l:Loc Jobs.Column.Left}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="6" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Where}" Margin="16,0,0,0" />
|
||||
<TextBlock Grid.Column="7" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.State}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Rows: queue order, then the history; expandable log tail. -->
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}"
|
||||
<!-- Rows: queue order, then the history; expandable log tail. Tab walks every row button (the rows take no focus). -->
|
||||
<ListBox x:Name="JobList" Grid.Row="1" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Job}"
|
||||
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.ScrollChanged="OnScrollChanged" AutomationProperties.Name="{l:Loc Shell.Nav.Jobs}">
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.ScrollChanged="OnScrollChanged"
|
||||
KeyboardNavigation.TabNavigation="Continue" AutomationProperties.Name="{l:Loc Shell.Nav.Jobs}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type j:JobRowViewModel}">
|
||||
<StackPanel>
|
||||
<Grid x:Name="Row" Height="38" Background="Transparent">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="28" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="1.6*" MinWidth="120" />
|
||||
<ColumnDefinition Width="*" MinWidth="120" MaxWidth="240" />
|
||||
<ColumnDefinition Width="90" />
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="150" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="Toggle" Style="{StaticResource Button.IconSubtle}" Width="22" Height="22" MinWidth="22" Margin="14,0,0,0"
|
||||
ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronRight}" Command="{Binding ToggleLogCommand}"
|
||||
ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleToolTip}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Muted}" Text="{Binding Kind}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding Target}" Margin="10,0,0,0" ToolTip="{Binding Target}" />
|
||||
<Grid Grid.Column="3" Margin="10,0,0,0">
|
||||
<Border x:Name="Row" Height="38" Background="Transparent" Padding="14,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="44" />
|
||||
<ColumnDefinition Width="28" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="1.6*" MinWidth="120" />
|
||||
<ColumnDefinition Width="*" MinWidth="120" MaxWidth="240" />
|
||||
<ColumnDefinition Width="90" />
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="150" SharedSizeGroup="JobActions" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar Style="{StaticResource ProgressBar.Job}" Maximum="1" Value="{Binding Progress, Mode=OneWay}" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.MutedNumber}" Text="{Binding PercentText}" />
|
||||
<Button x:Name="Toggle" Style="{StaticResource Button.IconSubtle}" Width="22" Height="22" MinWidth="22" HorizontalAlignment="Left"
|
||||
ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronRight}" Command="{Binding ToggleLogCommand}"
|
||||
ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleName}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Muted}" Text="{Binding Kind}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding Target}" Margin="10,0,0,0" ToolTip="{Binding Target}" />
|
||||
<Grid Grid.Column="3" Margin="10,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="44" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar Style="{StaticResource ProgressBar.Job}" Maximum="1" Value="{Binding Progress, Mode=OneWay}" VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{Binding AccessibleName}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.MutedNumber}" Text="{Binding PercentText}" />
|
||||
</Grid>
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.MutedNumber}" Text="{Binding SpeedText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.MutedNumber}" Text="{Binding LeftText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="6" Style="{StaticResource Text.Muted}" Text="{Binding WhereText}" Margin="16,0,0,0" />
|
||||
<!-- A new state is announced with its job; progress ticks are not. -->
|
||||
<ui:StatusGlyph Grid.Column="7" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}"
|
||||
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding StateAnnouncement}" />
|
||||
<ItemsControl Grid.Column="8" ItemsSource="{Binding Actions}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False"
|
||||
VerticalAlignment="Center" Margin="10,0,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type j:JobAction}">
|
||||
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}"
|
||||
AutomationProperties.Name="{Binding AccessibleName}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.MutedNumber}" Text="{Binding SpeedText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.MutedNumber}" Text="{Binding LeftText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="6" Style="{StaticResource Text.Muted}" Text="{Binding WhereText}" Margin="16,0,0,0" />
|
||||
<ui:StatusGlyph Grid.Column="7" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}"
|
||||
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0" />
|
||||
<ItemsControl Grid.Column="8" ItemsSource="{Binding Actions}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False"
|
||||
VerticalAlignment="Center" Margin="10,0,8,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type j:JobAction}">
|
||||
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- The log keeps its left-to-right lines (times, paths, numbers) in every language. -->
|
||||
<Border x:Name="Log" Background="{DynamicResource Brush.Bg}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0"
|
||||
Padding="52,10,14,12" Visibility="Collapsed">
|
||||
<TextBlock Style="{StaticResource Text.Log}" Text="{Binding LogText}" />
|
||||
<TextBlock Style="{StaticResource Text.Log}" Text="{Binding LogText}" FlowDirection="LeftToRight" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<DataTemplate.Triggers>
|
||||
@@ -162,6 +211,8 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<ui:EmptyState Grid.Row="1" Message="{l:Loc Jobs.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}" />
|
||||
<ui:EmptyState Grid.Row="1" Message="{l:Loc Jobs.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}">
|
||||
<Button Content="{l:Loc Shell.Nav.Import}" Command="{Binding ImportCommand}" ToolTip="{l:Loc Tooltips.Jobs.Import}" />
|
||||
</ui:EmptyState>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -84,6 +84,7 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
Shell.Navigate(SectionKey.Settings);
|
||||
});
|
||||
LoadMoreCommand = new RelayCommand(() => _ = LoadMoreAsync());
|
||||
ImportCommand = new RelayCommand(() => Shell.Navigate(SectionKey.Import));
|
||||
}
|
||||
|
||||
public ShellViewModel Shell { get; }
|
||||
@@ -99,6 +100,9 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
public ICommand RenderingSettingsCommand { get; }
|
||||
public ICommand LoadMoreCommand { get; }
|
||||
|
||||
/// <summary>The empty state's one action: jobs start with an import.</summary>
|
||||
public ICommand ImportCommand { get; }
|
||||
|
||||
public JobFilter Filter
|
||||
{
|
||||
get => _filter;
|
||||
@@ -119,8 +123,11 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"Workers 1 / 4".</summary>
|
||||
public string WorkersText => Loc.L("Jobs.Workers", _model.RunningCount, _queue?.Workers ?? 0);
|
||||
/// <summary>"Workers 1 / 4": jobs this PC's workers run out of its workers.</summary>
|
||||
public string WorkersText => Loc.L("Jobs.Workers", _queue is { } queue ? _model.RunningOn(queue.WorkerId) : 0, _queue?.Workers ?? 0);
|
||||
|
||||
/// <summary>The engine of this PC runs workers (it has none before it starts).</summary>
|
||||
public bool HasWorkers => _queue is { Workers: > 0 };
|
||||
|
||||
/// <summary>"History keeps 90 days".</summary>
|
||||
public string HistoryText => Loc.Plural("Jobs.History", (long)new JobEngineOptions().HistoryRetention.TotalDays);
|
||||
@@ -258,9 +265,12 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
Shell.SetJob(JobText.Bar(current), current.Fraction ?? 0, indeterminate: current.Fraction is null);
|
||||
else
|
||||
Shell.SetJob(null, 0);
|
||||
Shell.SetJobCount(_model.RunningCount + _model.QueuedCount, _model.QueuedCount);
|
||||
Badge = _model.RunningCount;
|
||||
// The rail badge, the status strip and the Running chip count the same jobs: running or paused (Jobs.html).
|
||||
var active = _model.CountOf(JobFilter.Running);
|
||||
Shell.SetJobCount(active, _model.QueuedCount);
|
||||
Badge = active;
|
||||
OnPropertyChanged(nameof(WorkersText));
|
||||
OnPropertyChanged(nameof(HasWorkers));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
|
||||
@@ -318,41 +328,42 @@ internal sealed class JobActions(JobsViewModel owner)
|
||||
public IReadOnlyList<JobAction> For(JobEntry entry)
|
||||
{
|
||||
var job = entry.Job;
|
||||
var row = JobText.Name(job);
|
||||
return entry.State switch
|
||||
{
|
||||
JobState.Running =>
|
||||
[
|
||||
Make("Jobs.Action.Pause", "Tooltips.Jobs.Pause", q => q.PauseAsync(job.Id)),
|
||||
Make("Jobs.Action.Cancel", "Tooltips.Jobs.Cancel", q => q.CancelAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Pause", "Tooltips.Jobs.Pause", row, q => q.PauseAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Cancel", "Tooltips.Jobs.Cancel", row, q => q.CancelAsync(job.Id)),
|
||||
],
|
||||
JobState.Paused =>
|
||||
[
|
||||
Make("Jobs.Action.Resume", "Tooltips.Jobs.Resume", q => q.ResumeAsync(job.Id)),
|
||||
Make("Jobs.Action.Cancel", "Tooltips.Jobs.Cancel", q => q.CancelAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Resume", "Tooltips.Jobs.Resume", row, q => q.ResumeAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Cancel", "Tooltips.Jobs.Cancel", row, q => q.CancelAsync(job.Id)),
|
||||
],
|
||||
JobState.Queued when job.Priority < JobPriority.User =>
|
||||
[
|
||||
Make("Jobs.Action.MoveUp", "Tooltips.Jobs.MoveUp", q => q.RaisePriorityAsync(job.Id)),
|
||||
Make("Jobs.Action.Remove", "Tooltips.Jobs.Remove", q => q.CancelAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.MoveUp", "Tooltips.Jobs.MoveUp", row, q => q.RaisePriorityAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Remove", "Tooltips.Jobs.Remove", row, q => q.CancelAsync(job.Id)),
|
||||
],
|
||||
JobState.Queued =>
|
||||
[
|
||||
Make("Jobs.Action.Pause", "Tooltips.Jobs.PauseQueued", q => q.PauseAsync(job.Id)),
|
||||
Make("Jobs.Action.Remove", "Tooltips.Jobs.Remove", q => q.CancelAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Pause", "Tooltips.Jobs.PauseQueued", row, q => q.PauseAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Remove", "Tooltips.Jobs.Remove", row, q => q.CancelAsync(job.Id)),
|
||||
],
|
||||
JobState.Failed =>
|
||||
[
|
||||
Make("Jobs.Action.Retry", "Tooltips.Jobs.Retry", q => q.ResumeAsync(job.Id)),
|
||||
new JobAction(Loc.L("Jobs.Action.Show"), Loc.L("Tooltips.Jobs.Show"), new AsyncRelayCommand(() => owner.OpenTargetAsync(job))),
|
||||
OnQueue("Jobs.Action.Retry", "Tooltips.Jobs.Retry", row, q => q.ResumeAsync(job.Id)),
|
||||
Action("Jobs.Action.Show", "Tooltips.Jobs.Show", row, () => owner.OpenTargetAsync(job)),
|
||||
],
|
||||
JobState.Cancelled =>
|
||||
[
|
||||
Make("Jobs.Action.Retry", "Tooltips.Jobs.Retry", q => q.ResumeAsync(job.Id)),
|
||||
OnQueue("Jobs.Action.Retry", "Tooltips.Jobs.Retry", row, q => q.ResumeAsync(job.Id)),
|
||||
],
|
||||
_ =>
|
||||
[
|
||||
new JobAction(Loc.L("Jobs.Action.Open"), Loc.L("Tooltips.Jobs.Open"), new AsyncRelayCommand(() => owner.OpenTargetAsync(job))),
|
||||
new JobAction(Loc.L("Jobs.Action.Folder"), Loc.L("Tooltips.Jobs.Folder"), new AsyncRelayCommand(() => owner.RevealTargetAsync(job))),
|
||||
Action("Jobs.Action.Open", "Tooltips.Jobs.Open", row, () => owner.OpenTargetAsync(job)),
|
||||
Action("Jobs.Action.Folder", "Tooltips.Jobs.Folder", row, () => owner.RevealTargetAsync(job)),
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -371,9 +382,16 @@ internal sealed class JobActions(JobsViewModel owner)
|
||||
}
|
||||
}
|
||||
|
||||
private JobAction Make(string textKey, string toolTipKey, Func<IJobQueue, Task> run) =>
|
||||
new(Loc.L(textKey), Loc.L(toolTipKey), new AsyncRelayCommand(async () =>
|
||||
/// <summary>A row button named with its row for screen readers ("Pause: Render · Harbour sunset").</summary>
|
||||
private static JobAction Action(string textKey, string toolTipKey, string row, Func<Task> run)
|
||||
{
|
||||
var text = Loc.L(textKey);
|
||||
return new JobAction(text, Loc.L(toolTipKey), Loc.L("Jobs.ActionFor", text, row), new AsyncRelayCommand(run));
|
||||
}
|
||||
|
||||
private JobAction OnQueue(string textKey, string toolTipKey, string row, Func<IJobQueue, Task> run) =>
|
||||
Action(textKey, toolTipKey, row, async () =>
|
||||
{
|
||||
if (owner.Queue is { } queue) await run(queue);
|
||||
}));
|
||||
});
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||
xmlns:shell="clr-namespace:Titano.App.Shell"
|
||||
xmlns:srv="clr-namespace:Titano.App.Server">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="Text.RowLabel" TargetType="TextBlock" BasedOn="{StaticResource Text.Label}">
|
||||
@@ -15,12 +17,32 @@
|
||||
<Setter Property="Margin" Value="8,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<ItemsPanelTemplate x:Key="Panel.Row">
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
<ItemsPanelTemplate x:Key="Panel.Wrap">
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
<!-- Filter chip (Server.html, aria-pressed): one of a group, so screen readers hear which filter is on. -->
|
||||
<Style x:Key="RadioButton.Chip" TargetType="RadioButton" BasedOn="{StaticResource Button.Base}">
|
||||
<Setter Property="Height" Value="28" />
|
||||
<Setter Property="Padding" Value="12,0" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
|
||||
<Setter Property="ui:ControlState.CornerRadius" Value="14" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- A row reads as its sequence and state; Tab goes to its buttons. -->
|
||||
<Style x:Key="ListBoxItem.Sync" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding StateText}" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- Server.html: the connection panel, then the sync table; the render-node panel joins the connection panel. -->
|
||||
<!-- Server.html: the connection panel, then the sync table. The render-node status panel is not built (see the decisions). -->
|
||||
<Grid Margin="20,16,20,12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -40,21 +62,36 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Address, servers found on the LAN, connect / disconnect. -->
|
||||
<!-- Address (read-only while connected, still selectable), servers found on the LAN, connect / disconnect; Tab follows this order. -->
|
||||
<TextBlock Style="{StaticResource Text.RowLabel}" Text="{l:Loc Server.Label.Server}" />
|
||||
<DockPanel Grid.Column="1" LastChildFill="True">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Server.Connect}" Command="{Binding ConnectCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Server.Connect}" Margin="10,0,0,0" MinWidth="96"
|
||||
Visibility="{Binding IsDisconnected, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Server.Disconnect}" Command="{Binding DisconnectCommand}" ToolTip="{l:Loc Tooltips.Server.Disconnect}"
|
||||
Margin="10,0,0,0" MinWidth="96" Visibility="{Binding IsConnected, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button x:Name="KnownButton" DockPanel.Dock="Right" Style="{StaticResource Button.Icon}" Margin="10,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronDown}"
|
||||
IsEnabled="{Binding HasKnownServers}" Click="OnShowKnown" ToolTip="{l:Loc Tooltips.Server.Found}" AutomationProperties.Name="{l:Loc Server.Found}">
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="AddressBox" Text="{Binding Address, UpdateSourceTrigger=PropertyChanged}" ui:Field.Placeholder="{l:Loc Server.AddressPlaceholder}"
|
||||
ToolTip="{l:Loc Tooltips.Server.Address}" AutomationProperties.Name="{l:Loc Server.Label.Server}" IsReadOnly="{Binding IsConnected}"
|
||||
FlowDirection="LeftToRight">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding ConnectCommand}" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
<Button x:Name="KnownButton" Grid.Column="1" Style="{StaticResource Button.Icon}" Margin="10,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronDown}"
|
||||
IsEnabled="{Binding HasKnownServers}" Click="OnShowKnown" ToolTip="{Binding KnownToolTip}" AutomationProperties.Name="{l:Loc Server.Found}">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu ItemsSource="{Binding KnownServers}">
|
||||
<ContextMenu.ItemContainerStyle>
|
||||
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
|
||||
<Setter Property="Header" Value="{Binding Address}" />
|
||||
<!-- An address reads left to right in every language. -->
|
||||
<Setter Property="HeaderTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" FlowDirection="LeftToRight" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="InputGestureText" Value="{Binding Name}" />
|
||||
<Setter Property="Command" Value="{Binding DataContext.UseServerCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
@@ -64,18 +101,18 @@
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<TextBox x:Name="AddressBox" Text="{Binding Address, UpdateSourceTrigger=PropertyChanged}" ui:Field.Placeholder="{l:Loc Server.AddressPlaceholder}"
|
||||
ToolTip="{l:Loc Tooltips.Server.Address}" AutomationProperties.Name="{l:Loc Server.Label.Server}" IsEnabled="{Binding IsDisconnected}">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding ConnectCommand}" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
</DockPanel>
|
||||
<Button Grid.Column="2" Style="{StaticResource Button.Primary}" Content="{l:Loc Server.Connect}" Command="{Binding ConnectCommand}"
|
||||
ToolTip="{Binding ConnectToolTip}" Margin="10,0,0,0" MinWidth="96"
|
||||
Visibility="{Binding IsDisconnected, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Grid.Column="2" Content="{l:Loc Server.Disconnect}" Command="{Binding DisconnectCommand}" ToolTip="{l:Loc Tooltips.Server.Disconnect}"
|
||||
Margin="10,0,0,0" MinWidth="96" Visibility="{Binding IsConnected, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
|
||||
<!-- Status: state · server · version · latency · trusted certificate. -->
|
||||
<!-- Status: state · server · version · latency · trusted certificate; screen readers hear the state and the error change. -->
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource Text.RowLabel}" Text="{l:Loc Server.Label.Status}" Margin="0,12,10,0" />
|
||||
<WrapPanel Grid.Row="1" Grid.Column="1" Margin="0,12,0,0" VerticalAlignment="Center">
|
||||
<ui:StatusGlyph Kind="{Binding StatusKind}" Text="{Binding StatusText}" FontSize="13" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Server.Status}" />
|
||||
<ui:StatusGlyph Kind="{Binding StatusKind}" Text="{Binding StatusText}" FontSize="13" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Server.Status}"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding StatusText}" />
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding ServerText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||
<TextBlock Style="{StaticResource Text.Dot}" />
|
||||
<TextBlock Text="{Binding ServerText}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||
@@ -88,7 +125,8 @@
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding ErrorText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||
<TextBlock Style="{StaticResource Text.Dot}" />
|
||||
<ui:StatusGlyph Kind="Error" Text="{Binding ErrorText}" FontSize="13" VerticalAlignment="Center" />
|
||||
<ui:StatusGlyph Kind="Error" Text="{Binding ErrorText}" FontSize="13" VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Assertive" infra:LiveRegion.Text="{Binding ErrorText}" />
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
|
||||
@@ -105,16 +143,21 @@
|
||||
<TextBlock Text="{Binding RoleText}" ToolTip="{Binding RoleToolTip}" VerticalAlignment="Center" />
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding HasQuota, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Style="{StaticResource Text.Dot}" />
|
||||
<ProgressBar Width="160" Maximum="1" Value="{Binding QuotaFraction, Mode=OneWay}" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Server.Quota}" />
|
||||
<ProgressBar Width="160" Maximum="1" Value="{Binding QuotaFraction, Mode=OneWay}" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Server.Quota}"
|
||||
AutomationProperties.Name="{Binding QuotaText}" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding QuotaText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" VerticalAlignment="Center"
|
||||
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Server.Quota}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- Options of this PC. -->
|
||||
<!-- Options of this PC; the render-node option names the encoders it offers. -->
|
||||
<Border Grid.Row="3" Grid.ColumnSpan="2" Margin="0,14,0,0" Padding="0,10,0,0" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0">
|
||||
<WrapPanel>
|
||||
<CheckBox Content="{l:Loc Server.RenderNode}" IsChecked="{Binding RenderNodeOptIn}" ToolTip="{l:Loc Tooltips.Server.RenderNode}" Margin="0,0,22,0" />
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,22,0">
|
||||
<CheckBox Content="{l:Loc Server.RenderNode}" IsChecked="{Binding RenderNodeOptIn}" ToolTip="{l:Loc Tooltips.Server.RenderNode}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding NodeCodecsText}" ToolTip="{Binding NodeCodecsToolTip}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0"
|
||||
VerticalAlignment="Center" Visibility="{Binding NodeCodecsText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
</StackPanel>
|
||||
<CheckBox Content="{l:Loc Server.KeepProxies}" IsChecked="{Binding KeepProxiesOffline}" ToolTip="{l:Loc Tooltips.Server.KeepProxies}" Margin="0,0,22,0" />
|
||||
<CheckBox Content="{l:Loc Server.AutoSync}" IsChecked="{Binding SyncSettingsAutomatically}" ToolTip="{l:Loc Tooltips.Server.AutoSync}" Margin="0,0,22,0" />
|
||||
<CheckBox Content="{l:Loc Server.PauseMetered}" IsChecked="{Binding PauseUploadsOnMetered}" ToolTip="{l:Loc Tooltips.Server.PauseMetered}" Margin="0,0,22,0" />
|
||||
@@ -133,43 +176,46 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Toolbar in visual (and Tab) order: title, chips, search, Upload all local. -->
|
||||
<!-- Toolbar in visual (and Tab) order: title, chips, search, Upload all local. Chips wrap before anything is cut;
|
||||
the filters and search show only while signed in. -->
|
||||
<Grid Margin="14,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{l:Loc Server.Sync.Title}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,10,0" />
|
||||
<ItemsControl Grid.Column="1" ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False" VerticalAlignment="Center">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type srv:SyncFilterChip}">
|
||||
<Button x:Name="Chip" Style="{StaticResource Button.Chip}" Content="{Binding Text}" Tag="{Binding IsSelected}" Command="{Binding SelectCommand}"
|
||||
ToolTip="{Binding ToolTip}" Height="28" FontSize="12" Margin="0,0,10,0" Typography.NumeralAlignment="Tabular" />
|
||||
<DataTemplate.Triggers>
|
||||
<!-- Conflicts waiting are drawn in warning colours, unless the chip is the chosen one (then Accent, DESIGN §4). -->
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding NeedsAttention}" Value="True" />
|
||||
<Condition Binding="{Binding IsSelected}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter TargetName="Chip" Property="BorderBrush" Value="{DynamicResource Brush.Warning}" />
|
||||
<Setter TargetName="Chip" Property="Foreground" Value="{DynamicResource Brush.Warning}" />
|
||||
</MultiDataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBox Grid.Column="3" Width="200" Height="30" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Server.Sync.Search}" ToolTip="{l:Loc Tooltips.Server.Sync.Search}" AutomationProperties.Name="{l:Loc Server.Sync.Search}" />
|
||||
<Button Grid.Column="4" Content="{l:Loc Server.Sync.UploadAll}" Command="{Binding UploadAllCommand}" ToolTip="{Binding UploadAllToolTip}"
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Server.Sync.Title}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,4,10,4" />
|
||||
<ItemsControl ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Wrap}" Focusable="False" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type srv:SyncFilterChip}">
|
||||
<RadioButton x:Name="Chip" Style="{StaticResource RadioButton.Chip}" GroupName="SyncFilters" Content="{Binding Text}"
|
||||
IsChecked="{Binding IsSelected, Mode=OneWay}" Command="{Binding SelectCommand}" ToolTip="{Binding ToolTip}" Margin="0,1,10,1" />
|
||||
<DataTemplate.Triggers>
|
||||
<!-- Conflicts waiting are drawn in warning colours, unless the chip is the chosen one (then Accent, DESIGN §4). -->
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding NeedsAttention}" Value="True" />
|
||||
<Condition Binding="{Binding IsSelected}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter TargetName="Chip" Property="BorderBrush" Value="{DynamicResource Brush.Warning}" />
|
||||
<Setter TargetName="Chip" Property="Foreground" Value="{DynamicResource Brush.Warning}" />
|
||||
</MultiDataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
<TextBox Grid.Column="1" Width="200" Height="30" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Server.Sync.Search}" ToolTip="{l:Loc Tooltips.Server.Sync.Search}" AutomationProperties.Name="{l:Loc Server.Sync.Search}"
|
||||
Margin="10,0,0,0" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Grid.Column="2" Content="{l:Loc Server.Sync.UploadAll}" Command="{Binding UploadAllCommand}" ToolTip="{Binding UploadAllToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" Height="30" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
|
||||
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The right padding
|
||||
keeps the space of the rows' scroll bar, so the columns line up. -->
|
||||
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The list always
|
||||
keeps its 10 px scroll-bar gutter and the header the same on its right, so the columns line up with or without scrolling. -->
|
||||
<Border Grid.Row="1" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,1" Padding="14,8,24,8">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -186,11 +232,11 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Rows (virtualised): this PC, the server, the state and the actions that apply; conflicts on the card colour.
|
||||
<!-- Rows (virtualised): this PC, the server, the state and the actions that apply; conflicts on the warning tint.
|
||||
Tab walks every row button (the rows themselves take no focus). Actions wrap when longer labels need it. -->
|
||||
<ListBox x:Name="SyncList" Grid.Row="2" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}"
|
||||
<ListBox x:Name="SyncList" Grid.Row="2" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Sync}"
|
||||
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" KeyboardNavigation.TabNavigation="Continue"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" KeyboardNavigation.TabNavigation="Continue"
|
||||
AutomationProperties.Name="{l:Loc Server.Sync.Title}" Visibility="{Binding HasRows, Converter={StaticResource BoolToVisibility}}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type srv:SyncRow}">
|
||||
@@ -206,18 +252,15 @@
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Title}" ToolTip="{Binding Title}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding LocalText}" ToolTip="{Binding LocalText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding ServerText}" ToolTip="{Binding ServerText}" Margin="10,0,0,0" />
|
||||
<!-- A new state (uploading, in sync, failed) is announced with its sequence; progress ticks are not. -->
|
||||
<ui:StatusGlyph Grid.Column="3" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}"
|
||||
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0" />
|
||||
<ItemsControl Grid.Column="4" ItemsSource="{Binding Actions}" Focusable="False" VerticalAlignment="Center" Margin="10,4,0,4">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding StateAnnouncement}" />
|
||||
<ItemsControl Grid.Column="4" ItemsSource="{Binding Actions}" ItemsPanel="{StaticResource Panel.Wrap}" Focusable="False" VerticalAlignment="Center" Margin="10,4,0,4">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type srv:SyncRowAction}">
|
||||
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}"
|
||||
FontSize="12" Margin="0,2,6,2" />
|
||||
AutomationProperties.Name="{Binding AccessibleName}" FontSize="12" Margin="0,2,6,2" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@@ -225,15 +268,27 @@
|
||||
</Border>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsConflict}" Value="True">
|
||||
<Setter TargetName="RowBorder" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
<Setter TargetName="RowBorder" Property="Background" Value="{DynamicResource Brush.WarningSubtle}" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<ui:EmptyState Grid.Row="2" Message="{Binding EmptyText}" Visibility="{Binding EmptyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
|
||||
<!-- Footer: last comparison · server archive · retry state · admin panel. -->
|
||||
<!-- One sentence and its one action: connect, bring photos in, or show every sequence again. -->
|
||||
<ui:EmptyState Grid.Row="2" Message="{Binding EmptyText}" Visibility="{Binding EmptyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||
<Grid>
|
||||
<Button Content="{l:Loc Server.Connect}" Command="{Binding DataContext.ConnectCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
ToolTip="{Binding DataContext.ConnectToolTip, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Visibility="{Binding Empty, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=SignedOut}" />
|
||||
<Button Content="{l:Loc Shell.Nav.Import}" Command="{Binding ImportCommand}" ToolTip="{l:Loc Tooltips.Server.Sync.Import}"
|
||||
Visibility="{Binding Empty, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=Nothing}" />
|
||||
<Button Content="{l:Loc Server.Sync.ClearFilters}" Command="{Binding ClearFiltersCommand}" ToolTip="{l:Loc Tooltips.Server.Sync.ClearFilters}"
|
||||
Visibility="{Binding Empty, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=NoMatch}" />
|
||||
</Grid>
|
||||
</ui:EmptyState>
|
||||
|
||||
<!-- Footer: last comparison · server archive · retry state (announced) · admin panel for administrators. -->
|
||||
<Border Grid.Row="3" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" Padding="14,8">
|
||||
<DockPanel LastChildFill="False" TextElement.FontSize="12">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Server.Sync.OpenAdmin}" Command="{Binding OpenAdminCommand}"
|
||||
@@ -245,6 +300,7 @@
|
||||
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Server.Sync.Archive}"
|
||||
Visibility="{Binding ArchiveText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
<ui:StatusGlyph Kind="Warning" Text="{Binding ErrorText}" ToolTip="{Binding ErrorToolTip}" FontSize="12" VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding ErrorText}"
|
||||
Visibility="{Binding ErrorText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
@@ -2,7 +2,9 @@ using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Server;
|
||||
using Titano.App.Settings;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Mvvm;
|
||||
@@ -58,12 +60,20 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
|
||||
public bool HasKnownServers => KnownServers.Any();
|
||||
|
||||
/// <summary>What ▾ lists, or why it is disabled.</summary>
|
||||
public string KnownToolTip => Loc.L(HasKnownServers ? "Tooltips.Server.Found" : "Tooltips.Server.NoneFound");
|
||||
|
||||
/// <summary>What Connect does, or why it is disabled.</summary>
|
||||
public string ConnectToolTip => Loc.L(Address.Trim().Length > 0 ? "Tooltips.Server.Connect" : "Tooltips.Server.ConnectNoAddress");
|
||||
|
||||
public string Address
|
||||
{
|
||||
get => _address;
|
||||
set
|
||||
{
|
||||
if (Set(ref _address, value ?? string.Empty)) CommandManager.InvalidateRequerySuggested();
|
||||
if (!Set(ref _address, value ?? string.Empty)) return;
|
||||
OnPropertyChanged(nameof(ConnectToolTip));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +113,7 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
|
||||
/// <summary>"TLS 9A:3C:71:E0:… trusted 2026-09-01".</summary>
|
||||
public string? CertificateText => Fingerprint is { } fp && Session.TrustOf(fp) is { } trust
|
||||
? Loc.L("Server.Certificate.Trusted", ServerSession.ShortFingerprint(fp), Formatting.Date(trust.TrustedAt))
|
||||
? Loc.L("Server.Certificate.Trusted", Formatting.LeftToRight(ServerSession.ShortFingerprint(fp)), Formatting.Date(trust.TrustedAt))
|
||||
: null;
|
||||
|
||||
public string CertificateToolTip => Loc.L("Tooltips.Server.CertificateTrusted");
|
||||
@@ -138,6 +148,15 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The video encoders a render node on this PC offers the server.</summary>
|
||||
private IReadOnlyList<EncoderRow> NodeEncoders => EncoderUse.Node(Shell.Settings.Encoders.Select(e => e.Row),
|
||||
AppServices.AllowsHardware(Shell.Services.Settings.HardwareEncoding, ExportResolver.CustomId));
|
||||
|
||||
/// <summary>"HEVC · H.264 · AV1" beside "Offer this PC as render node" (BRIEF §12.7); null before the encoders are known.</summary>
|
||||
public string? NodeCodecsText => EncoderUse.Codecs(NodeEncoders);
|
||||
|
||||
public string NodeCodecsToolTip => Loc.L("Tooltips.Server.NodeEncoders", string.Join(", ", NodeEncoders.Select(e => e.DisplayName)));
|
||||
|
||||
/// <summary>Keep the proxy caches of server sequences opened with proxies up to date on this PC.</summary>
|
||||
public bool KeepProxiesOffline
|
||||
{
|
||||
@@ -166,8 +185,13 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Re-reads values another screen changed (Settings › Server).</summary>
|
||||
public void Refresh() => OnPropertyChanged(nameof(RenderNodeOptIn));
|
||||
/// <summary>Re-reads values another screen changed (Settings › Server and Rendering).</summary>
|
||||
public void Refresh()
|
||||
{
|
||||
OnPropertyChanged(nameof(RenderNodeOptIn));
|
||||
OnPropertyChanged(nameof(NodeCodecsText));
|
||||
OnPropertyChanged(nameof(NodeCodecsToolTip));
|
||||
}
|
||||
|
||||
/// <summary>Restores the saved session and starts listening for LAN servers.</summary>
|
||||
public async Task AttachAsync()
|
||||
@@ -181,6 +205,7 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
if (Address.Length == 0 && Session.Discovered.Count > 0) Address = Session.Discovered[0].Address;
|
||||
};
|
||||
if (!Shell.Services.Environment.IsCapture) _session.StartDiscovery();
|
||||
Shell.Settings.Encoders.CollectionChanged += OnEncodersChanged;
|
||||
Sync.Attach();
|
||||
await _session.RestoreAsync();
|
||||
if (_session.Flow.Error is not ConnectError.None and var error && !_session.IsConnected) ErrorText = ServerSession.ErrorText(error);
|
||||
@@ -189,10 +214,17 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
public override void Dispose()
|
||||
{
|
||||
if (_session is not null) _session.PropertyChanged -= OnSessionChanged;
|
||||
Shell.Settings.Encoders.CollectionChanged -= OnEncodersChanged;
|
||||
Sync.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>The encoders next to the render-node option are listed on the first visit.</summary>
|
||||
protected override void OnActivated()
|
||||
{
|
||||
if (Shell.Settings.Encoders.Count == 0 && !Shell.Settings.IsDetecting) _ = Shell.Settings.DetectEncodersAsync();
|
||||
}
|
||||
|
||||
private void SetSyncOption(bool value, bool current, Action<bool> store, [System.Runtime.CompilerServices.CallerMemberName] string? name = null)
|
||||
{
|
||||
if (value == current) return;
|
||||
@@ -222,22 +254,13 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
|
||||
private void ShowCertificate()
|
||||
{
|
||||
if (Fingerprint is not { } fingerprint) return;
|
||||
var forget = Shell.Services.Dialogs.Confirm(new ConfirmRequest
|
||||
{
|
||||
Heading = Loc.L("Server.Certificate.Title"),
|
||||
Message = Loc.L("Server.Certificate.Message"),
|
||||
Detail = ServerSession.FormatFingerprint(fingerprint),
|
||||
DetailToolTip = Loc.L("Tooltips.Server.Fingerprint"),
|
||||
SafeText = Loc.L("Server.Certificate.Keep"),
|
||||
SafeToolTip = Loc.L("Tooltips.Server.KeepTrust"),
|
||||
ActionText = Loc.L("Server.Certificate.Forget"),
|
||||
ActionToolTip = Loc.L("Tooltips.Server.ForgetTrust"),
|
||||
IsDestructive = true,
|
||||
});
|
||||
if (!forget) return;
|
||||
Session.Disconnect();
|
||||
Session.Forget(fingerprint);
|
||||
if (Fingerprint is { } fingerprint) Session.ConfirmForget(fingerprint, Shell.Services.Dialogs);
|
||||
}
|
||||
|
||||
private void OnEncodersChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(nameof(NodeCodecsText));
|
||||
OnPropertyChanged(nameof(NodeCodecsToolTip));
|
||||
}
|
||||
|
||||
private void OnSessionChanged(object? sender, PropertyChangedEventArgs e)
|
||||
|
||||
@@ -3,11 +3,58 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||
xmlns:shell="clr-namespace:Titano.App.Shell"
|
||||
xmlns:st="clr-namespace:Titano.App.Settings">
|
||||
<UserControl.Resources>
|
||||
<!-- Every page is a size scope: its labels share one column as wide as the longest label (at least 180 px, DESIGN §3),
|
||||
wrapping only past 280 px, so translations 40 % longer are never cut (DESIGN §2: MinWidth only). -->
|
||||
<Style x:Key="Page" TargetType="StackPanel">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Setter Property="Grid.IsSharedSizeScope" Value="True" />
|
||||
</Style>
|
||||
<Style x:Key="Setting.Row" TargetType="HeaderedContentControl">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Margin" Value="0,0,0,14" />
|
||||
<Setter Property="MinHeight" Value="32" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="HeaderedContentControl">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="180" SharedSizeGroup="SettingLabel" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource Text.Label}" VerticalAlignment="Top"
|
||||
TextTrimming="None" TextWrapping="Wrap" MaxWidth="280" Margin="0,7,14,0" />
|
||||
<ContentPresenter Grid.Column="1" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- A path in a row with buttons: up to 360 px, narrower before anything wraps or is cut; left to right in every language. -->
|
||||
<Style x:Key="TextBox.Path" TargetType="TextBox" BasedOn="{StaticResource TextBox.Setting}">
|
||||
<Setter Property="Width" Value="Auto" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
</Style>
|
||||
<!-- Numbers stay right-aligned in both reading directions. -->
|
||||
<Style x:Key="TextBox.SettingNumber" TargetType="TextBox" BasedOn="{StaticResource TextBox.Number}">
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
</Style>
|
||||
<!-- Keyboard focus in the section list: a 2 px Accent ring inside the item (DESIGN §4), distinct from the selected fill. -->
|
||||
<Style x:Key="Focus.Inset">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="2" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ListBoxItem.SettingsSection" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Section}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||
</Style>
|
||||
<Style x:Key="Slider.Budget" TargetType="Slider" BasedOn="{StaticResource {x:Type Slider}}">
|
||||
<Setter Property="ui:ControlState.Accent" Value="{DynamicResource Brush.Sun}" />
|
||||
@@ -24,6 +71,13 @@
|
||||
<Setter Property="ui:ControlState.CornerRadius" Value="12" />
|
||||
<Setter Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Reset}" />
|
||||
</Style>
|
||||
<!-- "Auto · 8": a pill of text with the advisor's reason in its tooltip (DESIGN §4), not a button. -->
|
||||
<Style x:Key="Text.AutoPill" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="{StaticResource Size.Chip}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="20,16,20,16">
|
||||
@@ -33,15 +87,16 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Section list: search, sections, settings as JSON. -->
|
||||
<DockPanel>
|
||||
<TextBox DockPanel.Dock="Top" Margin="0,0,0,8" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
<!-- Section list: search, sections, settings as JSON (visual and Tab order). -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Margin="0,0,0,8" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Settings.Search}" ToolTip="{l:Loc Tooltips.Settings.Search}" AutomationProperties.Name="{l:Loc Settings.Search}" />
|
||||
<StackPanel DockPanel.Dock="Bottom">
|
||||
<Button Content="{l:Loc Settings.Export}" Command="{Binding ExportSettingsCommand}" ToolTip="{l:Loc Tooltips.Settings.Export}" HorizontalAlignment="Stretch" Margin="0,0,0,8" />
|
||||
<Button Content="{l:Loc Settings.Import}" Command="{Binding ImportSettingsCommand}" ToolTip="{l:Loc Tooltips.Settings.Import}" HorizontalAlignment="Stretch" />
|
||||
</StackPanel>
|
||||
<ListBox ItemsSource="{Binding VisiblePages}" SelectedItem="{Binding SelectedPageItem}" ItemContainerStyle="{StaticResource ListBoxItem.Section}"
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding VisiblePages}" SelectedItem="{Binding SelectedPageItem}" ItemContainerStyle="{StaticResource ListBoxItem.SettingsSection}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" AutomationProperties.Name="{l:Loc Shell.Nav.Settings}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type st:SettingsPageItem}">
|
||||
@@ -49,17 +104,22 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
<StackPanel Grid.Row="2" Margin="0,8,0,0">
|
||||
<Button Content="{l:Loc Settings.Export}" Command="{Binding ExportSettingsCommand}" ToolTip="{l:Loc Tooltips.Settings.Export}" HorizontalAlignment="Stretch" Margin="0,0,0,8" />
|
||||
<Button Content="{l:Loc Settings.Import}" Command="{Binding ImportSettingsCommand}" ToolTip="{l:Loc Tooltips.Settings.Import}" HorizontalAlignment="Stretch" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="22,18">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{Binding PageTitle}" Style="{StaticResource Text.PageTitle}" Margin="0,0,0,18" />
|
||||
<Border DockPanel.Dock="Bottom" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" Padding="0,12,0,0" Margin="0,12,0,0">
|
||||
<Button Style="{StaticResource Button.Subtle}" HorizontalAlignment="Right" Content="{l:Loc Settings.ResetSection}" Command="{Binding ResetSectionCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.ResetSection}" BorderBrush="{DynamicResource Brush.Stroke}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</Border>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding PageTitle}" Style="{StaticResource Text.PageTitle}" Margin="0,0,0,18" />
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
|
||||
<Grid>
|
||||
<!-- ================= General ================= -->
|
||||
<StackPanel Style="{StaticResource Page}" Visibility="{Binding Page, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=General}">
|
||||
@@ -82,27 +142,35 @@
|
||||
<!-- ================= Archive ================= -->
|
||||
<StackPanel Style="{StaticResource Page}" Visibility="{Binding Page, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=Archive}">
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Archive.Root}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Setting}" Text="{Binding ArchiveRoot.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="360" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Path}" Text="{Binding ArchiveRoot.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding ArchiveRoot}" ToolTip="{Binding ArchiveRoot.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Archive.Root}" />
|
||||
<Button Style="{StaticResource Button.Icon}" Margin="10,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Command="{Binding BrowseArchiveCommand}"
|
||||
<Button Grid.Column="1" Style="{StaticResource Button.Icon}" Margin="10,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Command="{Binding BrowseArchiveCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.BrowseArchive}" AutomationProperties.Name="{l:Loc Settings.Browse}" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding ArchiveFreeText}" Margin="10,0,0,0" ToolTip="{l:Loc Tooltips.Settings.ArchiveFree}" />
|
||||
</WrapPanel>
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Hint}" Text="{Binding ArchiveFreeText}" Margin="10,0,0,0" ToolTip="{l:Loc Tooltips.Settings.ArchiveFree}" />
|
||||
</Grid>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Archive.Folders}">
|
||||
<TextBox Style="{StaticResource TextBox.SettingMono}" Text="{Binding FolderTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding FolderTemplate}" ToolTip="{Binding FolderTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Archive.Folders}" />
|
||||
shell:EditBehavior.Field="{Binding FolderTemplate}" ToolTip="{Binding FolderTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Archive.Folders}"
|
||||
FlowDirection="LeftToRight" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Archive.Files}">
|
||||
<TextBox Style="{StaticResource TextBox.SettingMono}" Text="{Binding FileTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding FileTemplate}" ToolTip="{Binding FileTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Archive.Files}" />
|
||||
shell:EditBehavior.Field="{Binding FileTemplate}" ToolTip="{Binding FileTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Archive.Files}"
|
||||
FlowDirection="LeftToRight" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Archive.Preview}">
|
||||
<ItemsControl ItemsSource="{Binding PreviewNames}" Focusable="False" Margin="0,7,0,0" ToolTip="{l:Loc Tooltips.Settings.Preview}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" FontFamily="{StaticResource Font.Mono}" FontSize="12" Foreground="{DynamicResource Brush.TextMuted}" LineHeight="20" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{Binding}" FontFamily="{StaticResource Font.Mono}" FontSize="12" Foreground="{DynamicResource Brush.TextMuted}" LineHeight="20"
|
||||
TextTrimming="CharacterEllipsis" FlowDirection="LeftToRight" HorizontalAlignment="Left" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@@ -126,8 +194,10 @@
|
||||
ToolTip="{l:Loc Tooltips.Settings.Memory}" AutomationProperties.Name="{l:Loc Settings.Rendering.Memory}" />
|
||||
<TextBlock Text="{Binding MemoryText}" Margin="12,0,0,0" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding InstalledText}" Margin="12,0,0,0" />
|
||||
<Button Style="{StaticResource Button.AutoPill}" Content="{Binding MemoryAutoText}" Margin="12,0,0,0" ToolTip="{l:Loc Tooltips.Settings.MemoryAuto}"
|
||||
Visibility="{Binding IsMemoryAuto, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Border Style="{StaticResource Pill.Auto}" Margin="12,0,0,0" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Settings.MemoryAuto}"
|
||||
Visibility="{Binding IsMemoryAuto, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Style="{StaticResource Text.AutoPill}" Text="{Binding MemoryAutoText}" />
|
||||
</Border>
|
||||
<Button Style="{StaticResource Button.Reset}" Margin="12,0,0,0" Command="{Binding ResetMemoryCommand}" ToolTip="{l:Loc Tooltips.Settings.MemoryReset}"
|
||||
AutomationProperties.Name="{l:Loc Settings.BackToAuto}"
|
||||
Visibility="{Binding IsMemoryAuto, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
@@ -135,11 +205,13 @@
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Rendering.Parallelism}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Number}" Text="{Binding Parallelism.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<TextBox Style="{StaticResource TextBox.SettingNumber}" Text="{Binding Parallelism.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding Parallelism}" ToolTip="{Binding Parallelism.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Rendering.Parallelism}" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding CoresText}" Margin="12,0,0,0" />
|
||||
<Button Style="{StaticResource Button.AutoPill}" Content="{Binding ParallelismAutoText}" Margin="12,0,0,0" ToolTip="{l:Loc Tooltips.Settings.ParallelismAuto}"
|
||||
Visibility="{Binding IsParallelismAuto, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Border Style="{StaticResource Pill.Auto}" Margin="12,0,0,0" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Settings.ParallelismAuto}"
|
||||
Visibility="{Binding IsParallelismAuto, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Style="{StaticResource Text.AutoPill}" Text="{Binding ParallelismAutoText}" />
|
||||
</Border>
|
||||
<Button Style="{StaticResource Button.Reset}" Margin="12,0,0,0" Command="{Binding ResetParallelismCommand}" ToolTip="{l:Loc Tooltips.Settings.ParallelismReset}"
|
||||
AutomationProperties.Name="{l:Loc Settings.BackToAuto}"
|
||||
Visibility="{Binding IsParallelismAuto, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
@@ -155,31 +227,40 @@
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<!-- Encoders on this PC -->
|
||||
<DockPanel Margin="0,4,0,8" LastChildFill="False">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Rendering.SelfTest}" Command="{Binding SelfTestCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.SelfTest}" Margin="8,0,0,0" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Rendering.Redetect}" Command="{Binding RedetectCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Redetect}" />
|
||||
<!-- Encoders on this PC (title, adapter, Re-detect, Run self-test: visual and Tab order). -->
|
||||
<Grid Margin="0,4,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{l:Loc Settings.Rendering.Encoders}" FontWeight="SemiBold" VerticalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding AdapterText}" Margin="10,0,0,0" ToolTip="{l:Loc Tooltips.Settings.Adapter}" />
|
||||
</DockPanel>
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Hint}" Text="{Binding AdapterText}" Margin="10,0,0,0" ToolTip="{l:Loc Tooltips.Settings.Adapter}" />
|
||||
<Button Grid.Column="2" Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Rendering.Redetect}" Command="{Binding RedetectCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.Redetect}" Margin="8,0,0,0" />
|
||||
<Button Grid.Column="3" Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Rendering.SelfTest}" Command="{Binding SelfTestCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.SelfTest}" Margin="8,0,0,0" />
|
||||
</Grid>
|
||||
<!-- Settings.html encoder table: codec, encoder, 10-bit, max size, self-test (announced as it moves on), presets served. -->
|
||||
<Border Style="{StaticResource Border.Card}">
|
||||
<StackPanel>
|
||||
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,8">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="1.4*" MinWidth="160" />
|
||||
<ColumnDefinition Width="90" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition Width="96" />
|
||||
<ColumnDefinition Width="1.2*" MinWidth="140" />
|
||||
<ColumnDefinition Width="70" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="130" />
|
||||
<ColumnDefinition Width="*" MinWidth="120" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Settings.Rendering.Column.Codec}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Settings.Rendering.Column.Encoder}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Settings.Rendering.Column.TenBit}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Settings.Rendering.Column.Max}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.Header}" Text="{l:Loc Settings.Rendering.Column.SelfTest}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.Header}" Text="{l:Loc Settings.Rendering.Column.UsedFor}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ItemsControl ItemsSource="{Binding Encoders}" Focusable="False">
|
||||
@@ -188,18 +269,22 @@
|
||||
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Height="36" Padding="14,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="1.4*" MinWidth="160" />
|
||||
<ColumnDefinition Width="90" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition Width="96" />
|
||||
<ColumnDefinition Width="1.2*" MinWidth="140" />
|
||||
<ColumnDefinition Width="70" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="130" />
|
||||
<ColumnDefinition Width="*" MinWidth="120" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Codec}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Name}" Margin="10,0,0,0" ToolTip="{Binding Row.Name}" />
|
||||
<TextBlock x:Name="TenBit" Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding TenBitText}" Margin="10,0,0,0" Foreground="{DynamicResource Brush.TextFaint}" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Cell}" Text="{Binding MaxText}" Margin="10,0,0,0" />
|
||||
<ui:StatusGlyph Grid.Column="4" Kind="{Binding ResultKind}" Text="{Binding ResultText}" ToolTip="{Binding ResultToolTip}" FontSize="13"
|
||||
VerticalAlignment="Center" Margin="10,0,0,0" Visibility="{Binding HasResult, Converter={StaticResource BoolToVisibility}}" />
|
||||
VerticalAlignment="Center" Margin="10,0,0,0" Visibility="{Binding HasResult, Converter={StaticResource BoolToVisibility}}"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding ResultAnnouncement}" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.Cell}" Text="{Binding UsedForText}" ToolTip="{Binding UsedForText}"
|
||||
Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<DataTemplate.Triggers>
|
||||
@@ -217,26 +302,33 @@
|
||||
<!-- ================= Storage ================= -->
|
||||
<StackPanel Style="{StaticResource Page}" Visibility="{Binding Page, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=Storage}">
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Storage.Folder}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Setting}" Text="{Binding CacheFolder.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<!-- Path, browse, usage, Clear on one line: the path gives way first (Settings.html). -->
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="360" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Path}" Text="{Binding CacheFolder.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding CacheFolder}" ToolTip="{Binding CacheFolder.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Storage.Folder}" />
|
||||
<Button Style="{StaticResource Button.Icon}" Margin="10,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Command="{Binding BrowseCacheCommand}"
|
||||
<Button Grid.Column="1" Style="{StaticResource Button.Icon}" Margin="10,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Command="{Binding BrowseCacheCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.BrowseCache}" AutomationProperties.Name="{l:Loc Settings.Browse}" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{Binding CacheUsageText}" Margin="10,0,0,0" ToolTip="{l:Loc Tooltips.Settings.CacheUsage}" />
|
||||
<Button Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Storage.Clear}" Command="{Binding ClearCacheCommand}" ToolTip="{l:Loc Tooltips.Settings.ClearCacheAsk}"
|
||||
Margin="10,0,0,0" />
|
||||
</WrapPanel>
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Hint}" Text="{Binding CacheUsageText}" Margin="10,0,0,0" ToolTip="{l:Loc Tooltips.Settings.CacheUsage}" />
|
||||
<Button Grid.Column="3" Style="{StaticResource Button.Compact}" Content="{l:Loc Settings.Storage.Clear}" Command="{Binding ClearCacheCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.ClearCacheAsk}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Storage.Thumbnails}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Number}" Width="96" Text="{Binding ThumbnailMemory.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<TextBox Style="{StaticResource TextBox.SettingNumber}" Width="96" Text="{Binding ThumbnailMemory.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding ThumbnailMemory}" ToolTip="{Binding ThumbnailMemory.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Storage.Thumbnails}" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{l:Loc Settings.Storage.ThumbnailsUnit}" Margin="12,0,0,0" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Storage.Limit}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Number}" Text="{Binding CacheLimit.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<TextBox Style="{StaticResource TextBox.SettingNumber}" Text="{Binding CacheLimit.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding CacheLimit}" ToolTip="{Binding CacheLimit.ToolTip}" AutomationProperties.Name="{l:Loc Settings.Storage.Limit}" />
|
||||
<TextBlock Style="{StaticResource Text.Hint}" Text="{l:Loc Settings.Storage.LimitUnit}" Margin="12,0,0,0" />
|
||||
</WrapPanel>
|
||||
@@ -248,10 +340,10 @@
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.Default}">
|
||||
<TextBox Style="{StaticResource TextBox.Setting}" Text="{Binding DefaultServer.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding DefaultServer}" ToolTip="{Binding DefaultServer.ToolTip}" ui:Field.Placeholder="{l:Loc Server.AddressPlaceholder}"
|
||||
AutomationProperties.Name="{l:Loc Settings.Server.Default}" />
|
||||
AutomationProperties.Name="{l:Loc Settings.Server.Default}" FlowDirection="LeftToRight" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.RenderNode}">
|
||||
<CheckBox Content="{l:Loc Server.RenderNode}" IsChecked="{Binding RenderNodeOptIn}" ToolTip="{l:Loc Tooltips.Server.RenderNode}" Margin="0,4,0,0" />
|
||||
<CheckBox Content="{l:Loc Settings.Server.OfferPc}" IsChecked="{Binding RenderNodeOptIn}" ToolTip="{l:Loc Tooltips.Server.RenderNode}" Margin="0,4,0,0" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.Certificates}">
|
||||
<Grid>
|
||||
@@ -267,12 +359,12 @@
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Server}" />
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Server}" ToolTip="{Binding Server}" FlowDirection="LeftToRight" HorizontalAlignment="Left" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Fingerprint}" FontFamily="{StaticResource Font.Mono}" FontSize="12"
|
||||
ToolTip="{Binding FullFingerprint}" Margin="10,0,0,0" />
|
||||
ToolTip="{Binding FullFingerprint}" Margin="10,0,0,0" FlowDirection="LeftToRight" HorizontalAlignment="Left" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding TrustedText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" />
|
||||
<Button Grid.Column="3" Style="{StaticResource Button.Row}" Content="{l:Loc Server.Certificate.Forget}" Command="{Binding ForgetCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Server.ForgetTrust}" Margin="10,0,0,0" />
|
||||
ToolTip="{l:Loc Tooltips.Server.ForgetTrust}" AutomationProperties.Name="{Binding ForgetName}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -290,7 +382,8 @@
|
||||
<WrapPanel>
|
||||
<Button Content="{l:Loc About.Update.Check}" Command="{Binding Shell.About.CheckCommand}" ToolTip="{l:Loc Tooltips.About.Check}" />
|
||||
<ui:StatusGlyph Kind="{Binding Shell.About.UpdateKind}" Text="{Binding Shell.About.UpdateText}" FontSize="13" VerticalAlignment="Center" Margin="12,0,0,0"
|
||||
Visibility="{Binding Shell.About.HasUpdateText, Converter={StaticResource BoolToVisibility}}" />
|
||||
Visibility="{Binding Shell.About.HasUpdateText, Converter={StaticResource BoolToVisibility}}"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding Shell.About.UpdateAnnouncement}" />
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc About.Update.Download}" Command="{Binding Shell.About.DownloadCommand}" ToolTip="{Binding Shell.About.DownloadToolTip}"
|
||||
VerticalAlignment="Center" Margin="12,0,0,0" FontSize="13"
|
||||
Visibility="{Binding Shell.About.IsUpdateAvailable, Converter={StaticResource BoolToVisibility}}" />
|
||||
@@ -309,19 +402,28 @@
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Advanced.Portable}">
|
||||
<TextBlock Text="{Binding PortableText}" Margin="0,7,0,0" ToolTip="{l:Loc Tooltips.Settings.Portable}" />
|
||||
</HeaderedContentControl>
|
||||
<!-- Read-only folders: the full path in the tooltip; Open says what it does. -->
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Advanced.DataFolder}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Setting}" IsReadOnly="True" Text="{Binding DataFolder, Mode=OneWay}" ToolTip="{l:Loc Tooltips.Settings.DataFolder}"
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="360" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Path}" IsReadOnly="True" Text="{Binding DataFolder, Mode=OneWay}" ToolTip="{Binding DataFolder}"
|
||||
AutomationProperties.Name="{l:Loc Settings.Advanced.DataFolder}" />
|
||||
<Button Content="{l:Loc Common.Open}" Command="{Binding OpenDataFolderCommand}" ToolTip="{l:Loc Tooltips.Settings.OpenDataFolder}" Margin="10,0,0,0" />
|
||||
</WrapPanel>
|
||||
<Button Grid.Column="1" Content="{l:Loc Common.Open}" Command="{Binding OpenDataFolderCommand}" ToolTip="{l:Loc Tooltips.Settings.OpenDataFolder}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Advanced.Logs}">
|
||||
<WrapPanel>
|
||||
<TextBox Style="{StaticResource TextBox.Setting}" IsReadOnly="True" Text="{Binding LogsFolder, Mode=OneWay}" ToolTip="{l:Loc Tooltips.Settings.LogsFolder}"
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="360" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Path}" IsReadOnly="True" Text="{Binding LogsFolder, Mode=OneWay}" ToolTip="{Binding LogsFolder}"
|
||||
AutomationProperties.Name="{l:Loc Settings.Advanced.Logs}" />
|
||||
<Button Content="{l:Loc Common.Open}" Command="{Binding OpenLogsCommand}" ToolTip="{l:Loc Tooltips.Common.OpenLogs}" Margin="10,0,0,0" />
|
||||
</WrapPanel>
|
||||
<Button Grid.Column="1" Content="{l:Loc Common.Open}" Command="{Binding OpenLogsCommand}" ToolTip="{l:Loc Tooltips.Common.OpenLogs}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Advanced.Diagnostics}">
|
||||
<Button HorizontalAlignment="Left" Content="{l:Loc Settings.Advanced.ExportBundle}" Command="{Binding ExportDiagnosticsCommand}" ToolTip="{l:Loc Tooltips.Settings.Diagnostics}"
|
||||
@@ -334,7 +436,14 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
|
||||
<!-- Reset section: only on pages with settings to reset. -->
|
||||
<Border Grid.Row="2" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" Padding="0,12,0,0" Margin="0,12,0,0"
|
||||
Visibility="{Binding CanResetSection, Converter={StaticResource BoolToVisibility}}">
|
||||
<Button Style="{StaticResource Button.Subtle}" HorizontalAlignment="Right" Content="{l:Loc Settings.ResetSection}" Command="{Binding ResetSectionCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Settings.ResetSection}" BorderBrush="{DynamicResource Brush.Stroke}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -144,7 +144,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
OpenLogsCommand = new RelayCommand(() => ShellActions.Reveal(LogsFolder));
|
||||
ExportDiagnosticsCommand = new AsyncRelayCommand(ExportDiagnosticsAsync);
|
||||
BackupDatabaseCommand = new AsyncRelayCommand(BackupDatabaseAsync, () => Shell.Services.Database is not null);
|
||||
ResetSectionCommand = new RelayCommand(ResetSection);
|
||||
ResetSectionCommand = new RelayCommand(ResetSection, () => CanResetSection);
|
||||
ExportSettingsCommand = new AsyncRelayCommand(ExportSettingsAsync);
|
||||
ImportSettingsCommand = new AsyncRelayCommand(ImportSettingsAsync);
|
||||
Loc.CultureChanged += OnCultureChanged;
|
||||
@@ -168,6 +168,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
if (!Set(ref _page, value)) return;
|
||||
OnPropertyChanged(nameof(SelectedPageItem));
|
||||
OnPropertyChanged(nameof(PageTitle));
|
||||
OnPropertyChanged(nameof(CanResetSection));
|
||||
if (value == SettingsPage.Rendering && Encoders.Count == 0 && !_isDetecting) _ = DetectEncodersAsync();
|
||||
if (value == SettingsPage.Storage) _ = UpdateCacheUsageAsync();
|
||||
}
|
||||
@@ -480,10 +481,13 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
// ---------------- Footer ----------------
|
||||
|
||||
public ICommand ResetSectionCommand { get; }
|
||||
|
||||
/// <summary>Advanced holds no setting with a default (paths and actions only): it has no Reset section.</summary>
|
||||
public bool CanResetSection => _page != SettingsPage.Advanced;
|
||||
public ICommand ExportSettingsCommand { get; }
|
||||
public ICommand ImportSettingsCommand { get; }
|
||||
|
||||
/// <summary>Loads what needs the services (certificates, cache usage).</summary>
|
||||
/// <summary>Loads what needs the services (certificates, cache usage) and follows the server session.</summary>
|
||||
public void Attach()
|
||||
{
|
||||
try
|
||||
@@ -495,16 +499,20 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Log.Warning("settings", "Cache folder not prepared", ex);
|
||||
}
|
||||
LoadCertificates();
|
||||
Shell.Services.Server.PropertyChanged += (_, _) => LoadCertificates();
|
||||
Shell.Services.Server.PropertyChanged += OnServerChanged;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Loc.CultureChanged -= OnCultureChanged;
|
||||
Shell.Services.Server.PropertyChanged -= OnServerChanged;
|
||||
_selfTest?.Cancel();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Other screens change the archive and the server in use: Settings shows them when it opens.</summary>
|
||||
protected override void OnActivated() => ReloadShared();
|
||||
|
||||
// ---------------- Implementation ----------------
|
||||
|
||||
private void Save() => Shell.Services.SaveSettings();
|
||||
@@ -527,6 +535,24 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
OnPropertyChanged(nameof(IsPreferHardware));
|
||||
OnPropertyChanged(nameof(IsSoftwareOnly));
|
||||
OnPropertyChanged(nameof(IsHardwareForPreviews));
|
||||
Shell.Server.Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes the archive and server values other screens set (opening an archive, connecting), unless the field holds an
|
||||
/// edit not committed yet.
|
||||
/// </summary>
|
||||
private void ReloadShared()
|
||||
{
|
||||
if (!ArchiveRoot.IsDirty) ArchiveRoot.Load(_s.LastArchivePath ?? string.Empty);
|
||||
if (!DefaultServer.IsDirty) DefaultServer.Load(ServerAddress.Display(_s.ServerUrl));
|
||||
UpdateArchiveFree();
|
||||
}
|
||||
|
||||
private void OnServerChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
LoadCertificates();
|
||||
if (!DefaultServer.IsDirty) DefaultServer.Load(ServerAddress.Display(_s.ServerUrl));
|
||||
}
|
||||
|
||||
private void UpdatePreview() => PreviewNames = NamingPreview.FirstNames(FolderTemplate.Text, FileTemplate.Text);
|
||||
@@ -623,7 +649,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
{
|
||||
Heading = Loc.L("Settings.Storage.ClearTitle"),
|
||||
Message = Loc.L("Settings.Storage.ClearMessage"),
|
||||
Detail = folder,
|
||||
Detail = Formatting.LeftToRight(folder),
|
||||
DetailToolTip = Loc.L("Tooltips.Settings.CacheFolder"),
|
||||
SafeText = Loc.L("Settings.Storage.Keep"),
|
||||
SafeToolTip = Loc.L("Tooltips.Settings.KeepCache"),
|
||||
@@ -715,11 +741,10 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
case SettingsPage.Updates:
|
||||
_s.CheckForUpdates = defaults.CheckForUpdates;
|
||||
break;
|
||||
case SettingsPage.Advanced:
|
||||
break;
|
||||
}
|
||||
Save();
|
||||
OnAllPropertiesChanged();
|
||||
Shell.Server.Refresh();
|
||||
}
|
||||
|
||||
private async Task ExportSettingsAsync()
|
||||
@@ -783,10 +808,10 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Certificates.Clear();
|
||||
foreach (var certificate in _s.TrustedCertificates.OrderByDescending(c => c.TrustedAt))
|
||||
{
|
||||
// The same question as on the Server screen; the session on that certificate is closed first.
|
||||
Certificates.Add(new TrustedCertificateRow(certificate, new RelayCommand(() =>
|
||||
{
|
||||
Shell.Services.Server.Forget(certificate.Fingerprint);
|
||||
LoadCertificates();
|
||||
if (Shell.Services.Server.ConfirmForget(certificate.Fingerprint, Shell.Services.Dialogs)) LoadCertificates();
|
||||
})));
|
||||
}
|
||||
OnPropertyChanged(nameof(HasCertificates));
|
||||
|
||||
@@ -47,13 +47,15 @@
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- A modal dialog over the dimmed shell: Tab, Ctrl+Tab and the arrows stay inside it, and it opens with focus on the chosen card. -->
|
||||
<Border Width="640" Background="{DynamicResource Brush.Surface}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="1"
|
||||
CornerRadius="{StaticResource Radius.Dialog}" Padding="32,28" Effect="{StaticResource Shadow.Popup}">
|
||||
CornerRadius="{StaticResource Radius.Dialog}" Padding="32,28" Effect="{StaticResource Shadow.Popup}"
|
||||
KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
|
||||
<StackPanel>
|
||||
<DockPanel LastChildFill="True">
|
||||
<ComboBox DockPanel.Dock="Right" VerticalAlignment="Top" MinWidth="120" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"
|
||||
DisplayMemberPath="Name" ToolTip="{l:Loc Tooltips.Welcome.Language}" AutomationProperties.Name="{l:Loc Settings.General.Language}" />
|
||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" />
|
||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" FlowDirection="LeftToRight" />
|
||||
<StackPanel Margin="16,0,16,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Shell.Welcome.Title}" FontSize="20" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{l:Loc Shell.Welcome.Question}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0" TextTrimming="CharacterEllipsis" />
|
||||
@@ -62,7 +64,7 @@
|
||||
|
||||
<StackPanel Margin="0,20,0,0">
|
||||
<!-- Create a local archive -->
|
||||
<RadioButton Style="{StaticResource RadioButton.Choice}" GroupName="Welcome" IsChecked="{Binding IsLocal}" ToolTip="{l:Loc Tooltips.Welcome.Local}"
|
||||
<RadioButton x:Name="LocalChoice" Style="{StaticResource RadioButton.Choice}" GroupName="Welcome" IsChecked="{Binding IsLocal}" ToolTip="{l:Loc Tooltips.Welcome.Local}"
|
||||
AutomationProperties.Name="{l:Loc Shell.Welcome.Local}">
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Subtle}" Content="{l:Loc Shell.Welcome.Change}" Command="{Binding ChangeRootCommand}"
|
||||
@@ -76,7 +78,7 @@
|
||||
</RadioButton>
|
||||
|
||||
<!-- Adopt an existing folder -->
|
||||
<RadioButton Style="{StaticResource RadioButton.Choice}" GroupName="Welcome" IsChecked="{Binding IsAdopt}" ToolTip="{l:Loc Tooltips.Welcome.Adopt}"
|
||||
<RadioButton x:Name="AdoptChoice" Style="{StaticResource RadioButton.Choice}" GroupName="Welcome" IsChecked="{Binding IsAdopt}" ToolTip="{l:Loc Tooltips.Welcome.Adopt}"
|
||||
AutomationProperties.Name="{l:Loc Shell.Welcome.Adopt}">
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Subtle}" Content="{l:Loc Shell.Welcome.Choose}" Command="{Binding ChooseAdoptCommand}"
|
||||
@@ -90,7 +92,7 @@
|
||||
</RadioButton>
|
||||
|
||||
<!-- Connect to a server -->
|
||||
<RadioButton Style="{StaticResource RadioButton.Choice}" GroupName="Welcome" IsChecked="{Binding IsServer}" ToolTip="{l:Loc Tooltips.Welcome.Server}"
|
||||
<RadioButton x:Name="ServerChoice" Style="{StaticResource RadioButton.Choice}" GroupName="Welcome" IsChecked="{Binding IsServer}" ToolTip="{l:Loc Tooltips.Welcome.Server}"
|
||||
AutomationProperties.Name="{l:Loc Shell.Welcome.Server}" Margin="0">
|
||||
<DockPanel>
|
||||
<ui:StatusGlyph DockPanel.Dock="Right" Kind="Online" Text="{l:Loc Shell.Welcome.Found}" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Welcome.Found}"
|
||||
@@ -104,12 +106,17 @@
|
||||
</RadioButton>
|
||||
</StackPanel>
|
||||
|
||||
<DockPanel Margin="0,20,0,0" LastChildFill="False">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Content="{l:Loc Shell.Welcome.Continue}"
|
||||
<!-- Consent, then Continue (visual and Tab order); the consent has the same label as in Settings. -->
|
||||
<Grid Margin="0,20,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Content="{l:Loc Settings.General.UsageCounts}" IsChecked="{Binding UsageCounts}" ToolTip="{l:Loc Tooltips.Settings.UsageCounts}" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<Button Grid.Column="1" Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Margin="12,0,0,0" Content="{l:Loc Shell.Welcome.Continue}"
|
||||
Command="{Binding ContinueCommand}" ToolTip="{l:Loc Tooltips.Welcome.Continue}" IsDefault="True" />
|
||||
<CheckBox Content="{l:Loc Shell.Welcome.Consent}" IsChecked="{Binding UsageCounts}" ToolTip="{l:Loc Tooltips.Settings.UsageCounts}" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,28 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Titano.App.Sections;
|
||||
|
||||
public partial class WelcomeView : UserControl
|
||||
{
|
||||
public WelcomeView() => InitializeComponent();
|
||||
public WelcomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsVisibleChanged += (_, e) =>
|
||||
{
|
||||
if (e.NewValue is true) Dispatcher.InvokeAsync(FocusChoice, DispatcherPriority.Input);
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The dialog opens with focus on the chosen card, so the keyboard starts inside it; the window keeps it as its focused
|
||||
/// element, so a window not active yet gives the card keyboard focus when activated.
|
||||
/// </summary>
|
||||
private void FocusChoice()
|
||||
{
|
||||
var chosen = new[] { LocalChoice, AdoptChoice, ServerChoice }.FirstOrDefault(c => c.IsChecked == true) ?? LocalChoice;
|
||||
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(chosen), chosen);
|
||||
Keyboard.Focus(chosen);
|
||||
}
|
||||
}
|
||||
@@ -100,13 +100,13 @@ public sealed class WelcomeViewModel : LocalizedViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"D:\TitanoArchive · 1.8 TB free".</summary>
|
||||
/// <summary>"D:\TitanoArchive · 1.8 TB free" (the path left to right in every language).</summary>
|
||||
public string LocalDetail => ArchiveLocations.FreeSpace(_localRoot) is { } free
|
||||
? Loc.L("Shell.Welcome.Local.Detail", _localRoot, Formatting.Bytes(free))
|
||||
: _localRoot;
|
||||
? Loc.L("Shell.Welcome.Local.Detail", Formatting.LeftToRight(_localRoot), Formatting.Bytes(free))
|
||||
: Formatting.LeftToRight(_localRoot);
|
||||
|
||||
/// <summary>The chosen folder to adopt; null until picked.</summary>
|
||||
public string? AdoptDetail => _adoptFolder;
|
||||
public string? AdoptDetail => _adoptFolder is { } folder ? Formatting.LeftToRight(folder) : null;
|
||||
|
||||
public bool HasAdoptDetail => _adoptFolder is not null;
|
||||
|
||||
@@ -117,7 +117,7 @@ public sealed class WelcomeViewModel : LocalizedViewModel
|
||||
|
||||
/// <summary>"Studio NAS on this network · https://nas.local:8443".</summary>
|
||||
public string? ServerDetail => FoundServer is { } s
|
||||
? s.Name == s.Address ? s.Address : Loc.L("Shell.Welcome.Server.Found", s.Name, s.Address)
|
||||
? s.Name == s.Address ? Formatting.LeftToRight(s.Address) : Loc.L("Shell.Welcome.Server.Found", s.Name, Formatting.LeftToRight(s.Address))
|
||||
: null;
|
||||
|
||||
public bool HasServerDetail => ServerDetail is not null;
|
||||
|
||||
@@ -77,6 +77,18 @@ public sealed class ServerSession : ObservableObject, ITrustStore, IDisposable
|
||||
OnAllPropertiesChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forgets a trusted certificate once the user confirmed it (Server screen and Settings › Server alike); the session
|
||||
/// that relies on it is closed first. True when it was forgotten.
|
||||
/// </summary>
|
||||
public bool ConfirmForget(string fingerprint, IAppDialogs dialogs)
|
||||
{
|
||||
if (!dialogs.Confirm(ForgetRequest(fingerprint))) return false;
|
||||
if (IsConnected && string.Equals(TrustOf(_flow.Info?.TlsFingerprint)?.Fingerprint, fingerprint, StringComparison.OrdinalIgnoreCase)) Disconnect();
|
||||
Forget(fingerprint);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------- Session ----------------
|
||||
|
||||
/// <summary>Resumes the saved session at start; stays signed out quietly when it cannot be reused.</summary>
|
||||
@@ -196,11 +208,27 @@ public sealed class ServerSession : ObservableObject, ITrustStore, IDisposable
|
||||
ActionToolTip = Loc.L("Tooltips.Server.Trust"),
|
||||
};
|
||||
|
||||
/// <summary>Splits the 32-byte SHA-256 fingerprint into two lines of 16 bytes.</summary>
|
||||
/// <summary>The destructive question before a trusted certificate is forgotten, with its fingerprint.</summary>
|
||||
public static ConfirmRequest ForgetRequest(string fingerprint) => new()
|
||||
{
|
||||
Heading = Loc.L("Server.Certificate.Title"),
|
||||
Message = Loc.L("Server.Certificate.Message"),
|
||||
Detail = FormatFingerprint(fingerprint),
|
||||
DetailToolTip = Loc.L("Tooltips.Server.Fingerprint"),
|
||||
SafeText = Loc.L("Server.Certificate.Keep"),
|
||||
SafeToolTip = Loc.L("Tooltips.Server.KeepTrust"),
|
||||
ActionText = Loc.L("Server.Certificate.Forget"),
|
||||
ActionToolTip = Loc.L("Tooltips.Server.ForgetTrust"),
|
||||
IsDestructive = true,
|
||||
};
|
||||
|
||||
/// <summary>Splits the 32-byte SHA-256 fingerprint into two lines of 16 bytes, each kept left to right.</summary>
|
||||
public static string FormatFingerprint(string fingerprint)
|
||||
{
|
||||
var bytes = fingerprint.Split(':');
|
||||
return bytes.Length <= 16 ? fingerprint : string.Join(':', bytes.Take(16)) + "\n" + string.Join(':', bytes.Skip(16));
|
||||
return bytes.Length <= 16
|
||||
? Formatting.LeftToRight(fingerprint)
|
||||
: Formatting.LeftToRight(string.Join(':', bytes.Take(16))) + "\n" + Formatting.LeftToRight(string.Join(':', bytes.Skip(16)));
|
||||
}
|
||||
|
||||
/// <summary>"9A:3C:71:E0:…" for the status line.</summary>
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Titano.App.Server;
|
||||
public sealed class SyncRowAction(SyncAction action, ICommand command) : ObservableObject
|
||||
{
|
||||
private string _toolTip = string.Empty;
|
||||
private string _sequence = string.Empty;
|
||||
|
||||
public SyncAction Action { get; } = action;
|
||||
public string Text => Loc.L("Server.Sync.Action." + Action);
|
||||
@@ -22,8 +23,25 @@ public sealed class SyncRowAction(SyncAction action, ICommand command) : Observa
|
||||
set => Set(ref _toolTip, value);
|
||||
}
|
||||
|
||||
/// <summary>The title of the row's sequence.</summary>
|
||||
public string Sequence
|
||||
{
|
||||
get => _sequence;
|
||||
set
|
||||
{
|
||||
if (Set(ref _sequence, value)) OnPropertyChanged(nameof(AccessibleName));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"Upload: Clouds over the Langhe": screen readers name the sequence each of the many identical buttons acts on.</summary>
|
||||
public string AccessibleName => Loc.L("Server.Sync.ActionFor", Text, _sequence);
|
||||
|
||||
/// <summary>The label in the current language.</summary>
|
||||
public void Relabel() => OnPropertyChanged(nameof(Text));
|
||||
public void Relabel()
|
||||
{
|
||||
OnPropertyChanged(nameof(Text));
|
||||
OnPropertyChanged(nameof(AccessibleName));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>One row of the sync table (Server.html): sequence, this PC, server, state and the actions that apply.</summary>
|
||||
@@ -47,9 +65,13 @@ public sealed class SyncRow : ObservableObject
|
||||
public string ServerText => SyncText.Server(_entry);
|
||||
public StatusKind StateKind => SyncText.State(_entry).Kind;
|
||||
public string StateText => SyncText.State(_entry).Text;
|
||||
|
||||
/// <summary>"Clouds over the Langhe: In sync": what a screen reader announces when the state changes (not progress).</summary>
|
||||
public string StateAnnouncement => Loc.L("Server.Sync.Row.State", Title, StateText);
|
||||
|
||||
public string StateToolTip => SyncText.State(_entry).ToolTip;
|
||||
|
||||
/// <summary>Settings differ on both sides: the row is drawn on the card colour, as in Server.html.</summary>
|
||||
/// <summary>Settings differ on both sides: the row is drawn on the warning tint (the word in the State column says it too).</summary>
|
||||
public bool IsConflict => _entry.Status == SyncStatus.Conflict && _entry.Transfer is null;
|
||||
|
||||
public IReadOnlyList<SyncRowAction> Actions
|
||||
@@ -93,7 +115,11 @@ public sealed class SyncRow : ObservableObject
|
||||
var kept = _actions.ToDictionary(a => a.Action);
|
||||
Actions = [.. wanted.Select(action => kept.GetValueOrDefault(action) ?? new SyncRowAction(action, new AsyncRelayCommand(() => _act(this, action))))];
|
||||
}
|
||||
foreach (var action in _actions) action.ToolTip = SyncText.ToolTip(_entry, action.Action);
|
||||
foreach (var action in _actions)
|
||||
{
|
||||
action.ToolTip = SyncText.ToolTip(_entry, action.Action);
|
||||
action.Sequence = Title;
|
||||
}
|
||||
}
|
||||
|
||||
private void RaiseTexts()
|
||||
@@ -103,6 +129,7 @@ public sealed class SyncRow : ObservableObject
|
||||
OnPropertyChanged(nameof(ServerText));
|
||||
OnPropertyChanged(nameof(StateKind));
|
||||
OnPropertyChanged(nameof(StateText));
|
||||
OnPropertyChanged(nameof(StateAnnouncement));
|
||||
OnPropertyChanged(nameof(StateToolTip));
|
||||
OnPropertyChanged(nameof(IsConflict));
|
||||
}
|
||||
|
||||
@@ -53,6 +53,15 @@ public sealed class SyncFilterChip(SyncFilter filter, Action<SyncFilter> select)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Why the sync table shows no rows; each case has its one action (BRIEF §0.2 rule 6).</summary>
|
||||
public enum SyncEmpty
|
||||
{
|
||||
None,
|
||||
SignedOut,
|
||||
Nothing,
|
||||
NoMatch,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The sync table of the Server screen (BRIEF §12.7, Server.html): every sequence of this PC and of the signed-in
|
||||
/// server with what each side holds, where it stands and what can be done (upload, download originals, open with
|
||||
@@ -87,6 +96,13 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
if (Host.Server is { } server) ShellActions.OpenUrl(server + "/admin");
|
||||
});
|
||||
ClearFiltersCommand = new RelayCommand(() =>
|
||||
{
|
||||
_search = string.Empty;
|
||||
OnPropertyChanged(nameof(SearchText));
|
||||
Select(SyncFilter.All);
|
||||
});
|
||||
ImportCommand = new RelayCommand(() => _shell.Navigate(SectionKey.Import));
|
||||
}
|
||||
|
||||
public ObservableCollection<SyncRow> Rows { get; } = [];
|
||||
@@ -94,6 +110,12 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
public ICommand UploadAllCommand => _uploadAll;
|
||||
public ICommand OpenAdminCommand { get; }
|
||||
|
||||
/// <summary>"No sequence matches": back to every sequence.</summary>
|
||||
public ICommand ClearFiltersCommand { get; }
|
||||
|
||||
/// <summary>"Nothing to compare yet": bring photos in.</summary>
|
||||
public ICommand ImportCommand { get; }
|
||||
|
||||
public string SearchText
|
||||
{
|
||||
get => _search;
|
||||
@@ -108,11 +130,19 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
|
||||
public bool HasRows => Rows.Count > 0;
|
||||
|
||||
public SyncEmpty Empty => HasRows ? SyncEmpty.None
|
||||
: !IsActive ? SyncEmpty.SignedOut
|
||||
: _entries.Count == 0 ? SyncEmpty.Nothing
|
||||
: SyncEmpty.NoMatch;
|
||||
|
||||
/// <summary>"Not connected to a server", "Nothing to compare yet" or "No sequence matches"; null when rows show.</summary>
|
||||
public string? EmptyText => HasRows ? null
|
||||
: !IsActive ? Loc.L("Server.Empty")
|
||||
: _entries.Count == 0 ? Loc.L("Server.Sync.Empty")
|
||||
: Loc.L("Server.Sync.NoMatch");
|
||||
public string? EmptyText => Empty switch
|
||||
{
|
||||
SyncEmpty.SignedOut => Loc.L("Server.Empty"),
|
||||
SyncEmpty.Nothing => Loc.L("Server.Sync.Empty"),
|
||||
SyncEmpty.NoMatch => Loc.L("Server.Sync.NoMatch"),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>What "Upload all local" sends, or why it is disabled.</summary>
|
||||
public string UploadAllToolTip =>
|
||||
@@ -134,8 +164,9 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
|
||||
public string? ErrorToolTip => Host.Agent?.LastError is { } error ? Loc.L("Tooltips.Server.Sync.Retrying", error.Message) : null;
|
||||
|
||||
/// <summary>The server's web admin (it admits administrators only).</summary>
|
||||
public bool CanOpenAdmin => IsActive;
|
||||
/// <summary>The server's web admin admits administrators only: the link shows for accounts that manage the archive or users.</summary>
|
||||
public bool CanOpenAdmin => _shell.Services.Server.User is { } user && IsActive
|
||||
&& (user.Permissions & (long)(Permissions.ManageArchive | Permissions.ManageUsers)) != 0;
|
||||
|
||||
private SyncHost Host => _shell.Services.Sync;
|
||||
|
||||
@@ -249,6 +280,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
while (Rows.Count > wanted.Count) Rows.RemoveAt(Rows.Count - 1);
|
||||
}
|
||||
OnPropertyChanged(nameof(HasRows));
|
||||
OnPropertyChanged(nameof(Empty));
|
||||
OnPropertyChanged(nameof(EmptyText));
|
||||
}
|
||||
|
||||
|
||||
@@ -234,11 +234,16 @@ public static class SyncText
|
||||
_ => Loc.L("Tooltips.Server.Sync." + action),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The chips sort by where the originals are: a sequence being transferred still counts as only on this PC (no server
|
||||
/// copy yet) or only on the server (no local originals yet), as the chip tooltips say.
|
||||
/// </summary>
|
||||
public static bool Matches(SyncEntry entry, SyncFilter filter, string search) =>
|
||||
(filter switch
|
||||
{
|
||||
SyncFilter.LocalOnly => entry.Status == SyncStatus.LocalOnly,
|
||||
SyncFilter.Remote => entry.Status is SyncStatus.RemoteOnly or SyncStatus.ProxiesOnly,
|
||||
SyncFilter.LocalOnly => entry.Status == SyncStatus.LocalOnly || entry is { Status: SyncStatus.Transferring, Link: null },
|
||||
SyncFilter.Remote => entry.Status is SyncStatus.RemoteOnly or SyncStatus.ProxiesOnly
|
||||
|| entry is { Status: SyncStatus.Transferring, HasLocalOriginals: false, Link: not null },
|
||||
SyncFilter.Conflicts => entry.Status == SyncStatus.Conflict,
|
||||
_ => true,
|
||||
}) && (search.Length == 0 || entry.Title.Contains(search, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
@@ -11,28 +11,6 @@ using Titano.Core.Windows.MediaFoundation;
|
||||
|
||||
namespace Titano.App.Settings;
|
||||
|
||||
/// <summary>Who provides an encoder row.</summary>
|
||||
public enum EncoderSource
|
||||
{
|
||||
/// <summary>A Media Foundation MFT (hardware or Microsoft software).</summary>
|
||||
MediaFoundation,
|
||||
|
||||
/// <summary>Titano's managed MJPEG/AVI writer.</summary>
|
||||
BuiltInMjpeg,
|
||||
|
||||
/// <summary>Titano's managed GIF/APNG encoders.</summary>
|
||||
BuiltInAnimation,
|
||||
}
|
||||
|
||||
/// <summary>One row of Settings › Rendering › Encoders.</summary>
|
||||
public sealed record EncoderRow(string Codec, string Name, string? Vendor, EncoderSource Source, bool Hardware, bool TenBit, int MaxWidth, int MaxHeight, VideoCodec? VideoCodec)
|
||||
{
|
||||
public bool CanSelfTest => Source != EncoderSource.BuiltInAnimation;
|
||||
|
||||
/// <summary>"NVIDIA · NVIDIA HEVC Encoder MFT" unless the name already carries the vendor.</summary>
|
||||
public string DisplayName => Vendor is { } vendor && !Name.Contains(vendor, StringComparison.OrdinalIgnoreCase) ? vendor + " · " + Name : Name;
|
||||
}
|
||||
|
||||
/// <summary>Outcome of encoding the synthetic test clip with one encoder.</summary>
|
||||
public sealed record SelfTestResult(bool Passed, double FramesPerSecond, string? Error);
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using Titano.Core.Export;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Video;
|
||||
|
||||
namespace Titano.App.Settings;
|
||||
|
||||
/// <summary>Who provides an encoder row.</summary>
|
||||
public enum EncoderSource
|
||||
{
|
||||
/// <summary>A Media Foundation MFT (hardware or Microsoft software).</summary>
|
||||
MediaFoundation,
|
||||
|
||||
/// <summary>Titano's managed MJPEG/AVI writer.</summary>
|
||||
BuiltInMjpeg,
|
||||
|
||||
/// <summary>Titano's managed GIF/APNG encoders.</summary>
|
||||
BuiltInAnimation,
|
||||
}
|
||||
|
||||
/// <summary>One row of Settings › Rendering › Encoders.</summary>
|
||||
public sealed record EncoderRow(string Codec, string Name, string? Vendor, EncoderSource Source, bool Hardware, bool TenBit, int MaxWidth, int MaxHeight, VideoCodec? VideoCodec)
|
||||
{
|
||||
public bool CanSelfTest => Source != EncoderSource.BuiltInAnimation;
|
||||
|
||||
/// <summary>"NVIDIA · NVIDIA HEVC Encoder MFT" unless the name already carries the vendor.</summary>
|
||||
public string DisplayName => Vendor is { } vendor && !Name.Contains(vendor, StringComparison.OrdinalIgnoreCase) ? vendor + " · " + Name : Name;
|
||||
}
|
||||
|
||||
/// <summary>What the encoders of this PC are for: the built-in presets each one serves and what a render node offers.</summary>
|
||||
public static class EncoderUse
|
||||
{
|
||||
/// <summary>Names of the built-in presets an encoder row can encode, in preset order.</summary>
|
||||
public static IReadOnlyList<string> Presets(EncoderRow row) =>
|
||||
[
|
||||
.. ExportPresets.BuiltIn
|
||||
.Where(p => row.Source == EncoderSource.BuiltInAnimation ? p.Codec is VideoCodec.Gif or VideoCodec.Apng : p.Codec == row.VideoCodec)
|
||||
.Select(p => Loc.L(p.NameKey)),
|
||||
];
|
||||
|
||||
/// <summary>"4K archive · 4K HEVC · …" for the Used for column (every codec of this PC has built-in presets).</summary>
|
||||
public static string Text(EncoderRow row) => string.Join(" · ", Presets(row));
|
||||
|
||||
/// <summary>
|
||||
/// The Media Foundation encoders a render node on this PC offers the server: the software ones, and the hardware ones
|
||||
/// when its renders may use them (<paramref name="allowsHardware"/>, as the node client decides).
|
||||
/// </summary>
|
||||
public static IReadOnlyList<EncoderRow> Node(IEnumerable<EncoderRow> rows, bool allowsHardware) =>
|
||||
[.. rows.Where(r => r.Source == EncoderSource.MediaFoundation && (!r.Hardware || allowsHardware))];
|
||||
|
||||
/// <summary>"HEVC · H.264 · AV1": the codecs of <paramref name="encoders"/>, each once; null when there are none.</summary>
|
||||
public static string? Codecs(IEnumerable<EncoderRow> encoders) =>
|
||||
encoders.Select(e => e.Codec).Distinct(StringComparer.Ordinal).ToList() is { Count: > 0 } codecs ? string.Join(" · ", codecs) : null;
|
||||
}
|
||||
@@ -64,8 +64,11 @@ public sealed class EncoderRowViewModel(EncoderRow row) : ObservableObject
|
||||
|
||||
public bool HasTenBit => Row.TenBit;
|
||||
|
||||
/// <summary>"8192×8192" or "no limit".</summary>
|
||||
public string MaxText => Row.MaxWidth > 0 ? $"{Row.MaxWidth}×{Row.MaxHeight}" : Loc.L("Settings.Rendering.NoLimit");
|
||||
/// <summary>"8192×8192" (width first in every language) or "no limit".</summary>
|
||||
public string MaxText => Row.MaxWidth > 0 ? Formatting.LeftToRight($"{Row.MaxWidth}×{Row.MaxHeight}") : Loc.L("Settings.Rendering.NoLimit");
|
||||
|
||||
/// <summary>The built-in presets this encoder serves (Settings.html "Used for").</summary>
|
||||
public string UsedForText => EncoderUse.Text(Row);
|
||||
|
||||
public bool IsTesting
|
||||
{
|
||||
@@ -97,6 +100,9 @@ public sealed class EncoderRowViewModel(EncoderRow row) : ObservableObject
|
||||
|
||||
public string ResultToolTip => _result is { Passed: false, Error: { } error } ? error : Loc.L("Tooltips.Settings.SelfTestResult");
|
||||
|
||||
/// <summary>What a screen reader announces when the self-test of this row moves on: "HEVC NVIDIA NVENC (hardware): 142 fps · ok".</summary>
|
||||
public string ResultAnnouncement => Loc.L("Settings.Rendering.ResultFor", Codec, Name, ResultText);
|
||||
|
||||
internal void Refresh() => OnAllPropertiesChanged();
|
||||
|
||||
private void RaiseResult()
|
||||
@@ -105,6 +111,7 @@ public sealed class EncoderRowViewModel(EncoderRow row) : ObservableObject
|
||||
OnPropertyChanged(nameof(ResultKind));
|
||||
OnPropertyChanged(nameof(ResultText));
|
||||
OnPropertyChanged(nameof(ResultToolTip));
|
||||
OnPropertyChanged(nameof(ResultAnnouncement));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +124,7 @@ public sealed class TrustedCertificateRow(TrustedCertificate certificate, IComma
|
||||
public string FullFingerprint => Certificate.Fingerprint;
|
||||
public string TrustedText => Formatting.Date(Certificate.TrustedAt);
|
||||
public ICommand ForgetCommand { get; } = forget;
|
||||
|
||||
/// <summary>"Forget: https://nas.local:8443": the button names its server for screen readers.</summary>
|
||||
public string ForgetName => Loc.L("Settings.Server.ForgetName", Server);
|
||||
}
|
||||
Reference in new issue
Block a user