feat: owner review 2 phase 1: :latest, Unraid array space, Settings with About, whole-folder import (#9)
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
- :latest follows the highest stable release, or the highest pre-release while none is stable (Chronos.Tools release-channels); bad tags are refused before anything is built. - Unraid: CHRONOS_SPACE_PATH and the template's Array view show the array's free space; the write volume (cache) is shown apart; completions check the archive volume (507). - Settings is a gear, docked at the foot of the admin sidebar; About is the last part of Settings on the desktop and the panel. - Import > Folder > Whole folder: one sequence per format (desktop only). 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 #9.
This commit is contained in:
1 parent
5acdf146c7
commit
1f089888e8
320 files changed
+3030
-927
No files matched your search
@@ -1,82 +0,0 @@
|
||||
<UserControl x:Class="Chronos.App.Sections.AboutView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:Chronos.Ui.Controls;assembly=Chronos.Ui"
|
||||
xmlns:l="clr-namespace:Chronos.Ui.Localization;assembly=Chronos.Ui"
|
||||
xmlns:infra="clr-namespace:Chronos.App.Infrastructure">
|
||||
<!-- BRIEF §12.9 (no mockup): built from the kit — panel, label column, one primary action. -->
|
||||
<Grid Margin="20,16,20,20">
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="28,24" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="600">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,22">
|
||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" />
|
||||
<StackPanel Margin="16,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Shell.AppName}" Style="{StaticResource Text.PageTitle}" FontSize="22" />
|
||||
<TextBlock Text="{Binding Version}" Style="{StaticResource Text.Secondary}" Margin="0,2,0,0" Typography.NumeralAlignment="Tabular" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="140" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="28" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc About.Build}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Build}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc About.Runtime}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Runtime}" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc About.System}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding OperatingSystem}" ToolTip="{Binding OperatingSystem}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc About.Licence}" />
|
||||
<Button Grid.Row="3" Grid.Column="1" Style="{StaticResource Button.Link}" FontSize="13" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Content="{l:Loc About.LicenceLink}" Command="{Binding OpenLicenceCommand}" ToolTip="{l:Loc Tooltips.About.Licence}" />
|
||||
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc About.ThirdParty}" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{l:Loc About.ThirdPartyNone}" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.About.ThirdParty}" />
|
||||
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc About.Data}" />
|
||||
<!-- A path reads left to right in every language and shows whole in its tooltip when cut. -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding DataFolder}" ToolTip="{Binding DataFolder}" VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
TextTrimming="CharacterEllipsis" FlowDirection="LeftToRight" />
|
||||
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc About.Translation}" Height="28"
|
||||
Visibility="{Binding IsTranslated, Converter={StaticResource BoolToVisibility}}" />
|
||||
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" Height="28" Visibility="{Binding IsTranslated, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{l:Loc About.MachineTranslated}" VerticalAlignment="Center" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Review}"
|
||||
Command="{Binding ReviewTranslationCommand}" ToolTip="{l:Loc Tooltips.About.Review}" />
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Row="7" Style="{StaticResource Text.Label}" Text="{l:Loc About.Updates}" />
|
||||
<StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal">
|
||||
<ui:StatusGlyph Kind="{Binding UpdateKind}" Text="{Binding UpdateText}" FontSize="13" VerticalAlignment="Center"
|
||||
Visibility="{Binding HasUpdateText, Converter={StaticResource BoolToVisibility}}"
|
||||
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding UpdateAnnouncement}" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Update.Download}"
|
||||
Command="{Binding DownloadCommand}" ToolTip="{Binding DownloadToolTip}"
|
||||
Visibility="{Binding IsUpdateAvailable, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Update.Cancel}"
|
||||
Command="{Binding CancelDownloadCommand}" ToolTip="{l:Loc Tooltips.About.CancelDownload}"
|
||||
Visibility="{Binding IsDownloading, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Update.ShowFile}"
|
||||
Command="{Binding ShowPackageCommand}" ToolTip="{Binding ShowPackageToolTip}"
|
||||
Visibility="{Binding IsPackageReady, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<WrapPanel Margin="0,22,0,0">
|
||||
<Button Style="{StaticResource Button.Primary}" Content="{l:Loc About.Update.Check}" Command="{Binding CheckCommand}" ToolTip="{l:Loc Tooltips.About.Check}" Margin="0,0,8,8" />
|
||||
<Button Content="{l:Loc About.Releases}" Command="{Binding OpenReleasesCommand}" ToolTip="{l:Loc Tooltips.About.Releases}" ui:ButtonIcon.Glyph="{StaticResource Icon.ExternalLink}" Margin="0,0,8,8" />
|
||||
<Button Content="{l:Loc About.Diagnostics}" Command="{Binding DiagnosticsCommand}" ToolTip="{l:Loc Tooltips.About.Diagnostics}" ui:ButtonIcon.Glyph="{StaticResource Icon.Export}" Margin="0,0,8,8" />
|
||||
<Button Content="{l:Loc About.OpenData}" Command="{Binding OpenDataFolderCommand}" ToolTip="{l:Loc Tooltips.About.OpenData}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}" Margin="0,0,8,8" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Chronos.App.Sections;
|
||||
|
||||
public partial class AboutView : UserControl
|
||||
{
|
||||
public AboutView() => InitializeComponent();
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.About;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.App.Sections;
|
||||
|
||||
/// <summary>
|
||||
/// About (BRIEF §12.9): version and build, licence link, third-party notice (none), translation notice,
|
||||
/// diagnostics bundle and the update notice of <see cref="UpdateFlow"/> (BRIEF §18), which Settings › Updates shows too.
|
||||
/// </summary>
|
||||
public sealed class AboutViewModel : SectionViewModel
|
||||
{
|
||||
private readonly UpdateFlow _update;
|
||||
|
||||
public AboutViewModel(ShellViewModel shell)
|
||||
: base(SectionKey.About, "Icon.About")
|
||||
{
|
||||
Shell = shell;
|
||||
var environment = shell.Services.Environment;
|
||||
_update = new UpdateFlow(new UpdateHost(UpdateCheck.RunningVersion(Version), environment.IsCapture, environment.IsPortable,
|
||||
ct => Shell.Services.CheckForUpdateAsync(ct), (release, progress, ct) => Shell.Services.DownloadUpdateAsync(release, progress, ct),
|
||||
ShellActions.OpenUrl, ShellActions.Reveal)
|
||||
{ RunningIsPrerelease = UpdateCheck.IsPrerelease(Version) });
|
||||
_update.Changed += RaiseUpdate;
|
||||
ShowPackageCommand = new RelayCommand(() =>
|
||||
{
|
||||
if (_update.PackagePath is { } path) ShellActions.Reveal(path);
|
||||
}, () => _update.PackagePath is not null);
|
||||
CancelDownloadCommand = new RelayCommand(_update.CancelDownload, () => IsDownloading);
|
||||
OpenReleasesCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Releases));
|
||||
OpenLicenceCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Licence));
|
||||
ReviewTranslationCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Issues));
|
||||
OpenDataFolderCommand = new RelayCommand(() => ShellActions.Reveal(DataFolder));
|
||||
DiagnosticsCommand = new AsyncRelayCommand(DiagnosticsAsync);
|
||||
}
|
||||
|
||||
public ShellViewModel Shell { get; }
|
||||
|
||||
public string Version => AppServices.VersionText;
|
||||
|
||||
/// <summary>File version and processor architecture.</summary>
|
||||
public string Build =>
|
||||
(typeof(App).Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? Version) + Loc.Separator + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant();
|
||||
|
||||
public string Runtime => RuntimeInformation.FrameworkDescription;
|
||||
|
||||
public string OperatingSystem => RuntimeInformation.OSDescription;
|
||||
|
||||
public string DataFolder => Shell.Services.Environment.DataDirectory;
|
||||
|
||||
/// <summary>Every language but English is machine-translated and open to review (BRIEF §16).</summary>
|
||||
public bool IsTranslated => !Loc.Culture.TwoLetterISOLanguageName.Equals("en", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
public ICommand CheckCommand => _update.Check;
|
||||
public ICommand DownloadCommand => _update.Download;
|
||||
public ICommand ShowPackageCommand { get; }
|
||||
public ICommand CancelDownloadCommand { get; }
|
||||
public ICommand OpenReleasesCommand { get; }
|
||||
public ICommand OpenLicenceCommand { get; }
|
||||
public ICommand ReviewTranslationCommand { get; }
|
||||
public ICommand OpenDataFolderCommand { get; }
|
||||
public ICommand DiagnosticsCommand { get; }
|
||||
|
||||
/// <summary>"Up to date", "Chronos 0.2.0 available", …; null before the first check.</summary>
|
||||
public string? UpdateText => _update.State switch
|
||||
{
|
||||
UpdateState.Checking => Loc.L("About.Update.Checking"),
|
||||
UpdateState.UpToDate => Loc.L("About.Update.Current"),
|
||||
UpdateState.Available when _update.Release is { } r => Loc.L("About.Update.Available", UpdateCheck.Display(r.Version)),
|
||||
UpdateState.Failed => Loc.L("About.Update.Failed"),
|
||||
UpdateState.Downloading => Loc.L("About.Update.Downloading", _update.Downloaded),
|
||||
UpdateState.Downloaded when _update.Release is { } r => Loc.L("About.Update.Ready", UpdateCheck.Display(r.Version)),
|
||||
UpdateState.DownloadFailed => Loc.L("About.Update.DownloadFailed"),
|
||||
UpdateState.NotVerified => Loc.L("About.Update.NotVerified"),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>What screen readers announce: each new state, not each percent of a download.</summary>
|
||||
public string? UpdateAnnouncement => _update.State == UpdateState.Downloading ? Loc.L("About.Update.InProgress") : UpdateText;
|
||||
|
||||
public StatusKind UpdateKind => _update.State switch
|
||||
{
|
||||
UpdateState.Checking or UpdateState.Downloading => StatusKind.Running,
|
||||
UpdateState.UpToDate or UpdateState.Downloaded => StatusKind.Done,
|
||||
UpdateState.Available => StatusKind.Warning,
|
||||
_ => StatusKind.Error,
|
||||
};
|
||||
|
||||
public bool HasUpdateText => UpdateText is not null;
|
||||
|
||||
/// <summary>Download is offered: a newer release exists and no verified package is waiting (a failed download can be retried).</summary>
|
||||
public bool IsUpdateAvailable => _update.IsDownloadOffered;
|
||||
|
||||
/// <summary>The verified setup or portable zip is in the temporary folder.</summary>
|
||||
public bool IsPackageReady => _update.State == UpdateState.Downloaded;
|
||||
|
||||
public bool IsDownloading => _update.State == UpdateState.Downloading;
|
||||
|
||||
/// <summary>What Download does here: fetch and verify the setup or the portable zip (with its size), or open the release page.</summary>
|
||||
public string DownloadToolTip => _update.Package is { } package
|
||||
? Loc.L(_update.IsPortable ? "Tooltips.About.DownloadPortable" : "Tooltips.About.Download", Formatting.Bytes(package.Size))
|
||||
: Loc.L("Tooltips.About.DownloadPage");
|
||||
|
||||
public string ShowPackageToolTip => Loc.L(_update.IsPortable ? "Tooltips.About.ShowPortable" : "Tooltips.About.ShowSetup");
|
||||
|
||||
/// <summary>Starts the update check on start when allowed (opt-out, BRIEF §18); never in a capture run.</summary>
|
||||
public void Attach() => _ = NotifyAsync();
|
||||
|
||||
/// <summary>Sets a result without the network (capture, tests).</summary>
|
||||
internal void SetResult(ReleaseInfo? release, bool failed = false) => _update.SetResult(release, failed);
|
||||
|
||||
private async Task NotifyAsync()
|
||||
{
|
||||
if (await _update.CheckOnStartAsync(Shell.Services.Settings.CheckForUpdates) is not { } newer) return;
|
||||
Shell.Notify(Loc.L("About.Update.Available", UpdateCheck.Display(newer.Version)), actionText: Loc.L("About.Update.Download"),
|
||||
actionToolTip: DownloadToolTip, action: () => DownloadCommand.Execute(null));
|
||||
}
|
||||
|
||||
private async Task DiagnosticsAsync()
|
||||
{
|
||||
var folder = Shell.Services.Dialogs.PickFolder(Loc.L("Settings.Advanced.DiagnosticsTitle"));
|
||||
if (folder is null) return;
|
||||
try
|
||||
{
|
||||
var path = await DiagnosticsBundle.CreateAsync(Shell.Services, folder);
|
||||
Shell.Notify(Loc.L("Settings.Advanced.DiagnosticsDone"), Path.GetFileName(path), Loc.L("Library.Export.Show"), Loc.L("Tooltips.Library.ShowExport"), () => ShellActions.Reveal(path));
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or Chronos.Data.DatabaseException)
|
||||
{
|
||||
Shell.ReportError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void RaiseUpdate()
|
||||
{
|
||||
OnPropertyChanged(nameof(UpdateText));
|
||||
OnPropertyChanged(nameof(UpdateAnnouncement));
|
||||
OnPropertyChanged(nameof(UpdateKind));
|
||||
OnPropertyChanged(nameof(HasUpdateText));
|
||||
OnPropertyChanged(nameof(IsUpdateAvailable));
|
||||
OnPropertyChanged(nameof(IsPackageReady));
|
||||
OnPropertyChanged(nameof(IsDownloading));
|
||||
OnPropertyChanged(nameof(DownloadToolTip));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
@@ -102,13 +102,14 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Up to four digits (gap ≤ 1440) in 56 px: half the usual side padding. -->
|
||||
<!-- Up to four digits (gap ≤ 1440) in 56 px: half the usual side padding. A disabled box still says why in its tooltip. -->
|
||||
<Style x:Key="TextBox.Small" TargetType="TextBox" BasedOn="{StaticResource TextBox.Number}">
|
||||
<Setter Property="Width" Value="56" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="Padding" Value="4,0" />
|
||||
<Setter Property="Margin" Value="6,0" />
|
||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
</Style>
|
||||
|
||||
<!-- File paths and name templates stay left to right in every language (BRIEF §16). -->
|
||||
@@ -355,17 +356,27 @@
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<!-- A picked folder only: its sessions, or the whole folder as one sequence per format. -->
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Group}"
|
||||
Visibility="{Binding CanGroupFolder, Converter={StaticResource BoolToVisibility}}">
|
||||
<WrapPanel>
|
||||
<RadioButton Content="{l:Loc Import.Group.Sessions}" IsChecked="{Binding GroupBySessions}" ToolTip="{l:Loc Tooltips.Import.GroupSessions}" />
|
||||
<RadioButton Content="{l:Loc Import.Group.WholeFolder}" IsChecked="{Binding GroupWholeFolder}" ToolTip="{l:Loc Tooltips.Import.WholeFolder}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Scan}">
|
||||
<WrapPanel>
|
||||
<CheckBox Content="{l:Loc Import.Scan.Subfolders}" IsChecked="{Binding IncludeSubfolders}" ToolTip="{l:Loc Tooltips.Import.Subfolders}" />
|
||||
<CheckBox Content="{l:Loc Import.Scan.Sessions}" IsChecked="{Binding SplitSessions}" ToolTip="{l:Loc Tooltips.Import.Sessions}" />
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding SplitSessions}">
|
||||
<CheckBox Content="{l:Loc Import.Scan.Sessions}" IsChecked="{Binding SplitSessions}" IsEnabled="{Binding SessionsApply}"
|
||||
ToolTip="{Binding SessionsToolTip}" />
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding GapApplies}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Gap}" Style="{StaticResource Text.Unit}" />
|
||||
<TextBox x:Name="GapBox" Style="{StaticResource TextBox.Small}" Text="{Binding GapMinutes.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding GapMinutes}" ToolTip="{Binding GapMinutes.ToolTip}" AutomationProperties.Name="{l:Loc Import.Scan.GapName}" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minutes}" Style="{StaticResource Text.Unit}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}">
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding SessionsApply}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minimum}" Style="{StaticResource Text.Unit}" />
|
||||
<TextBox Style="{StaticResource TextBox.Small}" Text="{Binding MinimumFrames.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding MinimumFrames}" ToolTip="{Binding MinimumFrames.ToolTip}" AutomationProperties.Name="{l:Loc Import.Scan.MinimumName}" />
|
||||
|
||||
@@ -120,8 +120,10 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
// The path is checked only while Folder is the destination; typing one chooses Folder, as "…" does.
|
||||
FolderPath = new EditableField(string.Empty, text => IsFolderDestination ? ArchiveLocations.Validate(text) : null,
|
||||
text => Choices = _choices with { FolderPath = text, Destination = ImportDestinationKind.Folder }, () => Loc.L("Tooltips.Import.FolderPath"));
|
||||
GapMinutes = NumberField(1, 24 * 60, () => _choices.GapMinutes, n => Choices = _choices with { GapMinutes = n }, "Tooltips.Import.Gap");
|
||||
MinimumFrames = NumberField(1, 1000, () => _choices.MinimumFrames, n => Choices = _choices with { MinimumFrames = n }, "Tooltips.Import.MinimumFrames");
|
||||
GapMinutes = NumberField(1, 24 * 60, () => _choices.GapMinutes, n => Choices = _choices with { GapMinutes = n },
|
||||
() => SessionToolTip("Tooltips.Import.Gap"));
|
||||
MinimumFrames = NumberField(1, 1000, () => _choices.MinimumFrames, n => Choices = _choices with { MinimumFrames = n },
|
||||
() => SessionToolTip("Tooltips.Import.MinimumFrames"));
|
||||
FolderTemplate = new EditableField(_choices.FolderTemplate, t => NamingPreview.Validate(t, isFolder: true),
|
||||
t => Choices = _choices with { FolderTemplate = t }, () => Loc.L("Tooltips.Import.FolderTemplate"));
|
||||
FileTemplate = new EditableField(_choices.FileTemplate, t => NamingPreview.Validate(t, isFolder: false),
|
||||
@@ -264,6 +266,11 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
if (previous == value) return;
|
||||
_choices = value;
|
||||
if (value.Destination != previous.Destination) FolderPath.Refresh();
|
||||
if (value.Grouping != previous.Grouping)
|
||||
{
|
||||
GapMinutes.Refresh();
|
||||
MinimumFrames.Refresh();
|
||||
}
|
||||
OnPropertyChanged(string.Empty);
|
||||
if (value.NeedsNewPlan(previous) || (value.TitlesChangeNames != previous.TitlesChangeNames && _titles.Count > 0)) SchedulePlan();
|
||||
else ApplyPlan();
|
||||
@@ -320,6 +327,37 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
set => Choices = _choices with { IncludeSubfolders = value };
|
||||
}
|
||||
|
||||
/// <summary>"Group" is offered for a picked folder only (BRIEF §12.4): a card or a drive always splits into sessions.</summary>
|
||||
public bool CanGroupFolder => _selected?.Kind == SourceKind.Folder;
|
||||
|
||||
public bool GroupBySessions
|
||||
{
|
||||
get => !IsWholeFolder;
|
||||
set
|
||||
{
|
||||
if (value) SetGrouping(ImportGrouping.Sessions);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The picked folder is one sequence per format: camera bodies and pauses are ignored.</summary>
|
||||
public bool GroupWholeFolder
|
||||
{
|
||||
get => IsWholeFolder;
|
||||
set
|
||||
{
|
||||
if (value && CanGroupFolder) SetGrouping(ImportGrouping.WholeFolder);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsWholeFolder => CanGroupFolder && _choices.Grouping == ImportGrouping.WholeFolder;
|
||||
|
||||
/// <summary>Sessions, their gap and their minimum do not apply to a whole folder.</summary>
|
||||
public bool SessionsApply => !IsWholeFolder;
|
||||
|
||||
public bool GapApplies => SessionsApply && _choices.SplitSessions;
|
||||
|
||||
public string SessionsToolTip => SessionToolTip("Tooltips.Import.Sessions");
|
||||
|
||||
public bool SplitSessions
|
||||
{
|
||||
get => _choices.SplitSessions;
|
||||
@@ -340,6 +378,18 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
public IReadOnlyList<TokenItem> Tokens { get; }
|
||||
public ICommand InsertTokenCommand { get; }
|
||||
|
||||
private void SetGrouping(ImportGrouping grouping)
|
||||
{
|
||||
if (_choices.Grouping == grouping) return;
|
||||
// Splits and merges were made on the other grouping's sessions.
|
||||
_splits.Clear();
|
||||
_merges.Clear();
|
||||
Choices = _choices with { Grouping = grouping };
|
||||
}
|
||||
|
||||
/// <summary>A session control's tooltip, or why it does not apply to a whole folder.</summary>
|
||||
private string SessionToolTip(string key) => IsWholeFolder ? Loc.L("Import.Blocked.WholeFolder") : Loc.L(key);
|
||||
|
||||
/// <summary>The view tells which template field the "{ }" menu writes into.</summary>
|
||||
public void SetActiveTemplate(bool folder) => _activeTemplateIsFolder = folder;
|
||||
|
||||
@@ -966,7 +1016,8 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
{
|
||||
if (!cts.IsCancellationRequested) SetStatus(ImportPhase.Planning, Loc.Plural("Import.Status.ReadingCount", n));
|
||||
});
|
||||
var options = _choices.ToOptions(_titles, _splits, _merges);
|
||||
// A card or a drive is always planned by sessions, whatever a folder chose before.
|
||||
var options = _choices.ToOptions(_titles, _splits, _merges) with { Grouping = IsWholeFolder ? ImportGrouping.WholeFolder : ImportGrouping.Sessions };
|
||||
var cardId = _selected.Kind == SourceKind.Card ? await RegisteredCardIdAsync() : null;
|
||||
try
|
||||
{
|
||||
@@ -1083,7 +1134,10 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
else ApplyPlan();
|
||||
}
|
||||
|
||||
/// <summary>Joins a session to the earlier one of the same camera and format (BRIEF §13: merge in the plan).</summary>
|
||||
/// <summary>
|
||||
/// Joins a session to the earlier one of the same camera and format, or for a whole folder of the same format
|
||||
/// (BRIEF §13: merge in the plan).
|
||||
/// </summary>
|
||||
private void Merge(PlanSessionRow row)
|
||||
{
|
||||
_splits.Remove(row.FirstPath);
|
||||
@@ -1456,11 +1510,11 @@ public sealed class ImportViewModel : SectionViewModel
|
||||
else dispatcher.BeginInvoke(action);
|
||||
}
|
||||
|
||||
private static EditableField NumberField(int min, int max, Func<int> current, Action<int> commit, string toolTipKey) =>
|
||||
private static EditableField NumberField(int min, int max, Func<int> current, Action<int> commit, Func<string> toolTip) =>
|
||||
new(current().ToString(Loc.Culture),
|
||||
text => int.TryParse(text.Trim(), NumberStyles.Integer, Loc.Culture, out var n) && n >= min && n <= max
|
||||
? null
|
||||
: Loc.L("Errors.Number.Range", min.ToString("N0", Loc.Culture), max.ToString("N0", Loc.Culture)),
|
||||
text => commit(int.Parse(text.Trim(), NumberStyles.Integer, Loc.Culture)),
|
||||
() => Loc.L(toolTipKey));
|
||||
toolTip);
|
||||
}
|
||||
@@ -583,6 +583,8 @@
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc About.Update.ShowFile}" Command="{Binding Shell.About.ShowPackageCommand}" ToolTip="{Binding Shell.About.ShowPackageToolTip}"
|
||||
VerticalAlignment="Center" Margin="12,0,0,0" FontSize="13"
|
||||
Visibility="{Binding Shell.About.IsPackageReady, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc About.Releases}" Command="{Binding Shell.About.OpenReleasesCommand}" ToolTip="{l:Loc Tooltips.About.Releases}"
|
||||
VerticalAlignment="Center" Margin="12,0,0,0" FontSize="13" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
@@ -646,6 +648,46 @@
|
||||
ToolTip="{l:Loc Tooltips.Settings.ResetAll}" />
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ================= About ================= -->
|
||||
<!-- BRIEF §12.9, the last page (owner review 2, R5): this copy only. The update check is on Updates, the data folder and the
|
||||
diagnostics bundle on Advanced, so nothing is offered twice. Versions, names and paths read left to right (DESIGN §5). -->
|
||||
<StackPanel Style="{StaticResource Page}" Visibility="{Binding Page, Converter={x:Static shell:EqualsToVisibilityConverter.Instance}, ConverterParameter=About}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
||||
<ui:BrandMarkIcon Width="40" Height="40" ShowPlate="True" />
|
||||
<StackPanel Margin="14,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Shell.AppName}" Style="{StaticResource Text.Title}" />
|
||||
<TextBlock Text="{Binding Shell.About.Version}" Style="{StaticResource Text.Secondary}" Margin="0,2,0,0" HorizontalAlignment="Left" FlowDirection="LeftToRight"
|
||||
Typography.NumeralAlignment="Tabular" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Build}">
|
||||
<TextBlock Text="{Binding Shell.About.Build}" HorizontalAlignment="Left" FlowDirection="LeftToRight" Typography.NumeralAlignment="Tabular" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Runtime}">
|
||||
<TextBlock Text="{Binding Shell.About.Runtime}" HorizontalAlignment="Left" FlowDirection="LeftToRight" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.System}">
|
||||
<TextBlock Text="{Binding Shell.About.OperatingSystem}" ToolTip="{Binding Shell.About.OperatingSystem}" HorizontalAlignment="Left" FlowDirection="LeftToRight"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Licence}">
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" HorizontalAlignment="Left" Content="{l:Loc About.LicenceLink}" Command="{Binding Shell.About.OpenLicenceCommand}"
|
||||
ToolTip="{l:Loc Tooltips.About.Licence}" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.ThirdParty}">
|
||||
<TextBlock Text="{l:Loc About.ThirdPartyNone}" ToolTip="{l:Loc Tooltips.About.ThirdParty}" HorizontalAlignment="Left" />
|
||||
</HeaderedContentControl>
|
||||
<!-- Every language but English is machine-translated (BRIEF §16). -->
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc About.Translation}"
|
||||
Visibility="{Binding Shell.About.IsTranslated, Converter={StaticResource BoolToVisibility}}">
|
||||
<WrapPanel>
|
||||
<TextBlock Text="{l:Loc About.MachineTranslated}" VerticalAlignment="Center" />
|
||||
<Button Style="{StaticResource Button.Link}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" Content="{l:Loc About.Review}"
|
||||
Command="{Binding Shell.About.ReviewTranslationCommand}" ToolTip="{l:Loc Tooltips.About.Review}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace Chronos.App.Sections;
|
||||
/// Archive rows show and change the open archive's own settings (archive.json, through the archive engine) and are the
|
||||
/// defaults of new archives; Import and Analysis feed the defaults of new cards and the analysis jobs; Rendering feeds
|
||||
/// the jobs from the next one on; Formats lists the decode tier per format on this PC with the codec extensions to
|
||||
/// install; Advanced restores the index from a daily backup at the next start.
|
||||
/// install; Advanced restores the index from a daily backup at the next start; About, the last page, shows this copy
|
||||
/// (<see cref="ShellViewModel.About"/>, whose update notice Updates shows).
|
||||
/// </summary>
|
||||
public sealed class SettingsViewModel : SectionViewModel
|
||||
{
|
||||
@@ -81,9 +82,12 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
new(SettingsPage.Formats, ["Settings.Formats.Title", "Settings.Formats.Column.Tier", "Settings.Formats.Install"]),
|
||||
new(SettingsPage.Storage, ["Settings.Storage.Folder", "Settings.Storage.Thumbnails", "Settings.Storage.Limit"]),
|
||||
new(SettingsPage.Server, ["Settings.Server.Default", "Settings.Server.RenderNode", "Settings.Server.Certificates"]),
|
||||
new(SettingsPage.Updates, ["Settings.General.CheckOnStart"]),
|
||||
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.Diagnostics", "Settings.Advanced.Backup",
|
||||
"Settings.Advanced.Restore", "Settings.Advanced.Reset"]),
|
||||
// The translation row shows outside English only, and the language changes while Settings is open.
|
||||
new(SettingsPage.About, () => ["Shell.AppName", "About.Build", "About.Runtime", "About.System", "About.Licence", "About.ThirdParty",
|
||||
.. Shell.About.IsTranslated ? (string[])["About.Translation"] : []]),
|
||||
];
|
||||
_visiblePages = AllPages;
|
||||
|
||||
@@ -802,8 +806,11 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
|
||||
public ICommand ResetSectionCommand { get; }
|
||||
|
||||
/// <summary>Advanced holds no setting with a default (paths and actions only) and Formats only shows this PC: they have no Reset section.</summary>
|
||||
public bool CanResetSection => _page is not (SettingsPage.Advanced or SettingsPage.Formats);
|
||||
/// <summary>
|
||||
/// Advanced holds no setting with a default (paths and actions only), Formats only shows this PC and About only this
|
||||
/// copy: they have no Reset section.
|
||||
/// </summary>
|
||||
public bool CanResetSection => _page is not (SettingsPage.Advanced or SettingsPage.Formats or SettingsPage.About);
|
||||
public ICommand ExportSettingsCommand { get; }
|
||||
public ICommand ImportSettingsCommand { get; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user