diff --git a/i18n/en/About.resx b/i18n/en/About.resx
index 37466cd9..fe6b0d73 100644
--- a/i18n/en/About.resx
+++ b/i18n/en/About.resx
@@ -27,6 +27,7 @@
Download failedDownloading {0:P0}Check failed
+ Downloading…Download not verifiedTitano {0} downloadedShow file
diff --git a/i18n/en/Jobs.resx b/i18n/en/Jobs.resx
index 723aaee7..9e6c4cd8 100644
--- a/i18n/en/Jobs.resx
+++ b/i18n/en/Jobs.resx
@@ -13,6 +13,7 @@
ResumeRetryShow
+ {0}: {1}{0} leftClear doneKind
@@ -50,8 +51,12 @@
after {0}nextNo log lines yet
+ Hide log
+ Show logPause allRendering settings
+ {0} · {1}
+ {0}: {1}invariantSearch target or kind{0} fps{0}/s
diff --git a/i18n/en/Server.resx b/i18n/en/Server.resx
index 3d9acadf..378cdb93 100644
--- a/i18n/en/Server.resx
+++ b/i18n/en/Server.resx
@@ -95,7 +95,7 @@
Pause metered uploads{0} of {1}{0} used
- Offer this PC as render node
+ Act as render nodeAdminEditorUploader
@@ -157,8 +157,10 @@
Sync settingsTake serverUpload
+ {0}: {1}Server archive {1} · {0} sequencelong; {0} sequence count, {1} archive sizeServer archive {1} · {0} sequenceslong; {0} sequence count, {1} archive size
+ Show allThis PCSequenceServer
@@ -180,6 +182,7 @@
{0} uploads queued{0} count{0} received{0} percentNot compared · retrying
+ {0}: {1}invariantThis PC's settings savedlongSearchShow file
diff --git a/i18n/en/Settings.resx b/i18n/en/Settings.resx
index 1604e694..0447eb74 100644
--- a/i18n/en/Settings.resx
+++ b/i18n/en/Settings.resx
@@ -54,12 +54,13 @@
StorageUpdatesAuto · {0}
- Low priority while editing
+ Background priorityCodecEncoderMaxSelf-test10-bit
+ Used forof {0} logical cores{0} (built in){0} (hardware)
@@ -76,12 +77,13 @@
Parallelism{0} fps · okPrefer hardware
- Hardware for previews only
+ Hardware for previewsQuality profileBalancedBestFastRe-detect
+ {0} {1}: {2}Run self-testSoftware only10-bit
@@ -90,7 +92,9 @@
Search settingsTrusted certificatesDefault server
+ Forget: {0}None
+ Offer this PCRender nodeClearSpilled frames and decoded thumbnails are deleted and rebuilt when needed. Originals, proxies and renders are not touched.long
diff --git a/i18n/en/Tooltips.resx b/i18n/en/Tooltips.resx
index 2601110d..11c0ea73 100644
--- a/i18n/en/Tooltips.resx
+++ b/i18n/en/Tooltips.resx
@@ -274,6 +274,7 @@
Show the folder in ExplorerHide the logFinished jobs older than this are removed when Titano starts
+ Bring photos in from a card or a folder; imports, analyses and renders then show up hereRaise the priority: it runs before jobs of lower priorityOpen what this job worked onPause at the next checkpoint; Resume continues from there
@@ -355,6 +356,7 @@
Close without changing either copyThe settings that differ: this PC's value, then the server'sIdentify the server, confirm a new certificate, then sign in · Enter
+ Type the address of the Titano Server firstClose the session and work with the local archive only; you stay signed inDo not connect; nothing is sent to this serverSHA-256 fingerprint of the server certificate
@@ -365,6 +367,8 @@
Close without signing in · EscSent only to this server; Titano keeps a session token, never the passwordYour user name on the server
+ Video encoders the server can use on this PC: {0}
+ No server found on this network yet; type its addressPause uploads while Windows reports this connection as metered; they resume by themselves when it is notlongSpace you use on the server out of your quotaLet the server send render jobs to this PC when it is idle; uses your GPU encoders
@@ -376,6 +380,7 @@
Sign out; the token is removed from this PCConnection to the serverSize and sequences of the server archive
+ Clear the search and the filter to list every sequence againFetch the originals to this PC, verified by hash ({0}){0} sizeAll sequences on this PC and on the serverSettings differ between this PC and the server
@@ -383,6 +388,7 @@
Only on the serverCopy the server's render to this PC ({1}){0} count, {1} sizeCopy the {0} server renders to this PC ({1}){0} count, {1} size
+ Bring photos in from a card or a folder, then upload them from hereOverwrite the server copy with this PC's settingsWhen this PC last compared every sequence with the server, and how long it tookOpen the web admin in your browser (admins only)
diff --git a/i18n/it/About.it.resx b/i18n/it/About.it.resx
index c290af5d..86977362 100644
--- a/i18n/it/About.it.resx
+++ b/i18n/it/About.it.resx
@@ -27,6 +27,7 @@
Download non riuscitoDownload in corso {0:P0}Verifica non riuscita
+ Download in corso…Download non verificatoTitano {0} scaricatoMostra file
diff --git a/i18n/it/Jobs.it.resx b/i18n/it/Jobs.it.resx
index 58ed4e7c..4524e528 100644
--- a/i18n/it/Jobs.it.resx
+++ b/i18n/it/Jobs.it.resx
@@ -13,6 +13,7 @@
RiprendiRiprovaMostra
+ {0}: {1}{0} rimanentiRimuovi concluseTipo
@@ -50,8 +51,12 @@
dopo {0}prossimaAncora nessuna riga di log
+ Nascondi log
+ Mostra logSospendi tutteImpostazioni di rendering
+ {0} · {1}
+ {0}: {1}Cerca oggetto o tipo{0} fps{0}/s
diff --git a/i18n/it/Server.it.resx b/i18n/it/Server.it.resx
index ab68efee..14baa2bc 100644
--- a/i18n/it/Server.it.resx
+++ b/i18n/it/Server.it.resx
@@ -93,7 +93,7 @@
Pausa su reti a consumo{0} di {1}{0} usati
- Offri questo PC per il rendering
+ Usa come nodo di renderingAmministratoreEditorCaricatore
@@ -155,8 +155,10 @@
SincronizzaUsa il serverCarica
+ {0}: {1}Archivio del server {1} · {0} sequenzaArchivio del server {1} · {0} sequenze
+ Mostra tutteQuesto PCSequenzaServer
@@ -177,6 +179,7 @@
{0} caricamenti in coda{0} ricevutoConfronto fallito · riprovo
+ {0}: {1}Impostazioni di questo PC salvateCercaMostra file
diff --git a/i18n/it/Settings.it.resx b/i18n/it/Settings.it.resx
index 198c180c..d559b97b 100644
--- a/i18n/it/Settings.it.resx
+++ b/i18n/it/Settings.it.resx
@@ -54,12 +54,13 @@
Spazio su discoAggiornamentiAuto · {0}
- Priorità bassa in modifica
+ Priorità bassaCodecEncoderMassimoAutotest10 bit
+ Usato perdi {0} core logici{0} (integrato){0} (hardware)
@@ -76,12 +77,13 @@
Parallelismo{0} fps · okPreferisci hardware
- Hardware solo per anteprime
+ Hardware per anteprimeProfilo di qualitàBilanciatoMassima qualitàVeloceRileva di nuovo
+ {0} {1}: {2}Esegui autotestSolo software10 bit
@@ -90,7 +92,9 @@
Cerca impostazioniCertificati attendibiliServer predefinito
+ Dimentica: {0}Nessuno
+ Offri questo PCNodo di renderingSvuotaI fotogrammi temporanei e le miniature vengono eliminati e ricreati quando servono. Originali, proxy ed esportazioni restano intatti.
diff --git a/i18n/it/Tooltips.it.resx b/i18n/it/Tooltips.it.resx
index 2d899232..94527f4f 100644
--- a/i18n/it/Tooltips.it.resx
+++ b/i18n/it/Tooltips.it.resx
@@ -274,6 +274,7 @@
Mostra la cartella in Esplora fileNasconde il logLe attività concluse più vecchie vengono rimosse all'avvio di Titano
+ Porta dentro le foto da una scheda o da una cartella; importazioni, analisi e rendering compaiono poi quiAlza la priorità: verrà eseguita prima delle attività a priorità più bassaApre l'oggetto di questa attivitàMette in pausa al prossimo punto di ripresa; Riprendi continua da lì
@@ -355,6 +356,7 @@
Chiudi senza modificare nessuna delle due copieLe impostazioni diverse: il valore di questo PC, poi quello del serverIdentifica il server, conferma un certificato nuovo e poi accedi · Invio
+ Scrivi prima l'indirizzo del Titano ServerChiude la sessione e lavora solo con l'archivio locale; l'accesso resta salvatoNon connetterti; a questo server non viene inviato nullaImpronta SHA-256 del certificato del server
@@ -365,6 +367,8 @@
Chiude senza accedere · EscInviata solo a questo server; Titano conserva un token di sessione, mai la passwordIl tuo nome utente sul server
+ Encoder video che il server può usare su questo PC: {0}
+ Nessun server trovato ancora in questa rete; scrivi il suo indirizzoMette in pausa i caricamenti mentre Windows segnala questa connessione come a consumo; riprendono da soli quando non lo èSpazio che usi sul server rispetto alla tua quotaPermette al server di inviare rendering a questo PC quando è inattivo; usa gli encoder della tua GPU
@@ -376,6 +380,7 @@
Esci; il token viene rimosso da questo PCConnessione al serverDimensione e sequenze dell'archivio del server
+ Cancella la ricerca e il filtro per rivedere tutte le sequenzeScarica gli originali su questo PC, verificati con l'hash ({0})Tutte le sequenze di questo PC e del serverLe impostazioni differiscono tra questo PC e il server
@@ -383,6 +388,7 @@
Solo sul serverCopia su questo PC il render del server ({1})Copia su questo PC i {0} render del server ({1})
+ Porta dentro le foto da una scheda o da una cartella, poi caricale da quiSovrascrivi la copia del server con le impostazioni di questo PCQuando questo PC ha confrontato per l'ultima volta tutte le sequenze con il server, e quanto ha impiegatoApri l'amministrazione web nel browser (solo amministratori)
diff --git a/src/Titano.App/Infrastructure/Formatting.cs b/src/Titano.App/Infrastructure/Formatting.cs
index 18c48b23..60fd23b0 100644
--- a/src/Titano.App/Infrastructure/Formatting.cs
+++ b/src/Titano.App/Infrastructure/Formatting.cs
@@ -56,4 +56,10 @@ public static class Formatting
/// Camera wall-clock date in the culture's short format.
public static string Date(DateTime wallClock) => wallClock.ToString("d", Loc.Culture);
+
+ ///
+ /// 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.
+ ///
+ public static string LeftToRight(string text) => "" + text + "";
}
diff --git a/src/Titano.App/Infrastructure/LiveRegion.cs b/src/Titano.App/Infrastructure/LiveRegion.cs
new file mode 100644
index 00000000..c9129e1f
--- /dev/null
+++ b/src/Titano.App/Infrastructure/LiveRegion.cs
@@ -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;
+
+///
+/// A status line screen readers announce when it changes (a live region): LiveRegion.Text becomes the element's
+/// accessible name and every later change raises . The element's
+/// (Polite, or Assertive for errors) must be set as well.
+///
+public static class LiveRegion
+{
+ public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached(
+ "Text", typeof(string), typeof(LiveRegion), new PropertyMetadata(null, OnTextChanged));
+
+ ///
+ /// 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.
+ ///
+ 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);
+}
diff --git a/src/Titano.App/Infrastructure/UiLanguage.cs b/src/Titano.App/Infrastructure/UiLanguage.cs
index e2a5f783..66ba0b02 100644
--- a/src/Titano.App/Infrastructure/UiLanguage.cs
+++ b/src/Titano.App/Infrastructure/UiLanguage.cs
@@ -7,6 +7,15 @@ namespace Titano.App.Infrastructure;
/// Switches the UI language at run time without restart (BRIEF §16), mirroring right-to-left languages.
public static class UiLanguage
{
+ static UiLanguage()
+ {
+ // Windows created later (the main window at start, every dialog) take the reading direction when they load.
+ EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent, new RoutedEventHandler((sender, _) => ((Window)sender).FlowDirection = Direction));
+ }
+
+ /// The reading direction of the current language.
+ public static FlowDirection Direction => Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
+
/// Applies (or the OS language when null) and returns the culture in use.
public static CultureInfo Apply(string? code)
{
@@ -25,8 +34,7 @@ public static class UiLanguage
Loc.SetCulture(culture);
if (Application.Current is { } app)
{
- foreach (Window window in app.Windows)
- window.FlowDirection = Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
+ foreach (Window window in app.Windows) window.FlowDirection = Direction;
}
return culture;
}
diff --git a/src/Titano.App/Jobs/JobListModel.cs b/src/Titano.App/Jobs/JobListModel.cs
index cd72b0c8..4621ace1 100644
--- a/src/Titano.App/Jobs/JobListModel.cs
+++ b/src/Titano.App/Jobs/JobListModel.cs
@@ -132,6 +132,9 @@ public sealed class JobListModel
public int RunningCount => _entries.Values.Count(e => e.State == JobState.Running);
+ /// Running jobs claimed by this machine's workers (), not by render nodes or other PCs.
+ 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);
/// Same order as JobRepository.ClaimNextAsync: priority descending, then creation time and id.
diff --git a/src/Titano.App/Jobs/JobRowViewModel.cs b/src/Titano.App/Jobs/JobRowViewModel.cs
index 7aed3470..6893f915 100644
--- a/src/Titano.App/Jobs/JobRowViewModel.cs
+++ b/src/Titano.App/Jobs/JobRowViewModel.cs
@@ -8,8 +8,8 @@ using Titano.Ui.Mvvm;
namespace Titano.App.Jobs;
-/// A row action: label, tooltip and command (26-px row buttons, DESIGN §4 tables).
-public sealed record JobAction(string Text, string ToolTip, ICommand Command, bool IsDestructive = false);
+/// A row action: label, tooltip, the name screen readers hear (label and row) and command (26-px row buttons, DESIGN §4 tables).
+public sealed record JobAction(string Text, string ToolTip, string AccessibleName, ICommand Command);
/// One row of the Jobs table (Jobs.html): kind, target, progress, speed, left, where, state, actions, log.
public sealed class JobRowViewModel : ObservableObject
@@ -36,6 +36,9 @@ public sealed class JobRowViewModel : ObservableObject
public string Target => _entry.Job.TargetLabel ?? string.Empty;
+ /// "Render · Harbour sunset → 4K HEVC": the row's name for screen readers.
+ public string AccessibleName => JobText.Name(_entry.Job);
+
/// Progress 0…1 (0 while unknown).
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);
+ /// "Render · Harbour sunset: done · 3:00": what a screen reader announces when the state changes (not progress).
+ public string StateAnnouncement => Loc.L("Jobs.Row.State", AccessibleName, StateText);
+
/// Glyph and colour of the state (paired with the word, never colour alone).
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");
+ /// "Show log: Render · Harbour sunset": the expander names its row.
+ public string ToggleName => Loc.L("Jobs.ActionFor", Loc.L(_isExpanded ? "Jobs.Log.Hide" : "Jobs.Log.Show"), AccessibleName);
+
/// The last lines of the job log, plus the live message while it runs.
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));
}
diff --git a/src/Titano.App/Jobs/JobText.cs b/src/Titano.App/Jobs/JobText.cs
index 4bec41c4..72da9fa3 100644
--- a/src/Titano.App/Jobs/JobText.cs
+++ b/src/Titano.App/Jobs/JobText.cs
@@ -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);
+ }
+
+ /// The job was claimed by one of this machine's numbered workers ("node#0", "node#1", …).
+ public static bool IsLocal(string? nodeId, string localWorkerId) =>
+ !string.IsNullOrEmpty(nodeId) && NodeName(nodeId).Equals(localWorkerId, StringComparison.OrdinalIgnoreCase);
+
+ /// "Kind: target" ("Render: Harbour sunset → 4K HEVC"), what a row is called for screen readers.
+ 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];
}
///
diff --git a/src/Titano.App/Sections/AboutView.xaml b/src/Titano.App/Sections/AboutView.xaml
index 805a251a..ac29b3b4 100644
--- a/src/Titano.App/Sections/AboutView.xaml
+++ b/src/Titano.App/Sections/AboutView.xaml
@@ -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">
-
+
+
@@ -35,14 +37,16 @@
-
+
-
+
+
@@ -53,7 +57,8 @@
+ Visibility="{Binding HasUpdateText, Converter={StaticResource BoolToVisibility}}"
+ AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding UpdateAnnouncement}" />
diff --git a/src/Titano.App/Sections/AboutViewModel.cs b/src/Titano.App/Sections/AboutViewModel.cs
index f11240da..1ed7fe2f 100644
--- a/src/Titano.App/Sections/AboutViewModel.cs
+++ b/src/Titano.App/Sections/AboutViewModel.cs
@@ -81,6 +81,9 @@ public sealed class AboutViewModel : SectionViewModel
_ => null,
};
+ /// What screen readers announce: each new state, not each percent of a download.
+ 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));
diff --git a/src/Titano.App/Sections/JobsView.xaml b/src/Titano.App/Sections/JobsView.xaml
index 2e77d413..d7d353e5 100644
--- a/src/Titano.App/Sections/JobsView.xaml
+++ b/src/Titano.App/Sections/JobsView.xaml
@@ -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">
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
@@ -66,7 +107,7 @@
-
+
@@ -77,67 +118,75 @@
-
+
-
-
+
+
-
-
+
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.ScrollChanged="OnScrollChanged"
+ KeyboardNavigation.TabNavigation="Continue" AutomationProperties.Name="{l:Loc Shell.Nav.Jobs}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
@@ -162,6 +211,8 @@
-
+
+
+
diff --git a/src/Titano.App/Sections/JobsViewModel.cs b/src/Titano.App/Sections/JobsViewModel.cs
index 82432966..3a7ab09a 100644
--- a/src/Titano.App/Sections/JobsViewModel.cs
+++ b/src/Titano.App/Sections/JobsViewModel.cs
@@ -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; }
+ /// The empty state's one action: jobs start with an import.
+ public ICommand ImportCommand { get; }
+
public JobFilter Filter
{
get => _filter;
@@ -119,8 +123,11 @@ public sealed class JobsViewModel : SectionViewModel
}
}
- /// "Workers 1 / 4".
- public string WorkersText => Loc.L("Jobs.Workers", _model.RunningCount, _queue?.Workers ?? 0);
+ /// "Workers 1 / 4": jobs this PC's workers run out of its workers.
+ public string WorkersText => Loc.L("Jobs.Workers", _queue is { } queue ? _model.RunningOn(queue.WorkerId) : 0, _queue?.Workers ?? 0);
+
+ /// The engine of this PC runs workers (it has none before it starts).
+ public bool HasWorkers => _queue is { Workers: > 0 };
/// "History keeps 90 days".
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 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 run) =>
- new(Loc.L(textKey), Loc.L(toolTipKey), new AsyncRelayCommand(async () =>
+ /// A row button named with its row for screen readers ("Pause: Render · Harbour sunset").
+ private static JobAction Action(string textKey, string toolTipKey, string row, Func 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 run) =>
+ Action(textKey, toolTipKey, row, async () =>
{
if (owner.Queue is { } queue) await run(queue);
- }));
+ });
}
diff --git a/src/Titano.App/Sections/ServerView.xaml b/src/Titano.App/Sections/ServerView.xaml
index a6bdfcd5..3f26066c 100644
--- a/src/Titano.App/Sections/ServerView.xaml
+++ b/src/Titano.App/Sections/ServerView.xaml
@@ -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">
-
-
+
+
+
+
+
+
-
+
@@ -40,21 +62,36 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
+
+
+
+
+
+
diff --git a/src/Titano.App/Sections/SettingsViewModel.cs b/src/Titano.App/Sections/SettingsViewModel.cs
index 4933f3ef..47b7b01f 100644
--- a/src/Titano.App/Sections/SettingsViewModel.cs
+++ b/src/Titano.App/Sections/SettingsViewModel.cs
@@ -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; }
+
+ /// Advanced holds no setting with a default (paths and actions only): it has no Reset section.
+ public bool CanResetSection => _page != SettingsPage.Advanced;
public ICommand ExportSettingsCommand { get; }
public ICommand ImportSettingsCommand { get; }
- /// Loads what needs the services (certificates, cache usage).
+ /// Loads what needs the services (certificates, cache usage) and follows the server session.
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();
}
+ /// Other screens change the archive and the server in use: Settings shows them when it opens.
+ 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();
+ }
+
+ ///
+ /// Takes the archive and server values other screens set (opening an archive, connecting), unless the field holds an
+ /// edit not committed yet.
+ ///
+ 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));
diff --git a/src/Titano.App/Sections/WelcomeView.xaml b/src/Titano.App/Sections/WelcomeView.xaml
index d90ccc78..281180ee 100644
--- a/src/Titano.App/Sections/WelcomeView.xaml
+++ b/src/Titano.App/Sections/WelcomeView.xaml
@@ -47,13 +47,15 @@
+
+ CornerRadius="{StaticResource Radius.Dialog}" Padding="32,28" Effect="{StaticResource Shadow.Popup}"
+ KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
-
+
@@ -62,7 +64,7 @@
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
diff --git a/src/Titano.App/Sections/WelcomeView.xaml.cs b/src/Titano.App/Sections/WelcomeView.xaml.cs
index e6236f21..b9a2e861 100644
--- a/src/Titano.App/Sections/WelcomeView.xaml.cs
+++ b/src/Titano.App/Sections/WelcomeView.xaml.cs
@@ -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);
+ };
+ }
+
+ ///
+ /// 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.
+ ///
+ private void FocusChoice()
+ {
+ var chosen = new[] { LocalChoice, AdoptChoice, ServerChoice }.FirstOrDefault(c => c.IsChecked == true) ?? LocalChoice;
+ FocusManager.SetFocusedElement(FocusManager.GetFocusScope(chosen), chosen);
+ Keyboard.Focus(chosen);
+ }
}
diff --git a/src/Titano.App/Sections/WelcomeViewModel.cs b/src/Titano.App/Sections/WelcomeViewModel.cs
index c5fcf375..3276e6e0 100644
--- a/src/Titano.App/Sections/WelcomeViewModel.cs
+++ b/src/Titano.App/Sections/WelcomeViewModel.cs
@@ -100,13 +100,13 @@ public sealed class WelcomeViewModel : LocalizedViewModel
}
}
- /// "D:\TitanoArchive · 1.8 TB free".
+ /// "D:\TitanoArchive · 1.8 TB free" (the path left to right in every language).
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);
/// The chosen folder to adopt; null until picked.
- 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
/// "Studio NAS on this network · https://nas.local:8443".
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;
diff --git a/src/Titano.App/Server/ServerSession.cs b/src/Titano.App/Server/ServerSession.cs
index d8cdd412..9f944024 100644
--- a/src/Titano.App/Server/ServerSession.cs
+++ b/src/Titano.App/Server/ServerSession.cs
@@ -77,6 +77,18 @@ public sealed class ServerSession : ObservableObject, ITrustStore, IDisposable
OnAllPropertiesChanged();
}
+ ///
+ /// 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.
+ ///
+ 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 ----------------
/// Resumes the saved session at start; stays signed out quietly when it cannot be reused.
@@ -196,11 +208,27 @@ public sealed class ServerSession : ObservableObject, ITrustStore, IDisposable
ActionToolTip = Loc.L("Tooltips.Server.Trust"),
};
- /// Splits the 32-byte SHA-256 fingerprint into two lines of 16 bytes.
+ /// The destructive question before a trusted certificate is forgotten, with its fingerprint.
+ 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,
+ };
+
+ /// Splits the 32-byte SHA-256 fingerprint into two lines of 16 bytes, each kept left to right.
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)));
}
/// "9A:3C:71:E0:…" for the status line.
diff --git a/src/Titano.App/Server/SyncRow.cs b/src/Titano.App/Server/SyncRow.cs
index a5647aa7..18fa01d3 100644
--- a/src/Titano.App/Server/SyncRow.cs
+++ b/src/Titano.App/Server/SyncRow.cs
@@ -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);
}
+ /// The title of the row's sequence.
+ public string Sequence
+ {
+ get => _sequence;
+ set
+ {
+ if (Set(ref _sequence, value)) OnPropertyChanged(nameof(AccessibleName));
+ }
+ }
+
+ /// "Upload: Clouds over the Langhe": screen readers name the sequence each of the many identical buttons acts on.
+ public string AccessibleName => Loc.L("Server.Sync.ActionFor", Text, _sequence);
+
/// The label in the current language.
- public void Relabel() => OnPropertyChanged(nameof(Text));
+ public void Relabel()
+ {
+ OnPropertyChanged(nameof(Text));
+ OnPropertyChanged(nameof(AccessibleName));
+ }
}
/// One row of the sync table (Server.html): sequence, this PC, server, state and the actions that apply.
@@ -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;
+
+ /// "Clouds over the Langhe: In sync": what a screen reader announces when the state changes (not progress).
+ public string StateAnnouncement => Loc.L("Server.Sync.Row.State", Title, StateText);
+
public string StateToolTip => SyncText.State(_entry).ToolTip;
- /// Settings differ on both sides: the row is drawn on the card colour, as in Server.html.
+ /// Settings differ on both sides: the row is drawn on the warning tint (the word in the State column says it too).
public bool IsConflict => _entry.Status == SyncStatus.Conflict && _entry.Transfer is null;
public IReadOnlyList 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));
}
diff --git a/src/Titano.App/Server/SyncTableViewModel.cs b/src/Titano.App/Server/SyncTableViewModel.cs
index 88fb2f8f..2b1cc56c 100644
--- a/src/Titano.App/Server/SyncTableViewModel.cs
+++ b/src/Titano.App/Server/SyncTableViewModel.cs
@@ -53,6 +53,15 @@ public sealed class SyncFilterChip(SyncFilter filter, Action select)
}
}
+/// Why the sync table shows no rows; each case has its one action (BRIEF §0.2 rule 6).
+public enum SyncEmpty
+{
+ None,
+ SignedOut,
+ Nothing,
+ NoMatch,
+}
+
///
/// 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 Rows { get; } = [];
@@ -94,6 +110,12 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
public ICommand UploadAllCommand => _uploadAll;
public ICommand OpenAdminCommand { get; }
+ /// "No sequence matches": back to every sequence.
+ public ICommand ClearFiltersCommand { get; }
+
+ /// "Nothing to compare yet": bring photos in.
+ 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;
+
/// "Not connected to a server", "Nothing to compare yet" or "No sequence matches"; null when rows show.
- 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,
+ };
/// What "Upload all local" sends, or why it is disabled.
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;
- /// The server's web admin (it admits administrators only).
- public bool CanOpenAdmin => IsActive;
+ /// The server's web admin admits administrators only: the link shows for accounts that manage the archive or users.
+ 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));
}
diff --git a/src/Titano.App/Server/SyncText.cs b/src/Titano.App/Server/SyncText.cs
index f55ab693..7fe2ab5b 100644
--- a/src/Titano.App/Server/SyncText.cs
+++ b/src/Titano.App/Server/SyncText.cs
@@ -234,11 +234,16 @@ public static class SyncText
_ => Loc.L("Tooltips.Server.Sync." + action),
};
+ ///
+ /// 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.
+ ///
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));
diff --git a/src/Titano.App/Settings/EncoderInventory.cs b/src/Titano.App/Settings/EncoderInventory.cs
index 0996bd62..efabe68c 100644
--- a/src/Titano.App/Settings/EncoderInventory.cs
+++ b/src/Titano.App/Settings/EncoderInventory.cs
@@ -11,28 +11,6 @@ using Titano.Core.Windows.MediaFoundation;
namespace Titano.App.Settings;
-/// Who provides an encoder row.
-public enum EncoderSource
-{
- /// A Media Foundation MFT (hardware or Microsoft software).
- MediaFoundation,
-
- /// Titano's managed MJPEG/AVI writer.
- BuiltInMjpeg,
-
- /// Titano's managed GIF/APNG encoders.
- BuiltInAnimation,
-}
-
-/// One row of Settings › Rendering › Encoders.
-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;
-
- /// "NVIDIA · NVIDIA HEVC Encoder MFT" unless the name already carries the vendor.
- public string DisplayName => Vendor is { } vendor && !Name.Contains(vendor, StringComparison.OrdinalIgnoreCase) ? vendor + " · " + Name : Name;
-}
-
/// Outcome of encoding the synthetic test clip with one encoder.
public sealed record SelfTestResult(bool Passed, double FramesPerSecond, string? Error);
diff --git a/src/Titano.App/Settings/EncoderUse.cs b/src/Titano.App/Settings/EncoderUse.cs
new file mode 100644
index 00000000..0ea94f22
--- /dev/null
+++ b/src/Titano.App/Settings/EncoderUse.cs
@@ -0,0 +1,53 @@
+using Titano.Core.Export;
+using Titano.Core.Localization;
+using Titano.Core.Video;
+
+namespace Titano.App.Settings;
+
+/// Who provides an encoder row.
+public enum EncoderSource
+{
+ /// A Media Foundation MFT (hardware or Microsoft software).
+ MediaFoundation,
+
+ /// Titano's managed MJPEG/AVI writer.
+ BuiltInMjpeg,
+
+ /// Titano's managed GIF/APNG encoders.
+ BuiltInAnimation,
+}
+
+/// One row of Settings › Rendering › Encoders.
+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;
+
+ /// "NVIDIA · NVIDIA HEVC Encoder MFT" unless the name already carries the vendor.
+ public string DisplayName => Vendor is { } vendor && !Name.Contains(vendor, StringComparison.OrdinalIgnoreCase) ? vendor + " · " + Name : Name;
+}
+
+/// What the encoders of this PC are for: the built-in presets each one serves and what a render node offers.
+public static class EncoderUse
+{
+ /// Names of the built-in presets an encoder row can encode, in preset order.
+ public static IReadOnlyList 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)),
+ ];
+
+ /// "4K archive · 4K HEVC · …" for the Used for column (every codec of this PC has built-in presets).
+ public static string Text(EncoderRow row) => string.Join(" · ", Presets(row));
+
+ ///
+ /// 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 (, as the node client decides).
+ ///
+ public static IReadOnlyList Node(IEnumerable rows, bool allowsHardware) =>
+ [.. rows.Where(r => r.Source == EncoderSource.MediaFoundation && (!r.Hardware || allowsHardware))];
+
+ /// "HEVC · H.264 · AV1": the codecs of , each once; null when there are none.
+ public static string? Codecs(IEnumerable encoders) =>
+ encoders.Select(e => e.Codec).Distinct(StringComparer.Ordinal).ToList() is { Count: > 0 } codecs ? string.Join(" · ", codecs) : null;
+}
diff --git a/src/Titano.App/Settings/SettingsRows.cs b/src/Titano.App/Settings/SettingsRows.cs
index 60fa3b35..51ed12a5 100644
--- a/src/Titano.App/Settings/SettingsRows.cs
+++ b/src/Titano.App/Settings/SettingsRows.cs
@@ -64,8 +64,11 @@ public sealed class EncoderRowViewModel(EncoderRow row) : ObservableObject
public bool HasTenBit => Row.TenBit;
- /// "8192×8192" or "no limit".
- public string MaxText => Row.MaxWidth > 0 ? $"{Row.MaxWidth}×{Row.MaxHeight}" : Loc.L("Settings.Rendering.NoLimit");
+ /// "8192×8192" (width first in every language) or "no limit".
+ public string MaxText => Row.MaxWidth > 0 ? Formatting.LeftToRight($"{Row.MaxWidth}×{Row.MaxHeight}") : Loc.L("Settings.Rendering.NoLimit");
+
+ /// The built-in presets this encoder serves (Settings.html "Used for").
+ 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");
+ /// What a screen reader announces when the self-test of this row moves on: "HEVC NVIDIA NVENC (hardware): 142 fps · ok".
+ 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;
+
+ /// "Forget: https://nas.local:8443": the button names its server for screen readers.
+ public string ForgetName => Loc.L("Settings.Server.ForgetName", Server);
}
diff --git a/tests/Titano.App.Tests/Jobs/JobListModelTests.cs b/tests/Titano.App.Tests/Jobs/JobListModelTests.cs
index 400b72e7..be90578c 100644
--- a/tests/Titano.App.Tests/Jobs/JobListModelTests.cs
+++ b/tests/Titano.App.Tests/Jobs/JobListModelTests.cs
@@ -167,6 +167,31 @@ public sealed class JobListModelTests
Assert.Equal("done · 3:00", JobText.State(done));
}
+ [Test]
+ public void TheWorkersReadoutCountsOnlyJobsOfThisPc()
+ {
+ var model = new JobListModel();
+ model.Apply(Job(JobState.Running, started: -1) with { NodeId = "STUDIO#0" });
+ model.Apply(Job(JobState.Running, started: -2) with { NodeId = "studio#3" });
+ model.Apply(Job(JobState.Running, started: -3) with { NodeId = "render-box#0" });
+ model.Apply(Job(JobState.Running, started: -4));
+ model.Apply(Job(JobState.Done, started: -9, finished: -8) with { NodeId = "studio#1" });
+
+ Assert.Equal(4, model.RunningCount);
+ Assert.Equal(2, model.RunningOn("studio"));
+ Assert.True(JobText.IsLocal("studio#2", "STUDIO"));
+ Assert.False(JobText.IsLocal("studio-2", "studio"));
+ Assert.False(JobText.IsLocal(null, "studio"));
+ }
+
+ [Test]
+ public void RowsAreNamedByKindAndTarget()
+ {
+ Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
+ Assert.Equal("Render · Harbour sunset", JobText.Name(Job(JobState.Running, kind: JobKind.Render, label: "Harbour sunset")));
+ Assert.Equal("Proxies", JobText.Name(Job(JobState.Queued)));
+ }
+
private static Job Job(JobState state, int created = 0, int? started = null, int? finished = null, JobPriority priority = JobPriority.Normal,
JobKind kind = JobKind.Proxies, string? label = null, long done = 0, long total = 0) => new()
{
diff --git a/tests/Titano.App.Tests/Jobs/JobsScreenSmokeTests.cs b/tests/Titano.App.Tests/Jobs/JobsScreenSmokeTests.cs
new file mode 100644
index 00000000..5b6b615e
--- /dev/null
+++ b/tests/Titano.App.Tests/Jobs/JobsScreenSmokeTests.cs
@@ -0,0 +1,90 @@
+using System.Windows;
+using System.Windows.Automation;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using Titano.App.Jobs;
+using Titano.App.Sections;
+using Titano.App.Shell;
+using Titano.App.Tests.Windows;
+using Titano.Core.Localization;
+using Titano.Testing;
+using Titano.Ui.Controls;
+
+namespace Titano.App.Tests.Jobs;
+
+/// The Jobs screen on the capture sample: keyboard reach, names for screen readers, counts and the table's columns.
+[WindowsOnly]
+[Serial]
+[Timeout(300_000)]
+public sealed class JobsScreenSmokeTests
+{
+ [Test]
+ public Task RowsAreReachableNamedAndLinedUpWithTheHeader() => ScreenHost.RunAsync(async () =>
+ {
+ await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
+ var shell = app.Shell;
+ await app.Sample.FillAsync();
+ await shell.Jobs.ReloadAsync();
+ shell.Navigate(SectionKey.Jobs);
+ await app.ExpectAsync("jobs");
+ var jobs = shell.Jobs;
+
+ // The rail badge, the status strip and the Running chip count the same jobs.
+ var running = jobs.Chips.Single(c => c.Filter == JobFilter.Running).Count;
+ Assert.Greater(running, 0);
+ Assert.Equal(running, jobs.Badge);
+ Assert.Equal(Loc.Plural("Shell.Status.Jobs", running), shell.JobsText);
+ // The capture engine starts no workers: there is no "Workers n / 0" to show.
+ Assert.False(jobs.HasWorkers);
+
+ // Tab reaches every row button: the rows take no focus, the list passes Tab on to their content.
+ var list = app.FindAll().Single(l => l.Name == "JobList");
+ Assert.Equal(KeyboardNavigationMode.Continue, KeyboardNavigation.GetTabNavigation(list));
+ var items = app.FindAll().Where(i => i.DataContext is JobRowViewModel && i.IsVisible).ToList();
+ Assert.True(items.Count > 3, "several rows are on screen");
+ foreach (var item in items)
+ {
+ var row = (JobRowViewModel)item.DataContext;
+ // A row reads as its job and state; its buttons and its log toggle name the job.
+ Assert.Equal(row.AccessibleName, AutomationProperties.GetName(item));
+ Assert.Equal(row.StateText, AutomationProperties.GetItemStatus(item));
+ var buttons = Descendants(item).Where(b => b.IsVisible).ToList();
+ Assert.True(buttons.All(b => b.Focusable && b.IsTabStop), "every row button is a tab stop");
+ Assert.True(buttons.All(b => AutomationProperties.GetName(b).Contains(row.AccessibleName, StringComparison.Ordinal)), $"buttons of {row.AccessibleName} name it");
+ var state = Descendants(item).Single();
+ Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(state));
+ // Right to left: numbers stay right-aligned in both reading directions.
+ var percent = Descendants(item).First(t => t.Text == row.PercentText);
+ Assert.True(percent.FlowDirection == FlowDirection.LeftToRight && percent.TextAlignment == TextAlignment.Right, "the percentage stays right-aligned");
+ }
+
+ // Header and rows share their columns: same padding, one actions column for all, the scroll-bar gutter kept.
+ var rows = items.Select(i => (Row: (JobRowViewModel)i.DataContext, Item: i)).ToList();
+ var kindHeader = Text(app, Loc.L("Jobs.Column.Kind"));
+ var stateHeader = Text(app, Loc.L("Jobs.Column.State"));
+ foreach (var (row, item) in rows)
+ {
+ Assert.Approximately(Left(kindHeader), Left(Descendants(item).First(t => t.Text == row.Kind)), 1.5, $"Kind of {row.AccessibleName}");
+ Assert.Approximately(Left(stateHeader), Left(Descendants(item).Single()), 1.5, $"State of {row.AccessibleName}");
+ }
+ var actionColumns = rows.Select(r => Left(Descendants(r.Item).Last())).ToList();
+ Assert.True(actionColumns.Max() - actionColumns.Min() < 1, "the actions column starts at the same x in every row");
+ });
+
+ private static TextBlock Text(ScreenSmokeTests.SampleApp app, string text) => app.FindAll().First(t => t.Text == text && t.IsVisible);
+
+ /// The left edge of an element in window coordinates.
+ private static double Left(FrameworkElement element) => element.TranslatePoint(new Point(0, 0), Window.GetWindow(element)).X;
+
+ private static IEnumerable Descendants(DependencyObject node)
+ where T : DependencyObject
+ {
+ for (var i = 0; i < VisualTreeHelper.GetChildrenCount(node); i++)
+ {
+ var child = VisualTreeHelper.GetChild(node, i);
+ if (child is T match) yield return match;
+ foreach (var nested in Descendants(child)) yield return nested;
+ }
+ }
+}
diff --git a/tests/Titano.App.Tests/Server/ServerScreenSmokeTests.cs b/tests/Titano.App.Tests/Server/ServerScreenSmokeTests.cs
index 8c1ee512..e68a4475 100644
--- a/tests/Titano.App.Tests/Server/ServerScreenSmokeTests.cs
+++ b/tests/Titano.App.Tests/Server/ServerScreenSmokeTests.cs
@@ -1,3 +1,5 @@
+using System.Windows;
+using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
using Titano.App.Infrastructure;
@@ -82,6 +84,36 @@ public sealed class ServerScreenSmokeTests
Assert.True(rowButtons.Select(b => b.DataContext).OfType().Count() > 3, "buttons of several rows are on screen");
Assert.True(rowButtons.All(b => b.Focusable && b.IsTabStop), "every row button is a tab stop");
+ // Screen readers: a row reads as its sequence and state, each of the many "Upload" buttons names its sequence.
+ foreach (var item in app.FindAll().Where(i => i.DataContext is SyncRow && i.IsVisible))
+ {
+ var row = (SyncRow)item.DataContext;
+ Assert.Equal(row.Title, AutomationProperties.GetName(item));
+ Assert.Equal(row.StateText, AutomationProperties.GetItemStatus(item));
+ }
+ Assert.True(rowButtons.All(b => AutomationProperties.GetName(b) == ((SyncRowAction)b.DataContext).AccessibleName), "row buttons carry their row's name");
+ Assert.Equal(Loc.L("Server.Sync.ActionFor", Loc.L("Server.Sync.Action.Upload"), "Clouds over the Langhe"),
+ Row(table, "Clouds over the Langhe").Actions.Single().AccessibleName);
+
+ // The filters are a radio group: the chosen one is checked, so its state reaches screen readers.
+ var chips = app.FindAll().Where(r => r.DataContext is SyncFilterChip).ToList();
+ Assert.Count(Enum.GetValues().Length, chips);
+ Assert.True(chips.All(c => c.IsChecked == ((SyncFilterChip)c.DataContext).IsSelected), "the checked chip is the chosen filter");
+
+ // While connected the address is read-only text (selectable, not dimmed), kept left to right; status changes are announced.
+ var address = app.FindAll().Single(t => t.Name == "AddressBox");
+ Assert.True(address.IsEnabled && address.IsReadOnly, "the connected address is read-only, not disabled");
+ Assert.Equal(FlowDirection.LeftToRight, address.FlowDirection);
+ var known = app.FindAll().Single(b => b.Name == "KnownButton");
+ Assert.False(string.IsNullOrEmpty(AutomationProperties.GetName(known)), "the icon-only button has a name");
+ Assert.True(ToolTipService.GetShowOnDisabled(known), "a disabled ▾ still says why");
+ Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(
+ app.FindAll().First(g => g.IsVisible && g.Text == shell.Server.StatusText)));
+
+ // The web admin admits administrators only: the sample user is an editor.
+ Assert.False(table.CanOpenAdmin);
+ Assert.False(app.FindAll().Any(b => b.Content as string == Loc.L("Server.Sync.OpenAdmin") && b.IsVisible), "no admin link for an editor");
+
// Transfers in every state: the rows show what moves and offer Pause or Resume.
await app.Sample.FillSyncAsync();
await table.ReloadAsync();
@@ -104,9 +136,22 @@ public sealed class ServerScreenSmokeTests
Assert.Equal("Holy grail · Monviso", Assert.Contains(table.Rows, _ => true).Title);
Assert.Count(1, table.Rows);
await app.ExpectAsync("server-conflict");
+
+ // One row, no scrolling: the header still lines up with the cells (same padding, constant scroll-bar gutter).
+ var only = table.Rows[0];
+ Assert.Approximately(Left(Text(app, Loc.L("Server.Sync.Column.Local"))), Left(Text(app, only.LocalText)), 1.5, "This PC column");
+ Assert.Approximately(Left(Text(app, Loc.L("Server.Sync.Column.State"))),
+ Left(app.FindAll().First(g => g.DataContext == only && g.IsVisible)), 1.5, "State column");
+
+ // No match: one sentence and its one action, which shows every sequence again.
table.SearchText = "nothing like this";
Assert.False(table.HasRows);
Assert.NotNull(table.EmptyText);
+ Assert.Equal(SyncEmpty.NoMatch, table.Empty);
+ table.ClearFiltersCommand.Execute(null);
+ Assert.Equal(string.Empty, table.SearchText);
+ Assert.True(Chip(table, SyncFilter.All).IsSelected);
+ Assert.Equal(Chip(table, SyncFilter.All).Count, table.Rows.Count);
// Another language relabels chips and rows at once.
UiLanguage.Apply("it");
@@ -137,12 +182,23 @@ public sealed class ServerScreenSmokeTests
Assert.False(shell.Server.Sync.IsActive);
Assert.False(shell.Server.Sync.HasRows);
+ Assert.Equal(SyncEmpty.SignedOut, shell.Server.Sync.Empty);
Assert.False(shell.Server.Sync.UploadAllCommand.CanExecute(null));
Assert.Equal(Loc.L("Tooltips.Server.Sync.UploadAll.NotConnected"), shell.Server.Sync.UploadAllToolTip);
shell.Navigate(SectionKey.Server);
await app.ExpectAsync("server-signedout-table");
+
+ // Nothing to filter while signed out: chips and search give way to the one action, Connect.
+ Assert.False(app.FindAll().Any(r => r.DataContext is SyncFilterChip && r.IsVisible), "no filter chips while signed out");
+ Assert.False(app.FindAll().Any(t => AutomationProperties.GetName(t) == Loc.L("Server.Sync.Search") && t.IsVisible), "no search while signed out");
+ Assert.True(app.FindAll().Any(b => b.Content as string == Loc.L("Server.Connect") && b.IsVisible), "the empty table offers Connect");
});
+ private static TextBlock Text(ScreenSmokeTests.SampleApp app, string text) => app.FindAll().First(t => t.Text == text && t.IsVisible);
+
+ /// The left edge of an element in window coordinates.
+ private static double Left(FrameworkElement element) => element.TranslatePoint(new Point(0, 0), Window.GetWindow(element)).X;
+
private static SyncFilterChip Chip(SyncTableViewModel table, SyncFilter filter) => table.Chips.Single(c => c.Filter == filter);
private static SyncRow Row(SyncTableViewModel table, string title) => table.Rows.Single(r => r.Title == title);
diff --git a/tests/Titano.App.Tests/Server/SyncTextTests.cs b/tests/Titano.App.Tests/Server/SyncTextTests.cs
index d655eac9..5b26df27 100644
--- a/tests/Titano.App.Tests/Server/SyncTextTests.cs
+++ b/tests/Titano.App.Tests/Server/SyncTextTests.cs
@@ -153,6 +153,24 @@ public sealed class SyncTextTests
Assert.Equal(0, rows.Count(r => SyncText.Matches(r, SyncFilter.Conflicts, "comet")));
}
+ [Test]
+ public void ATransferCountsWhereItsOriginalsAre()
+ {
+ var uploadNotOnServer = Entry(SyncStatus.Transferring, transfer: Upload(JobState.Queued)) with { Link = null };
+ var download = new Job { Id = Guid.CreateVersion7(), Kind = JobKind.Download, State = JobState.Running };
+ var downloadNotHere = Entry(SyncStatus.Transferring, transfer: download) with { Local = null };
+ var uploadOnBoth = Entry(SyncStatus.Transferring, transfer: Upload(JobState.Running));
+
+ Assert.True(SyncText.Matches(uploadNotOnServer, SyncFilter.LocalOnly, string.Empty));
+ Assert.False(SyncText.Matches(uploadNotOnServer, SyncFilter.Remote, string.Empty));
+ Assert.True(SyncText.Matches(downloadNotHere, SyncFilter.Remote, string.Empty));
+ Assert.False(SyncText.Matches(downloadNotHere, SyncFilter.LocalOnly, string.Empty));
+ // Partly on both sides: neither "only here" nor "only on the server".
+ Assert.False(SyncText.Matches(uploadOnBoth, SyncFilter.LocalOnly, string.Empty));
+ Assert.False(SyncText.Matches(uploadOnBoth, SyncFilter.Remote, string.Empty));
+ Assert.True(SyncText.Matches(uploadOnBoth, SyncFilter.All, string.Empty));
+ }
+
private static (StatusKind, string) Kind(SyncEntry entry)
{
var (kind, text, _) = SyncText.State(entry);
diff --git a/tests/Titano.App.Tests/Settings/SettingsLogicTests.cs b/tests/Titano.App.Tests/Settings/SettingsLogicTests.cs
index cf95d401..79fea520 100644
--- a/tests/Titano.App.Tests/Settings/SettingsLogicTests.cs
+++ b/tests/Titano.App.Tests/Settings/SettingsLogicTests.cs
@@ -4,6 +4,7 @@ using System.IO;
using Titano.App.Settings;
using Titano.Core.Localization;
using Titano.Core.Naming;
+using Titano.Core.Video;
using Titano.Testing;
namespace Titano.App.Tests.Settings;
@@ -132,6 +133,37 @@ public sealed class SettingsLogicTests
Assert.Equal("en", LanguageCatalog.Match(CultureInfo.GetCultureInfo("sw")).Code);
}
+ [Test]
+ public void EachEncoderNamesThePresetsItServes()
+ {
+ var hevc = new EncoderRow("HEVC", "NVIDIA HEVC Encoder MFT", "NVIDIA", EncoderSource.MediaFoundation, true, true, 8192, 8192, VideoCodec.Hevc);
+ var av1 = hevc with { Codec = "AV1", Name = "NVIDIA AV1 Encoder MFT", VideoCodec = VideoCodec.Av1 };
+ var h264 = new EncoderRow("H.264", "H264 Encoder MFT", "Microsoft", EncoderSource.MediaFoundation, false, false, 4096, 2304, VideoCodec.H264);
+ var animation = new EncoderRow("GIF · APNG", "Titano", null, EncoderSource.BuiltInAnimation, false, false, 0, 0, null);
+
+ Assert.SequenceEqual(["8K archive", "4K archive", "4K HEVC", "DCI 4K", "Cinema 21:9", "4K 60 fps"], EncoderUse.Presets(hevc));
+ Assert.Equal("Animated GIF · Animated PNG", EncoderUse.Text(animation));
+ Assert.Contains("Share 1080p", EncoderUse.Presets(h264));
+ Assert.Equal("4K AV1", EncoderUse.Text(av1));
+ }
+
+ [Test]
+ public void ARenderNodeOffersHardwareEncodersOnlyWhenRendersMayUseThem()
+ {
+ EncoderRow[] rows =
+ [
+ new("HEVC", "NVIDIA HEVC Encoder MFT", "NVIDIA", EncoderSource.MediaFoundation, true, true, 8192, 8192, VideoCodec.Hevc),
+ new("H.264", "NVIDIA H.264 Encoder MFT", "NVIDIA", EncoderSource.MediaFoundation, true, false, 4096, 4096, VideoCodec.H264),
+ new("H.264", "H264 Encoder MFT", "Microsoft", EncoderSource.MediaFoundation, false, false, 4096, 2304, VideoCodec.H264),
+ new("MJPEG · AVI", "Titano", null, EncoderSource.BuiltInMjpeg, false, false, 0, 0, VideoCodec.Mjpeg),
+ ];
+
+ Assert.Equal("HEVC · H.264", EncoderUse.Codecs(EncoderUse.Node(rows, allowsHardware: true)));
+ Assert.Equal(3, EncoderUse.Node(rows, allowsHardware: true).Count);
+ Assert.Equal("H.264", EncoderUse.Codecs(EncoderUse.Node(rows, allowsHardware: false)));
+ Assert.Null(EncoderUse.Codecs([]));
+ }
+
[Test]
public void EnumDrivenKeysExistInEveryRequiredLanguage()
{
diff --git a/tests/Titano.App.Tests/Settings/SettingsScreenSmokeTests.cs b/tests/Titano.App.Tests/Settings/SettingsScreenSmokeTests.cs
new file mode 100644
index 00000000..6a0d9251
--- /dev/null
+++ b/tests/Titano.App.Tests/Settings/SettingsScreenSmokeTests.cs
@@ -0,0 +1,195 @@
+using System.Windows;
+using System.Windows.Automation;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Threading;
+using Titano.App.Infrastructure;
+using Titano.App.Sections;
+using Titano.App.Server;
+using Titano.App.Settings;
+using Titano.App.Shell;
+using Titano.App.Tests.Windows;
+using Titano.Core.Localization;
+using Titano.Testing;
+
+namespace Titano.App.Tests.Settings;
+
+///
+/// Settings, the first-run dialog and the reading direction on the capture sample: values other screens set, labels and
+/// paths that survive long translations and right-to-left text, keyboard focus and the questions before forgetting.
+///
+[WindowsOnly]
+[Serial]
+[Timeout(300_000)]
+public sealed class SettingsScreenSmokeTests
+{
+ [Test]
+ public Task SettingsShowCurrentValuesAndNeverCutLabelsOrRows() => ScreenHost.RunAsync(async () =>
+ {
+ await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
+ var shell = app.Shell;
+ await app.Sample.FillAsync();
+ await shell.Services.Server.RestoreAsync();
+ var settings = shell.Settings;
+
+ // The open archive and the server connected to were set after Settings was built: it shows them when opened.
+ shell.Navigate(SectionKey.Settings);
+ Assert.Equal(@"D:\TitanoArchive", settings.ArchiveRoot.Text);
+ Assert.Equal("https://nas.local:8443", settings.DefaultServer.Text);
+ Assert.False(settings.ArchiveRoot.IsDirty || settings.DefaultServer.IsDirty, "values loaded, not edits");
+
+ // The section list shows where keyboard focus is.
+ await app.ExpectAsync("settings-general");
+ Assert.True(app.FindAll().Where(i => i.DataContext is SettingsPageItem).All(i => i.FocusVisualStyle is not null), "sections have a focus ring");
+
+ // At the minimum window width the cache folder row stays one line: Clear beside the path, not under it.
+ settings.Page = SettingsPage.Storage;
+ await app.ExpectAsync("settings-storage");
+ var window = Window.GetWindow(app.FindAll().First(v => v.IsVisible));
+ var width = window.Width;
+ window.Width = 1200;
+ window.UpdateLayout();
+ var cache = Field(app, Loc.L("Settings.Storage.Folder"));
+ var clear = app.FindAll().First(b => b.Content as string == Loc.L("Settings.Storage.Clear") && b.IsVisible);
+ Assert.Approximately(Middle(cache), Middle(clear), 2, "Clear is on the path's line");
+ Assert.Equal(FlowDirection.LeftToRight, cache.FlowDirection);
+ window.Width = width;
+
+ // Long translations are never cut: German labels show whole (or wrap) in the shared label column.
+ UiLanguage.Apply("de");
+ try
+ {
+ await app.ExpectAsync("settings-storage-de");
+ foreach (var label in Labels(app)) Assert.True(IsWhole(label), $"\"{label.Text}\" is shown whole");
+ }
+ finally
+ {
+ UiLanguage.Apply("en");
+ }
+
+ // Auto values are text with their reason in the tooltip, not buttons that do nothing.
+ settings.Page = SettingsPage.Rendering;
+ await app.ExpectAsync("settings-rendering");
+ Assert.False(app.FindAll().Any(b => b.Content is string text && (text == settings.MemoryAutoText || text == settings.ParallelismAutoText)), "no dead Auto buttons");
+
+ // Paths, addresses and fingerprints read left to right; read-only paths show whole in their tooltip.
+ settings.Page = SettingsPage.Advanced;
+ await app.ExpectAsync("settings-advanced");
+ var data = Field(app, Loc.L("Settings.Advanced.DataFolder"));
+ Assert.Equal(FlowDirection.LeftToRight, data.FlowDirection);
+ Assert.Equal(settings.DataFolder, data.ToolTip);
+ // Advanced has nothing to reset: no Reset section there.
+ Assert.False(settings.CanResetSection);
+ Assert.False(settings.ResetSectionCommand.CanExecute(null));
+ Assert.False(app.FindAll().Any(b => b.Content as string == Loc.L("Settings.ResetSection") && b.IsVisible), "no Reset section on Advanced");
+
+ // Forgetting a trusted certificate asks first, as on the Server screen; a "no" keeps it and the session.
+ settings.Page = SettingsPage.Server;
+ await app.ExpectAsync("settings-server");
+ Assert.True(settings.CanResetSection);
+ Assert.Equal(FlowDirection.LeftToRight, Field(app, Loc.L("Settings.Server.Default")).FlowDirection);
+ var certificate = Assert.Contains(settings.Certificates, _ => true);
+ Assert.Contains(certificate.Server, certificate.ForgetName);
+ certificate.ForgetCommand.Execute(null);
+ Assert.Count(1, settings.Certificates);
+ Assert.True(shell.Server.IsConnected, "the session on the certificate stays");
+ Assert.True(ServerSession.ForgetRequest(certificate.FullFingerprint).IsDestructive);
+ });
+
+ [Test]
+ public Task TheFirstRunDialogKeepsTheKeyboardInside() => ScreenHost.RunAsync(async () =>
+ {
+ await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
+ app.Shell.ShowWelcome();
+ await app.ExpectAsync("welcome");
+
+ var welcome = app.FindAll().First(v => v.IsVisible);
+ var dialog = (FrameworkElement)welcome.Content;
+ Assert.Equal(KeyboardNavigationMode.Cycle, KeyboardNavigation.GetTabNavigation(dialog));
+ Assert.Equal(KeyboardNavigationMode.Cycle, KeyboardNavigation.GetControlTabNavigation(dialog));
+ Assert.Equal(KeyboardNavigationMode.Contained, KeyboardNavigation.GetDirectionalNavigation(dialog));
+ // It opens with focus on the chosen card (a local archive by default).
+ var focused = FocusManager.GetFocusedElement(Window.GetWindow(welcome)) as RadioButton;
+ Assert.NotNull(focused, "a card has focus");
+ Assert.True(focused.IsChecked == true && welcome.IsAncestorOf(focused), "the chosen card of the dialog has focus");
+ // The logo is not mirrored in right-to-left languages.
+ Assert.True(app.FindAll().Where(b => b.IsVisible).All(b => b.FlowDirection == FlowDirection.LeftToRight));
+ app.Shell.CompleteWelcome();
+ });
+
+ [Test]
+ public Task ARightToLeftLanguageMirrorsEveryWindowAlsoThoseOpenedLater() => ScreenHost.RunAsync(async () =>
+ {
+ await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
+ app.Shell.About.SetResult(null);
+ app.Shell.Navigate(SectionKey.About);
+ await app.ExpectAsync("about");
+ var main = Window.GetWindow(app.FindAll().First(v => v.IsVisible));
+ Assert.Equal(FlowDirection.LeftToRight, main.FlowDirection);
+
+ UiLanguage.Apply("ar");
+ var dialog = new Window
+ {
+ WindowStartupLocation = WindowStartupLocation.Manual,
+ Left = -20000,
+ Top = -20000,
+ Width = 320,
+ Height = 200,
+ ShowActivated = false,
+ ShowInTaskbar = false,
+ };
+ try
+ {
+ Assert.Equal(FlowDirection.RightToLeft, main.FlowDirection);
+ dialog.Show();
+ await dialog.Dispatcher.InvokeAsync(() => { }, DispatcherPriority.ApplicationIdle);
+ Assert.Equal(FlowDirection.RightToLeft, dialog.FlowDirection, "a window opened after the switch (a dialog) is mirrored too");
+ await app.ExpectAsync("about-ar");
+
+ // Inside the mirrored window, paths and the logo keep their left-to-right order.
+ var path = app.FindAll().First(t => t.IsVisible && t.Text == app.Shell.About.DataFolder);
+ Assert.Equal(FlowDirection.LeftToRight, path.FlowDirection);
+ Assert.Equal(app.Shell.About.DataFolder, path.ToolTip);
+ // The update result is a live region: screen readers hear each new state.
+ var update = app.FindAll().First(g => g.IsVisible && g.Text == app.Shell.About.UpdateText);
+ Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(update));
+ Assert.Equal(app.Shell.About.UpdateAnnouncement, AutomationProperties.GetName(update));
+ }
+ finally
+ {
+ dialog.Close();
+ UiLanguage.Apply("en");
+ }
+ Assert.Equal(FlowDirection.LeftToRight, main.FlowDirection);
+ });
+
+ private static TextBox Field(ScreenSmokeTests.SampleApp app, string name) =>
+ app.FindAll().First(t => t.IsVisible && AutomationProperties.GetName(t) == name);
+
+ private static double Middle(FrameworkElement element) =>
+ element.TranslatePoint(new Point(0, element.ActualHeight / 2), Window.GetWindow(element)).Y;
+
+ /// The label of every visible Settings row (the first text of the row template).
+ private static IEnumerable Labels(ScreenSmokeTests.SampleApp app) =>
+ app.FindAll().Where(h => h.IsVisible).Select(h => Descendants(h).First());
+
+ /// The label's text fits its width on one line, or wraps onto more lines; never trimmed.
+ private static bool IsWhole(TextBlock label)
+ {
+ var probe = new TextBlock { Text = label.Text, FontFamily = label.FontFamily, FontSize = label.FontSize, FontWeight = label.FontWeight };
+ probe.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+ return label.TextTrimming == TextTrimming.None || probe.DesiredSize.Width <= label.ActualWidth + 0.5;
+ }
+
+ private static IEnumerable Descendants(DependencyObject node)
+ where T : DependencyObject
+ {
+ for (var i = 0; i < VisualTreeHelper.GetChildrenCount(node); i++)
+ {
+ var child = VisualTreeHelper.GetChild(node, i);
+ if (child is T match) yield return match;
+ foreach (var nested in Descendants(child)) yield return nested;
+ }
+ }
+}