fix(app): Library and Archive delete, quick actions and toolbar after review

Delete… runs in an in-window dialog shared by the Library and the Archive
manager: the dry run and the move into the trash report progress and stop
on Cancel, the toast counts only what really moved, and its Undo reports
failures. The confirmation names at most six moves and three refusals in
the UI font. Delete… stands apart at the far right of both bars and last
in the tab order.

The toolbar's filters wrap instead of pushing out the right-hand group at
1200 px. Card and row quick actions show while selected or focused, so Tab
reaches them; Analyse and Render are disabled with a reason when nothing
can run them, and say so in a toast if the session drops. Remote cards get
their own card, Analyse and Render tooltips; the details panel's Folder and
the saved-view menu say why they are disabled. Status offers Rendered, Not
rendered and Synced. Remote cards count in the Year and Camera choices and
the timeline. The trash dialog shows one sentence when empty.

--capture adds archive-trash and library-viewname.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-06 08:06:14 +00:00
1 parent 992834988d
commit 04895c7b7b
29 files changed
+602 -170

No files matched your search

+20 -1
View File
@@ -132,6 +132,23 @@
</Border>
</DataTemplate>
<!-- Delete…: how far the dry run, then the move into the trash, has got; Cancel stops between two sequences. -->
<DataTemplate DataType="{x:Type ar:DeleteDialogViewModel}">
<Border Style="{StaticResource Border.Dialog}" Width="460">
<StackPanel>
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" TextTrimming="CharacterEllipsis" />
<ProgressBar Maximum="1" Value="{Binding Progress, Mode=OneWay}" Margin="0,16,0,0" AutomationProperties.Name="{Binding Heading}"
AutomationProperties.HelpText="{Binding BusyText}" />
<DockPanel Margin="0,18,0,0">
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
IsDefault="True" MinWidth="96" />
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
Typography.NumeralAlignment="Tabular" Margin="0,0,12,0" />
</DockPanel>
</StackPanel>
</Border>
</DataTemplate>
<!-- The archive's trash: deleted sequences, newest first, each with Restore. -->
<DataTemplate DataType="{x:Type ar:TrashDialogViewModel}">
<Border Style="{StaticResource Border.Dialog}" Width="640" MaxHeight="520">
@@ -144,7 +161,9 @@
</Grid.RowDefinitions>
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" TextTrimming="CharacterEllipsis" />
<TextBlock Grid.Row="1" Text="{Binding SummaryText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,8,0,8" Typography.NumeralAlignment="Tabular" />
<ListBox Grid.Row="2" ItemsSource="{Binding Rows}" MinHeight="120" AutomationProperties.Name="{l:Loc Archive.Trash.List}" KeyboardNavigation.TabNavigation="Continue">
<!-- An empty trash is the summary sentence alone. -->
<ListBox Grid.Row="2" ItemsSource="{Binding Rows}" MinHeight="120" AutomationProperties.Name="{l:Loc Archive.Trash.List}" KeyboardNavigation.TabNavigation="Continue"
Visibility="{Binding HasRows, Converter={StaticResource BoolToVisibility}}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
+7 -2
View File
@@ -5,11 +5,11 @@ namespace Titano.App.Archiving;
/// <summary>
/// The Archive views that <c>--capture</c> renders (<c>archive-&lt;view&gt;-&lt;theme&gt;.png</c>) and the screen smoke
/// tests check, on the sample archive: the tree with figures and charts, the maintenance view with its reports, the
/// rebuild dialog, and the Move dialog with its dry run.
/// rebuild dialog, the Move dialog with its dry run, and the trash (Maintenance › Trash…) with deleted sequences.
/// </summary>
public static class ArchiveScenes
{
public static readonly IReadOnlyList<string> Views = ["overview", "maintenance", "rebuild", "move"];
public static readonly IReadOnlyList<string> Views = ["overview", "maintenance", "rebuild", "move", "trash"];
public static async Task ShowAsync(ShellViewModel shell, string view)
{
@@ -41,6 +41,11 @@ public static class ArchiveScenes
await move.PlanAsync();
}
break;
case "trash":
archive.ViewIndex = 1;
await archive.OpenTrashAsync();
if (archive.Dialog is TrashDialogViewModel trash && archive.SelectedArchive is { } shown) trash.Show(SampleReports.Trash(shown.Id, locations));
break;
default:
throw new ArgumentOutOfRangeException(nameof(view), view, "Unknown Archive view.");
}
+1
View File
@@ -29,6 +29,7 @@ public static class DeletePlans
Message = Loc.L("Archive.Delete.Message", Loc.Plural("Shell.Status.Photos", plan.Frames), Loc.Plural("Archive.Delete.Files", plan.Files),
Formatting.Bytes(plan.Bytes)),
Detail = string.Join(Environment.NewLine, lines),
IsDetailMonospaced = false,
DetailToolTip = Loc.L("Tooltips.Archive.DeletePlan"),
SafeText = Loc.L("Archive.Delete.Keep"),
SafeToolTip = Loc.L("Tooltips.Archive.DeleteKeep"),
+12 -1
View File
@@ -5,7 +5,7 @@ using Titano.Data.Repositories;
namespace Titano.App.Archiving;
/// <summary>
/// Capture and smoke-test data ONLY: maintenance reports and rebuild counts over the sample archive's sequences
/// Capture and smoke-test data ONLY: maintenance reports, rebuild counts and trash rows over the sample archive's sequences
/// (the sample index has no sidecars on disk, so the real searches would find nothing to show).
/// </summary>
public static class SampleReports
@@ -31,6 +31,17 @@ public static class SampleReports
? new OrphanReport([], [], [])
: new OrphanReport([new SequenceOrphans(sequences[2].Folder, ["IMG_0412.CR2", "IMG_0413.CR2"], [])], [sequences[3]], ["2024/2024-12-31 Unsorted"]);
/// <summary>The trash dialog's rows: the first two sample sequences, deleted an hour and a day ago (nothing moves on disk).</summary>
public static IReadOnlyList<TrashEntry> Trash(Guid archiveId, IReadOnlyList<SequenceLocation> sequences)
{
var now = DateTimeOffset.UtcNow;
return
[
.. sequences.Take(2).Select((s, i) => new TrashEntry(archiveId, s.Id.ToString("N"), s.Id, s.Title ?? s.Folder, s.Folder, 1_200 * (i + 1), 1_206 * (i + 1),
31_457_280L * 1_200 * (i + 1), now.AddHours(-1 - (23 * i)), Environment.UserName)),
];
}
/// <summary>What the rebuild dialog counts: a sidecar in every sequence folder but the last two, read by metadata instead.</summary>
public static IReadOnlyList<SequenceFolder> Folders(IReadOnlyList<SequenceLocation> sequences)
{
@@ -52,12 +52,16 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel
{
if (!Set(ref _rows, value)) return;
OnPropertyChanged(nameof(IsEmpty));
OnPropertyChanged(nameof(HasRows));
OnPropertyChanged(nameof(SummaryText));
}
}
public bool IsEmpty => _rows.Count == 0;
/// <summary>The list shows; an empty trash is its summary sentence alone.</summary>
public bool HasRows => _rows.Count > 0;
/// <summary>"3 sequences · 182 GB", or "The trash is empty".</summary>
public string SummaryText => _rows.Count == 0 ? Loc.L("Archive.Trash.Empty")
: Loc.Plural("Shell.Status.Sequences", _rows.Count) + " · " + Formatting.Bytes(_rows.Sum(r => r.Entry.Bytes));
+12 -1
View File
@@ -172,7 +172,8 @@ public sealed class SampleData
/// <summary>
/// The server's side: six sequences this PC also holds (two the same, one with settings changed on both sides, one
/// with more originals on the server, one with more here, one with renders this PC lacks) and two only on the server;
/// with more originals on the server, one with more here, one with renders this PC lacks) and two only on the server
/// (captured in the months the local sample spans, so they join the Library's year choices and timeline);
/// the others are only here.
/// </summary>
private async Task FillServerAsync(TitanoDatabase db, IReadOnlyList<Sequence> local)
@@ -201,6 +202,11 @@ public sealed class SampleData
ArchiveId = Guid.Empty,
Title = "Sunrise over Superga",
Folder = "2026/2026-07-02 Sony ILCE-7M4",
CameraMake = "SONY",
CameraModel = "ILCE-7M4",
FirstCapture = DateTime.Today.AddDays(-96).AddHours(5.2),
LastCapture = DateTime.Today.AddDays(-96).AddHours(6.8),
MedianInterval = 2,
FrameCount = 2_880,
TotalBytes = 2_880 * 21_000_000L,
Status = SequenceStatus.ProxiesBuilt | SequenceStatus.ThumbsBuilt,
@@ -213,6 +219,11 @@ public sealed class SampleData
ArchiveId = Guid.Empty,
Title = "Lake Como storm",
Folder = "2026/2026-08-21 Canon EOS R5",
CameraMake = "Canon",
CameraModel = "Canon EOS R5",
FirstCapture = DateTime.Today.AddDays(-46).AddHours(16.5),
LastCapture = DateTime.Today.AddDays(-46).AddHours(17.3),
MedianInterval = 2,
FrameCount = 1_450,
TotalBytes = 1_450 * 45_000_000L,
Status = SequenceStatus.ThumbsBuilt,
+4 -1
View File
@@ -6,9 +6,12 @@ public sealed record ConfirmRequest
public required string Heading { get; init; }
public required string Message { get; init; }
/// <summary>Monospaced detail (certificate fingerprint); null hides it.</summary>
/// <summary>Detail block (certificate fingerprint, list of what changes); null hides it.</summary>
public string? Detail { get; init; }
/// <summary>The detail is set in the monospaced font (fingerprints, values to compare); false sets it in the UI font (names, sentences).</summary>
public bool IsDetailMonospaced { get; init; } = true;
public string? DetailToolTip { get; init; }
public required string SafeText { get; init; }
public required string SafeToolTip { get; init; }
+24 -4
View File
@@ -74,7 +74,11 @@ public sealed class LibraryActions(ShellViewModel shell)
{
if (sequence is { Origin: SequenceOrigin.Server, SyncState: SyncState.RemoteOnly })
{
if (Remote() is not { } remote) return;
if (Remote() is not { } remote)
{
NotConnected();
return;
}
await PostAsync(async () =>
{
var (project, width, height) = await RemoteProjectAsync(remote, sequence.Id);
@@ -127,7 +131,11 @@ public sealed class LibraryActions(ShellViewModel shell)
/// </summary>
public async Task<Guid?> OpenRemoteAsync(Sequence sequence)
{
if (Remote() is not { } remote || Services.Engine is not { } engine) return null;
if (Remote() is not { } remote || Services.Engine is not { } engine)
{
NotConnected();
return null;
}
if (remote.Service.OpenRemote(remote.Server, sequence.Id) is not null)
{
shell.OpenSequence(sequence.Id);
@@ -173,7 +181,12 @@ public sealed class LibraryActions(ShellViewModel shell)
private async Task QueueAsync(ArchiveJobRequest request)
{
if (Services.Engine is not { } engine || request.Targets.Count == 0) return;
if (request.Targets.Count == 0) return;
if (Services.Engine is not { } engine)
{
shell.Notify(Loc.L("Library.Blocked.NoIndex"));
return;
}
await engine.EnqueueAsync(request);
Queued(request.Kind, request.Label ?? string.Empty);
}
@@ -182,7 +195,11 @@ public sealed class LibraryActions(ShellViewModel shell)
private async Task PostAsync(Func<Task<CreateJobRequest>> build, JobKind kind, string label)
{
var session = Services.Server;
if (!CanPost || session.Flow is not { Address: { } address, Token: { } token }) return;
if (!CanPost || session.Flow is not { Address: { } address, Token: { } token })
{
NotConnected();
return;
}
try
{
var request = await build();
@@ -197,6 +214,9 @@ public sealed class LibraryActions(ShellViewModel shell)
}
}
/// <summary>A remote card's action could not start: the session ended since the card was drawn.</summary>
private void NotConnected() => shell.Notify(Loc.L("Library.Remote.Unavailable"), Loc.L("Library.Blocked.NotConnected"));
/// <summary>The project of a remote card: from its proxy cache when it was opened here, else from the server's manifest; and its frame size when cached.</summary>
private static async Task<(ProjectSettings Project, int Width, int Height)> RemoteProjectAsync(RemoteSource remote, Guid id)
{
+10 -2
View File
@@ -7,11 +7,12 @@ namespace Titano.App.Library;
/// <summary>
/// The Library states that <c>--capture</c> renders (<c>library-&lt;scene&gt;-&lt;theme&gt;.png</c>) and the screen smoke
/// tests check, on the sample index while signed in to the sample server: the timeline with a month chosen, a selection
/// with the whole mass actions bar, and the server's sequences without a copy here as remote cards.
/// with the whole mass actions bar, the server's sequences without a copy here as remote cards, and "Save view" naming
/// the filters on screen.
/// </summary>
public static class LibraryScenes
{
public static readonly IReadOnlyList<string> Scenes = ["timeline", "mass", "remote"];
public static readonly IReadOnlyList<string> Scenes = ["timeline", "mass", "remote", "viewname"];
/// <summary>Sequences selected for the mass actions bar.</summary>
public const int MassSelection = 3;
@@ -20,6 +21,7 @@ public static class LibraryScenes
{
var library = shell.Library;
shell.Navigate(SectionKey.Library);
library.Dialog?.CloseCommand.Execute(null);
library.ClearSelectionCommand.Execute(null);
library.ClearFiltersCommand.Execute(null);
library.LayoutIndex = 0;
@@ -45,6 +47,12 @@ public static class LibraryScenes
// Remote thumbnails come through the sync engine's connection, not the local thumbnail service.
for (var i = 0; i < 60 && library.Items.Any(item => item.Thumbnail is null); i++) await Task.Delay(50);
break;
case "viewname":
library.SelectedStatus = library.Statuses.First(o => o.Value == StatusFilter.NotRendered);
await library.RefreshAsync();
library.OpenSaveView();
if (library.Dialog is ViewNameDialogViewModel naming) naming.Name.Text = library.SelectedStatus.Label;
break;
default:
throw new ArgumentOutOfRangeException(nameof(scene), scene, "Unknown Library scene.");
}
+1 -1
View File
@@ -6,7 +6,7 @@ using Titano.Data.Repositories;
namespace Titano.App.Library;
/// <summary>A named set of Library filters and sort ("Night, 4K, not analysed"), BRIEF §12.2.</summary>
/// <summary>A named set of Library filters and sort ("Night, 4K, not rendered"), BRIEF §12.2.</summary>
public sealed record SavedView
{
public const int MaxName = 40;
+42 -35
View File
@@ -358,43 +358,50 @@
</Grid>
</Grid>
<!-- ===================== Mass operations on the selected, filtered set ===================== -->
<!-- ===================== Mass operations on the selected, filtered set; Delete… apart at the far right (Archive.html) ===================== -->
<Border Grid.Row="3" Style="{StaticResource Border.Panel}" Padding="14,8,6,0" Margin="0,14,0,0" MinHeight="48"
Visibility="{Binding IsOverview, Converter={StaticResource BoolToVisibility}}">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="{l:Loc Archive.Set.Label}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,10,8" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" BorderBrush="{DynamicResource Brush.Accent}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Set}"
AutomationProperties.Name="{l:Loc Archive.Set.Filter}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding SetText}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" MaxWidth="260" TextTrimming="CharacterEllipsis" />
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
</StackPanel>
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="{l:Loc Library.Filter.Camera}" ItemsSource="{Binding CameraChoices}" ItemContainerStyle="{StaticResource MenuItem.Choice}"
ToolTip="{l:Loc Tooltips.Archive.FilterCamera}" />
<MenuItem Header="{l:Loc Library.Filter.Status}" ItemsSource="{Binding StatusChoices}" ItemContainerStyle="{StaticResource MenuItem.Choice}"
ToolTip="{l:Loc Tooltips.Archive.FilterStatus}" />
<MenuItem Header="{l:Loc Library.Filter.Tags}" ItemsSource="{Binding TagChoices}" ItemContainerStyle="{StaticResource MenuItem.Choice}"
ToolTip="{l:Loc Tooltips.Archive.FilterTag}" />
<Separator />
<MenuItem Header="{l:Loc Archive.Set.ClearFilter}" Command="{Binding ClearFilterCommand}" ToolTip="{l:Loc Tooltips.Archive.ClearFilter}" ToolTipService.ShowOnDisabled="True" />
</ContextMenu>
</Button.ContextMenu>
</Button>
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="4,0,12,8" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Analyse}" Command="{Binding AnalyseSetCommand}" ToolTip="{Binding AnalyseSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Proxies}" Command="{Binding ProxiesSetCommand}" ToolTip="{Binding ProxiesSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Thumbnails}" Command="{Binding ThumbnailsSetCommand}"
ToolTip="{Binding ThumbnailsSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Verify}" Command="{Binding VerifySetCommand}" ToolTip="{Binding VerifySetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Rename}" Command="{Binding RenameSetCommand}" ToolTip="{Binding RenameSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Move}" Command="{Binding MoveSetCommand}" ToolTip="{Binding MoveSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Retag}" Command="{Binding RetagSetCommand}" ToolTip="{Binding RetagSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Export}" Command="{Binding ExportSetCommand}" ToolTip="{Binding ExportSetToolTip}" />
<Button Style="{StaticResource Button.Destructive}" Height="30" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Delete}" Command="{Binding DeleteSetCommand}"
ToolTip="{Binding DeleteSetToolTip}" />
</WrapPanel>
<!-- Delete… last in the tab order too. -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="{l:Loc Archive.Set.Label}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,10,8" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" BorderBrush="{DynamicResource Brush.Accent}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Set}"
AutomationProperties.Name="{l:Loc Archive.Set.Filter}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding SetText}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" MaxWidth="260" TextTrimming="CharacterEllipsis" />
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
</StackPanel>
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="{l:Loc Library.Filter.Camera}" ItemsSource="{Binding CameraChoices}" ItemContainerStyle="{StaticResource MenuItem.Choice}"
ToolTip="{l:Loc Tooltips.Archive.FilterCamera}" />
<MenuItem Header="{l:Loc Library.Filter.Status}" ItemsSource="{Binding StatusChoices}" ItemContainerStyle="{StaticResource MenuItem.Choice}"
ToolTip="{l:Loc Tooltips.Archive.FilterStatus}" />
<MenuItem Header="{l:Loc Library.Filter.Tags}" ItemsSource="{Binding TagChoices}" ItemContainerStyle="{StaticResource MenuItem.Choice}"
ToolTip="{l:Loc Tooltips.Archive.FilterTag}" />
<Separator />
<MenuItem Header="{l:Loc Archive.Set.ClearFilter}" Command="{Binding ClearFilterCommand}" ToolTip="{l:Loc Tooltips.Archive.ClearFilter}" ToolTipService.ShowOnDisabled="True" />
</ContextMenu>
</Button.ContextMenu>
</Button>
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="4,0,12,8" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Analyse}" Command="{Binding AnalyseSetCommand}" ToolTip="{Binding AnalyseSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Proxies}" Command="{Binding ProxiesSetCommand}" ToolTip="{Binding ProxiesSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Thumbnails}" Command="{Binding ThumbnailsSetCommand}"
ToolTip="{Binding ThumbnailsSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Verify}" Command="{Binding VerifySetCommand}" ToolTip="{Binding VerifySetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Rename}" Command="{Binding RenameSetCommand}" ToolTip="{Binding RenameSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Move}" Command="{Binding MoveSetCommand}" ToolTip="{Binding MoveSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Retag}" Command="{Binding RetagSetCommand}" ToolTip="{Binding RetagSetToolTip}" />
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Export}" Command="{Binding ExportSetCommand}" ToolTip="{Binding ExportSetToolTip}" />
</WrapPanel>
<Button Grid.Column="1" Style="{StaticResource Button.Destructive}" Height="30" Margin="8,0,8,8" VerticalAlignment="Top" Content="{l:Loc Archive.Set.Delete}"
Command="{Binding DeleteSetCommand}" ToolTip="{Binding DeleteSetToolTip}" />
</Grid>
</Border>
<ui:EmptyState Grid.Row="2" Message="{l:Loc Archive.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}">
+12 -1
View File
@@ -97,7 +97,7 @@ public sealed class ArchiveViewModel : SectionViewModel
MoveSetCommand = new AsyncRelayCommand(() => OpenRenameDialogAsync(RenameMode.Folders), () => HasSet() && IsOnline());
RetagSetCommand = new RelayCommand(OpenRetag, () => HasSet() && IsOnline());
ExportSetCommand = new AsyncRelayCommand(ExportAsync, HasSet);
DeleteSetCommand = new AsyncRelayCommand(() => SequenceDeletion.RunAsync(Shell, [.. Set().Select(s => s.Id)]), () => HasSet() && IsOnline());
DeleteSetCommand = new AsyncRelayCommand(DeleteSetAsync, () => HasSet() && IsOnline());
TrashCommand = new AsyncRelayCommand(OpenTrashAsync, () => _archive is not null);
FindDuplicatesCommand = new AsyncRelayCommand(FindDuplicatesAsync, () => _archive is not null && _search is null);
@@ -636,6 +636,17 @@ public sealed class ArchiveViewModel : SectionViewModel
await dialog.PlanAsync();
}
/// <summary>
/// Delete… on the set: the dry run, the typed confirmation and the move into the trash, in the in-window dialog the
/// Library shares, which says how far it is and stops on Cancel. True when something left the archive.
/// </summary>
public async Task<bool> DeleteSetAsync()
{
var dialog = new DeleteDialogViewModel(Shell, [.. Set().Select(s => s.Id)], CloseDialog);
OpenDialog(dialog);
return await dialog.RunAsync();
}
/// <summary>Opens the trash of the archive and reads it.</summary>
public async Task OpenTrashAsync()
{
+97 -64
View File
@@ -59,6 +59,27 @@
<DataTemplate x:Key="Template.Status" DataType="{x:Type v:CardStatus}">
<ui:StatusGlyph Kind="{Binding Kind}" Text="{Binding Text}" ToolTip="{Binding ToolTip}" Margin="0,0,8,0" />
</DataTemplate>
<!-- A row's quick actions: on the hovered row, on selected rows and while the keyboard is in the row (Tab reaches them). -->
<Style x:Key="Border.RowActions" TargetType="Border">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
<!-- The toolbar's filters: each capped and trimmed; they wrap to a second line rather than push the right-hand group out. -->
<Style x:Key="ComboBox.ToolbarFilter" TargetType="ComboBox" BasedOn="{StaticResource ComboBox.Filter}">
<Setter Property="Margin" Value="10,4,0,4" />
<Setter Property="MaxWidth" Value="170" />
<Setter Property="ItemTemplate" Value="{StaticResource Template.FilterOption}" />
</Style>
<ItemsPanelTemplate x:Key="Panel.Row">
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
@@ -93,7 +114,7 @@
<Grid>
<Grid IsEnabled="{Binding IsContentEnabled}">
<Grid.RowDefinitions>
<RowDefinition Height="56" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
@@ -103,33 +124,34 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Toolbar (Main.html): search, filters, sort · saved views, layout switch, rescan. The search box gives way first. -->
<Grid Grid.ColumnSpan="2" Margin="20,0">
<!--
Toolbar (Main.html): search, filters, sort · saved views, layout switch, rescan. The search box gives way first
(down to 160 px); filters that still do not fit wrap to a second line, so the right-hand group is never cut.
-->
<Grid Grid.ColumnSpan="2" Margin="20,0" MinHeight="56">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="140" MaxWidth="260" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="260" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox VerticalAlignment="Center" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
<TextBox VerticalAlignment="Top" Margin="0,12,0,0" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
ui:Field.Placeholder="{l:Loc Library.Search}" ToolTip="{l:Loc Tooltips.Library.Search}" AutomationProperties.Name="{l:Loc Library.Search}" />
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<ComboBox Style="{StaticResource ComboBox.Filter}" Margin="10,0,0,0" ItemsSource="{Binding Years}" SelectedItem="{Binding SelectedYear}" Tag="{Binding IsYearFiltered}"
ItemTemplate="{StaticResource Template.FilterOption}" ToolTip="{l:Loc Tooltips.Library.Year}" AutomationProperties.Name="{l:Loc Library.Filter.Year}" />
<ComboBox Style="{StaticResource ComboBox.Filter}" Margin="10,0,0,0" MaxWidth="170" ItemsSource="{Binding Cameras}" SelectedItem="{Binding SelectedCamera}"
Tag="{Binding IsCameraFiltered}" ItemTemplate="{StaticResource Template.FilterOption}" ToolTip="{l:Loc Tooltips.Library.Camera}"
AutomationProperties.Name="{l:Loc Library.Filter.Camera}" />
<ComboBox Style="{StaticResource ComboBox.Filter}" Margin="10,0,0,0" ItemsSource="{Binding Statuses}" SelectedItem="{Binding SelectedStatus}" Tag="{Binding IsStatusFiltered}"
ItemTemplate="{StaticResource Template.FilterOption}" ToolTip="{l:Loc Tooltips.Library.Status}" AutomationProperties.Name="{l:Loc Library.Filter.Status}" />
<ComboBox Style="{StaticResource ComboBox.Filter}" Margin="10,0,0,0" MaxWidth="170" ItemsSource="{Binding Tags}" SelectedItem="{Binding SelectedTag}" Tag="{Binding IsTagFiltered}"
ItemTemplate="{StaticResource Template.FilterOption}" ToolTip="{l:Loc Tooltips.Library.Tags}" AutomationProperties.Name="{l:Loc Library.Filter.Tags}" />
<ComboBox Style="{StaticResource ComboBox.Filter}" Margin="10,0,0,0" ItemsSource="{Binding Origins}" SelectedItem="{Binding SelectedOrigin}" Tag="{Binding IsOriginFiltered}"
ItemTemplate="{StaticResource Template.FilterOption}" ToolTip="{l:Loc Tooltips.Library.Origin}" AutomationProperties.Name="{l:Loc Library.Filter.Origin}"
<WrapPanel Grid.Column="1" VerticalAlignment="Top" Margin="0,8">
<ComboBox Style="{StaticResource ComboBox.ToolbarFilter}" ItemsSource="{Binding Years}" SelectedItem="{Binding SelectedYear}" Tag="{Binding IsYearFiltered}"
ToolTip="{l:Loc Tooltips.Library.Year}" AutomationProperties.Name="{l:Loc Library.Filter.Year}" />
<ComboBox Style="{StaticResource ComboBox.ToolbarFilter}" ItemsSource="{Binding Cameras}" SelectedItem="{Binding SelectedCamera}" Tag="{Binding IsCameraFiltered}"
ToolTip="{l:Loc Tooltips.Library.Camera}" AutomationProperties.Name="{l:Loc Library.Filter.Camera}" />
<ComboBox Style="{StaticResource ComboBox.ToolbarFilter}" ItemsSource="{Binding Statuses}" SelectedItem="{Binding SelectedStatus}" Tag="{Binding IsStatusFiltered}"
ToolTip="{l:Loc Tooltips.Library.Status}" AutomationProperties.Name="{l:Loc Library.Filter.Status}" />
<ComboBox Style="{StaticResource ComboBox.ToolbarFilter}" ItemsSource="{Binding Tags}" SelectedItem="{Binding SelectedTag}" Tag="{Binding IsTagFiltered}"
ToolTip="{l:Loc Tooltips.Library.Tags}" AutomationProperties.Name="{l:Loc Library.Filter.Tags}" />
<ComboBox Style="{StaticResource ComboBox.ToolbarFilter}" ItemsSource="{Binding Origins}" SelectedItem="{Binding SelectedOrigin}" Tag="{Binding IsOriginFiltered}"
ToolTip="{l:Loc Tooltips.Library.Origin}" AutomationProperties.Name="{l:Loc Library.Filter.Origin}"
Visibility="{Binding ShowsOrigin, Converter={StaticResource BoolToVisibility}}" />
<ComboBox Style="{StaticResource ComboBox.Filter}" Margin="10,0,0,0" ItemsSource="{Binding Sorts}" SelectedItem="{Binding SelectedSort}"
ItemTemplate="{StaticResource Template.FilterOption}" ToolTip="{l:Loc Tooltips.Library.Sort}" AutomationProperties.Name="{l:Loc Library.Sort}" />
</StackPanel>
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0,0,0">
<ComboBox Style="{StaticResource ComboBox.ToolbarFilter}" ItemsSource="{Binding Sorts}" SelectedItem="{Binding SelectedSort}"
ToolTip="{l:Loc Tooltips.Library.Sort}" AutomationProperties.Name="{l:Loc Library.Sort}" />
</WrapPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Top" Margin="10,12,0,0">
<Button x:Name="ViewsButton" Click="OnOpenMenu" ui:ButtonIcon.Glyph="{StaticResource Icon.Filter}" ToolTip="{Binding ViewsToolTip}"
AutomationProperties.Name="{l:Loc Library.Views}" Margin="0,0,10,0">
<Button.Style>
@@ -145,12 +167,12 @@
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="{l:Loc Library.Views.Apply}" ItemsSource="{Binding ViewChoices}" ItemContainerStyle="{StaticResource MenuItem.View}"
IsEnabled="{Binding HasViews}" ToolTip="{l:Loc Tooltips.Library.ViewsApply}" ToolTipService.ShowOnDisabled="True" />
IsEnabled="{Binding HasViews}" ToolTip="{Binding ViewsApplyToolTip}" ToolTipService.ShowOnDisabled="True" />
<Separator />
<MenuItem Header="{l:Loc Library.Views.SaveMenu}" Command="{Binding SaveViewCommand}" ToolTip="{l:Loc Tooltips.Library.ViewSave}" ToolTipService.ShowOnDisabled="True" />
<MenuItem Header="{l:Loc Library.Views.RenameMenu}" Command="{Binding RenameViewCommand}" ToolTip="{l:Loc Tooltips.Library.ViewRename}"
<MenuItem Header="{l:Loc Library.Views.SaveMenu}" Command="{Binding SaveViewCommand}" ToolTip="{Binding ViewSaveToolTip}" ToolTipService.ShowOnDisabled="True" />
<MenuItem Header="{l:Loc Library.Views.RenameMenu}" Command="{Binding RenameViewCommand}" ToolTip="{Binding ViewRenameToolTip}"
ToolTipService.ShowOnDisabled="True" />
<MenuItem Header="{l:Loc Library.Views.Delete}" Command="{Binding DeleteViewCommand}" ToolTip="{l:Loc Tooltips.Library.ViewDelete}"
<MenuItem Header="{l:Loc Library.Views.Delete}" Command="{Binding DeleteViewCommand}" ToolTip="{Binding ViewDeleteToolTip}"
ToolTipService.ShowOnDisabled="True" />
</ContextMenu>
</Button.ContextMenu>
@@ -178,7 +200,7 @@
<!-- Grid view (also under the timeline): virtualised, recycling card grid. -->
<ListBox x:Name="CardGrid" Grid.Row="2" Style="{StaticResource ListBox.Cards}" ItemsSource="{Binding Items}" ItemContainerStyle="{StaticResource ListBoxItem.LibraryCard}"
Visibility="{Binding IsGrid, Converter={StaticResource BoolToVisibility}}" AutomationProperties.Name="{l:Loc Shell.Nav.Library}"
ScrollViewer.ScrollChanged="OnScrollChanged">
ScrollViewer.ScrollChanged="OnScrollChanged" KeyboardNavigation.TabNavigation="Continue">
<ListBox.InputBindings>
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding OpenCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenCommand}" />
@@ -188,7 +210,7 @@
<v:SequenceCard Title="{Binding Title}" Subtitle="{Binding Subtitle}" Statuses="{Binding Statuses}" Thumbnail="{Binding Thumbnail}"
ScrubSource="{Binding ScrubSource}" lib:ThumbnailLoading.Width="236"
IsSelected="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Mode=TwoWay}"
SelectToolTip="{l:Loc Tooltips.Library.Select}" ToolTip="{l:Loc Tooltips.Library.Card}">
SelectToolTip="{l:Loc Tooltips.Library.Select}" ToolTip="{Binding CardToolTip}">
<v:SequenceCard.ActionsContent>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Sequence}"
@@ -196,7 +218,7 @@
ToolTip="{l:Loc Tooltips.Library.Open}" AutomationProperties.Name="{l:Loc Library.Action.Open}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Analyse}"
Command="{Binding DataContext.AnalyseItemCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
ToolTip="{l:Loc Tooltips.Library.Analyse}" AutomationProperties.Name="{l:Loc Library.Action.Analyse}" />
ToolTip="{Binding AnalyseToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Analyse}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Render}"
Command="{Binding DataContext.RenderItemCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
ToolTip="{Binding RenderToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Render}" />
@@ -241,7 +263,8 @@
</Border>
<ListBox x:Name="RowList" Grid.Row="1" ItemsSource="{Binding Items}" ItemContainerStyle="{StaticResource ListBoxItem.LibraryRow}" SelectionMode="Extended"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.ScrollChanged="OnScrollChanged" AutomationProperties.Name="{l:Loc Shell.Nav.Library}">
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.ScrollChanged="OnScrollChanged" AutomationProperties.Name="{l:Loc Shell.Nav.Library}"
KeyboardNavigation.TabNavigation="Continue">
<ListBox.InputBindings>
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding OpenCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenCommand}" />
@@ -268,15 +291,14 @@
<TextBlock Grid.Column="6" Style="{StaticResource Text.CellNumber}" Text="{Binding SizeText}" Margin="10,0,0,0" />
<ItemsControl Grid.Column="7" Margin="16,0,0,0" ItemsSource="{Binding Statuses}" ItemTemplate="{StaticResource Template.Status}"
ItemsPanel="{StaticResource Panel.Row}" VerticalAlignment="Center" Focusable="False" ClipToBounds="True" />
<Border Grid.Column="7" HorizontalAlignment="Right" Background="{DynamicResource Brush.Card}" Padding="6,0,0,0"
Visibility="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Converter={StaticResource BoolToVisibility}}">
<Border Grid.Column="7" HorizontalAlignment="Right" Background="{DynamicResource Brush.Card}" Padding="6,0,0,0" Style="{StaticResource Border.RowActions}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Button Style="{StaticResource Button.RowQuick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Sequence}"
Command="{Binding DataContext.OpenItemCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
ToolTip="{l:Loc Tooltips.Library.Open}" AutomationProperties.Name="{l:Loc Library.Action.Open}" />
<Button Style="{StaticResource Button.RowQuick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Analyse}"
Command="{Binding DataContext.AnalyseItemCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
ToolTip="{l:Loc Tooltips.Library.Analyse}" AutomationProperties.Name="{l:Loc Library.Action.Analyse}" />
ToolTip="{Binding AnalyseToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Analyse}" />
<Button Style="{StaticResource Button.RowQuick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Render}"
Command="{Binding DataContext.RenderItemCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
ToolTip="{Binding RenderToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Render}" />
@@ -358,46 +380,57 @@
<Button Content="{l:Loc Library.Action.Render}" Command="{Binding DataContext.RenderItemCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}" ToolTip="{Binding RenderToolTip}" ui:ButtonIcon.Glyph="{StaticResource Icon.Render}" Margin="0,0,8,8" />
<Button Content="{l:Loc Library.Action.Folder}" Command="{Binding DataContext.RevealCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
ToolTip="{l:Loc Tooltips.Library.Folder}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Margin="0,0,8,8" />
ToolTip="{Binding DataContext.RevealToolTip, RelativeSource={RelativeSource AncestorType=UserControl}}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}"
Margin="0,0,8,8" />
</WrapPanel>
</StackPanel>
</ScrollViewer>
</Border>
<!-- Mass actions bar on the selection (BRIEF §12.2): each button disabled with its reason when it cannot run on it. -->
<!--
Mass actions bar on the selection (BRIEF §12.2): each button disabled with its reason when it cannot run on it.
Delete… stands apart at the far right (Archive.html), the destructive action last.
-->
<Border Grid.Row="3" Grid.ColumnSpan="2" Style="{StaticResource Border.Panel}" Padding="14,8,6,0" Margin="20,0,20,12" MinHeight="48"
Visibility="{Binding HasSelection, Converter={StaticResource BoolToVisibility}}">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="{Binding SelectionTitle}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,8,8" Typography.NumeralAlignment="Tabular" />
<TextBlock Text="{Binding SelectionSummary}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,12,8"
Typography.NumeralAlignment="Tabular" />
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="0,0,12,8" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{Binding AnalyseToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Proxies}" Command="{Binding ProxiesCommand}" ToolTip="{Binding ProxiesToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Verify}" Command="{Binding VerifyCommand}" ToolTip="{Binding VerifyToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Tag}" Command="{Binding TagCommand}" ToolTip="{Binding TagToolTip}" />
<Button Style="{StaticResource Button.Bar}" Click="OnOpenMenu" IsEnabled="{Binding CanRate}" ToolTip="{Binding RateToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Rate}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Library.Action.Rate}" />
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
</StackPanel>
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding RatingChoices}" ItemContainerStyle="{StaticResource MenuItem.Rating}" />
</Button.ContextMenu>
</Button>
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Move}" Command="{Binding MoveCommand}" ToolTip="{Binding MoveToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Upload}" Command="{Binding UploadCommand}" ToolTip="{Binding UploadToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Download}" Command="{Binding DownloadCommand}" ToolTip="{Binding DownloadToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.ExportList}" Command="{Binding ExportListCommand}" ToolTip="{Binding ExportListToolTip}" />
<Button Style="{StaticResource Button.Destructive}" Height="30" Margin="0,0,8,8" Content="{l:Loc Library.Action.Delete}" Command="{Binding DeleteCommand}"
ToolTip="{Binding DeleteToolTip}" />
<Button Style="{StaticResource Button.Subtle}" Height="30" Margin="0,0,8,8" Content="{l:Loc Library.Action.ClearSelection}" Command="{Binding ClearSelectionCommand}"
ToolTip="{l:Loc Tooltips.Library.ClearSelection}" />
</WrapPanel>
<!-- Delete… last in the tab order too. -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="{Binding SelectionTitle}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,8,8" Typography.NumeralAlignment="Tabular" />
<TextBlock Text="{Binding SelectionSummary}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,12,8"
Typography.NumeralAlignment="Tabular" />
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="0,0,12,8" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{Binding AnalyseToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Proxies}" Command="{Binding ProxiesCommand}" ToolTip="{Binding ProxiesToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Verify}" Command="{Binding VerifyCommand}" ToolTip="{Binding VerifyToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Tag}" Command="{Binding TagCommand}" ToolTip="{Binding TagToolTip}" />
<Button Style="{StaticResource Button.Bar}" Click="OnOpenMenu" IsEnabled="{Binding CanRate}" ToolTip="{Binding RateToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Rate}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Library.Action.Rate}" />
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
</StackPanel>
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding RatingChoices}" ItemContainerStyle="{StaticResource MenuItem.Rating}" />
</Button.ContextMenu>
</Button>
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Move}" Command="{Binding MoveCommand}" ToolTip="{Binding MoveToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Upload}" Command="{Binding UploadCommand}" ToolTip="{Binding UploadToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Download}" Command="{Binding DownloadCommand}" ToolTip="{Binding DownloadToolTip}" />
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.ExportList}" Command="{Binding ExportListCommand}" ToolTip="{Binding ExportListToolTip}" />
<Button Style="{StaticResource Button.Subtle}" Height="30" Margin="0,0,8,8" Content="{l:Loc Library.Action.ClearSelection}" Command="{Binding ClearSelectionCommand}"
ToolTip="{l:Loc Tooltips.Library.ClearSelection}" />
</WrapPanel>
<Button Grid.Column="1" Style="{StaticResource Button.Destructive}" Height="30" Margin="8,0,8,8" VerticalAlignment="Top"
Content="{l:Loc Library.Action.Delete}" Command="{Binding DeleteCommand}" ToolTip="{Binding DeleteToolTip}" />
</Grid>
</Border>
</Grid>
<!-- In-window dialogs (tags, move, view name) over a scrim; the keyboard stays inside the dialog. -->
<!-- In-window dialogs (tags, move, view name, delete) over a scrim; the keyboard stays inside the dialog. -->
<Grid Visibility="{Binding IsDialogOpen, Converter={StaticResource BoolToVisibility}}" KeyboardNavigation.TabNavigation="Cycle"
KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
<Border Background="{DynamicResource Brush.Scrim}" />
+118 -25
View File
@@ -63,6 +63,7 @@ public sealed class LibraryViewModel : SectionViewModel
private IReadOnlyList<Sequence> _remote = [];
private Dictionary<Guid, SyncEntry> _entries = [];
private Dictionary<Guid, SequenceDto> _listing = [];
private ArchiveStats? _localStats;
private LibraryTimeline _timeline = LibraryTimeline.Empty;
private IReadOnlyList<ChartRow> _timelineBands = [];
private (int Year, int Month)? _timelineMonth;
@@ -124,7 +125,7 @@ public sealed class LibraryViewModel : SectionViewModel
MoveCommand = Mass(MassAction.Move, OpenMoveAsync);
UploadCommand = Mass(MassAction.Upload, _ => TransferAsync(MassAction.Upload));
DownloadCommand = Mass(MassAction.Download, _ => TransferAsync(MassAction.Download));
DeleteCommand = Mass(MassAction.Delete, t => SequenceDeletion.RunAsync(Shell, [.. t.Select(s => s.Id)]));
DeleteCommand = Mass(MassAction.Delete, t => DeleteAsync([.. t.Select(s => s.Id)]));
ExportListCommand = Mass(MassAction.ExportList, ExportListAsync);
ClearSelectionCommand = new RelayCommand(ClearSelection, () => SelectionCount > 0);
@@ -135,13 +136,16 @@ public sealed class LibraryViewModel : SectionViewModel
else if (p is string name && Enum.TryParse<SequenceSort>(name, out var parsed)) SelectedSort = Sorts.First(o => o.Value == parsed);
});
OpenItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? OpenAsync(item) : Task.CompletedTask);
AnalyseItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? _actions.AnalyseAsync([item.Sequence]) : Task.CompletedTask);
RenderItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? _actions.RenderAsync(item.Sequence) : Task.CompletedTask);
AnalyseItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? _actions.AnalyseAsync([item.Sequence]) : Task.CompletedTask,
p => p is SequenceItem { CanRunQuick: true });
RenderItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? _actions.RenderAsync(item.Sequence) : Task.CompletedTask,
p => p is SequenceItem { CanRunQuick: true });
SyncItemCommand = new AsyncRelayCommand((p, _) => p is SequenceItem item ? SyncItemAsync(item) : Task.CompletedTask, p => p is SequenceItem { CanSync: true });
SaveViewCommand = new RelayCommand(() => OpenViewName(rename: false), () => _viewStore is not null);
RenameViewCommand = new RelayCommand(() => OpenViewName(rename: true), () => ActiveView is not null);
DeleteViewCommand = new AsyncRelayCommand(DeleteViewAsync, () => ActiveView is not null);
UndoDeleteViewCommand = new AsyncRelayCommand((p, _) => p is SavedView view ? UndoDeleteViewAsync(view) : Task.CompletedTask);
ImportCardCommand = new RelayCommand(() => Shell.Navigate(SectionKey.Import));
AdoptFolderCommand = new AsyncRelayCommand(AdoptFolderAsync);
@@ -182,6 +186,9 @@ public sealed class LibraryViewModel : SectionViewModel
public ICommand SaveViewCommand { get; }
public ICommand RenameViewCommand { get; }
public ICommand DeleteViewCommand { get; }
/// <summary>The Undo of a deleted view's toast (parameter: the view); a failure is reported like any command's.</summary>
public ICommand UndoDeleteViewCommand { get; }
public ICommand ImportCardCommand { get; }
public ICommand AdoptFolderCommand { get; }
public ICommand ConnectCommand { get; }
@@ -260,10 +267,27 @@ public sealed class LibraryViewModel : SectionViewModel
set => SetFilter(ref _tag, value ?? Tags[0], nameof(IsTagFiltered));
}
/// <summary>The origin also decides which sequences the Year and Camera choices and the timeline count.</summary>
public FilterOption<OriginFilter> SelectedOrigin
{
get => _origin;
set => SetFilter(ref _origin, value ?? Origins[0], nameof(IsOriginFiltered));
set
{
var suppressed = _suppressReload;
_suppressReload = true;
try
{
if (!Set(ref _origin, value ?? Origins[0])) return;
ApplyFacets();
}
finally
{
_suppressReload = suppressed;
}
OnPropertyChanged(nameof(IsOriginFiltered));
RaiseViews();
Reload();
}
}
public FilterOption<SequenceSort> SelectedSort
@@ -332,6 +356,18 @@ public sealed class LibraryViewModel : SectionViewModel
/// <summary>"Saved views · Night, 4K" or what the menu does.</summary>
public string ViewsToolTip => ActiveView is { } active ? Loc.L("Tooltips.Library.ViewsActive", active.Name) : Loc.L("Tooltips.Library.Views");
/// <summary>"Show view": what it does, or that no view is saved yet.</summary>
public string ViewsApplyToolTip => HasViews ? Loc.L("Tooltips.Library.ViewsApply") : Loc.L("Library.Blocked.NoViews");
/// <summary>"Save view…": what it does, or that the index is not open.</summary>
public string ViewSaveToolTip => _viewStore is null ? Loc.L("Library.Blocked.NoIndex") : Loc.L("Tooltips.Library.ViewSave");
/// <summary>"Rename view…": what it does, or that no saved view is in use.</summary>
public string ViewRenameToolTip => IsViewActive ? Loc.L("Tooltips.Library.ViewRename") : Loc.L("Library.Blocked.NoActiveView");
/// <summary>"Delete view": what it does, or that no saved view is in use.</summary>
public string ViewDeleteToolTip => IsViewActive ? Loc.L("Tooltips.Library.ViewDelete") : Loc.L("Library.Blocked.NoActiveView");
// ---------------- Timeline ----------------
/// <summary>One band per capture year, newest first: photos per month.</summary>
@@ -398,9 +434,15 @@ public sealed class LibraryViewModel : SectionViewModel
public SequenceItem? Selected
{
get => _selected;
private set => Set(ref _selected, value);
private set
{
if (Set(ref _selected, value)) OnPropertyChanged(nameof(RevealToolTip));
}
}
/// <summary>The details panel's "Folder": what it does, or why a remote card has no folder here.</summary>
public string RevealToolTip => _selected is { IsRemote: true } ? Loc.L("Library.Blocked.ServerOnly") : Loc.L("Tooltips.Library.Folder");
public int SelectionCount
{
get => _selectionCount;
@@ -458,7 +500,7 @@ public sealed class LibraryViewModel : SectionViewModel
// ---------------- Dialogs ----------------
/// <summary>The open in-window dialog (tags, move, view name); null when none.</summary>
/// <summary>The open in-window dialog (tags, move, view name, delete); null when none.</summary>
public ArchiveDialogViewModel? Dialog
{
get => _dialog;
@@ -542,6 +584,20 @@ public sealed class LibraryViewModel : SectionViewModel
/// <summary>Opens Tags on the selection (capture, tests).</summary>
public void OpenRetag() => OpenRetag(Targets(MassAction.Tag));
/// <summary>Opens "Save view" on the filters on screen (capture, tests).</summary>
public void OpenSaveView() => OpenViewName(rename: false);
/// <summary>
/// Delete…: the archive engine's dry run, the typed confirmation and the move into the trash, in an in-window dialog
/// that says how far it is and stops on Cancel. True when something left the Library.
/// </summary>
public async Task<bool> DeleteAsync(IReadOnlyList<Guid> sequenceIds)
{
var dialog = new DeleteDialogViewModel(Shell, sequenceIds, CloseDialog);
OpenDialog(dialog);
return await dialog.RunAsync();
}
private void Reload()
{
if (_suppressReload) return;
@@ -643,27 +699,13 @@ public sealed class LibraryViewModel : SectionViewModel
var tags = await _db.Tags.ListAsync();
_hasArchive = (await _db.Archives.ListAsync()).Count > 0;
Shell.SetLibraryTotals(stats.Sequences, stats.Photos, stats.Bytes);
_timeline = LibraryTimeline.From(stats, DateTime.Today);
_localStats = stats;
_suppressReload = true;
var year = _year.Value;
var camera = _camera.Value;
var tag = _tag.Value;
Years = [AnyYear(), .. stats.ByYear.OrderByDescending(y => y.Year).Select(y => new FilterOption<int?>(y.Year, YearText(y.Year), YearText(y.Year)))];
Cameras =
[
AnyCamera(),
.. stats.ByCamera.Where(c => !string.IsNullOrWhiteSpace(c.Model))
.GroupBy(c => c.Model!, StringComparer.Ordinal)
.Select(g => (Model: g.Key, Name: Core.Naming.PathTemplate.CameraName(g.First().Make, g.Key)))
.OrderBy(c => c.Name, StringComparer.CurrentCultureIgnoreCase)
.Select(c => new FilterOption<string?>(c.Model, c.Name, c.Name)),
];
Tags = [AnyTag(), .. tags.OrderBy(t => t.Name, StringComparer.CurrentCultureIgnoreCase).Select(t => new FilterOption<string?>(t.Name, t.Name, t.Name))];
SelectedYear = Years.FirstOrDefault(o => o.Value == year) ?? Years[0];
SelectedCamera = Cameras.FirstOrDefault(o => o.Value == camera) ?? Cameras[0];
SelectedTag = Tags.FirstOrDefault(o => o.Value == tag) ?? Tags[0];
TimelineBands = [.. _timeline.Bands.Select(b => new ChartRow(b.Label, b.Values, b.ToolTips))];
ApplyFacets();
}
catch (DatabaseException ex)
{
@@ -675,6 +717,48 @@ public sealed class LibraryViewModel : SectionViewModel
}
}
/// <summary>
/// The Year and Camera choices and the timeline bands of the origins in view (BRIEF §4.4 mixed mode): the index's
/// figures and the remote cards'. A chosen year or camera that no sequence in view has stays chosen.
/// </summary>
private void ApplyFacets()
{
if (_localStats is not { } local) return;
var suppressed = _suppressReload;
_suppressReload = true;
try
{
var stats = LibraryFacets.Of(local, _remote, _origin.Value);
_timeline = LibraryTimeline.From(stats, DateTime.Today);
var year = _year.Value;
var camera = _camera.Value;
Years = WithChosen([AnyYear(), .. stats.ByYear.OrderByDescending(y => y.Year).Select(y => new FilterOption<int?>(y.Year, YearText(y.Year), YearText(y.Year)))],
year, YearText);
Cameras = WithChosen(
[
AnyCamera(),
.. stats.ByCamera.Where(c => !string.IsNullOrWhiteSpace(c.Model))
.GroupBy(c => c.Model!, StringComparer.Ordinal)
.Select(g => (Model: g.Key, Name: Core.Naming.PathTemplate.CameraName(g.First().Make, g.Key)))
.OrderBy(c => c.Name, StringComparer.CurrentCultureIgnoreCase)
.Select(c => new FilterOption<string?>(c.Model, c.Name, c.Name)),
], camera, c => c ?? string.Empty);
SelectedYear = Years.First(o => o.Value == year);
SelectedCamera = Cameras.First(o => o.Value == camera);
TimelineBands = [.. _timeline.Bands.Select(b => new ChartRow(b.Label, b.Values, b.ToolTips))];
OnPropertyChanged(nameof(TimelineBand));
OnPropertyChanged(nameof(TimelineSlot));
}
finally
{
_suppressReload = suppressed;
}
}
/// <summary><paramref name="options"/>, plus the chosen value when they lack it, so a filter never changes by itself.</summary>
private static IReadOnlyList<FilterOption<T>> WithChosen<T>(IReadOnlyList<FilterOption<T>> options, T chosen, Func<T, string> text) =>
chosen is null || options.Any(o => EqualityComparer<T>.Default.Equals(o.Value, chosen)) ? options : [.. options, Option(options, chosen, text)];
/// <summary>
/// Reads the sync table of the signed-in server: the server's sequences without a copy here become remote cards
/// (with the server's listing when a new one appears), and every card learns what its Sync quick action does.
@@ -710,6 +794,7 @@ public sealed class LibraryViewModel : SectionViewModel
_entries = entries;
var changed = !SameCards(_remote, remote);
_remote = remote;
if (changed) ApplyFacets();
foreach (var item in Items) ApplySync(item);
OnPropertyChanged(nameof(ShowsOrigin));
RaiseMass();
@@ -719,12 +804,15 @@ public sealed class LibraryViewModel : SectionViewModel
private static bool SameCards(IReadOnlyList<Sequence> a, IReadOnlyList<Sequence> b) =>
a.Count == b.Count && a.Zip(b).All(p => p.First.Id == p.Second.Id && p.First.UpdatedAt == p.Second.UpdatedAt && p.First.FrameCount == p.Second.FrameCount);
/// <summary>The card's sync row and what its Sync quick action does now.</summary>
/// <summary>The card's sync row, what its Sync quick action does now, and whether Analyse and Render can start.</summary>
private void ApplySync(SequenceItem item)
{
var entry = _entries.GetValueOrDefault(item.Id);
var action = MassActions.QuickSync(new SelectedSequence(item.Sequence, entry), Context, out var blocker);
item.SetSync(entry, action is not null, action is { } a ? Loc.L("Tooltips.Library.QuickSync." + a) : blocker ?? string.Empty);
item.SetQuickBlocker(item.IsRemote
? _actions.CanPost ? null : Loc.L("Library.Blocked.NotConnected")
: Context.HasEngine ? null : Loc.L("Library.Blocked.NoIndex"));
}
private SelectionContext Context => new(_db is not null && Shell.Services.Engine is not null, Shell.Services.Sync.Server is not null, _actions.Rights);
@@ -821,11 +909,12 @@ public sealed class LibraryViewModel : SectionViewModel
await store.DeleteAsync(view.Id);
await LoadViewsAsync();
Shell.Notify(Loc.L("Library.Views.Deleted", view.Name), actionText: Loc.L("Library.Views.Undo"), actionToolTip: Loc.L("Tooltips.Library.ViewUndo"),
action: () => _ = UndoDeleteAsync(store, view));
action: () => UndoDeleteViewCommand.Execute(view));
}
private async Task UndoDeleteAsync(SavedViewStore store, SavedView view)
private async Task UndoDeleteViewAsync(SavedView view)
{
if (_viewStore is not { } store) return;
await store.SaveAsync(view);
await LoadViewsAsync();
}
@@ -864,6 +953,10 @@ public sealed class LibraryViewModel : SectionViewModel
OnPropertyChanged(nameof(ActiveView));
OnPropertyChanged(nameof(IsViewActive));
OnPropertyChanged(nameof(ViewsToolTip));
OnPropertyChanged(nameof(ViewsApplyToolTip));
OnPropertyChanged(nameof(ViewSaveToolTip));
OnPropertyChanged(nameof(ViewRenameToolTip));
OnPropertyChanged(nameof(ViewDeleteToolTip));
CommandManager.InvalidateRequerySuggested();
}
+1 -1
View File
@@ -12,7 +12,7 @@
<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 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" />
</Border>
<StackPanel x:Name="Typing" Margin="0,16,0,0" Visibility="Collapsed">
<TextBlock Text="{Binding TypedPrompt}" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" />
@@ -12,6 +12,7 @@ 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;
Typing.Visibility = Visibility.Visible;
Loaded += (_, _) => Typed.Focus();
+3 -2
View File
@@ -154,8 +154,8 @@ public static class ScreenCapture
/// <summary>
/// <c>library-timeline</c>, <c>library-mass</c> (the selection with the whole bar), <c>library-delete</c> (the dry run
/// of deleting that selection, behind its typed confirmation) and <c>library-remote</c> (the server's sequences as
/// remote cards), then the Library as it was.
/// of deleting that selection, behind its typed confirmation), <c>library-remote</c> (the server's sequences as
/// remote cards) and <c>library-viewname</c> (Save view), then the Library as it was.
/// </summary>
private static async Task<int> CaptureLibraryScenesAsync(MainWindow window, ShellViewModel shell, string directory, AppTheme theme)
{
@@ -168,6 +168,7 @@ public static class ScreenCapture
if (scene == "mass" && await LibraryScenes.DeleteRequestAsync(shell) is { } request)
written += await SaveDialogAsync(new ConfirmDialog(request), directory, "library-delete", theme);
}
shell.Library.Dialog?.CloseCommand.Execute(null);
shell.Library.ClearSelectionCommand.Execute(null);
shell.Library.ClearFiltersCommand.Execute(null);
shell.Library.LayoutIndex = 0;
+5
View File
@@ -122,11 +122,16 @@
<Trigger Property="IsScrubbing" Value="True">
<Setter TargetName="ScrubTrack" Property="Visibility" Value="Visible" />
</Trigger>
<!-- A selected card keeps its actions in sight, so the keyboard reaches them (Tab from the card). -->
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Select" Property="Visibility" Value="Visible" />
<Setter TargetName="Actions" Property="Visibility" Value="Visible" />
<Setter TargetName="Frame" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
<Setter TargetName="Glow" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="Actions" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4" />
</Trigger>
+1 -1
View File
@@ -82,7 +82,7 @@ public class SequenceCard : Control
/// <summary>Tooltip of the selection check box.</summary>
public object? SelectToolTip { get => GetValue(SelectToolTipProperty); set => SetValue(SelectToolTipProperty, value); }
/// <summary>Quick actions shown bottom-right of the thumbnail on hover (Open, Analyse, Render, Sync).</summary>
/// <summary>Quick actions shown bottom-right of the thumbnail on hover, while selected and while the keyboard is in them (Open, Analyse, Render, Sync).</summary>
public object? ActionsContent { get => GetValue(ActionsContentProperty); set => SetValue(ActionsContentProperty, value); }
/// <summary>Selection state; bind two-way to the container's IsSelected so the check box toggles it.</summary>