merge: shared kit follow-ups (disabled lists, chart contrast and keyboard, RTL category charts, error toasts, short names)
Resolved: ArchiveView keeps the shared dialog dictionary from the Library branch and drops its local focus and list styles, now in the kit; the redundant left-to-right flag on the Move template box goes from ArchiveDialogs.xaml. Archive.View.Maintenance also leaves the 23 newly translated catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
72 files changed
+686
-262
No files matched your search
@@ -106,7 +106,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{l:Loc Archive.Rename.Template}" Style="{StaticResource Text.DialogLabel}" />
|
||||
<!-- A naming template keeps its tokens and separators in order in every language. -->
|
||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}" FlowDirection="LeftToRight"
|
||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}"
|
||||
Text="{Binding Template.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Template}"
|
||||
ToolTip="{Binding Template.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Rename.Template}" />
|
||||
</Grid>
|
||||
|
||||
@@ -24,6 +24,9 @@ public sealed class ArchiveTreeRowViewModel(ArchiveTreeNode node, ArchiveAvailab
|
||||
|
||||
public string ToggleToolTip => Loc.L(Node.IsExpanded ? "Tooltips.Archive.Collapse" : "Tooltips.Archive.Expand");
|
||||
|
||||
/// <summary>The expander's accessible name: two words, the sentence is its tooltip.</summary>
|
||||
public string ToggleName => Loc.L(Node.IsExpanded ? "Archive.Tree.Collapse" : "Archive.Tree.Expand");
|
||||
|
||||
/// <summary>
|
||||
/// The full title (the tree trims it) and its figures; a year also says how the keyboard opens and closes it, with
|
||||
/// the arrow keys swapped in a right-to-left layout.
|
||||
|
||||
@@ -196,6 +196,14 @@ public static class EditorText
|
||||
_ => parameter,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// "Deflicker window: 21 frames → 41 frames", one line of the Optimise toast. Bidi never mirrors an arrow, so a
|
||||
/// right-to-left language reads it from its own resource, the arrow pointing from the old value to the new one.
|
||||
/// </summary>
|
||||
public static string Change(SettingChange change) =>
|
||||
Loc.L(Loc.IsRightToLeft ? "Editor.Optimise.ChangeRtl" : "Editor.Optimise.Change", ParameterLabel(change.Parameter), Value(change.Parameter, change.Before),
|
||||
Value(change.Parameter, change.After));
|
||||
|
||||
/// <summary>A value of an advisor parameter as its control shows it (the "what changed" toast of Optimise).</summary>
|
||||
public static string Value(string parameter, object? value) => (parameter, value) switch
|
||||
{
|
||||
|
||||
@@ -819,6 +819,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
{
|
||||
Title = Loc.L("Editor.Save.Failed"),
|
||||
Message = ex.Message,
|
||||
IsError = true,
|
||||
ActionText = Loc.L("Editor.Save.Retry"),
|
||||
ActionToolTip = Loc.L("Tooltips.Editor.Save.Retry"),
|
||||
ActionCommand = new RelayCommand(() => _ = Session.FlushAsync()),
|
||||
@@ -893,9 +894,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
Shell.Notify(Loc.L("Editor.Optimise.Nothing"));
|
||||
return;
|
||||
}
|
||||
var lines = changes.Select(c => Loc.L("Editor.Optimise.Change", EditorText.ParameterLabel(c.Parameter), EditorText.Value(c.Parameter, c.Before),
|
||||
EditorText.Value(c.Parameter, c.After)));
|
||||
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, lines));
|
||||
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, changes.Select(EditorText.Change)));
|
||||
}
|
||||
|
||||
private async Task AnalyseAsync()
|
||||
@@ -957,6 +956,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
{
|
||||
Title = Loc.L("Editor.ServerJob.Ended", JobText.Kind(job.Kind), Loc.L("Jobs.State." + job.State), server),
|
||||
Message = job.Error ?? job.TargetLabel ?? Title,
|
||||
IsError = job.State == JobState.Failed,
|
||||
ActionText = Loc.L("Jobs.Action.Retry"),
|
||||
ActionToolTip = Loc.L("Tooltips.Editor.ServerJob.Retry", server),
|
||||
ActionCommand = new AsyncRelayCommand(() => Session.Source.RetryJobAsync(job.Id, CancellationToken.None), () => !_disposed),
|
||||
|
||||
@@ -177,7 +177,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException)
|
||||
{
|
||||
Log.Warning("import", "Card check failed", ex);
|
||||
_shell.Notify(Loc.L("Import.Toast.CheckFailed"), ex.Message);
|
||||
_shell.Notify(Loc.L("Import.Toast.CheckFailed"), ex.Message, isError: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -212,7 +212,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
Log.Warning("import", "Deleting imported photos failed", ex);
|
||||
_shell.Notify(Loc.L("Import.Toast.DeleteFailed"), ex.Message);
|
||||
_shell.Notify(Loc.L("Import.Toast.DeleteFailed"), ex.Message, isError: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -263,12 +263,12 @@ public sealed class ImportResultViewModel : LocalizedViewModel
|
||||
if (!unchanged)
|
||||
{
|
||||
Actions = _actions with { Erase = null, Card = null };
|
||||
_shell.Notify(Loc.L("Import.Toast.CardChanged", name), Loc.L("Import.Blocked.NoDryRun"));
|
||||
_shell.Notify(Loc.L("Import.Toast.CardChanged", name), Loc.L("Import.Blocked.NoDryRun"), isError: true);
|
||||
return;
|
||||
}
|
||||
var outcome = _shell.Services.Devices.Format(device);
|
||||
if (outcome == FormatOutcome.Formatted) Actions = _actions with { Erase = null, Card = null };
|
||||
if (outcome != FormatOutcome.Cancelled) _shell.Notify(Loc.L("Import.Toast.Format." + outcome, name));
|
||||
if (outcome != FormatOutcome.Cancelled) _shell.Notify(Loc.L("Import.Toast.Format." + outcome, name), isError: outcome == FormatOutcome.Failed);
|
||||
}
|
||||
|
||||
/// <summary>The first files that were never imported, one per line.</summary>
|
||||
@@ -286,7 +286,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
|
||||
try
|
||||
{
|
||||
var outcome = await Task.Run(() => _shell.Services.Devices.Eject(device));
|
||||
_shell.Notify(Loc.L("Import.Toast.Eject." + outcome, _card?.Nickname ?? device.Label));
|
||||
_shell.Notify(Loc.L("Import.Toast.Eject." + outcome, _card?.Nickname ?? device.Label), isError: outcome != EjectOutcome.Ejected);
|
||||
if (outcome == EjectOutcome.Ejected) SetDevice(null);
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -56,7 +56,7 @@ public static class ArchiveActions
|
||||
or Data.DatabaseException)
|
||||
{
|
||||
Log.Error("archive", "Archive action failed", ex);
|
||||
shell.Notify(Core.Localization.Loc.L("Errors.Archive.Open"), ex.Message);
|
||||
shell.Notify(Core.Localization.Loc.L("Errors.Archive.Open"), ex.Message, isError: true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,36 +13,6 @@
|
||||
<!-- The dialogs (and their styles) are shared with the Library, which runs Delete… too. -->
|
||||
<ResourceDictionary Source="pack://application:,,,/Titano;component/Archive/ArchiveDialogs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- Keyboard focus drawn inside the row (DESIGN §4 ring): an outer ring would be clipped by the list's scroll viewer. -->
|
||||
<Style x:Key="Focus.Inset">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="2" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!--
|
||||
Lists keep their panel's fill while the screen behind a dialog is disabled: the system template would paint them
|
||||
white. Rows and buttons dim themselves.
|
||||
-->
|
||||
<Style TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBox">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="1" SnapsToDevicePixels="True">
|
||||
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
|
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Text.PanelHeading" TargetType="TextBlock" BasedOn="{StaticResource Text.Section}">
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
@@ -163,7 +133,7 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="Toggle" Style="{StaticResource Button.IconSubtle}" Width="22" Height="22" MinWidth="22" ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronRight}"
|
||||
Command="{Binding ToggleCommand}" ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleToolTip}" Visibility="Hidden"
|
||||
Command="{Binding ToggleCommand}" ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleName}" Visibility="Hidden"
|
||||
Focusable="False" />
|
||||
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="Detail" Grid.Column="2" Text="{Binding Detail}" Style="{StaticResource Text.Secondary}" VerticalAlignment="Center" Margin="8,0,0,0"
|
||||
@@ -194,13 +164,6 @@
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<!--
|
||||
Chart labels in TextMuted as in Archive.html: the kit's charts draw them in TextFaint, too faint for 11 px data
|
||||
labels (reported to the shared controls; remove this alias once they draw in TextMuted).
|
||||
-->
|
||||
<Grid.Resources>
|
||||
<SolidColorBrush x:Key="Brush.TextFaint" Color="{DynamicResource Color.TextMuted}" />
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="14" />
|
||||
@@ -260,12 +223,7 @@
|
||||
</DockPanel>
|
||||
<v:HeatmapStrip Rows="{Binding MonthRows}" ColumnLabels="{Binding MonthLabels}" ValueFormatter="{Binding CountFormatter}" MaxCellSize="32" ShowScale="False"
|
||||
ToolTip="{l:Loc Tooltips.Archive.Months}" AutomationProperties.Name="{l:Loc Archive.Chart.Months}"
|
||||
AutomationProperties.HelpText="{Binding MonthsDescription}">
|
||||
<!-- Months still to come in the Stroke tone: the kit fills them with Card, the panel's own colour in the light theme. -->
|
||||
<v:HeatmapStrip.Resources>
|
||||
<SolidColorBrush x:Key="Brush.Card" Color="{DynamicResource Color.Stroke}" />
|
||||
</v:HeatmapStrip.Resources>
|
||||
</v:HeatmapStrip>
|
||||
AutomationProperties.HelpText="{Binding MonthsDescription}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="2" Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||
|
||||
@@ -935,5 +935,6 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
|
||||
/// <summary>An action stopped: what stopped, why in one sentence, and Retry to run it again (BRIEF §0.2 rule 6).</summary>
|
||||
private void NotifyFailure(string titleKey, Exception ex, ICommand retry) =>
|
||||
Shell.Notify(Loc.L(titleKey), ArchiveFailures.Cause(ex), Loc.L("Archive.Failed.Retry"), Loc.L("Tooltips.Archive.Retry"), () => retry.Execute(null));
|
||||
Shell.Notify(Loc.L(titleKey), ArchiveFailures.Cause(ex), Loc.L("Archive.Failed.Retry"), Loc.L("Tooltips.Archive.Retry"), () => retry.Execute(null),
|
||||
isError: true);
|
||||
}
|
||||
@@ -864,7 +864,7 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Archive manager "Adopt folder › Copy into the layout" (BRIEF §12.5): the folder becomes the source and this PC's
|
||||
/// Archive manager "Adopt folder › Copy into archive…" (BRIEF §12.5): the folder becomes the source and this PC's
|
||||
/// archive the destination; the plan shows where every photo goes before anything is copied.
|
||||
/// </summary>
|
||||
public async Task ImportFolderAsync(string folder)
|
||||
|
||||
@@ -197,7 +197,7 @@ public sealed class SequenceViewModel : SectionViewModel
|
||||
break;
|
||||
case JobState.Failed:
|
||||
Shell.Notify(Loc.L("Editor.Proxies.Failed"), job.Error ?? fetch.Title, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"),
|
||||
() => Shell.Navigate(SectionKey.Jobs));
|
||||
() => Shell.Navigate(SectionKey.Jobs), isError: true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Shell.Services.Thumbnails?.Clear();
|
||||
if (!CacheStore.IsOwned(folder))
|
||||
{
|
||||
Shell.Notify(Loc.L("Settings.Storage.NotOwned"));
|
||||
Shell.Notify(Loc.L("Settings.Storage.NotOwned"), isError: true);
|
||||
return;
|
||||
}
|
||||
var freed = await Task.Run(() => CacheStore.Clear(folder));
|
||||
@@ -776,7 +776,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
}
|
||||
if (imported is null)
|
||||
{
|
||||
Shell.Notify(Loc.L("Errors.Settings.Import"));
|
||||
Shell.Notify(Loc.L("Errors.Settings.Import"), isError: true);
|
||||
return;
|
||||
}
|
||||
// Everything but the session, the window and the first-run flag.
|
||||
|
||||
@@ -204,7 +204,7 @@ public sealed class WelcomeViewModel : LocalizedViewModel
|
||||
case WelcomeChoice.LocalArchive:
|
||||
if (ArchiveLocations.Validate(LocalRoot) is { } problem)
|
||||
{
|
||||
_shell.Notify(problem);
|
||||
_shell.Notify(problem, isError: true);
|
||||
return;
|
||||
}
|
||||
if (!await ArchiveActions.TryAsync(_shell, s => s.CreateAsync(LocalRoot))) return;
|
||||
|
||||
@@ -317,7 +317,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
case SyncAction.DownloadOriginals:
|
||||
if ((entry.Local?.ArchiveId ?? (await Host.CurrentArchiveAsync())?.Id) is not { } archive)
|
||||
{
|
||||
_shell.Notify(Loc.L("Errors.Sync.NoArchive"));
|
||||
_shell.Notify(Loc.L("Errors.Sync.NoArchive"), isError: true);
|
||||
return;
|
||||
}
|
||||
await service.EnqueueDownloadAsync(engine, server, entry.Id, entry.Title, SyncDownloadMode.Originals, archive);
|
||||
@@ -372,7 +372,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
catch (SyncConflictChangedException ex)
|
||||
{
|
||||
// One side changed after the choice was shown: the row now shows the fresh content.
|
||||
_shell.Notify(ex.Message);
|
||||
_shell.Notify(ex.Message, isError: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,6 @@
|
||||
|
||||
<Style x:Key="TextBox.Number" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||
<Setter Property="Width" Value="72" />
|
||||
<Setter Property="Padding" Value="8,0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Right" />
|
||||
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
|
||||
</Style>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<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}"
|
||||
ToolTip="{Binding RailToggleToolTip}" AutomationProperties.Name="{Binding RailToggleToolTip}" />
|
||||
ToolTip="{Binding RailToggleToolTip}" AutomationProperties.Name="{Binding RailToggleName}" />
|
||||
<ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding TopSections}" Focusable="False">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
||||
|
||||
@@ -121,11 +121,15 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
if (!Set(ref _isRailCollapsed, value)) return;
|
||||
_settings.RailCollapsed = value;
|
||||
OnPropertyChanged(nameof(RailToggleToolTip));
|
||||
OnPropertyChanged(nameof(RailToggleName));
|
||||
}
|
||||
}
|
||||
|
||||
public string RailToggleToolTip => Loc.L(IsRailCollapsed ? "Tooltips.Shell.ExpandRail" : "Tooltips.Shell.CollapseRail");
|
||||
|
||||
/// <summary>The rail button's accessible name: two words, the sentence is its tooltip.</summary>
|
||||
public string RailToggleName => Loc.L(IsRailCollapsed ? "Shell.Nav.Expand" : "Shell.Nav.Collapse");
|
||||
|
||||
/// <summary>The sequence the editor opens (set by the Library and the Jobs screen).</summary>
|
||||
public Guid? CurrentSequenceId
|
||||
{
|
||||
@@ -257,8 +261,11 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
if (e.PropertyName is nameof(SectionViewModel.Title) or "" or null) OnPropertyChanged(nameof(WindowTitle));
|
||||
}
|
||||
|
||||
/// <summary>A one-line notice with one action (job done, update available).</summary>
|
||||
public void Notify(string title, string? message = null, string? actionText = null, string? actionToolTip = null, Action? action = null) =>
|
||||
/// <summary>
|
||||
/// A one-line notice with one action (job done, update available). <paramref name="isError"/> marks something that
|
||||
/// did not happen or failed: screen readers then say it at once instead of after what they are reading.
|
||||
/// </summary>
|
||||
public void Notify(string title, string? message = null, string? actionText = null, string? actionToolTip = null, Action? action = null, bool isError = false) =>
|
||||
ShowToast(new Toast
|
||||
{
|
||||
Title = title,
|
||||
@@ -266,6 +273,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
ActionText = actionText,
|
||||
ActionToolTip = actionToolTip,
|
||||
ActionCommand = action is null ? null : new RelayCommand(action),
|
||||
IsError = isError,
|
||||
});
|
||||
|
||||
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6); the details go to the log.</summary>
|
||||
|
||||
Reference in new issue
Block a user