feat(app): matches list, compare dialog, settings rows, library and picker surfaces (owner review 6, P6)
Server > Matches shows the pairs the copy engine found (same sequence on the server and this PC, or twice here), attention first, with the design 8.1 actions; Keep apart and Unlink toast with Undo. The in-window Compare dialog walks photos, details, projects and the plan, blocks until details are chosen, and confirms only what replaces or merges (typed count for a merge). Sync rows of an unanswered pair read "match found" and offer Compare first; Upload all local skips suspected copies and says why. Settings > Server gains Link matches, Integrate photos and Integrate projects. Library cards carry the match status with Compare..., the sequence picker marks twins, and Jobs opens Integrate and Merge targets. The sample engine and capture scenes render every state; tests cover the text rules and the screens. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
283d04d9cd
commit
06b826e39d
34 files changed
+3762
-43
No files matched your search
@@ -747,7 +747,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
if (MaintenanceReports.MaintenanceKinds.Contains(job.Kind)) System.Windows.Application.Current?.Dispatcher.BeginInvoke(() => TrackRecent(job));
|
||||
if (job.State is not (JobState.Done or JobState.Failed)) return;
|
||||
if (job.Kind is not (JobKind.Scan or JobKind.Rebuild or JobKind.Verify or JobKind.Maintenance or JobKind.Import or JobKind.Proxies or JobKind.Thumbs
|
||||
or JobKind.LightAnalyse or JobKind.DeepAnalyse or JobKind.Move or JobKind.Convert)) return;
|
||||
or JobKind.LightAnalyse or JobKind.DeepAnalyse or JobKind.Move or JobKind.Convert or JobKind.Integrate or JobKind.MergeSequences)) return;
|
||||
System.Windows.Application.Current?.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (_archive is not { } archive || !job.TargetIds.Any(id => id == archive.Id || _sequenceIds.Contains(id))) return;
|
||||
|
||||
@@ -347,7 +347,7 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
Title = Loc.L("Shell.Job.Done"),
|
||||
Message = JobText.Name(job),
|
||||
ActionText = Loc.L("Jobs.Action.Open"),
|
||||
ActionToolTip = Loc.L("Tooltips.Jobs.Open"),
|
||||
ActionToolTip = Loc.L(job.Kind is JobKind.Integrate or JobKind.MergeSequences ? "Tooltips.Jobs.OpenMatch" : "Tooltips.Jobs.Open"),
|
||||
ActionCommand = new AsyncRelayCommand(() => OpenTargetAsync(job)),
|
||||
RunsFromNotification = true,
|
||||
};
|
||||
@@ -507,6 +507,19 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
{
|
||||
var db = Shell.Services.Database;
|
||||
if (db is null || job.TargetIds.Count == 0) return;
|
||||
// Owner review 6, #73: an Integrate shows its pair in Server › Matches; a merge opens the sequence it kept.
|
||||
if (job.Kind == JobKind.Integrate)
|
||||
{
|
||||
var title = await db.Sequences.GetAsync(job.TargetIds[0]) is { } local ? local.DisplayTitle : null;
|
||||
Shell.Navigate(SectionKey.Server);
|
||||
Shell.Server.Sync.ShowFilter(Chronos.App.Server.SyncFilter.FoundCopies, title);
|
||||
return;
|
||||
}
|
||||
if (job.Kind == JobKind.MergeSequences)
|
||||
{
|
||||
Shell.OpenSequence(job.TargetIds[0]);
|
||||
return;
|
||||
}
|
||||
var targets = job.TargetIds.Distinct().ToList();
|
||||
if (targets.Count > LibraryPager.DefaultPageSize)
|
||||
{
|
||||
|
||||
@@ -12,10 +12,22 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/Chronos;component/Archive/ArchiveDialogs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- A double-click is read on the card or row itself: it takes the mouse-down to select, so a gesture on the list never sees it. -->
|
||||
<!-- A card of a sequence in a match that asks for a choice offers Compare… in its menu (owner review 6, #73). -->
|
||||
<ContextMenu x:Key="Menu.CardMatch" x:Shared="False">
|
||||
<MenuItem Header="{l:Loc Library.Action.Compare}" ToolTip="{l:Loc Tooltips.Library.Compare}"
|
||||
Command="{Binding PlacementTarget.Tag.CompareItemCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}" />
|
||||
</ContextMenu>
|
||||
<Style x:Key="ListBoxItem.LibraryCard" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Card}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="Tag" Value="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListBox}}" />
|
||||
<EventSetter Event="MouseDoubleClick" Handler="OnItemDoubleClick" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasMatch}" Value="True">
|
||||
<Setter Property="ContextMenu" Value="{StaticResource Menu.CardMatch}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ListBoxItem.LibraryRow" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
|
||||
<Setter Property="Height" Value="38" />
|
||||
@@ -296,6 +308,11 @@
|
||||
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" Style="{StaticResource Border.RowActions}">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<!-- A sequence in a match that asks for a choice: Compare… (owner review 6, #73). -->
|
||||
<Button Style="{StaticResource Button.Row}" Content="{l:Loc Library.Action.Compare}" FontSize="12" Margin="0,0,6,0"
|
||||
Command="{Binding DataContext.CompareItemCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
|
||||
ToolTip="{l:Loc Tooltips.Library.Compare}" AutomationProperties.Name="{l:Loc Library.Action.Compare}"
|
||||
Visibility="{Binding HasMatch, Converter={StaticResource BoolToVisibility}}" />
|
||||
<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}" />
|
||||
|
||||
@@ -148,6 +148,10 @@ public sealed class LibraryViewModel : SectionViewModel
|
||||
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 });
|
||||
CompareItemCommand = new RelayCommand(p =>
|
||||
{
|
||||
if (p is SequenceItem item) CompareItem(item);
|
||||
}, p => p is SequenceItem { HasMatch: 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);
|
||||
@@ -196,6 +200,16 @@ public sealed class LibraryViewModel : SectionViewModel
|
||||
public ICommand AnalyseItemCommand { get; }
|
||||
public ICommand RenderItemCommand { get; }
|
||||
public ICommand SyncItemCommand { get; }
|
||||
|
||||
/// <summary>Compare…: Server › Matches, searched for the sequence's title (owner review 6, #73).</summary>
|
||||
public ICommand CompareItemCommand { get; }
|
||||
|
||||
/// <summary>Opens Server › Matches with the pair of <paramref name="item"/> found by its title.</summary>
|
||||
internal void CompareItem(SequenceItem item)
|
||||
{
|
||||
Shell.Navigate(SectionKey.Server);
|
||||
Shell.Server.Sync.ShowFilter(Chronos.App.Server.SyncFilter.FoundCopies, item.Title);
|
||||
}
|
||||
public ICommand SaveViewCommand { get; }
|
||||
public ICommand RenameViewCommand { get; }
|
||||
public ICommand DeleteViewCommand { get; }
|
||||
@@ -1097,7 +1111,9 @@ public sealed class LibraryViewModel : SectionViewModel
|
||||
}
|
||||
// Downloads of proxies only fill the proxy cache, so the Library is read again for originals and exports only.
|
||||
// A conversion makes new sequences, or changes the formats and sizes of the converted ones.
|
||||
// An Integrate fills a sequence with the other side's photos; a merge moves one sequence into another (owner review 6, #73).
|
||||
if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit or JobKind.Convert
|
||||
or JobKind.Integrate or JobKind.MergeSequences
|
||||
|| SyncService.TransferKind(job) is SyncTransferKind.DownloadOriginals or SyncTransferKind.GetExports)
|
||||
await RefreshAsync();
|
||||
else if (job.Kind is JobKind.LightAnalyse or JobKind.DeepAnalyse)
|
||||
|
||||
@@ -103,7 +103,14 @@
|
||||
lib:ThumbnailLoading.Width="64" DataContext="{Binding Sequence}">
|
||||
<Image Source="{Binding Thumbnail}" Stretch="UniformToFill" />
|
||||
</Border>
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Name}" Margin="12,0,0,0" FontWeight="SemiBold" ToolTip="{Binding Name}" />
|
||||
<!-- The same time-lapse has a project at the other home too: a muted Twin chip after the name (owner review 6, #73). -->
|
||||
<DockPanel Grid.Column="1" Margin="12,0,0,0" LastChildFill="True">
|
||||
<Border DockPanel.Dock="Right" CornerRadius="9" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="1" Padding="7,0" Margin="8,0,0,0"
|
||||
VerticalAlignment="Center" ToolTip="{Binding TwinToolTip}" Visibility="{Binding HasTwin, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{l:Loc Editor.Picker.Twin}" FontSize="11" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</Border>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Name}" FontWeight="SemiBold" ToolTip="{Binding Name}" />
|
||||
</DockPanel>
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding SequenceTitle}" Margin="12,0,0,0" Foreground="{DynamicResource Brush.TextMuted}"
|
||||
ToolTip="{Binding SequenceTitle}" />
|
||||
<ui:StatusGlyph Grid.Column="3" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}" Margin="12,0,8,0" VerticalAlignment="Center" />
|
||||
|
||||
@@ -319,12 +319,40 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
|
||||
if (generation != _generation) return;
|
||||
WorkspaceItems.Clear();
|
||||
foreach (var item in items) WorkspaceItems.Add(item);
|
||||
_ = MarkTwinsAsync(items);
|
||||
SelectedProject = WorkspaceItems.FirstOrDefault(i => i.ProjectId == _section.OpenProjectId) ?? WorkspaceItems.FirstOrDefault();
|
||||
OnPropertyChanged(nameof(HasWorkspaceItems));
|
||||
RaiseStates();
|
||||
_workspaceStates = ReadStatesAsync(items, generation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks the projects whose time-lapse (a linked or integrated match) has a workspace project at the other home too
|
||||
/// (owner review 6, #73): a muted Twin chip, "Also at {home}: {project}".
|
||||
/// </summary>
|
||||
private async Task MarkTwinsAsync(IReadOnlyList<WorkspaceProjectItem> items)
|
||||
{
|
||||
if (Shell.Services.Sync.Copies is not { } copies || items.Count == 0) return;
|
||||
try
|
||||
{
|
||||
var twins = await copies.TwinsAsync(CancellationToken.None);
|
||||
foreach (var item in items)
|
||||
{
|
||||
var twin = item.Entry.IsServerHome
|
||||
? twins.FirstOrDefault(t => t.RemoteId == item.SequenceId && t.LocalProject is not null)
|
||||
: twins.FirstOrDefault(t => t.LocalId == item.SequenceId && t.ServerProject is not null);
|
||||
if (twin is null) continue;
|
||||
var server = string.Equals(twin.Server, Shell.Services.Sync.Server, StringComparison.OrdinalIgnoreCase)
|
||||
? Shell.Services.Server.Flow.Info?.Name ?? twin.Server : twin.Server;
|
||||
if (item.Entry.IsServerHome) item.SetTwin(twin.LocalHome, twin.LocalProject);
|
||||
else item.SetTwin(server, twin.ServerProject);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or InvalidOperationException or DatabaseException)
|
||||
{
|
||||
Log.Warning("workspace", "The twins of the workspace projects could not be read", ex);
|
||||
}
|
||||
}
|
||||
/// <summary>Each listed project's state, asked of its home one after the other (a home may make a read wait a few seconds).</summary>
|
||||
private async Task ReadStatesAsync(IReadOnlyList<WorkspaceProjectItem> items, int generation)
|
||||
{
|
||||
|
||||
@@ -6,8 +6,14 @@
|
||||
xmlns:infra="clr-namespace:Chronos.App.Infrastructure"
|
||||
xmlns:shell="clr-namespace:Chronos.App.Shell"
|
||||
xmlns:srv="clr-namespace:Chronos.App.Server"
|
||||
xmlns:cp="clr-namespace:Chronos.App.Server.Copies"
|
||||
xmlns:sec="clr-namespace:Chronos.App.Sections">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Chronos;component/Archive/ArchiveDialogs.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Chronos;component/Server/Copies/CopyDialogs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style x:Key="Text.RowLabel" TargetType="TextBlock" BasedOn="{StaticResource Text.Label}">
|
||||
<Setter Property="MinWidth" Value="60" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
@@ -41,11 +47,13 @@
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding StateText}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- Server.html: this PC's shared library, the connection panel, the server's jobs while any run or wait paused, then the sync
|
||||
table. The render-node status panel is not built (see the decisions). -->
|
||||
<Grid Margin="20,16,20,12">
|
||||
<Grid>
|
||||
<Grid x:Name="Body" Margin="20,16,20,12" IsEnabled="{Binding IsContentEnabled}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -267,11 +275,12 @@
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Server.Sync.Title}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,4,10,4" />
|
||||
<ItemsControl ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Wrap}" Focusable="False" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}}">
|
||||
Visibility="{Binding ShowChips, Converter={StaticResource BoolToVisibility}}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type srv:SyncFilterChip}">
|
||||
<RadioButton x:Name="Chip" Style="{StaticResource RadioButton.Chip}" GroupName="SyncFilters" Content="{Binding Text}"
|
||||
IsChecked="{Binding IsSelected, Mode=OneWay}" Command="{Binding SelectCommand}" ToolTip="{Binding ToolTip}" Margin="0,1,10,1" />
|
||||
IsChecked="{Binding IsSelected, Mode=OneWay}" Command="{Binding SelectCommand}" ToolTip="{Binding ToolTip}" Margin="0,1,10,1"
|
||||
Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibility}}" />
|
||||
<DataTemplate.Triggers>
|
||||
<!-- Conflicts waiting are drawn in warning colours, unless the chip is the chosen one (then Accent, DESIGN §4). -->
|
||||
<MultiDataTrigger>
|
||||
@@ -289,9 +298,13 @@
|
||||
</WrapPanel>
|
||||
<TextBox Grid.Column="1" Width="200" Height="30" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Server.Sync.Search}" ToolTip="{l:Loc Tooltips.Server.Sync.Search}" AutomationProperties.Name="{l:Loc Server.Sync.Search}"
|
||||
Margin="10,0,0,0" Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibility}}" />
|
||||
Margin="10,0,0,0" Visibility="{Binding ShowSearch, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Grid.Column="2" Content="{l:Loc Server.Sync.UploadAll}" Command="{Binding UploadAllCommand}" ToolTip="{Binding UploadAllToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" Height="30" Margin="10,0,0,0" />
|
||||
ToolTipService.ShowOnDisabled="True" Height="30" Margin="10,0,0,0"
|
||||
Visibility="{Binding IsMatches, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<!-- Matches: Find matches replaces Upload all local. -->
|
||||
<Button Grid.Column="2" Content="{l:Loc Server.Copies.Action.Find}" Command="{Binding Copies.FindCommand}" ToolTip="{Binding Copies.FindToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" Height="30" Margin="10,0,0,0" Visibility="{Binding IsMatches, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
|
||||
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The actions column is at least wide enough for a row's three actions (Open with proxies, Download originals and an older server's disabled Open in workspace) on one line. The list always
|
||||
@@ -305,10 +318,17 @@
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition Width="1.4*" MinWidth="400" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Sequence}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Local}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Server}" Margin="10,0,0,0" />
|
||||
<TextBlock Visibility="{Binding IsMatches, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Sequence}" />
|
||||
<TextBlock Visibility="{Binding IsMatches, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Local}" Margin="10,0,0,0" />
|
||||
<TextBlock Visibility="{Binding IsMatches, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Server}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.State}" Margin="10,0,0,0" />
|
||||
<!-- Matches: Sequence · This side · Other side · State. -->
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Server.Copies.Column.Sequence}"
|
||||
Visibility="{Binding IsMatches, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Copies.Column.ThisSide}" Margin="10,0,0,0"
|
||||
Visibility="{Binding IsMatches, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Copies.Column.OtherSide}" Margin="10,0,0,0"
|
||||
Visibility="{Binding IsMatches, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -317,7 +337,7 @@
|
||||
<ListBox x:Name="SyncList" Grid.Row="2" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Sync}"
|
||||
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" KeyboardNavigation.TabNavigation="Continue"
|
||||
AutomationProperties.Name="{l:Loc Server.Sync.Title}" Visibility="{Binding HasRows, Converter={StaticResource BoolToVisibility}}">
|
||||
AutomationProperties.Name="{l:Loc Server.Sync.Title}" Visibility="{Binding ShowSyncList, Converter={StaticResource BoolToVisibility}}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type srv:SyncRow}">
|
||||
<Border x:Name="RowBorder" Background="Transparent" Padding="14,0">
|
||||
@@ -368,6 +388,52 @@
|
||||
</Grid>
|
||||
</ui:EmptyState>
|
||||
|
||||
<!-- Matches (owner review 6, #73): the pairs of this server and of this PC's archives, with the same row layout. -->
|
||||
<ListBox x:Name="CopyList" Grid.Row="2" ItemsSource="{Binding Copies.Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Sync}"
|
||||
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" KeyboardNavigation.TabNavigation="Continue"
|
||||
AutomationProperties.Name="{l:Loc Settings.Server.Copies}" Visibility="{Binding ShowCopyList, Converter={StaticResource BoolToVisibility}}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type cp:CopyRow}">
|
||||
<Border x:Name="RowBorder" Background="Transparent" Padding="14,0">
|
||||
<Grid MinHeight="40">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.6*" MinWidth="140" />
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition Width="1.4*" MinWidth="400" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Title}" ToolTip="{Binding TitleToolTip}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding HereText}" ToolTip="{Binding HereText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding ThereText}" ToolTip="{Binding ThereText}" Margin="10,0,0,0" />
|
||||
<ui:StatusGlyph Grid.Column="3" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}"
|
||||
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding StateAnnouncement}" />
|
||||
<ItemsControl Grid.Column="4" ItemsSource="{Binding Actions}" ItemsPanel="{StaticResource Panel.Wrap}" Focusable="False" VerticalAlignment="Center" Margin="10,4,0,4">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type cp:CopyRowAction}">
|
||||
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{Binding AccessibleName}" FontSize="12" Margin="0,2,6,2" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsConflict}" Value="True">
|
||||
<Setter TargetName="RowBorder" Property="Background" Value="{DynamicResource Brush.WarningSubtle}" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<!-- No pair: one sentence and Find matches. -->
|
||||
<ui:EmptyState Grid.Row="2" Message="{Binding Copies.EmptyText}" Visibility="{Binding ShowCopyEmpty, Converter={StaticResource BoolToVisibility}}">
|
||||
<Button Content="{l:Loc Server.Copies.Action.Find}" Command="{Binding Copies.FindCommand}" ToolTip="{Binding Copies.FindToolTip}" ToolTipService.ShowOnDisabled="True" />
|
||||
</ui:EmptyState>
|
||||
|
||||
<!-- Footer: last comparison · server archive · retry state (announced) · admin panel for administrators. -->
|
||||
<Border Grid.Row="3" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" Padding="14,8">
|
||||
<DockPanel LastChildFill="False" TextElement.FontSize="12">
|
||||
@@ -387,4 +453,12 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- The Compare dialog (and Delete…) over the section; Tab stays inside it (ArchiveView's scrim host). -->
|
||||
<Grid Visibility="{Binding IsDialogOpen, Converter={StaticResource BoolToVisibility}}" KeyboardNavigation.TabNavigation="Cycle"
|
||||
KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
|
||||
<Border Background="{DynamicResource Brush.Scrim}" />
|
||||
<ContentPresenter x:Name="DialogHost" Content="{Binding Dialog}" Margin="20" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,12 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Chronos.App.Sections;
|
||||
|
||||
public partial class ServerView : UserControl
|
||||
{
|
||||
public ServerView() => InitializeComponent();
|
||||
private IInputElement? _beforeDialog;
|
||||
|
||||
public ServerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContextChanged += OnDataContextChanged;
|
||||
}
|
||||
|
||||
/// <summary>The ▾ button opens the list of servers found on the LAN under itself.</summary>
|
||||
private void OnShowKnown(object sender, RoutedEventArgs e)
|
||||
@@ -17,4 +27,34 @@ public partial class ServerView : UserControl
|
||||
menu.Placement = PlacementMode.Bottom;
|
||||
menu.IsOpen = true;
|
||||
}
|
||||
|
||||
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.OldValue is ServerViewModel old) old.PropertyChanged -= OnModelChanged;
|
||||
if (e.NewValue is ServerViewModel model) model.PropertyChanged += OnModelChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A dialog that opens (Compare sequences) takes the keyboard; when it closes, the keyboard goes back to the control that
|
||||
/// opened it, or to the first control of the section when that one can no longer take it.
|
||||
/// </summary>
|
||||
private void OnModelChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != nameof(ServerViewModel.Dialog) || sender is not ServerViewModel model) return;
|
||||
if (model.Dialog is not null)
|
||||
{
|
||||
if (!IsVisible) return;
|
||||
_beforeDialog ??= Keyboard.FocusedElement is Visual focused && IsAncestorOf(focused) ? Keyboard.FocusedElement : null;
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Input, () => DialogHost.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)));
|
||||
return;
|
||||
}
|
||||
var back = _beforeDialog;
|
||||
_beforeDialog = null;
|
||||
if (!IsVisible) return;
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Input, () =>
|
||||
{
|
||||
if (back is UIElement { IsVisible: true, IsEnabled: true, Focusable: true } element && element.Focus()) return;
|
||||
Body.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.App.Settings;
|
||||
@@ -16,7 +17,7 @@ namespace Chronos.App.Sections;
|
||||
/// status (name, version, latency, certificate), account and quota, sign out, the options of this PC (render node,
|
||||
/// proxies kept offline, automatic project sync, uploads paused on metered networks), the server's running and paused jobs
|
||||
/// (<see cref="Jobs"/>) and the sync table (<see cref="Sync"/>).
|
||||
/// The rail badge counts the settings conflicts waiting for a choice.
|
||||
/// The rail badge counts the settings conflicts and the matches waiting for a choice; the Compare dialog shows over the section.
|
||||
/// </summary>
|
||||
public sealed class ServerViewModel : SectionViewModel
|
||||
{
|
||||
@@ -24,6 +25,10 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
private string _address;
|
||||
private string? _errorText;
|
||||
private ServerSession? _session;
|
||||
private ArchiveDialogViewModel? _dialog;
|
||||
|
||||
/// <summary>Dialogs that show once the open one closes, oldest first.</summary>
|
||||
private readonly Queue<ArchiveDialogViewModel> _waiting = new();
|
||||
|
||||
public ServerViewModel(ShellViewModel shell)
|
||||
: base(SectionKey.Server, "Icon.Server")
|
||||
@@ -42,6 +47,9 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
Sync = new SyncTableViewModel(shell);
|
||||
_conflicts = Sync.Chips.Single(c => c.Filter == SyncFilter.Conflicts);
|
||||
_conflicts.PropertyChanged += OnConflictsChanged;
|
||||
Sync.Copies.OpenDialog = OpenDialogWhenFree;
|
||||
Sync.Copies.CloseDialog = CloseDialog;
|
||||
Sync.Copies.Changed += UpdateBadge;
|
||||
Jobs = new ServerJobsViewModel(() => ServerJobsViewModel.AccountOf(Session), () => JobsConnection(Session), SynchronizationContext.Current,
|
||||
(title, message) => Shell.Notify(title, message, isError: true));
|
||||
SharePanel = new SharePanelViewModel(shell);
|
||||
@@ -61,6 +69,44 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
|
||||
public ShellViewModel Shell { get; }
|
||||
|
||||
/// <summary>The section's in-window dialog (Compare sequences, Delete…); null when none is open.</summary>
|
||||
public ArchiveDialogViewModel? Dialog
|
||||
{
|
||||
get => _dialog;
|
||||
private set
|
||||
{
|
||||
if (!Set(ref _dialog, value)) return;
|
||||
OnPropertyChanged(nameof(IsDialogOpen));
|
||||
OnPropertyChanged(nameof(IsContentEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDialogOpen => _dialog is not null;
|
||||
|
||||
/// <summary>The section behind an open dialog takes neither clicks nor keyboard focus.</summary>
|
||||
public bool IsContentEnabled => _dialog is null;
|
||||
|
||||
/// <summary>Shows <paramref name="dialog"/> now when none is open, else once the open one (and those waiting before it) closed.</summary>
|
||||
internal void OpenDialogWhenFree(ArchiveDialogViewModel dialog)
|
||||
{
|
||||
if (_dialog is null) Dialog = dialog;
|
||||
else _waiting.Enqueue(dialog);
|
||||
}
|
||||
|
||||
/// <summary>Closes <paramref name="dialog"/> if it is the open one; the next one waiting shows (one closed meanwhile is skipped).</summary>
|
||||
internal void CloseDialog(ArchiveDialogViewModel dialog)
|
||||
{
|
||||
if (!ReferenceEquals(_dialog, dialog)) return;
|
||||
dialog.Dispose();
|
||||
Dialog = null;
|
||||
while (_waiting.TryDequeue(out var next))
|
||||
{
|
||||
if (next.IsClosed) continue;
|
||||
Dialog = next;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private ServerSession Session => _session ?? Shell.Services.Server;
|
||||
|
||||
public ICommand ConnectCommand { get; }
|
||||
@@ -233,6 +279,8 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
public override void Dispose()
|
||||
{
|
||||
_conflicts.PropertyChanged -= OnConflictsChanged;
|
||||
Sync.Copies.Changed -= UpdateBadge;
|
||||
_dialog?.Dispose();
|
||||
if (_session is not null) _session.PropertyChanged -= OnSessionChanged;
|
||||
Shell.Settings.Encoders.CollectionChanged -= OnEncodersChanged;
|
||||
Sync.Dispose();
|
||||
@@ -249,9 +297,12 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
|
||||
private void OnConflictsChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName is nameof(SyncFilterChip.Count) or "" or null) Badge = _conflicts.Count;
|
||||
if (e.PropertyName is nameof(SyncFilterChip.Count) or "" or null) UpdateBadge();
|
||||
}
|
||||
|
||||
/// <summary>The rail badge: conflicts plus pairs asking for a choice (design §8.1).</summary>
|
||||
private void UpdateBadge() => Badge = _conflicts.Count + Sync.Copies.AttentionCount;
|
||||
|
||||
private void SetSyncOption(bool value, bool current, Action<bool> store, [System.Runtime.CompilerServices.CallerMemberName] string? name = null)
|
||||
{
|
||||
if (value == current) return;
|
||||
|
||||
@@ -681,6 +681,36 @@
|
||||
shell:EditBehavior.Field="{Binding DefaultServer}" ToolTip="{Binding DefaultServer.ToolTip}" ui:Field.Placeholder="{l:Loc Server.AddressPlaceholder}"
|
||||
AutomationProperties.Name="{l:Loc Settings.Server.Default}" FlowDirection="LeftToRight" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.CopyLinking}">
|
||||
<ComboBox Width="170" HorizontalAlignment="Left" ItemsSource="{Binding CopyRows.LinkingOptions}" SelectedItem="{Binding CopyRows.Linking}" DisplayMemberPath="Label"
|
||||
ToolTip="{l:Loc Tooltips.Settings.CopyLinking}" AutomationProperties.Name="{l:Loc Settings.Server.CopyLinking}">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.CopyPhotos}">
|
||||
<ComboBox Width="170" HorizontalAlignment="Left" ItemsSource="{Binding CopyRows.PhotoOptions}" SelectedItem="{Binding CopyRows.PhotoPolicy}" DisplayMemberPath="Label"
|
||||
ToolTip="{l:Loc Tooltips.Settings.CopyPhotos}" AutomationProperties.Name="{l:Loc Settings.Server.CopyPhotos}">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.CopyProjects}">
|
||||
<ComboBox Width="170" HorizontalAlignment="Left" ItemsSource="{Binding CopyRows.ProjectOptions}" SelectedItem="{Binding CopyRows.ProjectsChoice}" DisplayMemberPath="Label"
|
||||
ToolTip="{l:Loc Tooltips.Settings.CopyProjects}" AutomationProperties.Name="{l:Loc Settings.Server.CopyProjects}">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.Server.RenderNode}">
|
||||
<CheckBox Content="{l:Loc Settings.Server.OfferPc}" IsChecked="{Binding RenderNodeOptIn}" ToolTip="{l:Loc Tooltips.Server.RenderNode}" Margin="0,4,0,0" />
|
||||
</HeaderedContentControl>
|
||||
|
||||
@@ -92,7 +92,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
"Settings.Workspace.Sync", "Settings.Workspace.AfterSave", "Settings.Workspace.VersionOnRender", "Settings.Workspace.SaveBeforeRender",
|
||||
"Settings.Workspace.Kept", "Settings.Workspace.CleanAfter", "Settings.Workspace.OpenProject", "Settings.Workspace.Trash", "Settings.Workspace.Homes"]),
|
||||
new(SettingsPage.Server, ["Settings.Server.Share", "Settings.Server.ShareName", "Settings.Server.HttpsPort", "Settings.Server.HttpPort",
|
||||
"Settings.Server.PublicHttpsPort", "Settings.Server.PublicHttpPort", "Settings.Server.Discovery", "Settings.Server.ShareFolder", "Settings.Server.Default", "Settings.Server.RenderNode", "Settings.Server.Certificates", "Settings.Server.Known"]),
|
||||
"Settings.Server.PublicHttpsPort", "Settings.Server.PublicHttpPort", "Settings.Server.Discovery", "Settings.Server.ShareFolder", "Settings.Server.Default", "Settings.Server.CopyLinking", "Settings.Server.CopyPhotos", "Settings.Server.CopyProjects", "Settings.Server.RenderNode", "Settings.Server.Certificates", "Settings.Server.Known"]),
|
||||
new(SettingsPage.Updates, ["Settings.General.CheckOnStart", "Settings.Updates.Latest", "About.Update.Check", "About.Releases"]),
|
||||
new(SettingsPage.Advanced, ["Settings.Advanced.DataFolder", "Settings.Advanced.Logs", "Settings.Advanced.LogLevel", "Settings.Advanced.KeepLogs",
|
||||
"Settings.Advanced.FileSize", "Settings.Advanced.LogsTotal", "Settings.Advanced.Rotation", "Settings.Advanced.Diagnostics",
|
||||
@@ -180,6 +180,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
|
||||
// ---- Server › Sharing (owner review 5, #67); saving applies it to the share (AppServices.SaveSettings). ----
|
||||
ShareRows = new ShareSettingsRows(_s, Save, Shell.Services.Environment.ShareDirectory, Shell.Services.Environment.PcName);
|
||||
CopyRows = new CopySettingsRows(_s, Save);
|
||||
|
||||
// ---- Workspace ----
|
||||
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => AppEnvironment.Shown(Shell.Services.Workspace.Root), OpenWorkspaceFolder, ChangeWorkspaceFolderAsync,
|
||||
@@ -838,6 +839,9 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
/// <summary>Settings › Server › Sharing: this PC's library shared to the LAN (owner review 5, #67).</summary>
|
||||
public ShareSettingsRows ShareRows { get; }
|
||||
|
||||
/// <summary>Settings › Server › Link matches, Integrate photos, Integrate projects (owner review 6, #73).</summary>
|
||||
public CopySettingsRows CopyRows { get; }
|
||||
|
||||
public ICommand OpenDataFolderCommand { get; }
|
||||
public ICommand OpenLogsCommand { get; }
|
||||
public ICommand ExportDiagnosticsCommand { get; }
|
||||
@@ -1278,7 +1282,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
JobKind.Render, JobKind.Import, JobKind.Download, JobKind.UploadCommit, JobKind.Scan, JobKind.Rebuild, JobKind.Verify, JobKind.LightAnalyse,
|
||||
JobKind.DeepAnalyse, JobKind.Thumbs, JobKind.Proxies, JobKind.Maintenance, JobKind.Duplicates, JobKind.Orphans, JobKind.Adopt, JobKind.Move,
|
||||
JobKind.Backup, JobKind.Cleanup, JobKind.EmptyTrash, JobKind.Convert, JobKind.WorkspaceCopy, JobKind.WorkspaceRender, JobKind.WorkspaceSend,
|
||||
JobKind.WorkspaceMove, JobKind.VideoCopy,
|
||||
JobKind.WorkspaceMove, JobKind.VideoCopy, JobKind.Integrate, JobKind.MergeSequences,
|
||||
];
|
||||
|
||||
/// <summary>Stores <paramref name="level"/> for <paramref name="kind"/>, keeping only the levels that differ from the defaults.</summary>
|
||||
@@ -1675,6 +1679,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
case SettingsPage.Server:
|
||||
_s.RenderNodeOptIn = defaults.RenderNodeOptIn;
|
||||
ShareRows.Reset();
|
||||
CopyRows.Reset();
|
||||
break;
|
||||
case SettingsPage.Updates:
|
||||
_s.CheckForUpdates = defaults.CheckForUpdates;
|
||||
@@ -1783,6 +1788,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Logs.Refresh();
|
||||
WorkspaceRows.Refresh();
|
||||
ShareRows.Refresh();
|
||||
CopyRows.Refresh();
|
||||
UpdatePreview();
|
||||
LoadCertificates();
|
||||
OnAllPropertiesChanged();
|
||||
@@ -1902,6 +1908,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
foreach (var row in MissingExtensions) row.Refresh();
|
||||
Logs.Refresh();
|
||||
WorkspaceRows.Refresh();
|
||||
CopyRows.Refresh();
|
||||
ArchiveRoot.Refresh();
|
||||
FolderTemplate.Refresh();
|
||||
FileTemplate.Refresh();
|
||||
|
||||
Reference in new issue
Block a user