feat: work board, no usage data, archive folder tree, deploy guide (owner review 4 + owner review 1 phase 6) (#62)
CI / Build and test (push) Successful in 10m37s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 16m19s
CI / PostgreSQL 16 integration (push) Successful in 10m19s
CI / PostgreSQL 17 integration (push) Successful in 11m27s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m34s

Owner review 4 and owner review 1 phase 6.

- Work board in Videos (desktop and admin panel): Published and Workspace lanes (#29).
- Anonymous usage counts removed: Chronos sends nothing about its use (#30).
- The archive's whole folder tree is created inside any archive root, on the server and the desktop (#31).
- Video cards start with the preset; sizes keep number and unit together (#28).
- Deploy guide docs/deploy (Docker, Unraid, desktop), BRIEF §24, original documentation in docs/reference/original (#22).

Closes #22 #28 #29 #30 #31

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #62.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-06 18:46:22 +01:00
1 parent 728ffa35cb
commit 0075065884
304 files changed
+6892 -325

No files matched your search

@@ -141,11 +141,6 @@
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.General.Notifications}">
<CheckBox Content="{l:Loc Settings.General.OsNotifications}" IsChecked="{Binding OsNotifications}" ToolTip="{l:Loc Tooltips.Settings.OsNotifications}" Margin="0,4,0,0" />
</HeaderedContentControl>
<!-- Monetization consent (BRIEF §21): only in builds made with ChronosAdsEnabled=true. -->
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.General.Usage}"
Visibility="{Binding ShowsUsageCounts, Converter={StaticResource BoolToVisibility}}">
<CheckBox Content="{l:Loc Settings.General.UsageCounts}" IsChecked="{Binding UsageCounts}" ToolTip="{l:Loc Tooltips.Settings.UsageCounts}" Margin="0,4,0,0" />
</HeaderedContentControl>
</StackPanel>
<!-- ================= Archive ================= -->
+29 -26
View File
@@ -78,7 +78,7 @@ public sealed class SettingsViewModel : SectionViewModel
AllPages =
[
new(SettingsPage.General, ["Settings.General.Language", "Settings.General.Theme", .. ShowsStartup ? (string[])["Settings.General.Startup"] : [],
"Settings.General.Notifications", .. ProductFeatures.AdsEnabled ? (string[])["Settings.General.Usage"] : []]),
"Settings.General.Notifications"]),
new(SettingsPage.Archive, ["Settings.Archive.Root", "Settings.Archive.Folders", "Settings.Archive.Files", "Settings.Archive.Proxies",
"Settings.Archive.Thumbnails", "Settings.Archive.VideosFolder"]),
new(SettingsPage.Import, ["Import.Scan.Sessions", "Import.Label.Scan", "Import.Scan.Subfolders", "Import.Scan.Verify", "Import.Label.Duplicates",
@@ -108,7 +108,7 @@ public sealed class SettingsViewModel : SectionViewModel
_s.LastArchivePath = v.Length == 0 ? null : Path.GetFullPath(v);
Save();
UpdateArchiveFree();
_retarget = RetargetArchiveAsync();
_retarget = RetargetArchiveAsync(offerCreate: true);
}, () => Loc.L("Tooltips.Settings.ArchiveRoot"));
FolderTemplate = new EditableField(_s.FolderTemplate, v => NamingPreview.Validate(v, isFolder: true), v =>
{
@@ -387,21 +387,6 @@ public sealed class SettingsViewModel : SectionViewModel
}
}
/// <summary>The usage counts consent belongs to monetization (BRIEF §21): only builds with it enabled offer it.</summary>
public bool ShowsUsageCounts => ProductFeatures.AdsEnabled;
public bool UsageCounts
{
get => _s.AnonymousUsageCounts;
set
{
if (_s.AnonymousUsageCounts == value) return;
_s.AnonymousUsageCounts = value;
Save();
OnPropertyChanged();
}
}
// ---------------- Archive ----------------
public EditableField ArchiveRoot { get; }
@@ -1181,11 +1166,13 @@ public sealed class SettingsViewModel : SectionViewModel
/// <summary>
/// The archive folder changed: an archive already there is registered as at start (relinked when it moved) and given
/// its rescan, and the rows show its settings; any other folder leaves them with this PC's defaults for new archives.
/// Later edits never reach the archive shown before. Returns the archive registered at that folder (null for none),
/// even when another folder has been chosen since: edits made for this one go there.
/// its rescan, and the rows show its settings. A folder that is no archive yet becomes one in place, with the archive's
/// whole layout (as Welcome's Create), only when <paramref name="offerCreate"/> and the user confirms it for that folder
/// by name; otherwise the folder is only remembered and the rows keep this PC's defaults for new archives. Later edits
/// never reach the archive shown before. Returns the archive registered at that folder (null for none), even when
/// another folder has been chosen since: edits made for this one go there.
/// </summary>
private async Task<Archive?> RetargetArchiveAsync()
private async Task<Archive?> RetargetArchiveAsync(bool offerCreate)
{
_archive = null;
var root = _s.LastArchivePath;
@@ -1195,9 +1182,11 @@ public sealed class SettingsViewModel : SectionViewModel
{
var opened = await Task.Run(async () => File.Exists(new ArchivePaths(root).ManifestPath) ? await archives.OpenAsync(root) : null);
if (opened is not null) await Shell.Services.QueueScanAsync(opened, full: false);
// Never on its own: a folder the user typed half of, or one of their own folders, would become an archive and be scanned.
else if (offerCreate && ConfirmCreateArchive(root)) await Shell.Services.ArchiveSetup.CreateAsync(root);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or NewerFormatException
or DatabaseException)
or DatabaseException or ArgumentException or InvalidOperationException)
{
Log.Warning("settings", $"The archive at {root} could not be opened", ex);
Shell.Notify(Loc.L("Errors.Archive.Open"), ArchiveActions.Cause(ex), isError: true);
@@ -1206,6 +1195,21 @@ public sealed class SettingsViewModel : SectionViewModel
return await LoadArchiveAsync(root);
}
/// <summary>
/// The archive folder typed or picked holds no archive: the user confirms making it one, the folder named, before any
/// folder or file is written there. Declined, the folder is only remembered.
/// </summary>
private bool ConfirmCreateArchive(string root) => Shell.Services.Dialogs.Confirm(new ConfirmRequest
{
Heading = Loc.L("Settings.Archive.CreateTitle"),
Message = Loc.L("Settings.Archive.CreateMessage"),
Detail = root,
SafeText = Loc.L("Settings.Archive.CreateSkip"),
SafeToolTip = Loc.L("Tooltips.Settings.SkipCreateArchive"),
ActionText = Loc.L("Settings.Archive.CreateAction"),
ActionToolTip = Loc.L("Tooltips.Settings.CreateArchiveHere"),
});
/// <summary>
/// Archive › Reset section with an archive open writes the defaults into that archive's archive.json, which the server
/// and the other PCs share: the user confirms it for that archive by name first.
@@ -1575,7 +1579,6 @@ public sealed class SettingsViewModel : SectionViewModel
switch (_page)
{
case SettingsPage.General:
_s.AnonymousUsageCounts = defaults.AnonymousUsageCounts;
_s.OsNotifications = defaults.OsNotifications;
Startup.SetEnabled(false);
ApplyTheme(defaults.Theme);
@@ -1770,11 +1773,11 @@ public sealed class SettingsViewModel : SectionViewModel
return;
}
// Everything but the session, the window and its rail, the sequence edited last (another PC's ids mean nothing here),
// the first-run flag and the workspace, which is this PC's (its folder, the projects opened last and when).
// the first-run flag, the archive folder and the workspace, which are this PC's (another PC's drives mean nothing here).
ApplyAll(_s.KeepLocalIn(imported));
// Settings of a PC never rewrite the shared archive.json: the imported templates and sizes are the defaults of new
// archives, and the rows show the own settings of the archive at the (possibly imported) archive folder.
_retarget = RetargetArchiveAsync();
// archives, and the rows show the own settings of this PC's archive. An import never makes a folder an archive.
_retarget = RetargetArchiveAsync(offerCreate: false);
Shell.Notify(Loc.L("Settings.Import.Done"));
}
+156 -2
View File
@@ -101,6 +101,99 @@
<Setter Property="ContextMenu" Value="{StaticResource Menu.Video}" />
<EventSetter Event="MouseDoubleClick" Handler="OnItemDoubleClick" />
</Style>
<Style x:Key="ListBoxItem.VideoBoard" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
<Setter Property="Padding" Value="14,10" />
<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}}" />
<Setter Property="ContextMenu" Value="{StaticResource Menu.Video}" />
<EventSetter Event="MouseDoubleClick" Handler="OnItemDoubleClick" />
</Style>
<!--
A Board card's text and its actions: beside each other, and the actions on a row of their own under the text while the
player pane narrows the lanes (rc.14 review: at the window's smallest width the text kept about 80 px).
-->
<Style x:Key="Panel.BoardText" TargetType="StackPanel">
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.IsPlayerOpen, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="True">
<Setter Property="Grid.ColumnSpan" Value="2" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="Panel.BoardActions" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Grid.Column" Value="1" />
<Setter Property="Margin" Value="8,0,0,0" />
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.IsPlayerOpen, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="True">
<Setter Property="Grid.Column" Value="0" />
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Margin" Value="0,4,0,0" />
<Setter Property="HorizontalAlignment" Value="Left" />
</DataTrigger>
</Style.Triggers>
</Style>
<!-- A Board card: title, project and version, preset · codec · duration · size, kind · date, state chips, and its actions. -->
<DataTemplate x:Key="Template.BoardCard" DataType="{x:Type vid:VideoRowViewModel}">
<Grid ToolTip="{Binding ToolTip}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Style="{StaticResource Panel.BoardText}">
<TextBlock Text="{Binding Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
<TextBlock Style="{StaticResource Text.Secondary}" Text="{Binding ProjectText}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0"
Visibility="{Binding HasProject, Converter={StaticResource BoolToVisibility}}" />
<TextBlock Style="{StaticResource Text.Secondary}" Text="{Binding CardText}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" />
<TextBlock Style="{StaticResource Text.Faint}" Text="{Binding BoardFactsText}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" />
<ItemsControl Margin="0,6,0,0" ItemsSource="{Binding States}" ItemTemplate="{StaticResource Template.Status}" ItemsPanel="{StaticResource Panel.Row}"
Focusable="False" ClipToBounds="True" />
</StackPanel>
<StackPanel Style="{StaticResource Panel.BoardActions}">
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Play}"
Command="{Binding DataContext.PlayCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{l:Loc Videos.Play}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}"
Command="{Binding DataContext.ShowInFolderCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding MenuShowInFolderToolTip}" AutomationProperties.Name="{l:Loc Videos.ShowInFolder}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Sequence}"
Command="{Binding DataContext.OpenInEditCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding MenuOpenInEditToolTip}" AutomationProperties.Name="{l:Loc Videos.OpenInEdit}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Upload}"
Command="{Binding DataContext.SendCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding SendToolTip}" AutomationProperties.Name="{l:Loc Editor.Render.SendAgain}"
Visibility="{Binding CanSend, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</Grid>
</DataTemplate>
<Style x:Key="ListBox.Lane" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItem.VideoBoard}" />
<Setter Property="ItemTemplate" Value="{StaticResource Template.BoardCard}" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
<Setter Property="VirtualizingPanel.ScrollUnit" Value="Pixel" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue" />
</Style>
<Style x:Key="Border.LaneCount" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource Brush.Card}" />
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Stroke}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="9" />
<Setter Property="Padding" Value="7,0" />
<Setter Property="MinWidth" Value="22" />
<Setter Property="Height" Value="18" />
<Setter Property="Margin" Value="8,0,0,0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UserControl.Resources>
<Grid>
@@ -115,7 +208,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Toolbar: search, kind, codec, year, source, order · cards or list (decision 20). -->
<!-- Toolbar: search, kind, codec, year, source, order · cards, list or Board (decision 20). -->
<Grid Grid.ColumnSpan="2" Margin="20,0" MinHeight="56">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="260" />
@@ -141,6 +234,7 @@
AutomationProperties.Name="{l:Loc Videos.View.Grid}">
<v:SegmentedItem Glyph="{StaticResource Icon.ViewGrid}" ToolTip="{l:Loc Tooltips.Videos.View}" AutomationProperties.Name="{l:Loc Videos.View.Grid}" />
<v:SegmentedItem Glyph="{StaticResource Icon.ViewList}" ToolTip="{l:Loc Tooltips.Videos.View}" AutomationProperties.Name="{l:Loc Videos.View.List}" />
<v:SegmentedItem Glyph="{StaticResource Icon.ViewBoard}" ToolTip="{l:Loc Tooltips.Videos.View.Board}" AutomationProperties.Name="{l:Loc Videos.View.Board}" />
</v:SegmentedControl>
<Button Grid.Column="3" Style="{StaticResource Button.Quick}" VerticalAlignment="Top" Margin="8,14,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Refresh}"
Command="{Binding RefreshCommand}" ToolTip="{l:Loc Tooltips.Videos.Refresh}" AutomationProperties.Name="{l:Loc Videos.Refresh}" />
@@ -166,7 +260,7 @@
</ListBox.InputBindings>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type vid:VideoRowViewModel}">
<v:SequenceCard Title="{Binding Title}" Subtitle="{Binding DetailsText}" Badge="{Binding DurationText}" Statuses="{Binding States}" Thumbnail="{Binding Poster}"
<v:SequenceCard Title="{Binding Title}" Subtitle="{Binding CardText}" Badge="{Binding DurationText}" Statuses="{Binding States}" Thumbnail="{Binding Poster}"
IsSelected="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Mode=TwoWay}"
SelectToolTip="{l:Loc Tooltips.Videos.Select}" ToolTip="{Binding ToolTip}" Loaded="OnCardLoaded">
<v:SequenceCard.ActionsContent>
@@ -248,6 +342,66 @@
</Grid>
</Border>
<!--
Board (owner request of 2026-11-06): Published, the renders filed at this PC's archive or the server, and Workspace, the
workspace's renders not sent yet and those sent still in its exports; newest first, a count per lane, the list's filters.
-->
<Grid Grid.Row="2" Margin="20,4,20,12" Visibility="{Binding IsBoard, Converter={StaticResource BoolToVisibility}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="16" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource Border.Panel}">
<DockPanel>
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,10" Background="Transparent"
ToolTip="{l:Loc Tooltips.Videos.Lane.Published}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Videos.Lane.Published}" FontWeight="SemiBold" VerticalAlignment="Center" />
<Border Style="{StaticResource Border.LaneCount}">
<TextBlock Style="{StaticResource Text.Faint}" Text="{Binding PublishedCountText}" HorizontalAlignment="Center" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" />
</Border>
</StackPanel>
</Border>
<Grid>
<ListBox x:Name="PublishedLane" Style="{StaticResource ListBox.Lane}" ItemsSource="{Binding PublishedRows}" AutomationProperties.Name="{l:Loc Videos.Lane.Published}">
<ListBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding PlayCommand}" />
<KeyBinding Key="Delete" Command="{Binding DeleteCommand}" />
</ListBox.InputBindings>
</ListBox>
<TextBlock Style="{StaticResource Text.Hint}" Text="{l:Loc Videos.Empty}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,24,0,0"
Visibility="{Binding IsPublishedEmpty, Converter={StaticResource BoolToVisibility}}" />
</Grid>
</DockPanel>
</Border>
<Border Grid.Column="2" Style="{StaticResource Border.Panel}">
<DockPanel>
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,10" Background="Transparent"
ToolTip="{l:Loc Tooltips.Videos.Lane.Workspace}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Videos.Lane.Workspace}" FontWeight="SemiBold" VerticalAlignment="Center" />
<Border Style="{StaticResource Border.LaneCount}">
<TextBlock Style="{StaticResource Text.Faint}" Text="{Binding WorkspaceCountText}" HorizontalAlignment="Center" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" />
</Border>
</StackPanel>
</Border>
<Grid>
<ListBox x:Name="WorkspaceLane" Style="{StaticResource ListBox.Lane}" ItemsSource="{Binding WorkspaceRows}" AutomationProperties.Name="{l:Loc Videos.Lane.Workspace}">
<ListBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding PlayCommand}" />
<KeyBinding Key="Delete" Command="{Binding DeleteCommand}" />
</ListBox.InputBindings>
</ListBox>
<TextBlock Style="{StaticResource Text.Hint}" Text="{l:Loc Videos.Empty}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,24,0,0"
Visibility="{Binding IsWorkspaceEmpty, Converter={StaticResource BoolToVisibility}}" />
</Grid>
</DockPanel>
</Border>
</Grid>
<!-- Empty states: no video anywhere, or none the filters keep. -->
<ui:EmptyState Grid.Row="2" Message="{l:Loc Videos.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}" />
<ui:EmptyState Grid.Row="2" Message="{l:Loc Videos.Empty}" Visibility="{Binding IsNoMatch, Converter={StaticResource BoolToVisibility}}">
+123 -22
View File
@@ -26,12 +26,17 @@ namespace Chronos.App.Sections;
/// and of the workspace (not sent yet) in one list, merged by render id, with filters, an order, cards or a list, and the
/// actions on the selection: Play in the pane on the right, Show in folder, Copy (or Download) to the videos folder checked
/// by hash, Copy on server, Delete… into the trash after a dry run, Open in Edit, and Send for the workspace's renders.
/// An older server, or none, leaves this PC's videos with the reason.
/// An older server, or none, leaves this PC's videos with the reason. The Board (owner request of 2026-11-06) shows the same
/// renders in two lanes, Published and Workspace (<see cref="VideoBoard"/>), with the workspace's sent renders beside them.
/// </summary>
public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVideosSection
{
private IReadOnlyList<VideoEntry> _entries = [];
private IReadOnlyList<VideoRowViewModel> _rows = [];
private IReadOnlyList<VideoEntry> _sent = [];
private IReadOnlyList<VideoRowViewModel> _sentRows = [];
private IReadOnlyList<VideoRowViewModel> _publishedRows = [];
private IReadOnlyList<VideoRowViewModel> _workspaceRows = [];
private IReadOnlyList<FilterOption<string?>> _kinds = [];
private IReadOnlyList<FilterOption<string?>> _codecs = [];
private IReadOnlyList<FilterOption<int?>> _years = [];
@@ -79,10 +84,15 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
ClearFiltersCommand = new RelayCommand(ClearFilters, () => Filter.IsFiltered);
ClearSequenceCommand = new RelayCommand(() => ShowSequence(null), () => IsSequenceFiltered);
RefreshCommand = new AsyncRelayCommand(RefreshAsync);
_layoutIndex = services.Settings.VideosLayout == LibraryLayout.List ? 1 : 0;
_layoutIndex = services.Settings.VideosLayout switch
{
LibraryLayout.List => 1,
LibraryLayout.Board => 2,
_ => 0,
};
ClearSelectionCommand = new RelayCommand(() =>
{
foreach (var row in _rows) row.IsSelected = false;
foreach (var row in AllRows) row.IsSelected = false;
}, () => HasSelection);
ClosePlayerCommand = new RelayCommand(() => Player = null);
}
@@ -97,7 +107,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
/// <summary>The signed-in server's videos, and what the account may do there.</summary>
internal Func<VideoServer> ServerVideos { get; set; }
/// <summary>The workspace's renders not sent yet.</summary>
/// <summary>The workspace's renders: those not sent yet, and those sent whose file is still there (the Board's).</summary>
internal Func<CancellationToken, Task<IReadOnlyList<VideoEntry>>> WorkspaceRenders { get; set; }
/// <summary>Queues a job of this PC (a copy into the videos folder).</summary>
@@ -147,6 +157,30 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
}
}
/// <summary>The workspace's sent renders whose file is still in its <c>exports/</c>, before the filters (the Board's alone).</summary>
public IReadOnlyList<VideoEntry> SentEntries => _sent;
/// <summary>The Board's Published lane: renders filed at this PC's archive or the server, newest first.</summary>
public IReadOnlyList<VideoRowViewModel> PublishedRows { get => _publishedRows; private set => Set(ref _publishedRows, value); }
/// <summary>The Board's Workspace lane: the workspace's renders not sent yet and those sent, newest first.</summary>
public IReadOnlyList<VideoRowViewModel> WorkspaceRows { get => _workspaceRows; private set => Set(ref _workspaceRows, value); }
/// <summary>The Published lane's count.</summary>
public string PublishedCountText => Formatting.Count(_publishedRows.Count);
/// <summary>The Workspace lane's count.</summary>
public string WorkspaceCountText => Formatting.Count(_workspaceRows.Count);
/// <summary>The Published lane is empty and the Workspace lane is not ("No videos" in the lane; both empty is the section's empty state).</summary>
public bool IsPublishedEmpty => _publishedRows.Count == 0 && _workspaceRows.Count > 0;
/// <summary>The Workspace lane is empty and the Published lane is not.</summary>
public bool IsWorkspaceEmpty => _workspaceRows.Count == 0 && _publishedRows.Count > 0;
/// <summary>The rows of the list and the Board's sent rows: what a selection can hold.</summary>
private IEnumerable<VideoRowViewModel> AllRows => _rows.Concat(_sentRows);
public bool IsLoading
{
get => _isLoading;
@@ -159,26 +193,40 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
}
/// <summary>No video anywhere: "No videos".</summary>
public bool IsEmpty => !_isLoading && _entries.Count == 0;
public bool IsEmpty => !_isLoading && _entries.Count == 0 && (_sent.Count == 0 || !IsBoard);
/// <summary>Videos, none of which the filters keep: "No videos" and Clear filters.</summary>
public bool IsNoMatch => !_isLoading && _entries.Count > 0 && _rows.Count == 0;
public bool IsNoMatch => !_isLoading && !IsEmpty && (IsBoard ? _publishedRows.Count + _workspaceRows.Count == 0 : _rows.Count == 0);
/// <summary>The cards (0) or the list (1), kept for the next run (Settings: <see cref="AppSettings.VideosLayout"/>).</summary>
/// <summary>The cards (0), the list (1) or the Board (2), kept for the next run (Settings: <see cref="AppSettings.VideosLayout"/>).</summary>
public int LayoutIndex
{
get => _layoutIndex;
set
{
if (value is < 0 or > 1 || !Set(ref _layoutIndex, value)) return;
Shell.Services.Settings.VideosLayout = value == 1 ? LibraryLayout.List : LibraryLayout.Grid;
if (value is < 0 or > 2 || !Set(ref _layoutIndex, value)) return;
Shell.Services.Settings.VideosLayout = value switch
{
1 => LibraryLayout.List,
2 => LibraryLayout.Board,
_ => LibraryLayout.Grid,
};
// The sent renders show on the Board alone: off it, none of them stays selected out of sight.
if (value != 2)
{
foreach (var row in _sentRows) row.IsSelected = false;
}
OnPropertyChanged(nameof(IsGrid));
OnPropertyChanged(nameof(IsList));
OnPropertyChanged(nameof(IsBoard));
OnPropertyChanged(nameof(IsEmpty));
OnPropertyChanged(nameof(IsNoMatch));
}
}
public bool IsGrid => _layoutIndex == 0;
public bool IsList => _layoutIndex == 1;
public bool IsBoard => _layoutIndex == 2;
// ---- Filters ----
@@ -295,12 +343,12 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
// ---- Selection ----
public IReadOnlyList<VideoRowViewModel> SelectedRows => [.. _rows.Where(r => r.IsSelected)];
public IReadOnlyList<VideoRowViewModel> SelectedRows => [.. AllRows.Where(r => r.IsSelected)];
public bool HasSelection => _rows.Any(r => r.IsSelected);
public bool HasSelection => AllRows.Any(r => r.IsSelected);
/// <summary>"Selected: 3".</summary>
public string SelectionText => Loc.L("Videos.Selected", Formatting.Count(_rows.Count(r => r.IsSelected)));
public string SelectionText => Loc.L("Videos.Selected", Formatting.Count(AllRows.Count(r => r.IsSelected)));
public ICommand ClearSelectionCommand { get; }
@@ -371,6 +419,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
{
[var one] when CanOpen(one.Entry) => Loc.L("Tooltips.Videos.OpenInEdit"),
[{ Entry.IsUnsent: true }] => Loc.L("Tooltips.Videos.WorkspaceRow"),
[{ Entry.IsWorkspaceSent: true } sent] => WorkspaceText.ForHome("Tooltips.Videos.SentRow", sent.Entry.WorkspaceServerHome),
[_] => Loc.L("Tooltips.Videos.ServerOnly"),
[] => Loc.L("Tooltips.Videos.OpenInEdit"),
_ => Loc.L("Tooltips.Videos.SelectOne"),
@@ -408,6 +457,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
var merged = await WithLocalCopiesAsync(VideoSources.Merge(local, remote, workspace));
if (load != _loads) return;
_server = state;
_sent = [.. workspace.Where(e => e.IsWorkspaceSent)];
Entries = merged;
OnPropertyChanged(nameof(ServerState));
OnPropertyChanged(nameof(IsServerLimited));
@@ -428,6 +478,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
BuildOptions();
// The rows' words are made with them: made again in the new language.
Rows = [];
SetSentRows([]);
Apply();
base.OnLanguageChanged();
}
@@ -515,14 +566,57 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
private void Apply()
{
// A row is kept while its render reads the same (its selection and its poster with it).
var cache = _rows.ToDictionary(r => r.Entry.Id);
Rows = [.. Filter.Apply(_entries).Select(e => cache.TryGetValue(e.Id, out var row)
? row.Entry == e ? row : new VideoRowViewModel(e) { IsSelected = row.IsSelected, Poster = row.Poster }
: new VideoRowViewModel(e))];
if (_player is { } player && !_entries.Any(e => e.Id == player.Entry.Id)) Player = null;
var filter = Filter;
Rows = Reuse(_rows, filter.Apply(_entries));
// The Board: the same rows in their lanes, and the workspace's sent renders as rows of their own (a sent render's id is
// its home entry's too).
var (published, workspace) = VideoBoard.Split(_entries, _sent, filter);
SetSentRows(Reuse(_sentRows, workspace.Where(e => e.IsWorkspaceSent)));
var listed = _rows.ToDictionary(r => r.Entry.Id);
var sent = _sentRows.ToDictionary(r => r.Entry.Id);
PublishedRows = [.. published.Select(e => listed[e.Id])];
WorkspaceRows = [.. workspace.Select(e => e.IsWorkspaceSent ? sent[e.Id] : listed[e.Id])];
OnPropertyChanged(nameof(PublishedCountText));
OnPropertyChanged(nameof(WorkspaceCountText));
OnPropertyChanged(nameof(IsPublishedEmpty));
OnPropertyChanged(nameof(IsWorkspaceEmpty));
OnPropertyChanged(nameof(IsEmpty));
OnPropertyChanged(nameof(IsNoMatch));
if (_player is { } player && !_entries.Concat(_sent).Any(e => e.Id == player.Entry.Id)) Player = null;
OnPropertyChanged(nameof(Filter));
}
/// <summary>The rows of <paramref name="entries"/>, each kept from <paramref name="rows"/> while its render reads the same.</summary>
private static IReadOnlyList<VideoRowViewModel> Reuse(IReadOnlyList<VideoRowViewModel> rows, IEnumerable<VideoEntry> entries)
{
var cache = rows.ToDictionary(r => r.Entry.Id);
return
[
.. entries.Select(e => cache.TryGetValue(e.Id, out var row)
? row.Entry == e ? row : new VideoRowViewModel(e) { IsSelected = row.IsSelected, Poster = row.Poster }
: new VideoRowViewModel(e)),
];
}
/// <summary>The Board's sent rows, wired as the list's are.</summary>
private void SetSentRows(IReadOnlyList<VideoRowViewModel> rows)
{
foreach (var row in _sentRows)
{
row.SelectionChanged -= OnSelectionChanged;
row.PosterRequested -= OnPosterRequested;
}
var changed = _sentRows.Any(r => r.IsSelected) || rows.Any(r => r.IsSelected);
_sentRows = rows;
foreach (var row in _sentRows)
{
row.Section = this;
row.SelectionChanged += OnSelectionChanged;
row.PosterRequested += OnPosterRequested;
}
if (changed) OnSelectionChanged(null);
}
private void SetFilter<T>(ref FilterOption<T> field, FilterOption<T> value, [System.Runtime.CompilerServices.CallerMemberName] string? name = null)
{
if (EqualityComparer<FilterOption<T>>.Default.Equals(field, value)) return;
@@ -619,7 +713,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
OnPropertyChanged(nameof(ShowInFolderToolTip));
OnPropertyChanged(nameof(OpenInEditToolTip));
// A row's menu acts on the selection it is part of: its words follow the selection too.
foreach (var each in _rows) each.RefreshMenu();
foreach (var each in AllRows) each.RefreshMenu();
CommandManager.InvalidateRequerySuggested();
}
@@ -671,7 +765,12 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
internal string? CopyBlocker(IReadOnlyList<VideoRowViewModel> rows)
{
if (rows.Count == 0) return Loc.L("Tooltips.Videos.Copy");
if (!rows.Any(r => Copyable(r.Entry))) return rows.All(r => r.Entry.Missing) ? Loc.L("Tooltips.Videos.Missing") : Loc.L("Tooltips.Videos.WorkspaceRow");
if (!rows.Any(r => Copyable(r.Entry)))
{
return rows.All(r => r.Entry.Missing) ? Loc.L("Tooltips.Videos.Missing")
: rows.All(r => r.Entry.IsWorkspaceSent) ? WorkspaceText.ForHome("Tooltips.Videos.SentRow", rows[0].Entry.WorkspaceServerHome)
: Loc.L("Tooltips.Videos.WorkspaceRow");
}
if (FolderProblem() is { } problem) return VideoText.FolderReason(problem);
return LocalLibrary() is { IsAvailable: true } ? null : Loc.L("Tooltips.Videos.Copy");
}
@@ -688,7 +787,8 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
internal string? DeleteBlocker(IReadOnlyList<VideoRowViewModel> rows)
{
if (rows.Count == 0) return Loc.L("Tooltips.Videos.Delete");
if (rows.All(r => r.Entry.IsUnsent)) return Loc.L("Tooltips.Videos.WorkspaceRow");
if (rows.All(r => r.Entry.IsWorkspaceSent)) return WorkspaceText.ForHome("Tooltips.Videos.SentRow", rows[0].Entry.WorkspaceServerHome);
if (rows.All(r => r.Entry.IsUnsent || r.Entry.IsWorkspaceSent)) return Loc.L("Tooltips.Videos.WorkspaceRow");
var local = rows.Any(r => r.Entry.IsLocal) && LocalLibrary() is { IsAvailable: true };
var server = rows.Any(r => !r.Entry.IsLocal && r.Entry.IsOnServer);
if (local) return null;
@@ -699,9 +799,10 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
/// <summary>A render Copy to folder takes: this PC's file, or the server's alone (downloaded).</summary>
private bool Copyable(VideoEntry entry) =>
!entry.IsUnsent && !entry.Missing && (entry.IsLocal || (entry.IsOnServer && _server.State == VideoServerState.Available));
!entry.IsUnsent && !entry.IsWorkspaceSent && !entry.Missing && (entry.IsLocal || (entry.IsOnServer && _server.State == VideoServerState.Available));
private static bool CanOpen(VideoEntry entry) => entry.IsLocal || entry is { IsUnsent: true, WorkspaceServerHome: false };
/// <summary>Open in Edit: a render of this PC's archive, or a workspace's whose project's home is this PC's archive.</summary>
private static bool CanOpen(VideoEntry entry) => entry.IsLocal || (entry is { WorkspaceServerHome: false } && (entry.IsUnsent || entry.IsWorkspaceSent));
// ---- Actions ----
+3 -13
View File
@@ -106,19 +106,9 @@
</RadioButton>
</StackPanel>
<!-- Consent, then Continue (visual and Tab order); the consent has the same label as in Settings and, like all of
monetization (BRIEF §21), shows only in builds made with ChronosAdsEnabled=true. -->
<Grid Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<CheckBox Content="{l:Loc Settings.General.UsageCounts}" IsChecked="{Binding UsageCounts}" ToolTip="{l:Loc Tooltips.Settings.UsageCounts}" VerticalAlignment="Center"
HorizontalAlignment="Left" Foreground="{DynamicResource Brush.TextMuted}"
Visibility="{Binding ShowsUsageCounts, Converter={StaticResource BoolToVisibility}}" />
<Button Grid.Column="1" Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Margin="12,0,0,0" Content="{l:Loc Shell.Welcome.Continue}"
Command="{Binding ContinueCommand}" ToolTip="{l:Loc Tooltips.Welcome.Continue}" IsDefault="True" />
</Grid>
<!-- Continue, right-aligned; Chronos sends nothing about its use, so the first run asks no consent (owner review 4, R2). -->
<Button Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Margin="0,20,0,0" HorizontalAlignment="Right" Content="{l:Loc Shell.Welcome.Continue}"
Command="{Binding ContinueCommand}" ToolTip="{l:Loc Tooltips.Welcome.Continue}" IsDefault="True" />
</StackPanel>
</Border>
</UserControl>
+1 -14
View File
@@ -20,7 +20,7 @@ public enum WelcomeChoice
/// <summary>
/// First run (BRIEF §12.1, Welcome.html): create a local archive, adopt an existing folder or connect to a server,
/// plus the language and the anonymous-usage consent. Shown once; the archive actions go through
/// plus the language. Shown once; the archive actions go through
/// <see cref="IArchiveSetup"/>.
/// </summary>
public sealed class WelcomeViewModel : LocalizedViewModel
@@ -139,19 +139,6 @@ public sealed class WelcomeViewModel : LocalizedViewModel
}
}
/// <summary>The usage counts consent belongs to monetization (BRIEF §21): only builds with it enabled offer it.</summary>
public bool ShowsUsageCounts => ProductFeatures.AdsEnabled;
public bool UsageCounts
{
get => _shell.Services.Settings.AnonymousUsageCounts;
set
{
_shell.Services.Settings.AnonymousUsageCounts = value;
OnPropertyChanged();
}
}
public bool IsBusy
{
get => _isBusy;