merge: integration branch claude/keen-knuth-uhxv8w (Archive manager and UI kit review) into the Library workstream
The Archive manager's reviewed dialogs (live status lines, one-sentence errors, growing label columns, left-to-right paths) move into the shared ArchiveDialogs.xaml with their styles, so the Library's Delete and the Trash dialog use them too. Delete, Restore and Rate failures read as one sentence through ArchiveFailures, which now knows a stale delete plan, a newer sidecar and a sequence already back in the library (SequenceInLibraryException). The confirmation's plan lines in the UI font follow the reading direction; fingerprints stay left to right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
77 files changed
+1966
-468
No files matched your search
@@ -43,8 +43,9 @@
|
||||
<Setter Property="TextAlignment" Value="Right" />
|
||||
</Style>
|
||||
|
||||
<!-- Log tail: monospaced, muted. -->
|
||||
<!-- Log tail: monospaced, muted, left to right in every language (paths, times, codes). -->
|
||||
<Style x:Key="Text.Log" TargetType="TextBlock">
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter Property="FontFamily" Value="{StaticResource Font.Mono}" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="LineHeight" Value="18" />
|
||||
@@ -89,7 +90,7 @@
|
||||
|
||||
<!-- Section list entry of Settings: 34 px, active = Card fill + 3 px accent edge (Settings.html). -->
|
||||
<Style x:Key="ListBoxItem.Section" TargetType="ListBoxItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
<Setter Property="Height" Value="34" />
|
||||
<Setter Property="Margin" Value="0,0,0,2" />
|
||||
@@ -145,21 +146,6 @@
|
||||
<Setter Property="Margin" Value="0,0,6,0" />
|
||||
</Style>
|
||||
|
||||
<!-- "Auto · 8" pill (DESIGN §4 Auto/manual): accent outline, 24 px, 11 px text. -->
|
||||
<Style x:Key="Button.AutoPill" TargetType="Button" BasedOn="{StaticResource Button.Base}">
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="Padding" Value="8,0" />
|
||||
<Setter Property="FontSize" Value="11" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="ui:ControlState.CornerRadius" Value="12" />
|
||||
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.AccentSubtle}" />
|
||||
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="ui:ControlState.PressedBackground" Value="{DynamicResource Brush.AccentSubtle}" />
|
||||
</Style>
|
||||
|
||||
<!-- Toolbar dropdown (Library filters): accent border while a filter is active (bind Tag to the active flag). -->
|
||||
<Style x:Key="ComboBox.Filter" TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||
<Setter Property="MinWidth" Value="88" />
|
||||
@@ -213,8 +199,8 @@
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
</Style>
|
||||
|
||||
<!-- Path and template fields in Settings (360 px, DESIGN mockup). -->
|
||||
<Style x:Key="TextBox.Setting" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||
<!-- Path, address and template fields in Settings (360 px, DESIGN mockup), left to right in every language. -->
|
||||
<Style x:Key="TextBox.Setting" TargetType="TextBox" BasedOn="{StaticResource TextBox.Path}">
|
||||
<Setter Property="Width" Value="360" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
</Style>
|
||||
|
||||
@@ -5,14 +5,17 @@
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
Title="{l:Loc Shell.AppName}"
|
||||
IsDialog="True" ResizeMode="NoResize" SizeToContent="Height" Width="460"
|
||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False">
|
||||
<!-- DESIGN §4 dialog: two buttons, safe action left and default, the action on the right. -->
|
||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
|
||||
AutomationProperties.Name="{Binding Heading}" AutomationProperties.HelpText="{Binding Message}">
|
||||
<!-- DESIGN §4 dialog: two buttons, safe action left and default, the action on the right. Screen readers hear the
|
||||
heading and the message as the dialog opens on the safe button. -->
|
||||
<StackPanel Margin="24,18,24,20">
|
||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" TextWrapping="Wrap" TextTrimming="None" />
|
||||
<TextBlock Text="{Binding Message}" Margin="0,8,0,0" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18" />
|
||||
<Border Style="{StaticResource Border.Card}" Margin="0,16,0,0" Padding="12,10" ToolTip="{Binding DetailToolTip}"
|
||||
Visibility="{Binding Detail, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||
<TextBlock x:Name="DetailText" Text="{Binding Detail}" FontFamily="{StaticResource Font.Mono}" FontSize="{StaticResource Size.Secondary}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18" />
|
||||
<TextBlock x:Name="DetailText" Text="{Binding Detail}" FontFamily="{StaticResource Font.Mono}" FontSize="{StaticResource Size.Secondary}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18"
|
||||
FlowDirection="LeftToRight" />
|
||||
</Border>
|
||||
<StackPanel x:Name="Typing" Margin="0,16,0,0" Visibility="Collapsed">
|
||||
<TextBlock Text="{Binding TypedPrompt}" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" />
|
||||
@@ -20,7 +23,7 @@
|
||||
AutomationProperties.Name="{Binding TypedPrompt}" TextChanged="OnTyped" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,24,0,0">
|
||||
<Button Content="{Binding SafeText}" ToolTip="{Binding SafeToolTip}" IsDefault="True" IsCancel="True" MinWidth="96" Click="OnSafe" />
|
||||
<Button x:Name="Safe" Content="{Binding SafeText}" ToolTip="{Binding SafeToolTip}" IsDefault="True" IsCancel="True" MinWidth="96" Click="OnSafe" />
|
||||
<Button x:Name="Action" Content="{Binding ActionText}" ToolTip="{Binding ActionToolTip}" MinWidth="96" Margin="8,0,0,0" Click="OnAction" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -12,8 +12,17 @@ public sealed partial class ConfirmDialog : TitanoWindow
|
||||
DataContext = request;
|
||||
InitializeComponent();
|
||||
Action.SetResourceReference(StyleProperty, request.IsDestructive ? "Button.Destructive" : "Button.Primary");
|
||||
if (!request.IsDetailMonospaced) DetailText.SetResourceReference(FontFamilyProperty, "Font.Ui");
|
||||
if (request.TypedConfirmation is null) return;
|
||||
if (!request.IsDetailMonospaced)
|
||||
{
|
||||
// Names and sentences follow the reading direction; only fingerprints stay left to right.
|
||||
DetailText.SetResourceReference(FontFamilyProperty, "Font.Ui");
|
||||
DetailText.ClearValue(FlowDirectionProperty);
|
||||
}
|
||||
if (request.TypedConfirmation is null)
|
||||
{
|
||||
Loaded += (_, _) => Safe.Focus();
|
||||
return;
|
||||
}
|
||||
Typing.Visibility = Visibility.Visible;
|
||||
Loaded += (_, _) => Typed.Focus();
|
||||
EnableAction(false);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Reflection;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Import;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Render;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Sync;
|
||||
using Titano.Protocol.Client;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// The sentence an error toast shows (BRIEF §0.2: one sentence saying what happened plus one action). Only failures
|
||||
/// that carry a catalog sentence say what happened; anything else (framework and OS messages, often technical
|
||||
/// English) reads "Something went wrong." and stays in the log.
|
||||
/// </summary>
|
||||
public static class ErrorText
|
||||
{
|
||||
public static string For(Exception ex) => Describe(Unwrap(ex)) ?? Loc.L("Errors.Unexpected");
|
||||
|
||||
private static string? Describe(Exception ex) => ex switch
|
||||
{
|
||||
LeaseUnavailableException or ArchiveOfflineException or NewerFormatException or ImportSourceUnavailableException
|
||||
or CopyVerificationException or StaleRenamePlanException or SyncConflictChangedException => ex.Message,
|
||||
// The server words its errors in the client's language (Accept-Language).
|
||||
TitanoApiException api when !string.IsNullOrWhiteSpace(api.Error.Message) => api.Error.Message,
|
||||
RenderException render => Loc.Get(render.ReasonKey, Loc.Culture) is null ? null : Loc.L(render.ReasonKey, [.. render.Args]),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>Awaited tasks and reflection wrap the real failure in one layer or more.</summary>
|
||||
private static Exception Unwrap(Exception ex)
|
||||
{
|
||||
while (ex is AggregateException { InnerExceptions.Count: 1 } or TargetInvocationException && ex.InnerException is { } inner) ex = inner;
|
||||
return ex;
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
Title="{l:Loc Shell.AppName}"
|
||||
IsDialog="True" ResizeMode="NoResize" SizeToContent="Height" Width="440"
|
||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False">
|
||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False" AutomationProperties.Name="{l:Loc Server.Login.Title}">
|
||||
<!-- BRIEF §12.7 login modal: the server is already identified and its certificate trusted. -->
|
||||
<StackPanel Margin="24,18,24,20">
|
||||
<TextBlock Text="{l:Loc Server.Login.Title}" Style="{StaticResource Text.Title}" />
|
||||
<TextBlock x:Name="ServerText" Margin="0,4,0,0" Style="{StaticResource Text.Secondary}" />
|
||||
<TextBlock x:Name="ServerText" Margin="0,4,0,0" Style="{StaticResource Text.Secondary}" FlowDirection="LeftToRight" HorizontalAlignment="Left" />
|
||||
<Grid Margin="0,18,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="92" />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using Titano.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
@@ -6,7 +8,8 @@ namespace Titano.App.Shell;
|
||||
/// <summary>
|
||||
/// The login form (BRIEF §12.7). It calls back the connection with the credentials and stays open with the
|
||||
/// error sentence until the sign-in succeeds or the user cancels. The password never leaves the PasswordBox
|
||||
/// except for that call.
|
||||
/// except for that call. A failed sign-in is announced to screen readers and marks the password box (error border,
|
||||
/// sentence as its help text) until the next attempt.
|
||||
/// </summary>
|
||||
public sealed partial class LoginDialog : TitanoWindow
|
||||
{
|
||||
@@ -40,6 +43,7 @@ public sealed partial class LoginDialog : TitanoWindow
|
||||
{
|
||||
SignIn.IsEnabled = false;
|
||||
Error.Visibility = Visibility.Collapsed;
|
||||
Field.SetError(Password, null);
|
||||
try
|
||||
{
|
||||
var error = await _signIn(User.Text, Password.Password);
|
||||
@@ -50,8 +54,11 @@ public sealed partial class LoginDialog : TitanoWindow
|
||||
}
|
||||
Error.Text = error;
|
||||
Error.Visibility = Visibility.Visible;
|
||||
Field.SetError(Password, error);
|
||||
Password.Clear();
|
||||
Password.Focus();
|
||||
UIElementAutomationPeer.CreatePeerForElement(this)?.RaiseNotificationEvent(
|
||||
AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, error, "Titano.SignIn");
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:shell="clr-namespace:Titano.App.Shell"
|
||||
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||
xmlns:s="clr-namespace:Titano.App.Sections"
|
||||
Title="{Binding WindowTitle}"
|
||||
Width="1440" Height="900" MinWidth="1200" MinHeight="760"
|
||||
@@ -14,8 +15,24 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Navigation rail: full names, collapsible to icons (BRIEF §12.1). -->
|
||||
<Border x:Name="Rail" Background="{DynamicResource Brush.Chrome}" Width="128" ui:NavRail.IsCollapsed="{Binding IsRailCollapsed}">
|
||||
<!-- Navigation rail: full names, collapsible to icons (BRIEF §12.1). Expanded it is at least 128 px and grows with
|
||||
the longest label of the language (up to 200 px); collapsed it is 48 px of icons. While the first-run dialog is
|
||||
open the shell behind it takes no input. The buttons of both lists form one group (GroupName); their check
|
||||
binds one way, the section the shell navigates to (a GroupName spans every window not yet on screen). -->
|
||||
<Border x:Name="Rail" Background="{DynamicResource Brush.Chrome}" ui:NavRail.IsCollapsed="{Binding IsRailCollapsed}"
|
||||
IsEnabled="{Binding IsShellEnabled}">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="MinWidth" Value="128" />
|
||||
<Setter Property="MaxWidth" Value="200" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsRailCollapsed}" Value="True">
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="Width" Value="48" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<DockPanel Margin="8,8,8,8" LastChildFill="False">
|
||||
<Button DockPanel.Dock="Top" Style="{StaticResource Button.IconSubtle}" HorizontalAlignment="Left" Margin="0,0,0,6"
|
||||
ui:ButtonIcon.Glyph="{StaticResource Icon.Menu}" Command="{Binding ToggleRailCommand}"
|
||||
@@ -24,7 +41,7 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
||||
<ui:NavRailButton GroupName="Rail" Glyph="{Binding Glyph}" Content="{Binding Label}" Badge="{Binding Badge}"
|
||||
IsChecked="{Binding IsSelected}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
||||
IsChecked="{Binding IsSelected, Mode=OneWay}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
||||
Command="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -33,7 +50,7 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
||||
<ui:NavRailButton GroupName="Rail" Glyph="{Binding Glyph}" Content="{Binding Label}" Badge="{Binding Badge}"
|
||||
IsChecked="{Binding IsSelected}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
||||
IsChecked="{Binding IsSelected, Mode=OneWay}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
||||
Command="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -41,17 +58,19 @@
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid Grid.Column="1" IsEnabled="{Binding IsShellEnabled}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Job bar (DESIGN §4): current job, progress, time left, pause; "Ready" when idle, hidden when idle in the editor. -->
|
||||
<ui:JobBar Text="{Binding JobText}" Progress="{Binding JobProgress}" IsActive="{Binding IsJobActive}" IsIndeterminate="{Binding IsJobIndeterminate}"
|
||||
StopCommand="{Binding StopJobCommand}" StopToolTip="{l:Loc Tooltips.Shell.PauseJob}" ActionGlyph="{StaticResource Icon.Pause}"
|
||||
Visibility="{Binding IsJobBarVisible, Converter={StaticResource BoolToVisibility}}" />
|
||||
<!-- Job bar (DESIGN §4): current job, progress, time left, pause; "Ready" when idle, hidden when idle in the editor.
|
||||
Screen readers hear which job starts and when the queue empties, not its progress ticks. -->
|
||||
<ui:JobBar x:Name="JobBar" Text="{Binding JobText}" Progress="{Binding JobProgress}" IsActive="{Binding IsJobActive}" IsIndeterminate="{Binding IsJobIndeterminate}"
|
||||
StopCommand="{Binding StopJobCommand}" StopToolTip="{l:Loc Tooltips.Shell.PauseJob}" StopName="{l:Loc Shell.JobBar.Pause}" ActionGlyph="{StaticResource Icon.Pause}"
|
||||
Visibility="{Binding IsJobBarVisible, Converter={StaticResource BoolToVisibility}}"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding JobAnnouncement}" />
|
||||
|
||||
<ContentControl Grid.Row="1" Content="{Binding Current}" Focusable="False" />
|
||||
|
||||
@@ -61,18 +80,22 @@
|
||||
<TextBlock Text="{Binding SequencesText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding PhotosText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding StorageText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="Connection" Text="{Binding ConnectionText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="Connection" Text="{Binding ConnectionText}" Margin="0,0,18,0" VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding ConnectionText}" />
|
||||
<TextBlock Text="{Binding JobsText}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<ui:ToastHost x:Name="Toasts" Grid.Row="0" Grid.RowSpan="3" />
|
||||
</Grid>
|
||||
|
||||
<!-- First run (Welcome.html): the shell dimmed behind one dialog. -->
|
||||
<Grid Grid.ColumnSpan="2" Visibility="{Binding IsWelcomeOpen, Converter={StaticResource BoolToVisibility}}">
|
||||
<!-- First run (Welcome.html): the shell dimmed behind one dialog that keeps the keyboard. -->
|
||||
<Grid x:Name="WelcomeOverlay" Grid.ColumnSpan="2" Visibility="{Binding IsWelcomeOpen, Converter={StaticResource BoolToVisibility}}"
|
||||
KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
|
||||
<Border Background="{DynamicResource Brush.Scrim}" />
|
||||
<s:WelcomeView DataContext="{Binding Welcome}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,114,0,0" />
|
||||
<s:WelcomeView DataContext="{Binding Welcome}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,114,0,0"
|
||||
AutomationProperties.Name="{l:Loc Shell.Welcome.Title}" />
|
||||
</Grid>
|
||||
|
||||
<!-- Above the first-run dialog too, so a card inserted meanwhile can still be acted on (Welcome.html). -->
|
||||
<ui:ToastHost x:Name="Toasts" Grid.ColumnSpan="2" />
|
||||
</Grid>
|
||||
</ui:TitanoWindow>
|
||||
@@ -1,5 +1,9 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.Ui.Controls;
|
||||
|
||||
@@ -14,21 +18,50 @@ public partial class MainWindow : TitanoWindow
|
||||
_shell = shell;
|
||||
DataContext = shell;
|
||||
InitializeComponent();
|
||||
Rail.Width = shell.IsRailCollapsed ? 48 : 128;
|
||||
UpdateConnection();
|
||||
shell.PropertyChanged += (_, e) =>
|
||||
{
|
||||
if (e.PropertyName is nameof(ShellViewModel.IsRailCollapsed) or "")
|
||||
Rail.Width = shell.IsRailCollapsed ? 48 : 128;
|
||||
if (e.PropertyName is nameof(ShellViewModel.IsConnected) or "") UpdateConnection();
|
||||
if (e.PropertyName is nameof(ShellViewModel.IsWelcomeOpen) or "") FocusWelcome();
|
||||
};
|
||||
shell.PendingToasts.CollectionChanged += OnToastRequested;
|
||||
Loaded += (_, _) => FocusWelcome();
|
||||
RestorePlacement();
|
||||
Closing += (_, _) => SavePlacement();
|
||||
}
|
||||
|
||||
/// <summary>F6 moves the keyboard to the newest notification (as in Windows apps), Esc there dismisses it.</summary>
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if (!e.Handled && e.Key == Key.F6 && Keyboard.Modifiers == ModifierKeys.None) e.Handled = Toasts.FocusNewest();
|
||||
}
|
||||
|
||||
private void UpdateConnection() =>
|
||||
Connection.SetResourceReference(System.Windows.Controls.TextBlock.ForegroundProperty, _shell.IsConnected ? "Brush.Accent" : "Brush.TextMuted");
|
||||
Connection.SetResourceReference(TextBlock.ForegroundProperty, _shell.IsConnected ? "Brush.Accent" : "Brush.TextMuted");
|
||||
|
||||
/// <summary>The first-run dialog takes the keyboard on its chosen option once it is on screen.</summary>
|
||||
private void FocusWelcome()
|
||||
{
|
||||
if (!_shell.IsWelcomeOpen) return;
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () =>
|
||||
{
|
||||
if (!_shell.IsWelcomeOpen || !IsLoaded) return;
|
||||
if (FindChecked(WelcomeOverlay) is { } choice) choice.Focus();
|
||||
else WelcomeOverlay.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||
});
|
||||
}
|
||||
|
||||
private static RadioButton? FindChecked(DependencyObject root)
|
||||
{
|
||||
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(root, i);
|
||||
if (child is RadioButton { IsChecked: true } radio) return radio;
|
||||
if (FindChecked(child) is { } nested) return nested;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnToastRequested(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using Titano.App.Archiving;
|
||||
using Titano.App.DesignTime;
|
||||
using Titano.App.Editor;
|
||||
using Titano.App.Import;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Library;
|
||||
using Titano.App.Server;
|
||||
using Titano.App.Settings;
|
||||
@@ -18,7 +19,9 @@ namespace Titano.App.Shell;
|
||||
/// <summary>
|
||||
/// <c>Titano.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
||||
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
|
||||
/// one, then the sync table with transfers, a conflict and its confirmation), for visual review and phase reports (BRIEF §20.2), then exits.
|
||||
/// one, then the sync table with transfers, a conflict and its confirmation), plus the Library, the editor's Exposure
|
||||
/// tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review and phase reports
|
||||
/// (BRIEF §20.2), then exits.
|
||||
/// </summary>
|
||||
public static class ScreenCapture
|
||||
{
|
||||
@@ -82,6 +85,9 @@ public static class ScreenCapture
|
||||
written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell);
|
||||
shell.Library.LayoutIndex = 0;
|
||||
shell.Library.ClearSelectionCommand.Execute(null);
|
||||
shell.IsRailCollapsed = true;
|
||||
written += await SaveAsync(window, directory, "library-rail-collapsed", theme, waitForThumbnails: shell);
|
||||
shell.IsRailCollapsed = false;
|
||||
written += await CaptureLibraryScenesAsync(window, shell, directory, theme);
|
||||
|
||||
shell.Navigate(SectionKey.Jobs);
|
||||
@@ -241,6 +247,8 @@ public static class ScreenCapture
|
||||
foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast);
|
||||
}
|
||||
|
||||
written += await CaptureRightToLeftAsync(window, shell, editor, directory);
|
||||
|
||||
// Last, as it stays: an analysis of the sequence running (settings disabled, viewing tools live).
|
||||
await sample.MarkAnalysingAsync(id);
|
||||
await editor.AttachJobsAsync();
|
||||
@@ -252,6 +260,41 @@ public static class ScreenCapture
|
||||
return written;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Library, the editor's Exposure tab and the import plan in Arabic, dark: the layout mirrors while photos,
|
||||
/// charts, the filmstrip and templates stay left to right. English is restored whatever happens.
|
||||
/// </summary>
|
||||
private static async Task<int> CaptureRightToLeftAsync(MainWindow window, ShellViewModel shell, EditorViewModel editor, string directory)
|
||||
{
|
||||
var written = 0;
|
||||
var frame = editor.CurrentIndex;
|
||||
ThemeManager.Apply(AppTheme.Dark);
|
||||
UiLanguage.Apply("ar");
|
||||
try
|
||||
{
|
||||
DismissToasts(window);
|
||||
shell.Navigate(SectionKey.Library);
|
||||
written += await SaveAsync(window, directory, "library-rtl", AppTheme.Dark, waitForThumbnails: shell);
|
||||
|
||||
shell.Navigate(SectionKey.Sequence);
|
||||
editor.SelectedTab = editor.Exposure;
|
||||
editor.IsCompare = true;
|
||||
editor.CurrentIndex = 45;
|
||||
written += await SaveEditorAsync(window, editor, directory, "sequence-exposure-rtl", AppTheme.Dark);
|
||||
|
||||
await ImportScenes.ShowAsync(shell, "plan");
|
||||
DismissToasts(window);
|
||||
written += await SaveAsync(window, directory, "import-plan-rtl", AppTheme.Dark);
|
||||
}
|
||||
finally
|
||||
{
|
||||
UiLanguage.Apply("en");
|
||||
}
|
||||
shell.Navigate(SectionKey.Sequence);
|
||||
editor.CurrentIndex = frame;
|
||||
return written;
|
||||
}
|
||||
|
||||
private static async Task<int> SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme)
|
||||
{
|
||||
await Settle(window);
|
||||
@@ -306,6 +349,7 @@ public static class ScreenCapture
|
||||
return false;
|
||||
}
|
||||
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
||||
// A right-to-left window's content already renders mirrored, as on screen.
|
||||
bitmap.Render(root);
|
||||
var encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
||||
|
||||
@@ -16,6 +16,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
private SectionViewModel _current;
|
||||
private bool _isRailCollapsed;
|
||||
private string? _jobText;
|
||||
private string? _jobName;
|
||||
private double _jobProgress;
|
||||
private bool _jobActive;
|
||||
private bool _jobIndeterminate;
|
||||
@@ -85,12 +86,17 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
get => _welcome;
|
||||
private set
|
||||
{
|
||||
if (Set(ref _welcome, value)) OnPropertyChanged(nameof(IsWelcomeOpen));
|
||||
if (!Set(ref _welcome, value)) return;
|
||||
OnPropertyChanged(nameof(IsWelcomeOpen));
|
||||
OnPropertyChanged(nameof(IsShellEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsWelcomeOpen => _welcome is not null;
|
||||
|
||||
/// <summary>The rail and the sections take input only while no first-run dialog covers them.</summary>
|
||||
public bool IsShellEnabled => _welcome is null;
|
||||
|
||||
public SectionViewModel Current
|
||||
{
|
||||
get => _current;
|
||||
@@ -105,7 +111,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public string WindowTitle => Current == Library ? "Titano" : "Titano — " + Current.Title;
|
||||
public string WindowTitle => Current == Library ? Loc.L("Shell.AppName") : Loc.L("Shell.WindowTitle", Loc.L("Shell.AppName"), Current.Title);
|
||||
|
||||
public bool IsRailCollapsed
|
||||
{
|
||||
@@ -160,7 +166,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
// ---- Job bar ----
|
||||
public string JobText => _jobActive && _jobText is not null
|
||||
? _jobText
|
||||
: _queuedCount > 0 ? Loc.L("Shell.JobBar.Ready", _queuedCount) : Loc.L("Shell.JobBar.Idle");
|
||||
: _queuedCount > 0 ? Loc.Plural("Shell.JobBar.Ready", _queuedCount) : Loc.L("Shell.JobBar.Idle");
|
||||
|
||||
public double JobProgress { get => _jobProgress; private set => Set(ref _jobProgress, value); }
|
||||
public bool IsJobActive
|
||||
@@ -179,14 +185,25 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
/// <summary>Pauses the job the bar shows.</summary>
|
||||
public ICommand? StopJobCommand => Jobs.PauseCurrentCommand;
|
||||
|
||||
/// <summary>Updates the global job bar (and the taskbar progress through the window).</summary>
|
||||
public void SetJob(string? text, double progress, bool indeterminate = false)
|
||||
/// <summary>
|
||||
/// What screen readers hear from the job bar: the job when one starts, the idle line when the last one ends; not its
|
||||
/// progress, speed or time left, which change every second.
|
||||
/// </summary>
|
||||
public string JobAnnouncement => _jobActive && _jobName is not null ? _jobName : JobText;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the global job bar (and the taskbar progress through the window). <paramref name="name"/> says which job
|
||||
/// it is without its progress ("Render: Harbour sunset"); null reads <paramref name="text"/>.
|
||||
/// </summary>
|
||||
public void SetJob(string? text, double progress, bool indeterminate = false, string? name = null)
|
||||
{
|
||||
_jobText = text;
|
||||
_jobName = text is null ? null : name ?? text;
|
||||
IsJobActive = text is not null;
|
||||
JobProgress = progress;
|
||||
IsJobIndeterminate = indeterminate;
|
||||
OnPropertyChanged(nameof(JobText));
|
||||
OnPropertyChanged(nameof(JobAnnouncement));
|
||||
}
|
||||
|
||||
// ---- Status strip ----
|
||||
@@ -222,6 +239,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
_queuedCount = queued;
|
||||
OnPropertyChanged(nameof(JobsText));
|
||||
OnPropertyChanged(nameof(JobText));
|
||||
OnPropertyChanged(nameof(JobAnnouncement));
|
||||
}
|
||||
|
||||
public void Navigate(SectionKey key)
|
||||
@@ -250,14 +268,14 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
ActionCommand = action is null ? null : new RelayCommand(action),
|
||||
});
|
||||
|
||||
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6).</summary>
|
||||
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6); the details go to the log.</summary>
|
||||
public void ReportError(Exception ex)
|
||||
{
|
||||
Log.Error("ui", "Operation failed", ex);
|
||||
ShowToast(new Toast
|
||||
{
|
||||
Title = Loc.L("Errors.Unexpected"),
|
||||
Message = ex.Message,
|
||||
Title = ErrorText.For(ex),
|
||||
IsError = true,
|
||||
ActionText = Loc.L("Common.OpenLogs"),
|
||||
ActionToolTip = Loc.L("Tooltips.Common.OpenLogs"),
|
||||
ActionCommand = new RelayCommand(() => ShellActions.Reveal(Services.Environment.LogDirectory)),
|
||||
|
||||
Reference in new issue
Block a user