merge: phase 5 parcel P6
This commit is contained in:
commit
b9d5d384e2
12 files changed
+1663
-336
No files matched your search
@@ -1,17 +0,0 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Chronos.App.Editor;
|
||||
|
||||
/// <summary>Columns of the Export tab's preset grid: as many as fit at <see cref="MinCardWidth"/> (four at 1440 px, three at 1200 px).</summary>
|
||||
public sealed class CardColumns : IValueConverter
|
||||
{
|
||||
public const double MinCardWidth = 200;
|
||||
|
||||
public static CardColumns Instance { get; } = new();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
|
||||
value is double width && double.IsFinite(width) ? int.Max(1, (int)(width / MinCardWidth)) : 4;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<!--
|
||||
The measuring tool of each step, below the filmstrip (BRIEF §12.3): the Analysis step's findings, luminance, flicker
|
||||
and waveform, camera path and sky charts, the frame table, the keyframe and time-remap curve editors with the plan
|
||||
chart, and the Export step's preset cards. Clicking a chart seeks the preview.
|
||||
chart, and the Export step's preset table. Clicking a chart seeks the preview.
|
||||
-->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Chronos;component/Editor/EditorStyles.xaml" />
|
||||
@@ -272,44 +272,80 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Export: preset cards at least 200 px wide (four per row in Export.html at 1440 px, three at 1200 px). -->
|
||||
<!--
|
||||
Export: the preset table (owner review 1, R3; decision 3). Column headers, then each preset group behind a header that
|
||||
opens or closes it, one 28 px row per preset: the batch tick, the name with the Recommended chip, size, codec, fps and
|
||||
the two estimates. Clicking a row selects the preset; the tick adds it to the batch.
|
||||
-->
|
||||
<DataTemplate DataType="{x:Type e:PresetRow}">
|
||||
<!-- Disabled while a job runs or the project cannot change: the row's tooltip says why. -->
|
||||
<Button Style="{StaticResource Button.PresetRow}" Command="{Binding SelectCommand}" CommandParameter="{Binding}" ToolTip="{Binding ToolTip}"
|
||||
AutomationProperties.Name="{Binding Name}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Tick}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Size}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Codec}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Fps}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.EstimatedSize}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.EstimatedTime}" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsInBatch}" Visibility="{Binding CanBatch, Converter={StaticResource BoolToVisibility}}" VerticalAlignment="Center"
|
||||
ToolTip="{Binding BatchToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Export.InBatch}" />
|
||||
<DockPanel Grid.Column="1" Margin="0,0,8,0">
|
||||
<Border DockPanel.Dock="Right" Style="{StaticResource Border.Recommended}" Visibility="{Binding IsRecommended, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{l:Loc Editor.Export.Recommended}" FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.Accent}" />
|
||||
</Border>
|
||||
<TextBlock x:Name="Name" Text="{Binding Name}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Size}" Style="{StaticResource Text.Cell}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<TextBlock Grid.Column="3" Text="{Binding Codec}" Style="{StaticResource Text.Cell}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<TextBlock Grid.Column="4" Text="{Binding Fps}" Style="{StaticResource Text.Cell}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<TextBlock Grid.Column="5" Text="{Binding EstimatedSize}" Style="{StaticResource Text.Cell}" FontSize="{StaticResource Size.Secondary}" />
|
||||
<TextBlock Grid.Column="6" Text="{Binding EstimatedTime}" Style="{StaticResource Text.Cell}" FontSize="{StaticResource Size.Secondary}" />
|
||||
</Grid>
|
||||
</Button>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSelected}" Value="True">
|
||||
<Setter TargetName="Name" Property="FontWeight" Value="SemiBold" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type e:PresetGroup}">
|
||||
<StackPanel Margin="0,0,0,2">
|
||||
<ToggleButton Style="{StaticResource ToggleButton.Group}" IsChecked="{Binding IsExpanded}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Name}">
|
||||
<TextBlock Text="{Binding Header}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
||||
</ToggleButton>
|
||||
<ItemsControl ItemsSource="{Binding Rows}" Focusable="False" Visibility="{Binding IsExpanded, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type e:ExportTab}">
|
||||
<ScrollViewer Margin="0,10,0,0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
|
||||
<ItemsControl ItemsSource="{Binding Cards}" Focusable="False" IsEnabled="{Binding Editor.IsEditable}" Margin="-5,0,-5,0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ItemsControl}, Converter={x:Static e:CardColumns.Instance}}" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type e:PresetCard}">
|
||||
<!-- Disabled while a job runs or the project cannot change: the card's tooltip says why. -->
|
||||
<Button Style="{StaticResource Button.PresetCard}" Command="{Binding SelectCommand}" CommandParameter="{Binding}" ToolTip="{Binding ToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{Binding Name}">
|
||||
<DockPanel>
|
||||
<!-- The chip moves under the name when both do not fit on one line. -->
|
||||
<WrapPanel DockPanel.Dock="Top">
|
||||
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Margin="0,0,8,0" />
|
||||
<Border Style="{StaticResource Border.Recommended}" Margin="0" Visibility="{Binding IsRecommended, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{l:Loc Editor.Export.Recommended}" FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.Accent}" />
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
<DockPanel DockPanel.Dock="Bottom">
|
||||
<CheckBox DockPanel.Dock="Right" IsChecked="{Binding IsInBatch}" Visibility="{Binding CanBatch, Converter={StaticResource BoolToVisibility}}"
|
||||
ToolTip="{Binding BatchToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Export.InBatch}" Margin="6,0,0,0" />
|
||||
<TextBlock Text="{Binding Estimate}" FontSize="{StaticResource Size.Secondary}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
|
||||
Typography.NumeralAlignment="Tabular" />
|
||||
</DockPanel>
|
||||
<StackPanel Margin="0,4,0,0">
|
||||
<TextBlock Text="{Binding Format}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{Binding Encoding}" FontSize="{StaticResource Size.Secondary}" Foreground="{DynamicResource Brush.TextMuted}" TextTrimming="CharacterEllipsis"
|
||||
Margin="0,4,0,0" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="10,6,10,6" Margin="0,10,0,0">
|
||||
<DockPanel>
|
||||
<Grid DockPanel.Dock="Top" Margin="6,0,6,2" MinHeight="24">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Tick}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Size}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Codec}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.Fps}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.EstimatedSize}" />
|
||||
<ColumnDefinition Width="{StaticResource Export.Column.EstimatedTime}" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Export.Column.Name}" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Export.Column.Size}" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Export.Column.Codec}" />
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.Header}" Text="{l:Loc Export.Column.Fps}" />
|
||||
<TextBlock Grid.Column="5" Style="{StaticResource Text.Header}" Text="{l:Loc Export.Column.EstimatedSize}" />
|
||||
<TextBlock Grid.Column="6" Style="{StaticResource Text.Header}" Text="{l:Loc Export.Column.EstimatedTime}" />
|
||||
</Grid>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
|
||||
<ItemsControl ItemsSource="{Binding PresetGroups}" Focusable="False" />
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -371,51 +371,76 @@
|
||||
</ContentControl>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Export: the Output panel (Export.html aside). -->
|
||||
<!--
|
||||
A collapsible group's header (owner review 1, R3; DESIGN §4): the name in Text.Body 600 and, while the group is collapsed,
|
||||
the muted one-line summary of its values. Open or closed is kept per group by the app, not in the project.
|
||||
-->
|
||||
<DataTemplate DataType="{x:Type e:SettingGroup}">
|
||||
<ToggleButton Style="{StaticResource ToggleButton.Group}" IsChecked="{Binding IsExpanded}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Header}"
|
||||
Margin="-2,4,0,4">
|
||||
<DockPanel>
|
||||
<TextBlock Text="{Binding Header}" FontWeight="SemiBold" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding Summary}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Secondary}" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis" Visibility="{Binding IsExpanded, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
</DockPanel>
|
||||
</ToggleButton>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- A playback choice the export cannot take now (Boomerang with star trails): disabled, its reason in the tooltip. -->
|
||||
<Style x:Key="ComboBoxItem.Gated" TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsAvailable}" />
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Label}" />
|
||||
<Setter Property="AutomationProperties.HelpText" Value="{Binding ToolTip}" />
|
||||
</Style>
|
||||
|
||||
<!--
|
||||
Export: the Output panel (Export.html aside; owner review 1, R3). The title, then four collapsible groups that scroll
|
||||
(Output, Encoding, Playback, File) with the notices, and a fixed footer: the result line, Render now, Add to queue,
|
||||
Batch (n), and the Videos (n), Reveal and Send again links.
|
||||
-->
|
||||
<DataTemplate DataType="{x:Type e:ExportTab}">
|
||||
<Border Style="{StaticResource Border.EditorPanel}">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{Binding Title}" Style="{StaticResource Text.Section}" Margin="0,0,0,12" TextTrimming="CharacterEllipsis" />
|
||||
<StackPanel DockPanel.Dock="Bottom" Margin="0,12,0,0">
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{l:Loc Editor.Export.AddToQueue}" Command="{Binding AddToQueueCommand}" ToolTip="{Binding AddToQueueToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<Button Grid.Column="1" Content="{l:Loc Editor.Export.Batch}" Margin="8,0,0,0" Command="{Binding BatchCommand}" ToolTip="{Binding BatchToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
</Grid>
|
||||
<Button Style="{StaticResource Button.Primary}" Height="36" Content="{l:Loc Editor.Export.RenderNow}" Command="{Binding RenderNowCommand}"
|
||||
ToolTip="{Binding Editor.RenderToolTip}" ToolTipService.ShowOnDisabled="True" />
|
||||
<DockPanel Margin="0,8,0,0">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.HistoryLink}" Command="{Binding HistoryCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Export.History}" Margin="6,0,0,0" Visibility="{Binding CanOpenHistory, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.Reveal}" Command="{Binding RevealLastCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Render.Reveal}" Margin="6,0,0,0" Visibility="{Binding CanReveal, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Render.SendAgain}" Command="{Binding SendAgainCommand}"
|
||||
ToolTip="{Binding SendAgainToolTip}" ToolTipService.ShowOnDisabled="True" Margin="6,0,0,0"
|
||||
Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock DockPanel.Dock="Right" Text="{l:Loc Editor.Render.NotSent}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}"
|
||||
VerticalAlignment="Center" Margin="6,0,0,0" ToolTip="{Binding UnsentToolTip}"
|
||||
Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Text="{Binding HistoryText}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
|
||||
ToolTip="{Binding HistoryText}" />
|
||||
</DockPanel>
|
||||
<!-- A .chronos project file that opens this sequence with these settings (BRIEF §18). -->
|
||||
<Button Style="{StaticResource Button.Link}" HorizontalAlignment="Left" Margin="0,8,0,0" Content="{l:Loc Editor.ProjectFile.Save}"
|
||||
Command="{Binding SaveProjectCommand}" ToolTip="{Binding SaveProjectToolTip}" ToolTipService.ShowOnDisabled="True" />
|
||||
<!-- This PC's settings kept by "Save both" (sync conflicts): the newest, or another from the menu, becomes the project as one undo step. -->
|
||||
<v:SplitButton Margin="0,8,0,0" HorizontalAlignment="Left" Content="{Binding RestoreText}" Command="{Binding RestoreCommand}"
|
||||
ItemsSource="{Binding SavedCopies}" DisplayMemberPath="Label" SelectedItem="{Binding SelectedCopy}" ToolTip="{Binding RestoreToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
DropDownToolTip="{l:Loc Tooltips.Editor.Export.RestoreChoice}" AutomationProperties.Name="{l:Loc Editor.Export.RestoreName}"
|
||||
Visibility="{Binding HasSavedCopies, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{Binding Title}" Style="{StaticResource Text.Section}" Margin="0,0,0,6" TextTrimming="CharacterEllipsis" />
|
||||
|
||||
<Border DockPanel.Dock="Bottom" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" Margin="0,8,0,0" Padding="0,10,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding FooterSummary}" TextWrapping="Wrap" MaxHeight="36" TextTrimming="CharacterEllipsis" FontSize="{StaticResource Size.Secondary}"
|
||||
Foreground="{DynamicResource Brush.TextMuted}" Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Export.Footer.Summary}" />
|
||||
<Button Style="{StaticResource Button.Primary}" Height="36" Margin="0,8,0,0" Content="{l:Loc Editor.Export.RenderNow}" Command="{Binding RenderNowCommand}"
|
||||
ToolTip="{Binding Editor.RenderToolTip}" ToolTipService.ShowOnDisabled="True" />
|
||||
<Grid Margin="0,8,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{l:Loc Editor.Export.AddToQueue}" Command="{Binding AddToQueueCommand}" ToolTip="{Binding AddToQueueToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<Button Grid.Column="1" Content="{Binding BatchText}" Margin="8,0,0,0" Command="{Binding BatchCommand}" ToolTip="{Binding BatchToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
</Grid>
|
||||
<WrapPanel Margin="0,8,0,0">
|
||||
<Button Style="{StaticResource Button.Link}" Content="{Binding VideosText}" Command="{Binding VideosCommand}" ToolTip="{l:Loc Tooltips.Export.Footer.Videos}"
|
||||
ToolTipService.ShowOnDisabled="True" Margin="0,0,12,0" />
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.Reveal}" Command="{Binding RevealLastCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Render.Reveal}" Margin="0,0,12,0" Visibility="{Binding CanReveal, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Render.SendAgain}" Command="{Binding SendAgainCommand}"
|
||||
ToolTip="{Binding SendAgainToolTip}" ToolTipService.ShowOnDisabled="True" Margin="0,0,6,0"
|
||||
Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Text="{l:Loc Editor.Render.NotSent}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}" VerticalAlignment="Center"
|
||||
ToolTip="{Binding UnsentToolTip}" Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
|
||||
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<!-- ===== Output ===== -->
|
||||
<ContentControl Content="{Binding OutputGroup}" Focusable="False" />
|
||||
<Grid Margin="0,4,0,8" IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
Visibility="{Binding OutputGroup.IsExpanded, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Editor.Grid.Label}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
@@ -428,10 +453,6 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Container}" ToolTip="{l:Loc Editor.Export.Container}" />
|
||||
<ComboBox Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Containers}" SelectedItem="{Binding SelectedContainer}" DisplayMemberPath="Label"
|
||||
@@ -441,8 +462,12 @@
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding CodecChoices}" SelectedItem="{Binding SelectedCodec}" DisplayMemberPath="Label"
|
||||
ToolTip="{l:Loc Tooltips.Editor.Export.Codec}" AutomationProperties.Name="{l:Loc Editor.Export.Codec}" />
|
||||
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Resolution}" ToolTip="{l:Loc Editor.Export.Resolution}" />
|
||||
<Grid Grid.Row="2" Grid.Column="1" Margin="0,0,0,8">
|
||||
<!-- A standard size fitted to the chosen proportions (4K at 9:16 = 2160×3840), or Custom with Width × Height. -->
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc Export.Resolution.Standard}" ToolTip="{l:Loc Export.Resolution.Standard}" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Resolutions}" SelectedItem="{Binding SelectedResolution}" DisplayMemberPath="Label"
|
||||
ToolTip="{l:Loc Tooltips.Export.Resolution}" AutomationProperties.Name="{l:Loc Export.Resolution.Standard}" />
|
||||
|
||||
<Grid Grid.Row="3" Grid.Column="1" Margin="0,0,0,8" Visibility="{Binding IsCustomResolution, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="56" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -458,12 +483,12 @@
|
||||
</Grid>
|
||||
|
||||
<!-- What is rendered: the chosen proportions fitted in the box above (owner review 1, R5), "(capped)" when the encoder shrinks it. -->
|
||||
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.OutputSize}" ToolTip="{l:Loc Editor.Export.OutputSize}" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Margin="0,0,0,8" MinHeight="24" Style="{StaticResource Text.Number}" Text="{Binding OutputSizeText}"
|
||||
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.OutputSize}" ToolTip="{l:Loc Editor.Export.OutputSize}" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Margin="0,0,0,8" MinHeight="24" Style="{StaticResource Text.Number}" Text="{Binding OutputSizeText}"
|
||||
ToolTip="{Binding OutputSizeToolTip}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
|
||||
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FrameRate}" ToolTip="{l:Loc Editor.Export.FrameRate}" />
|
||||
<Grid Grid.Row="4" Grid.Column="1" Margin="0,0,0,8">
|
||||
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FrameRate}" ToolTip="{l:Loc Editor.Export.FrameRate}" />
|
||||
<Grid Grid.Row="5" Grid.Column="1" Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -479,23 +504,30 @@
|
||||
Visibility="{Binding IsFrameRateAuto, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Quality}" ToolTip="{l:Loc Editor.Export.Quality}" />
|
||||
<Grid Grid.Row="5" Grid.Column="1" Margin="0,0,0,8" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="64" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Minimum="1" Maximum="{Binding QualityMaximum}" SmallChange="1" LargeChange="5" IsSnapToTickEnabled="True" TickFrequency="1" Value="{Binding Quality}"
|
||||
IsEnabled="{Binding IsQualityApplicable}" ToolTip="{Binding QualityToolTip}" AutomationProperties.Name="{l:Loc Editor.Export.Quality}"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.RowValue}" Text="{Binding QualityText}" Margin="8,0,0,0"
|
||||
Visibility="{Binding IsQualityApplicable, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.NotApplicable}" Text="{l:Loc Common.NotApplicable}" ToolTip="{Binding QualityNotApplicable}" Margin="8,0,0,0"
|
||||
Visibility="{Binding IsQualityApplicable, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Colour}" ToolTip="{l:Loc Editor.Export.Colour}" />
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" ItemsSource="{Binding Depths}" SelectedItem="{Binding SelectedDepth}" DisplayMemberPath="Label"
|
||||
IsEnabled="{Binding CanChooseDepth}" ToolTip="{l:Loc Tooltips.Editor.Export.Colour}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Editor.Export.Colour}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Encoder}" ToolTip="{l:Loc Editor.Export.Encoder}" />
|
||||
<Grid Grid.Row="6" Grid.Column="1" Margin="0,0,0,8">
|
||||
<!-- ===== Encoding (owner review 1, R8: rate control, keyframes, B-frames, profile over the existing overrides) ===== -->
|
||||
<ContentControl Content="{Binding EncodingGroup}" Focusable="False" />
|
||||
<Grid Margin="0,4,0,8" IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
Visibility="{Binding EncodingGroup.IsExpanded, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Editor.Grid.Label}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Encoder}" ToolTip="{l:Loc Editor.Export.Encoder}" />
|
||||
<Grid Grid.Column="1" Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -516,18 +548,164 @@
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="7" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Colour}" ToolTip="{l:Loc Editor.Export.Colour}" />
|
||||
<ComboBox Grid.Row="7" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Depths}" SelectedItem="{Binding SelectedDepth}" DisplayMemberPath="Label"
|
||||
IsEnabled="{Binding CanChooseDepth}" ToolTip="{l:Loc Tooltips.Editor.Export.Colour}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Editor.Export.Colour}" />
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc Export.RateControl}" ToolTip="{l:Loc Export.RateControl}" />
|
||||
<Grid Grid.Row="1" Grid.Column="1" Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding RateControls}" SelectedItem="{Binding SelectedRateControl}" DisplayMemberPath="Label" IsEnabled="{Binding HasRateControl}"
|
||||
ToolTip="{Binding RateControlToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Export.RateControl}" />
|
||||
<Button Grid.Column="1" Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="8,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Reset}"
|
||||
Command="{Binding ResetRateControlCommand}" ToolTip="{l:Loc Tooltips.Export.ResetValue}" AutomationProperties.Name="{l:Loc Editor.ResetToAuto}"
|
||||
Visibility="{Binding IsRateControlSet, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="8" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FileName}" ToolTip="{l:Loc Editor.Export.FileName}" />
|
||||
<TextBox Grid.Row="8" Grid.Column="1" Margin="0,0,0,8" Text="{Binding NameTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
<!-- Bit rate (variable, constant) or quality 1–100 (quality rate control, JPEG, MJPEG, GIF); the label says which. -->
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{Binding QualityHeader}" ToolTip="{Binding QualityHeader}" />
|
||||
<Grid Grid.Row="2" Grid.Column="1" Margin="0,0,0,8" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="64" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Minimum="1" Maximum="{Binding QualityMaximum}" SmallChange="1" LargeChange="5" IsSnapToTickEnabled="True" TickFrequency="1" Value="{Binding Quality}"
|
||||
IsEnabled="{Binding IsQualityApplicable}" ToolTip="{Binding QualityToolTip}" AutomationProperties.Name="{Binding QualityHeader}"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.RowValue}" Text="{Binding QualityText}" Margin="8,0,0,0"
|
||||
Visibility="{Binding IsQualityApplicable, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.NotApplicable}" Text="{l:Loc Common.NotApplicable}" ToolTip="{Binding QualityNotApplicable}" Margin="8,0,0,0"
|
||||
Visibility="{Binding IsQualityApplicable, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<Button Grid.Column="2" Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="4,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Reset}"
|
||||
Command="{Binding ResetQualityCommand}" ToolTip="{l:Loc Tooltips.Export.ResetValue}" AutomationProperties.Name="{l:Loc Editor.ResetToAuto}"
|
||||
Visibility="{Binding IsQualitySet, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc Export.Keyframes}" ToolTip="{l:Loc Export.Keyframes}" />
|
||||
<ComboBox Grid.Row="3" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding KeyframeChoices}" SelectedItem="{Binding SelectedKeyframes}" DisplayMemberPath="Label"
|
||||
IsEnabled="{Binding HasRateControl}" ToolTip="{Binding KeyframesToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Export.Keyframes}" />
|
||||
|
||||
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc Export.BFrames}" ToolTip="{l:Loc Export.BFrames}" />
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding BFrameChoices}" SelectedItem="{Binding SelectedBFrames}" DisplayMemberPath="Label"
|
||||
IsEnabled="{Binding CanChooseBFrames}" ToolTip="{Binding BFramesToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
AutomationProperties.Name="{l:Loc Export.BFrames}" />
|
||||
|
||||
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc Export.Profile}" ToolTip="{l:Loc Export.Profile}" />
|
||||
<Grid Grid.Row="5" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding ProfileChoices}" SelectedItem="{Binding SelectedProfile}" DisplayMemberPath="Label" IsEnabled="{Binding CanChooseProfile}"
|
||||
ToolTip="{Binding ProfileToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Export.Profile}" />
|
||||
<Button Grid.Column="1" Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="8,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Reset}"
|
||||
Command="{Binding ResetProfileCommand}" ToolTip="{l:Loc Tooltips.Export.ResetValue}" AutomationProperties.Name="{l:Loc Editor.ResetToAuto}"
|
||||
Visibility="{Binding IsProfileSet, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- ===== Playback (owner review 1, R8; settings format 3 while it is not forward, once, without fades or hold) ===== -->
|
||||
<ContentControl Content="{Binding PlaybackGroup}" Focusable="False" />
|
||||
<Grid Margin="0,4,0,8" IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
Visibility="{Binding PlaybackGroup.IsExpanded, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Editor.Grid.Label}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Export.Direction}" ToolTip="{l:Loc Export.Direction}" />
|
||||
<Grid Grid.Column="1" Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding Directions}" SelectedItem="{Binding SelectedDirection}" DisplayMemberPath="Label" ItemContainerStyle="{StaticResource ComboBoxItem.Gated}"
|
||||
ToolTip="{l:Loc Tooltips.Export.Direction}" AutomationProperties.Name="{l:Loc Export.Direction}" />
|
||||
<Button Grid.Column="1" Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="8,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Reset}"
|
||||
Command="{Binding ResetPlaybackCommand}" ToolTip="{l:Loc Tooltips.Export.PlaybackReset}" AutomationProperties.Name="{l:Loc Editor.ResetToAuto}"
|
||||
Visibility="{Binding IsPlaybackDefault, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc Export.Loops}" ToolTip="{l:Loc Export.Loops}" />
|
||||
<Grid Grid.Row="1" Grid.Column="1" Margin="0,0,0,8" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="52" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Minimum="1" Maximum="10" SmallChange="1" LargeChange="1" IsSnapToTickEnabled="True" TickFrequency="1" Value="{Binding Loops}"
|
||||
ToolTip="{l:Loc Tooltips.Export.Loops}" AutomationProperties.Name="{l:Loc Export.Loops}" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.RowValue}" Text="{Binding LoopsText}" Margin="8,0,0,0" />
|
||||
</Grid>
|
||||
|
||||
<!-- Fades and hold: a 0–10 s slider in steps of 0.5, and the exact seconds typed (fades up to 30 s, hold up to 60 s). -->
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource Text.Label}" Text="{l:Loc Export.FadeIn}" ToolTip="{l:Loc Export.FadeIn}" />
|
||||
<Grid Grid.Row="2" Grid.Column="1" Margin="0,0,0,8" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="52" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Minimum="0" Maximum="10" SmallChange="0.5" LargeChange="1" IsSnapToTickEnabled="True" TickFrequency="0.5" Value="{Binding FadeIn}"
|
||||
ToolTip="{l:Loc Tooltips.Export.FadeIn}" AutomationProperties.Name="{l:Loc Export.FadeIn}" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Number}" Width="NaN" Margin="8,0,0,0"
|
||||
Text="{Binding FadeInField.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding FadeInField}"
|
||||
ToolTip="{Binding FadeInField.ToolTip}" AutomationProperties.Name="{l:Loc Export.FadeIn}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="3" Style="{StaticResource Text.Label}" Text="{l:Loc Export.FadeOut}" ToolTip="{l:Loc Export.FadeOut}" />
|
||||
<Grid Grid.Row="3" Grid.Column="1" Margin="0,0,0,8" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="52" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Minimum="0" Maximum="10" SmallChange="0.5" LargeChange="1" IsSnapToTickEnabled="True" TickFrequency="0.5" Value="{Binding FadeOut}"
|
||||
ToolTip="{l:Loc Tooltips.Export.FadeOut}" AutomationProperties.Name="{l:Loc Export.FadeOut}" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Number}" Width="NaN" Margin="8,0,0,0"
|
||||
Text="{Binding FadeOutField.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding FadeOutField}"
|
||||
ToolTip="{Binding FadeOutField.ToolTip}" AutomationProperties.Name="{l:Loc Export.FadeOut}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="4" Style="{StaticResource Text.Label}" Text="{l:Loc Export.HoldEnd}" ToolTip="{l:Loc Export.HoldEnd}" />
|
||||
<Grid Grid.Row="4" Grid.Column="1" MinHeight="32">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="52" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Minimum="0" Maximum="10" SmallChange="0.5" LargeChange="1" IsSnapToTickEnabled="True" TickFrequency="0.5" Value="{Binding HoldEnd}"
|
||||
ToolTip="{l:Loc Tooltips.Export.HoldEnd}" AutomationProperties.Name="{l:Loc Export.HoldEnd}" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Number}" Width="NaN" Margin="8,0,0,0"
|
||||
Text="{Binding HoldEndField.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding HoldEndField}"
|
||||
ToolTip="{Binding HoldEndField.ToolTip}" AutomationProperties.Name="{l:Loc Export.HoldEnd}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- ===== File ===== -->
|
||||
<ContentControl Content="{Binding FileGroup}" Focusable="False" />
|
||||
<Grid Margin="0,4,0,8" IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
Visibility="{Binding FileGroup.IsExpanded, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Editor.Grid.Label}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.FileName}" ToolTip="{l:Loc Editor.Export.FileName}" />
|
||||
<TextBox Grid.Column="1" Margin="0,0,0,8" Text="{Binding NameTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding NameTemplate}" ToolTip="{Binding NameTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Editor.Export.FileName}" />
|
||||
|
||||
<TextBlock Grid.Row="9" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.SaveTo}" ToolTip="{l:Loc Editor.Export.SaveTo}" />
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.SaveTo}" ToolTip="{l:Loc Editor.Export.SaveTo}" />
|
||||
<!-- The folder ends in an ellipsis (its full path is in the tooltip). -->
|
||||
<ComboBox Grid.Row="9" Grid.Column="1" ItemsSource="{Binding SaveChoices}" SelectedItem="{Binding SelectedSave}" IsEnabled="{Binding CanChooseFolder}"
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding SaveChoices}" SelectedItem="{Binding SelectedSave}" IsEnabled="{Binding CanChooseFolder}"
|
||||
ToolTip="{Binding SaveToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Export.SaveTo}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type e:SaveChoice}">
|
||||
@@ -537,30 +715,18 @@
|
||||
</ComboBox>
|
||||
<!-- Export.html "Sync" (12 px): also send the render to the server the sequence is linked to. Under the folder rather than beside
|
||||
it, as in the mockup, so that neither is cut in the 194 px field column in longer languages. -->
|
||||
<CheckBox Grid.Row="10" Grid.Column="1" Margin="0,6,0,0" HorizontalAlignment="Left" FontSize="{StaticResource Size.Secondary}"
|
||||
<CheckBox Grid.Row="2" Grid.Column="1" Margin="0,6,0,0" HorizontalAlignment="Left" FontSize="{StaticResource Size.Secondary}"
|
||||
Content="{l:Loc Editor.Export.Sync}" IsChecked="{Binding SyncToServer}" IsEnabled="{Binding CanSync}" ToolTip="{Binding SyncToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True" />
|
||||
<!-- This PC's settings kept by "Save both" (sync conflicts): the newest, or another from the menu, becomes the project as one undo step. -->
|
||||
<v:SplitButton Grid.Row="3" Grid.ColumnSpan="2" Margin="0,8,0,0" HorizontalAlignment="Left" Content="{Binding RestoreText}" Command="{Binding RestoreCommand}"
|
||||
ItemsSource="{Binding SavedCopies}" DisplayMemberPath="Label" SelectedItem="{Binding SelectedCopy}" ToolTip="{Binding RestoreToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
DropDownToolTip="{l:Loc Tooltips.Editor.Export.RestoreChoice}" AutomationProperties.Name="{l:Loc Editor.Export.RestoreName}"
|
||||
Visibility="{Binding HasSavedCopies, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
|
||||
<Border Style="{StaticResource Border.Card}" Margin="0,12,0,0" Padding="12,10">
|
||||
<StackPanel>
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding EstimatedSize}" Style="{StaticResource Text.Number}" FontSize="{StaticResource Size.Secondary}" />
|
||||
<TextBlock Text="{l:Loc Editor.Export.Size}" Style="{StaticResource Text.Secondary}" />
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,4,0,0">
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding EstimatedTime}" FontSize="{StaticResource Size.Secondary}" TextTrimming="CharacterEllipsis" MaxWidth="180" />
|
||||
<TextBlock Text="{l:Loc Editor.Export.Time}" Style="{StaticResource Text.Secondary}" />
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,4,0,0">
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding ResultName}" FontSize="{StaticResource Size.Secondary}" TextTrimming="CharacterEllipsis" MaxWidth="180"
|
||||
ToolTip="{Binding ResultName}" />
|
||||
<TextBlock Text="{l:Loc Editor.Export.Result}" Style="{StaticResource Text.Secondary}" />
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding Notices}" Margin="0,8,0,0" Focusable="False">
|
||||
<ItemsControl ItemsSource="{Binding Notices}" Margin="0,4,0,0" Focusable="False">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="0,4,0,0">
|
||||
|
||||
@@ -53,6 +53,53 @@ public sealed class AutoSetting<T>(
|
||||
public ProjectSettings Reset(ProjectSettings project) => set(project, get(project).Reset());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Which collapsible groups of the editor are open, by group key ("export.encoding", "preset.social"): a group nobody
|
||||
/// toggled opens as its default says. Until <see cref="Bind"/> attaches the app's settings the state lives for the run;
|
||||
/// bound, each toggle is written there and saved.
|
||||
/// </summary>
|
||||
public sealed class GroupStates
|
||||
{
|
||||
private readonly Lock _lock = new();
|
||||
private IDictionary<string, bool> _store = new Dictionary<string, bool>(StringComparer.Ordinal);
|
||||
private Action? _save;
|
||||
|
||||
/// <summary>Keeps the state in <paramref name="store"/> (the app's settings), calling <paramref name="save"/> after each toggle.</summary>
|
||||
public void Bind(IDictionary<string, bool> store, Action? save)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(store);
|
||||
lock (_lock)
|
||||
{
|
||||
// What was toggled before the settings were attached stays.
|
||||
foreach (var (key, open) in _store)
|
||||
{
|
||||
if (!store.ContainsKey(key)) store[key] = open;
|
||||
}
|
||||
(_store, _save) = (store, save);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Whether the group <paramref name="key"/> is open; <paramref name="fallback"/> when it was never toggled.</summary>
|
||||
public bool IsExpanded(string key, bool fallback)
|
||||
{
|
||||
lock (_lock) return _store.TryGetValue(key, out var open) ? open : fallback;
|
||||
}
|
||||
|
||||
/// <summary>Remembers that the group <paramref name="key"/> is open or closed.</summary>
|
||||
public void Set(string key, bool expanded)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(key);
|
||||
Action? save;
|
||||
lock (_lock)
|
||||
{
|
||||
if (_store.TryGetValue(key, out var open) && open == expanded) return;
|
||||
_store[key] = expanded;
|
||||
save = _save;
|
||||
}
|
||||
save?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The Auto settings of the editor's sections, in panel order.</summary>
|
||||
public static class EditorSettings
|
||||
{
|
||||
@@ -129,6 +176,12 @@ public static class EditorSettings
|
||||
public static bool IsSectionAuto(ProjectSettings project, AdvisorSection section) =>
|
||||
All.Where(s => s.Section == section).All(s => s.IsAuto(project));
|
||||
|
||||
/// <summary>
|
||||
/// The collapse state of the Export step's setting groups and preset groups (owner review 1, R3; DESIGN §4 collapsible
|
||||
/// group): this user's, kept by the app and not in the project.
|
||||
/// </summary>
|
||||
public static GroupStates Groups { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Whether <paramref name="setting"/> applies under the switches in force: the deflicker window, strength and regions
|
||||
/// with deflicker on, the transition length with holy grail on, the shutter angle with motion blur on, the flow quality
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
DynamicResource; sizes and the kit's styles StaticResource.
|
||||
-->
|
||||
|
||||
<!-- Preview height against the measuring area: the editor favours the picture; the Analysis findings and the Export preset cards take more room. -->
|
||||
<!-- Preview height against the measuring area: the editor favours the picture; the Analysis findings and the Export preset table take more room. -->
|
||||
<GridLength x:Key="Editor.Grid.Preview">17*</GridLength>
|
||||
<GridLength x:Key="Editor.Grid.Measure">10*</GridLength>
|
||||
<GridLength x:Key="Editor.Grid.ExportPreview">9*</GridLength>
|
||||
@@ -124,34 +124,35 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Preset card (Export.html): card fill, stroke, radius 8; accent border and glow when selected. -->
|
||||
<Style x:Key="Button.PresetCard" TargetType="Button">
|
||||
<!--
|
||||
A row of the Export step's preset table (owner review 1, R3): 28 px, transparent; card fill on hover, the accent wash and
|
||||
a 3 px accent bar at the start edge when it is the preset in use.
|
||||
-->
|
||||
<Style x:Key="Button.PresetRow" TargetType="Button">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Ring}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Stroke}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Height" Value="118" />
|
||||
<Setter Property="Margin" Value="5,0,5,10" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Height" Value="28" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid>
|
||||
<Border x:Name="Glow" Margin="-3" CornerRadius="11" BorderThickness="3" BorderBrush="{DynamicResource Brush.AccentSelected}" Visibility="Collapsed" />
|
||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"
|
||||
CornerRadius="{StaticResource Radius.Card}" Padding="12,10" SnapsToDevicePixels="True">
|
||||
<ContentPresenter />
|
||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
||||
<ContentPresenter Margin="6,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="False" />
|
||||
</Border>
|
||||
<Border x:Name="Bar" Width="3" HorizontalAlignment="Left" Margin="0,5" CornerRadius="1.5" Background="{DynamicResource Brush.Accent}" Visibility="Collapsed" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.StrokeStrong}" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding IsSelected}" Value="True">
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter TargetName="Glow" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.AccentSubtle}" />
|
||||
<Setter TargetName="Bar" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4" />
|
||||
@@ -162,7 +163,53 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- "Recommended" chip on a card: accent border and text (DESIGN §4 chips). -->
|
||||
<!-- Columns of the preset table: the batch tick, then size, codec, fps and the two estimates after the name. -->
|
||||
<GridLength x:Key="Export.Column.Tick">28</GridLength>
|
||||
<GridLength x:Key="Export.Column.Size">92</GridLength>
|
||||
<GridLength x:Key="Export.Column.Codec">104</GridLength>
|
||||
<GridLength x:Key="Export.Column.Fps">44</GridLength>
|
||||
<GridLength x:Key="Export.Column.EstimatedSize">76</GridLength>
|
||||
<GridLength x:Key="Export.Column.EstimatedTime">96</GridLength>
|
||||
|
||||
<!--
|
||||
Collapsible group header (DESIGN §4, owner review 1 R3): a chevron (down when open, toward the reading direction when
|
||||
closed), then the content: the group's name in Text.Body 600 and, while collapsed, a muted one-line summary.
|
||||
-->
|
||||
<Style x:Key="ToggleButton.Group" TargetType="ToggleButton">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Ring}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="MinHeight" Value="28" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="{StaticResource Radius.Control}" Padding="2,0,6,0" SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:Icon x:Name="Chevron" Glyph="{StaticResource Icon.ChevronRight}" Size="14" Margin="0,0,6,0" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<ContentPresenter Grid.Column="1" VerticalAlignment="Center" RecognizesAccessKey="False" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Chevron" Property="Glyph" Value="{StaticResource Icon.ChevronDown}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- "Recommended" chip on a preset row: accent border and text (DESIGN §4 chips). -->
|
||||
<Style x:Key="Border.Recommended" TargetType="Border">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.App.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// A collapsible group of the Export step's Output panel (owner review 1, R3; DESIGN §4): its name with a chevron and,
|
||||
/// while collapsed, a muted one-line summary of its values. Open or closed is this user's choice, kept by the app
|
||||
/// (<see cref="EditorSettings.Groups"/>), not in the project.
|
||||
/// </summary>
|
||||
public sealed class SettingGroup : ObservableObject
|
||||
{
|
||||
private readonly string _nameKey;
|
||||
private readonly string _toolTipKey;
|
||||
private readonly bool _expandedByDefault;
|
||||
private string? _summary;
|
||||
|
||||
/// <param name="key">The group's key in <see cref="EditorSettings.Groups"/> ("export.encoding").</param>
|
||||
public SettingGroup(string key, string nameKey, string toolTipKey, bool expandedByDefault)
|
||||
{
|
||||
Key = key;
|
||||
(_nameKey, _toolTipKey, _expandedByDefault) = (nameKey, toolTipKey, expandedByDefault);
|
||||
ToggleCommand = new RelayCommand(() => IsExpanded = !IsExpanded);
|
||||
}
|
||||
|
||||
public string Key { get; }
|
||||
|
||||
/// <summary>"Encoding".</summary>
|
||||
public string Header => Loc.L(_nameKey);
|
||||
|
||||
/// <summary>What opening the group shows.</summary>
|
||||
public string ToolTip => Loc.L(_toolTipKey);
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get => EditorSettings.Groups.IsExpanded(Key, _expandedByDefault);
|
||||
set
|
||||
{
|
||||
if (value == IsExpanded) return;
|
||||
EditorSettings.Groups.Set(Key, value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"Variable · 40 Mb/s · GOP 1 s · B 2 · High": the values, shown while the group is collapsed.</summary>
|
||||
public string? Summary { get => _summary; set => Set(ref _summary, value); }
|
||||
|
||||
public ICommand ToggleCommand { get; }
|
||||
|
||||
/// <summary>The UI language changed, or another editor toggled the group: everything is read again.</summary>
|
||||
public void Refresh() => OnAllPropertiesChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the Export step's advanced encoding rows offer for a codec and colour depth (owner review 1, R8; decision 6), and
|
||||
/// the keyframe interval in seconds as the project stores it in frames. Every value is an <see cref="ExportOverrides"/>
|
||||
/// member nodes of phase 4 already read, so none of them raises the settings format.
|
||||
/// </summary>
|
||||
public static class ExportRules
|
||||
{
|
||||
/// <summary>Keyframe intervals offered, in seconds (0.5 to 10, step 0.5).</summary>
|
||||
public static IReadOnlyList<double> KeyframeSeconds { get; } = [.. Enumerable.Range(1, 20).Select(i => i * 0.5)];
|
||||
|
||||
/// <summary>B-frame counts offered besides Auto.</summary>
|
||||
public static IReadOnlyList<int> BFrameCounts { get; } = [0, 1, 2, 3, 4];
|
||||
|
||||
/// <summary>
|
||||
/// The standard resolutions of the Resolution choice (decision 7): the landscape box written into
|
||||
/// <see cref="ExportOverrides.Width"/>/<see cref="ExportOverrides.Height"/>, which the chosen proportions are fitted in.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<(string Key, string LabelKey, int Width, int Height)> StandardResolutions { get; } =
|
||||
[.. ExportPresets.Resolutions.Select(r => (r.Key, "Export.Resolution." + ResolutionLabel(r.Key), r.Width, r.Height))];
|
||||
|
||||
/// <summary>Only the hardware codecs have a rate control, a keyframe interval and B-frames to choose.</summary>
|
||||
public static bool HasRateControl(VideoCodec codec) => !VideoCodecInfo.IsManaged(codec);
|
||||
|
||||
/// <summary>Why <paramref name="codec"/> has no rate control or keyframe interval to choose; null when it has.</summary>
|
||||
public static string? RateControlBlocked(VideoCodec codec) =>
|
||||
HasRateControl(codec) ? null : Loc.L("Tooltips.Export.RateControlNA", Loc.L("Export.Codec." + codec));
|
||||
|
||||
/// <summary>
|
||||
/// Why <paramref name="codec"/> with <paramref name="profile"/> takes no B-frames (Baseline, MJPEG, GIF, APNG and the
|
||||
/// image sequences); null when it does.
|
||||
/// </summary>
|
||||
public static string? BFramesBlocked(VideoCodec codec, CodecProfile profile) => codec switch
|
||||
{
|
||||
VideoCodec.H264 when profile == CodecProfile.H264Baseline => Loc.L("Tooltips.Export.BFramesNA", ProfileLabel(profile)),
|
||||
_ when VideoCodecInfo.IsManaged(codec) => Loc.L("Tooltips.Export.BFramesNA", Loc.L("Export.Codec." + codec)),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The profiles <paramref name="codec"/> offers at <paramref name="bitDepth"/>: H.264 Baseline, Main and High; HEVC Main
|
||||
/// at 8 bits or Main 10 above; AV1 Main; none for the managed codecs.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<CodecProfile> Profiles(VideoCodec codec, int bitDepth) => codec switch
|
||||
{
|
||||
VideoCodec.H264 => [CodecProfile.H264Baseline, CodecProfile.H264Main, CodecProfile.H264High],
|
||||
VideoCodec.Hevc => [bitDepth > 8 ? CodecProfile.HevcMain10 : CodecProfile.HevcMain],
|
||||
VideoCodec.Av1 => [CodecProfile.Av1Main],
|
||||
_ => [],
|
||||
};
|
||||
|
||||
/// <summary>Why the profile cannot be chosen (the codec has one, or none); null when it can.</summary>
|
||||
public static string? ProfileBlocked(VideoCodec codec, int bitDepth) =>
|
||||
Profiles(codec, bitDepth).Count > 1 ? null : Loc.L("Tooltips.Export.ProfileNA", Loc.L("Export.Codec." + codec));
|
||||
|
||||
/// <summary>"Baseline", "Main", "High", "Main 10".</summary>
|
||||
public static string ProfileLabel(CodecProfile profile) => Loc.L(profile switch
|
||||
{
|
||||
CodecProfile.H264Baseline => "Export.Profile.Baseline",
|
||||
CodecProfile.H264High => "Export.Profile.High",
|
||||
CodecProfile.HevcMain10 => "Export.Profile.Main10",
|
||||
_ => "Export.Profile.Main",
|
||||
});
|
||||
|
||||
/// <summary>The interval of <paramref name="seconds"/> as stored: whole frames at <paramref name="frameRate"/>, at least one.</summary>
|
||||
public static int GopFrames(double seconds, Rational frameRate) => int.Max(1, (int)double.Round(seconds * frameRate.Value));
|
||||
|
||||
/// <summary>The interval of <paramref name="gopFrames"/> at <paramref name="frameRate"/>, in seconds.</summary>
|
||||
public static double GopSeconds(int gopFrames, Rational frameRate) => frameRate.Value > 0 ? gopFrames / frameRate.Value : 0;
|
||||
|
||||
/// <summary>The offered interval nearest <paramref name="gopFrames"/> at <paramref name="frameRate"/> (what the choice shows).</summary>
|
||||
public static double NearestKeyframeSeconds(int gopFrames, Rational frameRate) =>
|
||||
double.Clamp(double.Round(GopSeconds(gopFrames, frameRate) * 2) / 2, KeyframeSeconds[0], KeyframeSeconds[^1]);
|
||||
|
||||
/// <summary>
|
||||
/// A keyframe interval chosen by hand keeps its seconds when the frame rate changes: <paramref name="gopFrames"/> at
|
||||
/// <paramref name="from"/> as frames at <paramref name="to"/>.
|
||||
/// </summary>
|
||||
public static int RescaleGop(int gopFrames, Rational from, Rational to) => GopFrames(GopSeconds(gopFrames, from), to);
|
||||
|
||||
/// <summary>"1.5 s".</summary>
|
||||
public static string Seconds(double seconds) => Loc.L("Export.Seconds", seconds.ToString("0.##", Loc.Culture));
|
||||
|
||||
private static string ResolutionLabel(string key) => key switch
|
||||
{
|
||||
"4k" => "Uhd4k",
|
||||
"dci4k" => "Dci4k",
|
||||
_ => key,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>The one-line summaries of the Export step (owner review 1, R3): a collapsed group's values and the footer's line.</summary>
|
||||
public static class ExportSummaries
|
||||
{
|
||||
private static string Separator => Loc.Separator;
|
||||
|
||||
/// <summary>
|
||||
/// "Variable · 40 Mb/s · GOP 1 s · B 2 · High" for a video codec; the quality ("Quality 95") or n/a for the managed
|
||||
/// codecs, which have no rate control.
|
||||
/// </summary>
|
||||
public static string Encoding(ResolvedExport export, long bitRate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(export);
|
||||
if (!ExportRules.HasRateControl(export.Codec))
|
||||
{
|
||||
var managed = EditorText.Encoding(export, 0, null);
|
||||
return managed.Length > 0 ? managed : Loc.L("Common.NotApplicable");
|
||||
}
|
||||
var parts = new List<string> { RateControlLabel(export.RateControl) };
|
||||
parts.Add(export.RateControl == RateControl.Quality ? Loc.L("Editor.Export.QualityValue", export.Quality) : EditorText.BitRate(bitRate));
|
||||
parts.Add(Loc.L("Export.Summary.Keyframes", ExportRules.Seconds(ExportRules.GopSeconds(export.GopFrames, export.FrameRate))));
|
||||
if (ExportRules.BFramesBlocked(export.Codec, export.Profile) is null) parts.Add(Loc.L("Export.Summary.BFrames", export.BFrames));
|
||||
if (export.Profile != CodecProfile.Auto) parts.Add(ExportRules.ProfileLabel(export.Profile));
|
||||
return string.Join(Separator, parts);
|
||||
}
|
||||
|
||||
/// <summary>"Forward · no fades", "Boomerang · ×2 · fades 1 s / 1.5 s · hold 2 s".</summary>
|
||||
public static string Playback(PlaybackSettings? playback)
|
||||
{
|
||||
playback ??= new PlaybackSettings();
|
||||
var parts = new List<string> { DirectionLabel(playback.EffectiveDirection) };
|
||||
if (playback.EffectiveLoops > 1) parts.Add(Loc.L("Export.Summary.Loops", playback.EffectiveLoops));
|
||||
parts.Add(playback.EffectiveFadeIn > 0 || playback.EffectiveFadeOut > 0
|
||||
? Loc.L("Export.Summary.Fades", ExportRules.Seconds(playback.EffectiveFadeIn), ExportRules.Seconds(playback.EffectiveFadeOut))
|
||||
: Loc.L("Export.Summary.NoFades"));
|
||||
if (playback.EffectiveHoldEnd > 0) parts.Add(Loc.L("Export.Summary.Hold", ExportRules.Seconds(playback.EffectiveHoldEnd)));
|
||||
return string.Join(Separator, parts);
|
||||
}
|
||||
|
||||
/// <summary>"2026-09-28 Harbour sunset - 4K archive.mp4 · Sync": the result's name, then Sync when it is on.</summary>
|
||||
public static string File(string? resultName, string folder, bool sync)
|
||||
{
|
||||
var parts = new List<string> { resultName is { Length: > 0 } name ? name : folder };
|
||||
if (sync) parts.Add(Loc.L("Editor.Export.Sync"));
|
||||
return string.Join(Separator, parts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The footer's line (decision 5): "2026-09-28 Harbour sunset - 4K….mp4 · 1.2 GB · about 4 min · 42 s · 1,260 frames"; the
|
||||
/// size and time are left out when there is no estimate (no encoder here).
|
||||
/// </summary>
|
||||
public static string Footer(string resultName, ExportEstimate? estimate, double durationSeconds, int frames)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(resultName);
|
||||
var duration = Formatting.Duration(TimeSpan.FromSeconds(double.Max(0, durationSeconds)));
|
||||
var count = Loc.Plural("Export.Footer.Frames", frames);
|
||||
return estimate is null
|
||||
? string.Join(Separator, resultName, duration, count)
|
||||
: Loc.L("Export.Footer.Summary", resultName, Formatting.Bytes(estimate.Bytes), Loc.L("Editor.Export.About", Formatting.Duration(estimate.Time)), duration, count);
|
||||
}
|
||||
|
||||
/// <summary>"Variable", "Constant", "Quality".</summary>
|
||||
public static string RateControlLabel(RateControl rateControl) => Loc.L("Export.RateControl." + rateControl);
|
||||
|
||||
/// <summary>"Forward", "Reverse", "Boomerang" (<see cref="PlaybackDirection"/>).</summary>
|
||||
public static string DirectionLabel(string direction) =>
|
||||
Loc.L("Export.Direction." + CultureInfo.InvariantCulture.TextInfo.ToTitleCase(PlaybackDirection.IsKnown(direction) ? direction.ToLowerInvariant() : PlaybackDirection.Forward));
|
||||
}
|
||||
@@ -34,6 +34,18 @@ public sealed record ExportPlan(ResolvedExport Export, RenderSetup Setup, Export
|
||||
|
||||
/// <summary>The encoder shrank the output (by more than the rounding to even sizes every encoder makes).</summary>
|
||||
public bool IsCapped => EncodedSize.Width < OutputSize.Width - 1 || EncodedSize.Height < OutputSize.Height - 1;
|
||||
|
||||
/// <summary>
|
||||
/// The frames as the encoder receives them (owner review 1, R8): the plan played as the export's playback says
|
||||
/// (direction, loops, fades, hold), which gives the video's duration and frame count.
|
||||
/// </summary>
|
||||
public OutputProgram? Program { get; init; }
|
||||
|
||||
/// <summary>The video's duration in seconds, holds and loops included.</summary>
|
||||
public double DurationSeconds => Program?.DurationSeconds ?? Setup.Plan.DurationSeconds;
|
||||
|
||||
/// <summary>The pictures the encoder receives (and the render renders), every loop included.</summary>
|
||||
public int FrameCount => Program?.Count ?? Setup.Plan.Frames.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,7 +100,8 @@ public sealed class ExportPlanner(SequenceContent content, IReadOnlyList<IVideoE
|
||||
var (name, error) = FileName(export.NameTemplate, resolved, setup);
|
||||
// The estimates follow the setup, which renders the adapted size the encoder may cap (RenderSetup.Create).
|
||||
var size = RenderSize.Of(input.Project.Camera, resolved, content.SourceWidth, content.SourceHeight, RenderOptions.Default.MaxWorkingLongEdge);
|
||||
return new ExportPlan(resolved, setup, setup.Estimate(model), name, error) { OutputSize = size };
|
||||
var program = OutputProgram.Build(setup.Plan, export.Playback, setup.Plan.FrameRate);
|
||||
return new ExportPlan(resolved, setup, setup.Estimate(model), name, error) { OutputSize = size, Program = program };
|
||||
}
|
||||
|
||||
/// <summary>The first problem of a name template, localised; null when it is valid.</summary>
|
||||
|
||||
+485
-163
@@ -19,77 +19,6 @@ using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.App.Editor;
|
||||
|
||||
/// <summary>A preset card of the Export tab (Export.html): what it renders and what it will cost on this machine.</summary>
|
||||
public sealed class PresetCard(ExportTab owner, ExportChoice choice) : ObservableObject
|
||||
{
|
||||
private string? _format;
|
||||
private string? _encoding;
|
||||
private string? _estimate;
|
||||
private bool _isSelected;
|
||||
|
||||
public ExportChoice Choice { get; } = choice;
|
||||
|
||||
public string Name => Choice.Name;
|
||||
|
||||
public bool IsRecommended => Choice.IsRecommended;
|
||||
|
||||
/// <summary>Sequence presets apply full settings; export presets only choose the output.</summary>
|
||||
public bool IsSequencePreset => Choice.Sequence is not null;
|
||||
|
||||
/// <summary>What choosing the card does, or why it cannot be chosen now (a job runs, the project cannot change).</summary>
|
||||
public string ToolTip => owner.Editor.LockedToolTip ?? (Choice.Reason is { } reason
|
||||
? Loc.L(IsSequencePreset ? "Tooltips.Editor.Export.ApplyPreset" : "Tooltips.Editor.Export.Recommended", reason)
|
||||
: Loc.L("Tooltips.Editor.Export.Preset", Name));
|
||||
|
||||
public string BatchToolTip => owner.Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Export.InBatch");
|
||||
|
||||
/// <summary>"MP4 · HEVC Main10 · 3840×2160 · 24 fps".</summary>
|
||||
public string? Format { get => _format; private set => Set(ref _format, value); }
|
||||
|
||||
/// <summary>"120 Mb/s · 0.07 bpp · NVENC".</summary>
|
||||
public string? Encoding { get => _encoding; private set => Set(ref _encoding, value); }
|
||||
|
||||
/// <summary>"2.2 GB · about 5 min".</summary>
|
||||
public string? Estimate { get => _estimate; private set => Set(ref _estimate, value); }
|
||||
|
||||
public bool IsSelected { get => _isSelected; set => Set(ref _isSelected, value); }
|
||||
|
||||
/// <summary>Ticked for "Batch…" (export presets only).</summary>
|
||||
public bool IsInBatch
|
||||
{
|
||||
get => owner.IsInBatch(Choice.ExportPresetId);
|
||||
set => owner.SetInBatch(Choice.ExportPresetId, value);
|
||||
}
|
||||
|
||||
public bool CanBatch => !IsSequencePreset;
|
||||
|
||||
public ICommand SelectCommand => owner.SelectCommand;
|
||||
|
||||
/// <remarks>A server sequence renders on the server: this PC's encoders neither name nor rule out the encoding.</remarks>
|
||||
public void Update(ExportPlan? plan)
|
||||
{
|
||||
if (plan is null)
|
||||
{
|
||||
Format = Encoding = Estimate = null;
|
||||
return;
|
||||
}
|
||||
var settings = plan.Setup.Encoder.Settings;
|
||||
var remote = owner.Editor.IsRemote;
|
||||
Format = EditorText.Format(plan.Export, settings.Width, settings.Height);
|
||||
Encoding = EditorText.Encoding(plan.Export, settings.BitRate, remote ? null : plan.Setup.Encoder.Capability?.Name);
|
||||
Estimate = remote || plan.Setup.Encoder.IsReady ? EditorText.Estimate(plan.Estimate) : Loc.L("Editor.Export.Unavailable");
|
||||
}
|
||||
|
||||
public void RefreshBatch() => OnPropertyChanged(nameof(IsInBatch));
|
||||
|
||||
/// <summary>A job of the sequence started or ended, or the project became read-only: the tooltips say why the card waits.</summary>
|
||||
public void RefreshLocked()
|
||||
{
|
||||
OnPropertyChanged(nameof(ToolTip));
|
||||
OnPropertyChanged(nameof(BatchToolTip));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A codec choice of the Output panel with the profile and depth it implies.</summary>
|
||||
public sealed record CodecChoice(VideoCodec Codec, CodecProfile Profile, int BitDepth)
|
||||
{
|
||||
@@ -104,10 +33,15 @@ public sealed record SaveChoice(string? Folder, bool Browse = false)
|
||||
public string Label => Browse ? Loc.L("Editor.Export.Browse") : Folder is null ? Loc.L("Editor.Export.SequenceFolder") : Path.GetFileName(Folder.TrimEnd('\\', '/'));
|
||||
}
|
||||
|
||||
/// <summary>A choice that may not apply now (Boomerang with star trails): disabled in the list, its reason in the tooltip.</summary>
|
||||
public sealed record GatedChoice(object Value, string Label, bool IsAvailable, string ToolTip);
|
||||
|
||||
/// <summary>
|
||||
/// Export (Export.html, BRIEF §11.4–11.5): preset cards with size and time estimates, the Output panel (container,
|
||||
/// codec, size, frame rate, quality, encoder, colour depth, name template, folder) with the estimate and the encoder's
|
||||
/// notices, and the render actions (now, queue, batch). Editing a value makes the preset "Custom" (§11.4).
|
||||
/// Export (Export.html, BRIEF §11.4–11.5, owner review 1 R3/R8): the preset table with size and time estimates, the Output
|
||||
/// panel in four collapsible groups (Output: container, codec, resolution, frame rate, colour depth; Encoding: encoder,
|
||||
/// rate control, bit rate or quality, keyframes, B-frames, profile; Playback: direction, loops, fades, hold; File: name
|
||||
/// template, folder, sync, restore), the encoder's notices, and a fixed footer with the result line and the render
|
||||
/// actions (now, queue, batch). Editing a value makes the preset "Custom" (§11.4).
|
||||
/// </summary>
|
||||
public sealed class ExportTab : EditorTab
|
||||
{
|
||||
@@ -119,79 +53,138 @@ public sealed class ExportTab : EditorTab
|
||||
new(VideoCodec.Tiff16Sequence, CodecProfile.Auto, 16), new(VideoCodec.LinearDngSequence, CodecProfile.Auto, 16),
|
||||
];
|
||||
|
||||
/// <summary>The Resolution choice's value for the preset's own box (no override).</summary>
|
||||
public const string PresetResolution = "preset";
|
||||
|
||||
/// <summary>The Resolution choice's value for the source size (a box of 0 × 0).</summary>
|
||||
public const string SourceResolution = "source";
|
||||
|
||||
/// <summary>The Resolution choice's value that shows the Width × Height fields.</summary>
|
||||
public const string CustomResolution = "custom";
|
||||
|
||||
/// <summary>The longest fade or hold the sliders reach (seconds); the fields take up to the playback's own limits.</summary>
|
||||
public const double SliderSeconds = 10;
|
||||
|
||||
private readonly LatestRunner _estimates = new(TimeSpan.FromMilliseconds(250));
|
||||
private readonly AsyncRelayCommand _renderNow;
|
||||
private readonly AsyncRelayCommand _addToQueue;
|
||||
private readonly AsyncRelayCommand _batch;
|
||||
private readonly AsyncRelayCommand _restore;
|
||||
private SavedCopy? _selectedCopy;
|
||||
private IReadOnlyList<PresetCard> _cards = [];
|
||||
private IReadOnlyList<PresetRow> _presets = [];
|
||||
private IReadOnlyList<PresetGroup> _presetGroups = [];
|
||||
private IReadOnlyList<CodecChoice> _codecChoices = [];
|
||||
private IReadOnlyList<Choice> _encoders = [];
|
||||
private IReadOnlyList<SaveChoice> _saveChoices = [];
|
||||
private IReadOnlyList<Choice> _depths = [];
|
||||
private IReadOnlyList<Choice> _keyframeChoices = [];
|
||||
private IReadOnlyList<Choice> _bFrameChoices = [];
|
||||
private IReadOnlyList<Choice> _profileChoices = [];
|
||||
private IReadOnlyList<GatedChoice> _directions = [];
|
||||
private IReadOnlyList<string> _notices = [];
|
||||
private bool _refreshing;
|
||||
private bool _customResolution;
|
||||
|
||||
public ExportTab(EditorViewModel editor)
|
||||
: base(editor, "Export", AdvisorSection.Export)
|
||||
{
|
||||
SelectCommand = new RelayCommand(p => Select(p as PresetCard), _ => !Editor.IsLocked);
|
||||
SelectCommand = new RelayCommand(p => Select(p as PresetRow), _ => !Editor.IsLocked);
|
||||
_renderNow = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: false), () => Editor.CanRender);
|
||||
_addToQueue = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.Normal, batch: false), () => Editor.CanRender);
|
||||
_batch = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: true), () => Editor.CanRender && Batch.Count > 0);
|
||||
HistoryCommand = new RelayCommand(OpenHistory);
|
||||
RevealLastCommand = new RelayCommand(() => ShellActions.Reveal(Editor.Session.Content.Renders[0].OutputPath), () => CanReveal);
|
||||
VideosCommand = new RelayCommand(OpenVideos, () => CanOpenVideos);
|
||||
_restore = new AsyncRelayCommand(RestoreAsync, () => !Editor.IsLocked && SelectedCopy is not null);
|
||||
SaveProjectCommand = new AsyncRelayCommand(() => new ProjectFiles(Editor.Shell).SaveAsync(Editor.Session), () => !Editor.IsRemote);
|
||||
ResetFrameRateCommand = new RelayCommand(() => EditOverrides(o => o with { FrameRate = null }));
|
||||
ResetFrameRateCommand = new RelayCommand(() => SetFrameRate(null));
|
||||
ResetRateControlCommand = new RelayCommand(() => EditOverrides(o => o with { RateControl = null }));
|
||||
ResetQualityCommand = new RelayCommand(() => EditOverrides(o => o with { BitRate = null, Quality = null }));
|
||||
ResetProfileCommand = new RelayCommand(() => EditOverrides(o => o with { Profile = null, BFrames = IsBaseline(o.Profile) ? null : o.BFrames }));
|
||||
ResetPlaybackCommand = new RelayCommand(() => EditExport(e => e with { Playback = null }), () => !IsPlaybackDefault);
|
||||
Width = new EditableField(string.Empty, ValidateSize, v => EditOverrides(o => o with { Width = ParseSize(v) }), () => Loc.L("Tooltips.Editor.Export.Width"));
|
||||
Height = new EditableField(string.Empty, ValidateSize, v => EditOverrides(o => o with { Height = ParseSize(v) }), () => Loc.L("Tooltips.Editor.Export.Height"));
|
||||
NameTemplate = new EditableField(string.Empty, ValidateTemplate, v => EditExport(e => e with { NameTemplate = v }), () => Loc.L("Tooltips.Editor.Export.Name"));
|
||||
FadeInField = SecondsField(PlaybackSettings.MaxFadeSeconds, (p, v) => p with { FadeIn = v }, "Tooltips.Export.FadeIn");
|
||||
FadeOutField = SecondsField(PlaybackSettings.MaxFadeSeconds, (p, v) => p with { FadeOut = v }, "Tooltips.Export.FadeOut");
|
||||
HoldEndField = SecondsField(PlaybackSettings.MaxHoldSeconds, (p, v) => p with { HoldEnd = v }, "Tooltips.Export.HoldEnd");
|
||||
OutputGroup = new SettingGroup("export.output", "Export.Group.Output", "Tooltips.Export.Group.Output", expandedByDefault: true);
|
||||
EncodingGroup = new SettingGroup("export.encoding", "Export.Group.Encoding", "Tooltips.Export.Group.Encoding", expandedByDefault: false);
|
||||
PlaybackGroup = new SettingGroup("export.playback", "Export.Group.Playback", "Tooltips.Export.Group.Playback", expandedByDefault: false);
|
||||
FileGroup = new SettingGroup("export.file", "Export.Group.File", "Tooltips.Export.Group.File", expandedByDefault: true);
|
||||
_selectedCopy = SavedCopies.FirstOrDefault();
|
||||
LoadCards();
|
||||
LoadTable();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public IReadOnlyList<PresetCard> Cards { get => _cards; private set => Set(ref _cards, value); }
|
||||
// ---- Preset table (measure area) ----
|
||||
|
||||
/// <summary>Every preset, in table order.</summary>
|
||||
public IReadOnlyList<PresetRow> Presets { get => _presets; private set => Set(ref _presets, value); }
|
||||
|
||||
/// <summary>The presets by group (Video, Social, Intermediate, Image sequence, Web), each one opened or closed.</summary>
|
||||
public IReadOnlyList<PresetGroup> PresetGroups { get => _presetGroups; private set => Set(ref _presetGroups, value); }
|
||||
|
||||
public ICommand SelectCommand { get; }
|
||||
|
||||
// ---- The groups of the Output panel ----
|
||||
|
||||
public SettingGroup OutputGroup { get; }
|
||||
|
||||
public SettingGroup EncodingGroup { get; }
|
||||
|
||||
public SettingGroup PlaybackGroup { get; }
|
||||
|
||||
public SettingGroup FileGroup { get; }
|
||||
|
||||
// ---- Footer ----
|
||||
|
||||
public ICommand RenderNowCommand => _renderNow;
|
||||
|
||||
public ICommand AddToQueueCommand => _addToQueue;
|
||||
|
||||
public ICommand BatchCommand => _batch;
|
||||
|
||||
/// <summary>Jobs, filtered on this sequence (its renders and analyses).</summary>
|
||||
public ICommand HistoryCommand { get; }
|
||||
|
||||
/// <summary>"Reveal in Explorer" for the newest render (BRIEF §11.5 follow-up).</summary>
|
||||
public ICommand RevealLastCommand { get; }
|
||||
|
||||
public string AddToQueueToolTip => Editor.RenderBlockedReason ?? Loc.L("Tooltips.Editor.Export.AddToQueue");
|
||||
|
||||
/// <summary>"Batch (2)": the ticked presets.</summary>
|
||||
public string BatchText => Loc.L("Export.Footer.Batch", Batch.Count.ToString("N0", Loc.Culture));
|
||||
|
||||
public string BatchToolTip => Editor.RenderBlockedReason ?? (Batch.Count == 0 ? Loc.L("Tooltips.Editor.Export.BatchEmpty")
|
||||
: Editor.IsRemote ? Loc.L("Tooltips.Editor.Export.BatchServer", Editor.ServerName)
|
||||
: Loc.L("Tooltips.Editor.Export.Batch"));
|
||||
|
||||
public bool HasHistory => Editor.Session.Content.Renders.Count > 0;
|
||||
|
||||
/// <summary>The "history" link opens this PC's Jobs screen, which does not list a server's jobs.</summary>
|
||||
public bool CanOpenHistory => !Editor.IsRemote;
|
||||
: Loc.L("Tooltips.Export.Footer.Batch"));
|
||||
|
||||
/// <summary>The newest render is a file on this PC (a server's renders stay on the server).</summary>
|
||||
public bool CanReveal => Editor.Session.Content.Renders is [{ OutputPath.Length: > 0 }, ..];
|
||||
|
||||
/// <summary>"Videos (3)": the renders of this sequence.</summary>
|
||||
public string VideosText => Loc.L("Export.Footer.Videos", Editor.Session.Content.Renders.Count.ToString("N0", Loc.Culture));
|
||||
|
||||
/// <summary>Opens the Videos section filtered on this sequence (owner review 1, R9).</summary>
|
||||
public ICommand VideosCommand { get; }
|
||||
|
||||
/// <summary>The app has a Videos section to open.</summary>
|
||||
public bool CanOpenVideos => VideosLink.Find(Editor.Shell.AllSections) is not null;
|
||||
|
||||
/// <summary>
|
||||
/// "2026-09-28 Harbour sunset - 4K archive.mp4 · 1.2 GB · about 4 min · 42 s · 1,260 frames": the result, its estimates,
|
||||
/// and the video's duration and frames as the playback plays them; null before the plan.
|
||||
/// </summary>
|
||||
public string? FooterSummary => Editor.Plan is { } plan
|
||||
? ExportSummaries.Footer(plan.FileName, Estimated?.Estimate, plan.DurationSeconds, plan.FrameCount)
|
||||
: null;
|
||||
|
||||
/// <summary>
|
||||
/// Saves a <c>.chronos</c> project file of this sequence and its settings (BRIEF §18); a server sequence has no
|
||||
/// archive on this PC for the file to name.
|
||||
/// archive on this PC for the file to name. Offered in the project ▾ menu.
|
||||
/// </summary>
|
||||
public ICommand SaveProjectCommand { get; }
|
||||
|
||||
public string SaveProjectToolTip => Editor.IsRemote ? Loc.L("Tooltips.Editor.ProjectFile.Remote") : Loc.L("Tooltips.Editor.ProjectFile.Save");
|
||||
|
||||
// ---- Export "Sync" (Export.html, next to Save to) ----
|
||||
// ---- File: Sync ----
|
||||
|
||||
/// <summary>Send each render made on this PC to the server the sequence is linked to; remembered in the project.</summary>
|
||||
public bool SyncToServer
|
||||
@@ -218,7 +211,7 @@ public sealed class ExportTab : EditorTab
|
||||
/// <summary>A server sequence renders into its exports folder on the server.</summary>
|
||||
public bool CanChooseFolder => !Editor.IsRemote;
|
||||
|
||||
// ---- "Save both" copies of this PC's settings ----
|
||||
// ---- File: "Save both" copies of this PC's settings ----
|
||||
|
||||
public IReadOnlyList<SavedCopy> SavedCopies => Editor.Session.Content.SavedCopies;
|
||||
|
||||
@@ -244,7 +237,7 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
public ICommand RestoreCommand => _restore;
|
||||
|
||||
public ICommand ResetFrameRateCommand { get; }
|
||||
// ---- Output ----
|
||||
|
||||
/// <summary>"Output · 4K archive".</summary>
|
||||
public string Title => Loc.L("Editor.Export.Output", Editor.Plan?.PresetName ?? ProcessingJobs.PresetName(ExportResolver.Resolve(Export)));
|
||||
@@ -276,6 +269,46 @@ public sealed class ExportTab : EditorTab
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Preset, Source, the standard sizes (720p … 8K) and Custom (decision 7).</summary>
|
||||
public IReadOnlyList<Choice> Resolutions { get; } =
|
||||
[
|
||||
new(PresetResolution, "Export.Resolution.Preset"), new(SourceResolution, "Export.Resolution.Source"),
|
||||
.. ExportRules.StandardResolutions.Select(r => new Choice(r.Key, r.LabelKey)),
|
||||
new(CustomResolution, "Export.Resolution.Custom"),
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// The size the export asks for: the preset's box, the source, a standard box (written into the overrides as landscape,
|
||||
/// so the chosen proportions are fitted in it: 4K at 9:16 renders 2160 × 3840), or Custom with Width × Height.
|
||||
/// </summary>
|
||||
public Choice? SelectedResolution
|
||||
{
|
||||
get => Resolutions.FirstOrDefault(c => Equals(c.Value, ResolutionKey(Export.Overrides, _customResolution)));
|
||||
set
|
||||
{
|
||||
if (_refreshing || value?.Value is not string key) return;
|
||||
_customResolution = key == CustomResolution;
|
||||
if (_customResolution)
|
||||
{
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(IsCustomResolution));
|
||||
return;
|
||||
}
|
||||
var (width, height) = key switch
|
||||
{
|
||||
PresetResolution => ((int?)null, (int?)null),
|
||||
SourceResolution => (0, 0),
|
||||
_ => ExportRules.StandardResolutions.Where(r => r.Key == key).Select(r => ((int?)r.Width, (int?)r.Height)).First(),
|
||||
};
|
||||
Width.Revert();
|
||||
Height.Revert();
|
||||
EditOverrides(o => o with { Width = width, Height = height });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Custom is chosen: the Width × Height fields show.</summary>
|
||||
public bool IsCustomResolution => Equals(SelectedResolution?.Value, CustomResolution);
|
||||
|
||||
public EditableField Width { get; }
|
||||
|
||||
public EditableField Height { get; }
|
||||
@@ -311,7 +344,7 @@ public sealed class ExportTab : EditorTab
|
||||
get => FrameRates.FirstOrDefault(c => FrameRateText.TryParse((string)c.Value, out var r) && FrameRateText.AreEqual(r, Resolved.FrameRate));
|
||||
set
|
||||
{
|
||||
if (!_refreshing && value?.Value is string rate) EditOverrides(o => o with { FrameRate = rate });
|
||||
if (!_refreshing && value?.Value is string rate) SetFrameRate(rate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,29 +353,27 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
public string FrameRateAutoToolTip => Loc.L("Tooltips.Editor.Export.FrameRateAuto", EditorText.FrameRate(ExportResolver.Resolve(Export with { Overrides = new ExportOverrides() }).FrameRate));
|
||||
|
||||
/// <summary>Bit rate in Mb/s (video) or quality 1–100 (JPEG, MJPEG, GIF).</summary>
|
||||
public double Quality
|
||||
public ICommand ResetFrameRateCommand { get; }
|
||||
|
||||
public IReadOnlyList<Choice> Depths { get => _depths; private set => Set(ref _depths, value); }
|
||||
|
||||
public Choice? SelectedDepth
|
||||
{
|
||||
get => IsBitRate ? (Editor.Plan?.Setup.Encoder.Settings.BitRate ?? Resolved.BitRate) / 1e6 : Resolved.Quality;
|
||||
get => Depths.FirstOrDefault(d => (int)d.Value == Resolved.BitDepth) ?? Depths[0];
|
||||
set
|
||||
{
|
||||
if (_refreshing) return;
|
||||
if (IsBitRate) EditOverrides(o => o with { BitRate = (long)(double.Round(value) * 1e6) }, "Export.Quality");
|
||||
else EditOverrides(o => o with { Quality = (int)double.Round(value) }, "Export.Quality");
|
||||
if (_refreshing || value?.Value is not int depth || depth == Resolved.BitDepth) return;
|
||||
EditOverrides(o => o with
|
||||
{
|
||||
BitDepth = depth,
|
||||
Profile = Resolved.Codec == VideoCodec.Hevc ? (depth > 8 ? CodecProfile.HevcMain10 : CodecProfile.HevcMain).ToString() : o.Profile,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBitRate => !VideoCodecInfo.IsManaged(Resolved.Codec);
|
||||
public bool CanChooseDepth => Depths.Count > 1;
|
||||
|
||||
public double QualityMaximum => IsBitRate ? 400 : 100;
|
||||
|
||||
public bool IsQualityApplicable => IsBitRate || Resolved.Codec is VideoCodec.Mjpeg or VideoCodec.JpegSequence or VideoCodec.Gif;
|
||||
|
||||
public string? QualityNotApplicable => IsQualityApplicable ? null : Loc.L("Tooltips.Editor.NotApplicable.Lossless");
|
||||
|
||||
public string QualityText => IsBitRate ? EditorText.BitRate((long)(Quality * 1e6)) : Quality.ToString("0", Loc.Culture);
|
||||
|
||||
public string QualityToolTip => Loc.L(IsBitRate ? "Tooltips.Editor.Export.BitRate" : "Tooltips.Editor.Export.Quality");
|
||||
// ---- Encoding ----
|
||||
|
||||
public IReadOnlyList<Choice> Encoders { get => _encoders; private set => Set(ref _encoders, value); }
|
||||
|
||||
@@ -367,23 +398,193 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
public bool IsHardware => !Editor.IsRemote && Editor.Plan?.Setup.Encoder.Capability?.Hardware == true;
|
||||
|
||||
public IReadOnlyList<Choice> Depths { get => _depths; private set => Set(ref _depths, value); }
|
||||
/// <summary>Variable, constant, quality (H.264, HEVC and AV1 only).</summary>
|
||||
public IReadOnlyList<Choice> RateControls { get; } =
|
||||
[.. Enum.GetValues<RateControl>().Select(r => new Choice(r, "Export.RateControl." + r))];
|
||||
|
||||
public Choice? SelectedDepth
|
||||
public Choice? SelectedRateControl
|
||||
{
|
||||
get => Depths.FirstOrDefault(d => (int)d.Value == Resolved.BitDepth) ?? Depths[0];
|
||||
get => RateControls.FirstOrDefault(c => Equals(c.Value, Resolved.RateControl));
|
||||
set
|
||||
{
|
||||
if (_refreshing || value?.Value is not int depth || depth == Resolved.BitDepth) return;
|
||||
if (_refreshing || value?.Value is not RateControl rateControl || rateControl == Resolved.RateControl) return;
|
||||
// The preset's own rate control (every preset is variable) is no override.
|
||||
EditOverrides(o => o with { RateControl = rateControl == PresetValues.RateControl ? null : rateControl.ToString().ToLowerInvariant() });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The codec has a rate control (and a keyframe interval) to choose.</summary>
|
||||
public bool HasRateControl => ExportRules.HasRateControl(Resolved.Codec);
|
||||
|
||||
public string RateControlToolTip => ExportRules.RateControlBlocked(Resolved.Codec) ?? Loc.L("Tooltips.Export.RateControl");
|
||||
|
||||
public bool IsRateControlSet => HasRateControl && Export.Overrides.RateControl is not null;
|
||||
|
||||
public ICommand ResetRateControlCommand { get; }
|
||||
|
||||
/// <summary>Bit rate in Mb/s (variable and constant rate) or quality 1–100 (quality rate control, JPEG, MJPEG, GIF).</summary>
|
||||
public double Quality
|
||||
{
|
||||
get => IsBitRate ? (Editor.Plan?.Setup.Encoder.Settings.BitRate ?? Resolved.BitRate) / 1e6 : Resolved.Quality;
|
||||
set
|
||||
{
|
||||
if (_refreshing) return;
|
||||
if (IsBitRate) EditOverrides(o => o with { BitRate = (long)(double.Round(value) * 1e6) }, "Export.Quality");
|
||||
else EditOverrides(o => o with { Quality = (int)double.Round(value) }, "Export.Quality");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The slider sets the bit rate: a video codec at variable or constant rate.</summary>
|
||||
public bool IsBitRate => HasRateControl && Resolved.RateControl != RateControl.Quality;
|
||||
|
||||
public double QualityMaximum => IsBitRate ? 400 : 100;
|
||||
|
||||
public bool IsQualityApplicable => HasRateControl || Resolved.Codec is VideoCodec.Mjpeg or VideoCodec.JpegSequence or VideoCodec.Gif;
|
||||
|
||||
public string? QualityNotApplicable => IsQualityApplicable ? null : Loc.L("Tooltips.Editor.NotApplicable.Lossless");
|
||||
|
||||
/// <summary>"Bit rate" or "Quality": the row's label follows what the slider sets.</summary>
|
||||
public string QualityHeader => Loc.L(IsBitRate ? "Export.BitRate" : "Editor.Export.Quality");
|
||||
|
||||
public string QualityText => IsBitRate ? EditorText.BitRate((long)(Quality * 1e6)) : Quality.ToString("0", Loc.Culture);
|
||||
|
||||
public string QualityToolTip => Loc.L(IsBitRate ? "Tooltips.Export.BitRate" : "Tooltips.Export.Quality");
|
||||
|
||||
public bool IsQualitySet => IsQualityApplicable && (IsBitRate ? Export.Overrides.BitRate : Export.Overrides.Quality) is not null;
|
||||
|
||||
public ICommand ResetQualityCommand { get; }
|
||||
|
||||
/// <summary>Auto (the preset's), then 0.5 to 10 s.</summary>
|
||||
public IReadOnlyList<Choice> KeyframeChoices { get => _keyframeChoices; private set => Set(ref _keyframeChoices, value); }
|
||||
|
||||
/// <summary>
|
||||
/// The keyframe interval in seconds (decision 6), stored as whole frames at the export's rate
|
||||
/// (<see cref="ExportOverrides.GopFrames"/>); 0 is Auto (the preset's).
|
||||
/// </summary>
|
||||
public Choice? SelectedKeyframes
|
||||
{
|
||||
get
|
||||
{
|
||||
var seconds = Export.Overrides.GopFrames is { } gop ? ExportRules.NearestKeyframeSeconds(gop, Resolved.FrameRate) : 0.0;
|
||||
return KeyframeChoices.FirstOrDefault(c => (double)c.Value == seconds);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_refreshing || value?.Value is not double seconds) return;
|
||||
var rate = Resolved.FrameRate;
|
||||
EditOverrides(o => o with { GopFrames = seconds <= 0 ? null : ExportRules.GopFrames(seconds, rate) });
|
||||
}
|
||||
}
|
||||
|
||||
public string KeyframesToolTip => ExportRules.RateControlBlocked(Resolved.Codec) ?? Loc.L("Tooltips.Export.Keyframes");
|
||||
|
||||
/// <summary>Auto (the preset's), then 0 to 4.</summary>
|
||||
public IReadOnlyList<Choice> BFrameChoices { get => _bFrameChoices; private set => Set(ref _bFrameChoices, value); }
|
||||
|
||||
/// <summary>B-frames, −1 for Auto (the preset's).</summary>
|
||||
public Choice? SelectedBFrames
|
||||
{
|
||||
get => BFrameChoices.FirstOrDefault(c => (int)c.Value == (Export.Overrides.BFrames ?? -1));
|
||||
set
|
||||
{
|
||||
if (_refreshing || value?.Value is not int count) return;
|
||||
EditOverrides(o => o with { BFrames = count < 0 ? null : count });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Baseline, MJPEG, GIF, APNG and the image sequences take no B-frames.</summary>
|
||||
public bool CanChooseBFrames => ExportRules.BFramesBlocked(Resolved.Codec, Resolved.Profile) is null;
|
||||
|
||||
public string BFramesToolTip => ExportRules.BFramesBlocked(Resolved.Codec, Resolved.Profile) ?? Loc.L("Tooltips.Export.BFrames");
|
||||
|
||||
/// <summary>The profiles of the codec at the chosen depth.</summary>
|
||||
public IReadOnlyList<Choice> ProfileChoices { get => _profileChoices; private set => Set(ref _profileChoices, value); }
|
||||
|
||||
public Choice? SelectedProfile
|
||||
{
|
||||
get => ProfileChoices.FirstOrDefault(c => Equals(c.Value, Resolved.Profile)) ?? ProfileChoices.FirstOrDefault();
|
||||
set
|
||||
{
|
||||
if (_refreshing || value?.Value is not CodecProfile profile || profile == Resolved.Profile) return;
|
||||
// Baseline takes no B-frames: none are asked for while it is chosen, the preset's again once it is not.
|
||||
EditOverrides(o => o with
|
||||
{
|
||||
BitDepth = depth,
|
||||
Profile = Resolved.Codec == VideoCodec.Hevc ? (depth > 8 ? CodecProfile.HevcMain10 : CodecProfile.HevcMain).ToString() : o.Profile,
|
||||
Profile = profile.ToString(),
|
||||
BFrames = profile == CodecProfile.H264Baseline ? 0 : IsBaseline(o.Profile) ? null : o.BFrames,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanChooseDepth => Depths.Count > 1;
|
||||
public bool CanChooseProfile => ProfileChoices.Count > 1;
|
||||
|
||||
public string ProfileToolTip => ExportRules.ProfileBlocked(Resolved.Codec, Resolved.BitDepth) ?? Loc.L("Tooltips.Export.Profile");
|
||||
|
||||
public bool IsProfileSet => CanChooseProfile && Export.Overrides.Profile is not null;
|
||||
|
||||
public ICommand ResetProfileCommand { get; }
|
||||
|
||||
// ---- Playback (settings format 3) ----
|
||||
|
||||
/// <summary>Forward, Reverse, Boomerang; Boomerang is not offered with star trails (decision 11).</summary>
|
||||
public IReadOnlyList<GatedChoice> Directions { get => _directions; private set => Set(ref _directions, value); }
|
||||
|
||||
public GatedChoice? SelectedDirection
|
||||
{
|
||||
get => Directions.FirstOrDefault(d => Equals(d.Value, Playback.EffectiveDirection));
|
||||
set
|
||||
{
|
||||
if (_refreshing || value is not { IsAvailable: true, Value: string direction } || direction == Playback.EffectiveDirection) return;
|
||||
EditPlayback(p => p with { Direction = direction });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Passes of the whole video, 1 to 10.</summary>
|
||||
public double Loops
|
||||
{
|
||||
get => Playback.EffectiveLoops;
|
||||
set
|
||||
{
|
||||
var loops = int.Clamp((int)double.Round(value), 1, PlaybackSettings.MaxLoops);
|
||||
if (_refreshing || loops == Playback.EffectiveLoops) return;
|
||||
EditPlayback(p => p with { Loops = loops }, "Export.Loops");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"×2".</summary>
|
||||
public string LoopsText => Loc.L("Export.Summary.Loops", Playback.EffectiveLoops);
|
||||
|
||||
/// <summary>Seconds of fade from black (slider 0–10, step 0.5; the field takes up to 30).</summary>
|
||||
public double FadeIn
|
||||
{
|
||||
get => double.Min(Playback.EffectiveFadeIn, SliderSeconds);
|
||||
set => SetSeconds(value, Playback.EffectiveFadeIn, (p, v) => p with { FadeIn = v }, "Export.FadeIn");
|
||||
}
|
||||
|
||||
public double FadeOut
|
||||
{
|
||||
get => double.Min(Playback.EffectiveFadeOut, SliderSeconds);
|
||||
set => SetSeconds(value, Playback.EffectiveFadeOut, (p, v) => p with { FadeOut = v }, "Export.FadeOut");
|
||||
}
|
||||
|
||||
/// <summary>Seconds the last frame stays (slider 0–10, step 0.5; the field takes up to 60).</summary>
|
||||
public double HoldEnd
|
||||
{
|
||||
get => double.Min(Playback.EffectiveHoldEnd, SliderSeconds);
|
||||
set => SetSeconds(value, Playback.EffectiveHoldEnd, (p, v) => p with { HoldEnd = v }, "Export.HoldEnd");
|
||||
}
|
||||
|
||||
public EditableField FadeInField { get; }
|
||||
|
||||
public EditableField FadeOutField { get; }
|
||||
|
||||
public EditableField HoldEndField { get; }
|
||||
|
||||
/// <summary>Forward, once, without fades or hold: the project writes no playback (and keeps its settings format).</summary>
|
||||
public bool IsPlaybackDefault => Export.Playback is null or { IsDefault: true };
|
||||
|
||||
public ICommand ResetPlaybackCommand { get; }
|
||||
|
||||
// ---- File ----
|
||||
|
||||
public EditableField NameTemplate { get; }
|
||||
|
||||
@@ -411,6 +612,8 @@ public sealed class ExportTab : EditorTab
|
||||
? Loc.L("Tooltips.Editor.Export.FolderServer")
|
||||
: Loc.L("Tooltips.Editor.Export.Folder", Export.Folder ?? Editor.Session.Content.ExportsFolder ?? string.Empty);
|
||||
|
||||
// ---- Estimate and notices ----
|
||||
|
||||
public string? EstimatedSize => Estimated is { } plan ? Formatting.Bytes(plan.Estimate.Bytes) : null;
|
||||
|
||||
/// <summary>"about 5 min · NVENC"; without this PC's encoder for a server sequence.</summary>
|
||||
@@ -420,14 +623,9 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
public string? ResultName => Editor.Plan?.FileName;
|
||||
|
||||
/// <summary>What the encoder changed or cannot do (localised notices and render remarks).</summary>
|
||||
/// <summary>What the encoder changed or cannot do, and what the playback could not do (localised notices and render remarks).</summary>
|
||||
public IReadOnlyList<string> Notices { get => _notices; private set => Set(ref _notices, value); }
|
||||
|
||||
/// <summary>"Previous renders of this sequence: 2 · last 2026-09-21".</summary>
|
||||
public string HistoryText => Editor.Session.Content.Renders is { Count: > 0 } renders
|
||||
? Loc.Plural("Editor.Export.History", renders.Count, Formatting.Date(renders[0].Created))
|
||||
: Loc.L("Editor.Export.NoHistory");
|
||||
|
||||
/// <summary>A workspace project's renders made on this PC that are not at its home yet (phase 5c): "Not sent".</summary>
|
||||
public bool HasUnsent => Editor.Session.Source is WorkspaceSequenceSource { UnsentRenders: > 0 };
|
||||
|
||||
@@ -466,12 +664,18 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
public IReadOnlyList<string> Batch => Export.Batch;
|
||||
|
||||
/// <summary>Completes when the card estimates in flight are done.</summary>
|
||||
/// <summary>Completes when the preset estimates in flight are done.</summary>
|
||||
public Task EstimatesIdle => _estimates.Idle;
|
||||
|
||||
private ExportSettings Export => Editor.Session.Project.Export;
|
||||
|
||||
private ResolvedExport Resolved => Editor.Plan?.Export ?? ExportResolver.Resolve(Export);
|
||||
private PlaybackSettings Playback => Export.Playback ?? new PlaybackSettings();
|
||||
|
||||
/// <summary>The project's export as the plan resolves it, read at once (the plan follows an edit later).</summary>
|
||||
private ResolvedExport Resolved => ExportResolver.Resolve(Export);
|
||||
|
||||
/// <summary>The export's preset without overrides: what Auto and Reset go back to.</summary>
|
||||
private ResolvedExport PresetValues => ExportResolver.Resolve(Export with { Overrides = new ExportOverrides() });
|
||||
|
||||
/// <summary>The plan when its estimates mean something: this PC can encode it, or the server renders it.</summary>
|
||||
private ExportPlan? Estimated => Editor.Plan is { } plan && (Editor.IsRemote || plan.Setup.Encoder.IsReady) ? plan : null;
|
||||
@@ -484,9 +688,26 @@ public sealed class ExportTab : EditorTab
|
||||
EditExport(e => e with { Batch = value ? [.. e.Batch, presetId] : [.. e.Batch.Where(b => !b.Equals(presetId, StringComparison.OrdinalIgnoreCase))] });
|
||||
}
|
||||
|
||||
/// <summary>The preset cards take more of the height than the preview (Export.html).</summary>
|
||||
/// <summary>The preset table takes more of the height than the preview (Export.html).</summary>
|
||||
public override bool PrefersTallMeasure => true;
|
||||
|
||||
/// <summary>
|
||||
/// The Resolution choice of <paramref name="overrides"/>: Preset without a box of its own, Source for 0 × 0, a standard
|
||||
/// size for its box, else Custom (also while <paramref name="custom"/>, chosen to type a size).
|
||||
/// </summary>
|
||||
public static string ResolutionKey(ExportOverrides overrides, bool custom = false)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(overrides);
|
||||
if (custom) return CustomResolution;
|
||||
return (overrides.Width, overrides.Height) switch
|
||||
{
|
||||
(null, null) => PresetResolution,
|
||||
(0, 0) => SourceResolution,
|
||||
({ } w, { } h) when ExportRules.StandardResolutions.FirstOrDefault(r => r.Width == w && r.Height == h) is { Key: { } key } => key,
|
||||
_ => CustomResolution,
|
||||
};
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
@@ -494,20 +715,21 @@ public sealed class ExportTab : EditorTab
|
||||
try
|
||||
{
|
||||
UpdateLists();
|
||||
LoadBox();
|
||||
LoadFields();
|
||||
SaveChoices = !CanChooseFolder ? [new SaveChoice(null)]
|
||||
: Export.Folder is { } folder ? [new SaveChoice(null), new SaveChoice(folder), new SaveChoice(null, Browse: true)]
|
||||
: [new SaveChoice(null), new SaveChoice(null, Browse: true)];
|
||||
if (!NameTemplate.IsDirty) NameTemplate.Load(Export.NameTemplate);
|
||||
UpdateSummaries();
|
||||
OnAllPropertiesChanged();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_refreshing = false;
|
||||
}
|
||||
SelectCards();
|
||||
foreach (var card in Cards) card.RefreshBatch();
|
||||
_ = EstimateCardsAsync();
|
||||
SelectRows();
|
||||
foreach (var row in Presets) row.RefreshBatch();
|
||||
_ = EstimateRowsAsync();
|
||||
}
|
||||
|
||||
public override void OnPlanChanged()
|
||||
@@ -515,9 +737,10 @@ public sealed class ExportTab : EditorTab
|
||||
_refreshing = true;
|
||||
try
|
||||
{
|
||||
LoadBox();
|
||||
LoadFields();
|
||||
UpdateLists();
|
||||
Notices = Editor.Plan is { } plan ? PlanNotices(plan) : [];
|
||||
UpdateSummaries();
|
||||
OnAllPropertiesChanged();
|
||||
}
|
||||
finally
|
||||
@@ -525,13 +748,13 @@ public sealed class ExportTab : EditorTab
|
||||
_refreshing = false;
|
||||
}
|
||||
// The plan follows the preset a read-only session chose to render.
|
||||
SelectCards();
|
||||
SelectRows();
|
||||
}
|
||||
|
||||
public override void OnBusyChanged()
|
||||
{
|
||||
base.OnBusyChanged();
|
||||
foreach (var card in Cards) card.RefreshLocked();
|
||||
foreach (var row in Presets) row.RefreshLocked();
|
||||
}
|
||||
|
||||
public override void OnContentChanged()
|
||||
@@ -539,8 +762,12 @@ public sealed class ExportTab : EditorTab
|
||||
// The ledger was read again: Send again goes by what it holds now.
|
||||
_sendQueued = false;
|
||||
_sendAgain?.RaiseCanExecuteChanged();
|
||||
LoadCards();
|
||||
LoadTable();
|
||||
if (SelectedCopy is null || !SavedCopies.Contains(SelectedCopy)) SelectedCopy = SavedCopies.FirstOrDefault();
|
||||
// The rows and groups keep texts in objects (a language switch comes this way too).
|
||||
_keyframeChoices = _bFrameChoices = _profileChoices = [];
|
||||
_directions = [];
|
||||
foreach (var group in new[] { OutputGroup, EncodingGroup, PlaybackGroup, FileGroup }) group.Refresh();
|
||||
base.OnContentChanged();
|
||||
}
|
||||
|
||||
@@ -559,6 +786,7 @@ public sealed class ExportTab : EditorTab
|
||||
{
|
||||
OnPropertyChanged(nameof(CanSync));
|
||||
OnPropertyChanged(nameof(SyncToolTip));
|
||||
FileGroup.Summary = FileSummary();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -569,15 +797,33 @@ public sealed class ExportTab : EditorTab
|
||||
|
||||
/// <summary>
|
||||
/// Width and Height edit the preset's box, which the chosen proportions are fitted in (owner review 1, R5): they show the
|
||||
/// resolved box (empty for a side the preset leaves to the source), not the size rendered (Output size).
|
||||
/// resolved box (empty for a side the preset leaves to the source), not the size rendered (Output size). The playback
|
||||
/// fields show the seconds in force.
|
||||
/// </summary>
|
||||
private void LoadBox()
|
||||
private void LoadFields()
|
||||
{
|
||||
var resolved = Resolved;
|
||||
if (!Width.IsDirty) Width.Load(resolved.Width > 0 ? resolved.Width.ToString(CultureInfo.InvariantCulture) : string.Empty);
|
||||
if (!Height.IsDirty) Height.Load(resolved.Height > 0 ? resolved.Height.ToString(CultureInfo.InvariantCulture) : string.Empty);
|
||||
var playback = Playback;
|
||||
if (!FadeInField.IsDirty) FadeInField.Load(SecondsText(playback.EffectiveFadeIn));
|
||||
if (!FadeOutField.IsDirty) FadeOutField.Load(SecondsText(playback.EffectiveFadeOut));
|
||||
if (!HoldEndField.IsDirty) HoldEndField.Load(SecondsText(playback.EffectiveHoldEnd));
|
||||
}
|
||||
|
||||
/// <summary>The one-line summaries the groups show while collapsed.</summary>
|
||||
private void UpdateSummaries()
|
||||
{
|
||||
var resolved = Resolved;
|
||||
var settings = Editor.Plan?.Setup.Encoder.Settings;
|
||||
OutputGroup.Summary = EditorText.Format(resolved, settings?.Width ?? resolved.Width, settings?.Height ?? resolved.Height);
|
||||
EncodingGroup.Summary = ExportSummaries.Encoding(resolved, settings?.BitRate ?? resolved.BitRate);
|
||||
PlaybackGroup.Summary = ExportSummaries.Playback(Export.Playback);
|
||||
FileGroup.Summary = FileSummary();
|
||||
}
|
||||
|
||||
private string FileSummary() => ExportSummaries.File(ResultName, SelectedSave?.Label ?? Loc.L("Editor.Export.SequenceFolder"), SyncToServer && CanSync);
|
||||
|
||||
/// <summary>"2160 × 3840".</summary>
|
||||
private static string SizeText((int Width, int Height) size) =>
|
||||
size.Width.ToString(Loc.Culture) + " × " + size.Height.ToString(Loc.Culture);
|
||||
@@ -596,7 +842,7 @@ public sealed class ExportTab : EditorTab
|
||||
return width > maxWidth || height > maxHeight ? (maxWidth, maxHeight) : plan.EncodedSize;
|
||||
}
|
||||
|
||||
/// <summary>The choices that depend on the resolved codec (new lists only when they change, so selections stay bound).</summary>
|
||||
/// <summary>The choices that depend on the resolved codec and the project (new lists only when they change, so selections stay bound).</summary>
|
||||
private void UpdateLists()
|
||||
{
|
||||
var resolved = Resolved;
|
||||
@@ -610,43 +856,77 @@ public sealed class ExportTab : EditorTab
|
||||
_ => [resolved.BitDepth],
|
||||
};
|
||||
if (!depths.SequenceEqual(Depths.Select(d => (int)d.Value))) Depths = [.. depths.Select(d => new Choice(d, "Editor.Export.Depth", d))];
|
||||
|
||||
// Auto names the preset's own value (its keyframe interval is in seconds, whatever the frame rate).
|
||||
var preset = PresetValues;
|
||||
var autoKeyframes = Auto(ExportRules.Seconds(ExportRules.GopSeconds(preset.GopFrames, preset.FrameRate)));
|
||||
if (KeyframeChoices.FirstOrDefault()?.Label != autoKeyframes)
|
||||
KeyframeChoices = [new Choice(0.0, "Editor.Value.Text", autoKeyframes), .. ExportRules.KeyframeSeconds.Select(s => new Choice(s, "Editor.Value.Text", ExportRules.Seconds(s)))];
|
||||
var autoBFrames = Auto(preset.BFrames.ToString(Loc.Culture));
|
||||
if (BFrameChoices.FirstOrDefault()?.Label != autoBFrames)
|
||||
BFrameChoices = [new Choice(-1, "Editor.Value.Text", autoBFrames), .. ExportRules.BFrameCounts.Select(n => new Choice(n, "Editor.Value.Number", n))];
|
||||
var profiles = ExportRules.Profiles(resolved.Codec, resolved.BitDepth);
|
||||
if (!profiles.Cast<object>().SequenceEqual(ProfileChoices.Select(c => c.Value)))
|
||||
ProfileChoices = [.. profiles.Select(p => new Choice(p, "Editor.Value.Text", ExportRules.ProfileLabel(p)))];
|
||||
|
||||
var starTrails = Editor.Session.Project.Stack.Mode == StackSetting.StarTrails;
|
||||
if (Directions.Count == 0 || Directions.Any(d => (string)d.Value == PlaybackDirection.Boomerang && d.IsAvailable == starTrails))
|
||||
{
|
||||
Directions =
|
||||
[
|
||||
.. PlaybackDirection.All.Select(d =>
|
||||
{
|
||||
var blocked = starTrails && d == PlaybackDirection.Boomerang;
|
||||
return new GatedChoice(d, ExportSummaries.DirectionLabel(d), !blocked, Loc.L(blocked ? "Tooltips.Export.BoomerangStack" : "Tooltips.Export.Direction"));
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadCards() => Cards = [.. ExportPlanner.Choices(Editor.Session.Presets, Editor.Session.Advice).Select(c => new PresetCard(this, c))];
|
||||
/// <summary>"Auto · 1 s".</summary>
|
||||
private static string Auto(string value) => Loc.L("Export.Auto") + Loc.Separator + value;
|
||||
|
||||
/// <summary>The card of the export preset the plan renders.</summary>
|
||||
private void SelectCards()
|
||||
private void LoadTable()
|
||||
{
|
||||
foreach (var card in Cards)
|
||||
card.IsSelected = card.Choice.Sequence is null && string.Equals(card.Choice.ExportPresetId, Resolved.PresetId, StringComparison.OrdinalIgnoreCase);
|
||||
Presets = [.. ExportPlanner.Choices(Editor.Session.Presets, Editor.Session.Advice).Select(c => new PresetRow(this, c))];
|
||||
PresetGroups = PresetTable.Build(Presets, Resolved.PresetId);
|
||||
}
|
||||
|
||||
/// <summary>The row of the export preset the plan renders.</summary>
|
||||
private void SelectRows()
|
||||
{
|
||||
foreach (var row in Presets)
|
||||
row.IsSelected = row.Choice.Sequence is null && string.Equals(row.Choice.ExportPresetId, Resolved.PresetId, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the plan changed or cannot do, localised; for a server sequence without this PC's encoder notices (the server
|
||||
/// or its render node picks the encoder).
|
||||
/// or its render node picks the encoder). The output program's remarks (fades shortened, a direction not known) follow.
|
||||
/// </summary>
|
||||
private IReadOnlyList<string> PlanNotices(ExportPlan plan)
|
||||
{
|
||||
var encoder = Editor.IsRemote ? plan.Setup.Encoder.Notices.Select(n => n.Key).ToHashSet(StringComparer.Ordinal) : [];
|
||||
return [.. plan.Setup.Warnings.Where(w => !encoder.Contains(w.Key)).Select(w => Loc.L(w.Key, [.. w.Args]))
|
||||
.Concat(plan.Export.Warnings.Select(k => Loc.L(k))).Distinct()];
|
||||
.Concat(plan.Export.Warnings.Select(k => Loc.L(k)))
|
||||
.Concat(plan.Program?.Warnings.Select(w => Loc.L(w.Key, [.. w.Args])) ?? []).Distinct()];
|
||||
}
|
||||
|
||||
/// <summary>Estimates every card off the UI thread for the project as it is now (latest request wins).</summary>
|
||||
private async Task EstimateCardsAsync()
|
||||
/// <summary>Estimates every preset off the UI thread for the project as it is now (latest request wins).</summary>
|
||||
private async Task EstimateRowsAsync()
|
||||
{
|
||||
var project = Editor.Session.Project;
|
||||
var cards = Cards;
|
||||
var plans = new ExportPlan?[cards.Count];
|
||||
var rows = Presets;
|
||||
var plans = new ExportPlan?[rows.Count];
|
||||
var done = false;
|
||||
try
|
||||
{
|
||||
await _estimates.Schedule(token =>
|
||||
{
|
||||
for (var i = 0; i < cards.Count; i++)
|
||||
for (var i = 0; i < rows.Count; i++)
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
var export = project.Export with { Preset = project.Export.Preset.WithManual(cards[i].Choice.ExportPresetId), Overrides = new ExportOverrides(), Batch = [] };
|
||||
// The playback stays: a preset renders with the loops and holds of the export (batch presets inherit it).
|
||||
var export = project.Export with { Preset = project.Export.Preset.WithManual(rows[i].Choice.ExportPresetId), Overrides = new ExportOverrides(), Batch = [] };
|
||||
plans[i] = Editor.Planner.Plan(project, export);
|
||||
}
|
||||
done = true;
|
||||
@@ -655,12 +935,12 @@ public sealed class ExportTab : EditorTab
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException or InvalidOperationException)
|
||||
{
|
||||
Core.Diagnostics.Log.Warning("editor", "Preset estimates failed", ex);
|
||||
Log.Warning("editor", "Preset estimates failed", ex);
|
||||
return;
|
||||
}
|
||||
// A superseded request stops part way (or never starts); undo can bring back the same project instance.
|
||||
if (!done || !ReferenceEquals(cards, Cards) || !ReferenceEquals(project, Editor.Session.Project)) return;
|
||||
for (var i = 0; i < cards.Count; i++) cards[i].Update(plans[i]);
|
||||
if (!done || !ReferenceEquals(rows, Presets) || !ReferenceEquals(project, Editor.Session.Project)) return;
|
||||
for (var i = 0; i < rows.Count; i++) rows[i].Update(plans[i]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -697,18 +977,14 @@ public sealed class ExportTab : EditorTab
|
||||
});
|
||||
}
|
||||
|
||||
private void OpenHistory()
|
||||
{
|
||||
Editor.Shell.Jobs.Filter = Jobs.JobFilter.All;
|
||||
Editor.Shell.Jobs.SearchText = Editor.Title;
|
||||
Editor.Shell.Navigate(Shell.SectionKey.Jobs);
|
||||
}
|
||||
private void OpenVideos() => VideosLink.Open(Editor.Shell.AllSections, Editor.Shell.Navigate, Editor.Session.Content.Sequence.Id);
|
||||
|
||||
private void Select(PresetCard? card)
|
||||
private void Select(PresetRow? row)
|
||||
{
|
||||
if (card is null) return;
|
||||
if (card.Choice.Sequence is { } preset) Editor.Session.ApplyPreset(preset);
|
||||
else EditExport(e => e with { Preset = e.Preset.WithManual(card.Choice.ExportPresetId), Overrides = new ExportOverrides() });
|
||||
if (row is null) return;
|
||||
_customResolution = false;
|
||||
if (row.Choice.Sequence is { } preset) Editor.Session.ApplyPreset(preset);
|
||||
else EditExport(e => e with { Preset = e.Preset.WithManual(row.Choice.ExportPresetId), Overrides = new ExportOverrides() });
|
||||
}
|
||||
|
||||
private void SelectCodec(CodecChoice choice) => EditOverrides(o => o with
|
||||
@@ -720,6 +996,17 @@ public sealed class ExportTab : EditorTab
|
||||
Encoder = null,
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Sets the frame rate (null: the preset's). A keyframe interval chosen by hand is kept in seconds (decision 6), so
|
||||
/// its frames follow the new rate.
|
||||
/// </summary>
|
||||
private void SetFrameRate(string? rate)
|
||||
{
|
||||
var from = Resolved.FrameRate;
|
||||
var to = rate is not null && FrameRateText.TryParse(rate, out var parsed) ? parsed : PresetValues.FrameRate;
|
||||
EditOverrides(o => o with { FrameRate = rate, GopFrames = o.GopFrames is { } gop ? ExportRules.RescaleGop(gop, from, to) : null });
|
||||
}
|
||||
|
||||
private IReadOnlyList<Choice> EncoderChoices(VideoCodec codec)
|
||||
{
|
||||
var names = Editor.Planner.Encoders.SelectMany(p => p.Capabilities).Where(c => c.Codec == codec).Select(c => c.Name).Distinct();
|
||||
@@ -732,6 +1019,41 @@ public sealed class ExportTab : EditorTab
|
||||
private void EditOverrides(Func<ExportOverrides, ExportOverrides> change, string? mergeKey = null) =>
|
||||
EditExport(e => e with { Overrides = change(e.Overrides) }, mergeKey);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the playback; at its default (forward, once, no fades or hold) the export holds none, so an ordinary project
|
||||
/// keeps its settings format (decision 8).
|
||||
/// </summary>
|
||||
private void EditPlayback(Func<PlaybackSettings, PlaybackSettings> change, string? mergeKey = null) =>
|
||||
EditExport(e => e with { Playback = change(e.Playback ?? new PlaybackSettings()) is var p && p.IsDefault ? null : p.Normalized() }, mergeKey);
|
||||
|
||||
/// <summary>A slider of seconds: snapped to 0.5 s; a value the field set above the slider's end stays until the slider moves.</summary>
|
||||
private void SetSeconds(double value, double current, Func<PlaybackSettings, double?, PlaybackSettings> set, string mergeKey)
|
||||
{
|
||||
var seconds = double.Round(double.Clamp(value, 0, SliderSeconds) * 2) / 2;
|
||||
if (_refreshing || seconds == double.Min(current, SliderSeconds)) return;
|
||||
EditPlayback(p => set(p, seconds), mergeKey);
|
||||
}
|
||||
|
||||
private EditableField SecondsField(double maximum, Func<PlaybackSettings, double?, PlaybackSettings> set, string toolTipKey) =>
|
||||
new(SecondsText(0), text => ParseSeconds(text, maximum) is null ? Loc.L("Errors.Number.DecimalRange", 0.ToString("0.##", Loc.Culture), maximum.ToString("0.##", Loc.Culture)) : null,
|
||||
text => EditPlayback(p => set(p, ParseSeconds(text, maximum))), () => Loc.L(toolTipKey));
|
||||
|
||||
/// <summary>"1.5" in the UI language.</summary>
|
||||
private static string SecondsText(double seconds) => seconds.ToString("0.##", Loc.Culture);
|
||||
|
||||
/// <summary>Seconds 0..<paramref name="maximum"/> in the UI language (or with a point); null when the text is not one.</summary>
|
||||
private static double? ParseSeconds(string text, double maximum)
|
||||
{
|
||||
var trimmed = text.Trim();
|
||||
if (trimmed.Length == 0) return 0;
|
||||
return (double.TryParse(trimmed, NumberStyles.Float, Loc.Culture, out var v) || double.TryParse(trimmed, NumberStyles.Float, CultureInfo.InvariantCulture, out v))
|
||||
&& double.IsFinite(v) && v >= 0 && v <= maximum
|
||||
? v
|
||||
: null;
|
||||
}
|
||||
|
||||
private static bool IsBaseline(string? profile) => string.Equals(profile, nameof(CodecProfile.H264Baseline), StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private static string? ValidateSize(string text) =>
|
||||
text.Length == 0 || (int.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out var v) && v is >= 16 and <= 16384)
|
||||
? null
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.App.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// A 28 px row of the Export step's preset table (owner review 1, R3; decision 3): the batch tick, the name with the
|
||||
/// Recommended chip, and the details as columns (size, codec, fps, estimated size and time). Clicking the row selects the
|
||||
/// preset; the tick adds it to the batch.
|
||||
/// </summary>
|
||||
public sealed class PresetRow : ObservableObject
|
||||
{
|
||||
private readonly ExportTab _owner;
|
||||
private string _size;
|
||||
private string _codec;
|
||||
private string _fps;
|
||||
private string? _estimatedSize;
|
||||
private string? _estimatedTime;
|
||||
private bool _isSelected;
|
||||
|
||||
public PresetRow(ExportTab owner, ExportChoice choice)
|
||||
{
|
||||
_owner = owner;
|
||||
Choice = choice;
|
||||
var preset = ExportPresets.Find(choice.ExportPresetId);
|
||||
_size = preset is { Width: > 0, Height: > 0 } ? EditorText.Size(preset.Width, preset.Height) : Loc.L("Export.Resolution.Source");
|
||||
_codec = preset is null ? string.Empty : EditorText.CodecName(preset.Codec, preset.Profile, preset.BitDepth);
|
||||
_fps = preset is null ? string.Empty : EditorText.FrameRate(preset.FrameRate);
|
||||
}
|
||||
|
||||
public ExportChoice Choice { get; }
|
||||
|
||||
public string Name => Choice.Name;
|
||||
|
||||
public bool IsRecommended => Choice.IsRecommended;
|
||||
|
||||
/// <summary>Sequence presets apply full settings; export presets only choose the output.</summary>
|
||||
public bool IsSequencePreset => Choice.Sequence is not null;
|
||||
|
||||
/// <summary>The preset group of the table (<see cref="ExportPreset.Group"/>): a sequence preset's is its export preset's.</summary>
|
||||
public string Group => ExportPresets.Find(Choice.ExportPresetId)?.Group ?? PresetTable.DefaultGroup;
|
||||
|
||||
/// <summary>What choosing the row does, or why it cannot be chosen now (a job runs, the project cannot change).</summary>
|
||||
public string ToolTip => _owner.Editor.LockedToolTip ?? (Choice.Reason is { } reason
|
||||
? Loc.L(IsSequencePreset ? "Tooltips.Editor.Export.ApplyPreset" : "Tooltips.Editor.Export.Recommended", reason)
|
||||
: Loc.L("Tooltips.Export.PresetRow", Name));
|
||||
|
||||
public string BatchToolTip => _owner.Editor.LockedToolTip ?? Loc.L("Tooltips.Export.PresetBatch", Name);
|
||||
|
||||
/// <summary>"3840×2160" as rendered (the chosen proportions fitted in the preset's box), "Source" for image sequences.</summary>
|
||||
public string Size { get => _size; private set => Set(ref _size, value); }
|
||||
|
||||
/// <summary>"HEVC Main10".</summary>
|
||||
public string Codec { get => _codec; private set => Set(ref _codec, value); }
|
||||
|
||||
/// <summary>"24".</summary>
|
||||
public string Fps { get => _fps; private set => Set(ref _fps, value); }
|
||||
|
||||
/// <summary>"2.2 GB", or "No encoder here"; null until estimated.</summary>
|
||||
public string? EstimatedSize { get => _estimatedSize; private set => Set(ref _estimatedSize, value); }
|
||||
|
||||
/// <summary>"about 5 min"; null until estimated or without an encoder here.</summary>
|
||||
public string? EstimatedTime { get => _estimatedTime; private set => Set(ref _estimatedTime, value); }
|
||||
|
||||
public bool IsSelected { get => _isSelected; set => Set(ref _isSelected, value); }
|
||||
|
||||
/// <summary>Ticked for the batch (export presets only).</summary>
|
||||
public bool IsInBatch
|
||||
{
|
||||
get => _owner.IsInBatch(Choice.ExportPresetId);
|
||||
set => _owner.SetInBatch(Choice.ExportPresetId, value);
|
||||
}
|
||||
|
||||
public bool CanBatch => !IsSequencePreset;
|
||||
|
||||
public ICommand SelectCommand => _owner.SelectCommand;
|
||||
|
||||
/// <remarks>A server sequence renders on the server: this PC's encoders do not rule out the estimate.</remarks>
|
||||
public void Update(ExportPlan? plan)
|
||||
{
|
||||
if (plan is null)
|
||||
{
|
||||
EstimatedSize = EstimatedTime = null;
|
||||
return;
|
||||
}
|
||||
var settings = plan.Setup.Encoder.Settings;
|
||||
if (settings.Width > 0 && settings.Height > 0) Size = EditorText.Size(settings.Width, settings.Height);
|
||||
Codec = EditorText.CodecName(plan.Export.Codec, plan.Export.Profile, plan.Export.BitDepth);
|
||||
Fps = EditorText.FrameRate(plan.Export.FrameRate);
|
||||
if (_owner.Editor.IsRemote || plan.Setup.Encoder.IsReady)
|
||||
{
|
||||
EstimatedSize = Formatting.Bytes(plan.Estimate.Bytes);
|
||||
EstimatedTime = Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time));
|
||||
}
|
||||
else
|
||||
{
|
||||
EstimatedSize = Loc.L("Editor.Export.Unavailable");
|
||||
EstimatedTime = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshBatch() => OnPropertyChanged(nameof(IsInBatch));
|
||||
|
||||
/// <summary>A job of the sequence started or ended, or the project became read-only: the tooltips say why the row waits.</summary>
|
||||
public void RefreshLocked()
|
||||
{
|
||||
OnPropertyChanged(nameof(ToolTip));
|
||||
OnPropertyChanged(nameof(BatchToolTip));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A group of the preset table ("Social (3)"): a header that opens or closes it, then its rows.</summary>
|
||||
public sealed class PresetGroup : ObservableObject
|
||||
{
|
||||
private readonly bool _expandedByDefault;
|
||||
|
||||
public PresetGroup(string key, IReadOnlyList<PresetRow> rows, bool expandedByDefault)
|
||||
{
|
||||
Key = key;
|
||||
Rows = rows;
|
||||
_expandedByDefault = expandedByDefault;
|
||||
ToggleCommand = new RelayCommand(() => IsExpanded = !IsExpanded);
|
||||
}
|
||||
|
||||
/// <summary>The <see cref="ExportPreset.Group"/> ("social").</summary>
|
||||
public string Key { get; }
|
||||
|
||||
public IReadOnlyList<PresetRow> Rows { get; }
|
||||
|
||||
/// <summary>"Social".</summary>
|
||||
public string Name => PresetTable.GroupName(Key);
|
||||
|
||||
/// <summary>"Social (3)".</summary>
|
||||
public string Header => Loc.L("Export.Preset.GroupCount", Name, Rows.Count.ToString("N0", Loc.Culture));
|
||||
|
||||
public string ToolTip => Loc.L("Tooltips.Export.PresetGroup", Name);
|
||||
|
||||
/// <summary>Kept per group by the app (<see cref="EditorSettings.Groups"/>); by default open when it holds the preset in use or the recommended one.</summary>
|
||||
public bool IsExpanded
|
||||
{
|
||||
get => EditorSettings.Groups.IsExpanded(PresetTable.StateKey(Key), _expandedByDefault);
|
||||
set
|
||||
{
|
||||
if (value == IsExpanded) return;
|
||||
EditorSettings.Groups.Set(PresetTable.StateKey(Key), value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ToggleCommand { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Export step's preset table (owner review 1, R3; decision 3): the presets grouped by <see cref="ExportPreset.Group"/>
|
||||
/// (Video, Social, Intermediate, Image sequence, Web) in the order the built-in list first names each group, a sequence
|
||||
/// preset first in the group of its export preset.
|
||||
/// </summary>
|
||||
public static class PresetTable
|
||||
{
|
||||
/// <summary>The group of a preset that names none.</summary>
|
||||
public const string DefaultGroup = "video";
|
||||
|
||||
/// <summary>The key of a group's open state in <see cref="EditorSettings.Groups"/>.</summary>
|
||||
public static string StateKey(string group) => "preset." + group;
|
||||
|
||||
/// <summary>"Image sequence" for "sequence".</summary>
|
||||
public static string GroupName(string group) => Loc.L("Export.Preset.Group." + group switch
|
||||
{
|
||||
"social" => "Social",
|
||||
"intermediate" => "Intermediate",
|
||||
"sequence" => "Sequence",
|
||||
"web" => "Web",
|
||||
_ => "Video",
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The groups of <paramref name="rows"/>, in the order of <see cref="ExportPresets.BuiltIn"/> (a group it does not name
|
||||
/// comes last), each row in the order given. A group with the preset in use (<paramref name="selectedPresetId"/>) or the
|
||||
/// recommended preset opens by default, the first group when none has either.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<PresetGroup> Build(IReadOnlyList<PresetRow> rows, string? selectedPresetId)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(rows);
|
||||
var order = ExportPresets.BuiltIn.Select(p => p.Group).Distinct(StringComparer.Ordinal).ToList();
|
||||
var groups = rows.GroupBy(r => r.Group, StringComparer.Ordinal)
|
||||
.OrderBy(g => order.IndexOf(g.Key) is var i and >= 0 ? i : int.MaxValue)
|
||||
.Select(g => (g.Key, Rows: g.ToList()))
|
||||
.ToList();
|
||||
var open = groups.Select(g => g.Rows.Any(r => r.IsRecommended
|
||||
|| (!r.IsSequencePreset && string.Equals(r.Choice.ExportPresetId, selectedPresetId, StringComparison.OrdinalIgnoreCase)))).ToList();
|
||||
if (open.Count > 0 && !open.Contains(true)) open[0] = true;
|
||||
return [.. groups.Select((g, i) => new PresetGroup(g.Key, g.Rows, open[i]))];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Chronos.App.Shell;
|
||||
|
||||
namespace Chronos.App.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// A rail section that lists the videos (owner review 1, R9: the Videos section) and can show only those of one
|
||||
/// sequence: the Export footer's "Videos (n)" and the Render menu open it filtered on the sequence in Edit.
|
||||
/// </summary>
|
||||
public interface IVideosSection
|
||||
{
|
||||
/// <summary>Lists the videos of <paramref name="sequenceId"/> only; null lists every video again.</summary>
|
||||
void ShowSequence(Guid? sequenceId);
|
||||
}
|
||||
|
||||
/// <summary>Opens the Videos section on one sequence's videos, wherever the shell keeps it.</summary>
|
||||
public static class VideosLink
|
||||
{
|
||||
/// <summary>The section of <paramref name="sections"/> that lists the videos; null while the app has none.</summary>
|
||||
public static SectionViewModel? Find(IEnumerable<SectionViewModel> sections)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sections);
|
||||
return sections.FirstOrDefault(s => s is IVideosSection);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filters the Videos section on <paramref name="sequenceId"/> and shows it through <paramref name="navigate"/>; false
|
||||
/// (nothing happens) when the app has no Videos section.
|
||||
/// </summary>
|
||||
public static bool Open(IEnumerable<SectionViewModel> sections, Action<SectionKey> navigate, Guid sequenceId)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(navigate);
|
||||
if (Find(sections) is not { } section) return false;
|
||||
((IVideosSection)section).ShowSequence(sequenceId);
|
||||
navigate(section.Key);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -130,9 +130,9 @@ public sealed class EditorSmokeTests
|
||||
Assert.False(export.BatchCommand.CanExecute(null), "nothing ticked");
|
||||
var batchButton = Find<Button>(window).Single(b => ReferenceEquals(b.Command, export.BatchCommand));
|
||||
Assert.False(batchButton.IsEnabled);
|
||||
export.Cards.First(c => c.CanBatch).IsInBatch = true;
|
||||
export.Presets.First(c => c.CanBatch).IsInBatch = true;
|
||||
await SettleAsync(window);
|
||||
Assert.True(batchButton.IsEnabled, "ticking a card enables Batch…");
|
||||
Assert.True(batchButton.IsEnabled, "ticking a preset enables Batch…");
|
||||
editor.ShowVectors = false;
|
||||
|
||||
// The waveform of the Exposure tab is measured from the preview.
|
||||
@@ -685,9 +685,9 @@ public sealed class EditorSmokeTests
|
||||
Assert.NotEmpty(Find<CurveEditor>(view).Where(c => c.IsVisible && c.ActualHeight > 50));
|
||||
break;
|
||||
case ExportTab export:
|
||||
Assert.NotEmpty(export.Cards);
|
||||
Assert.NotEmpty(Find<Button>(view).Where(b => b.DataContext is PresetCard && b.IsVisible));
|
||||
Assert.True(export.Cards.Any(c => c.Estimate is not null), "estimates on the cards");
|
||||
Assert.NotEmpty(export.Presets);
|
||||
Assert.NotEmpty(Find<Button>(view).Where(b => b.DataContext is PresetRow && b.IsVisible));
|
||||
Assert.True(export.Presets.Any(c => c.EstimatedSize is not null), "estimates in the preset table");
|
||||
break;
|
||||
default:
|
||||
var chart = Find<SeriesChart>(view).Single(c => c.IsVisible);
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
using System.Globalization;
|
||||
using Chronos.App.Editor;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Tests.Windows;
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Data.Processing;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.App.Tests.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// The Export step's Output panel (owner review 1, R3 and R8): what the advanced encoding rows offer per codec, the
|
||||
/// keyframe interval kept in seconds across a frame rate change, a standard resolution fitted to the chosen proportions,
|
||||
/// a playback that raises the settings format, the collapsed groups' summaries and open state, the preset table's
|
||||
/// groups, and the footer's Batch (n) and Videos (n).
|
||||
/// </summary>
|
||||
[Serial]
|
||||
public sealed class ExportTabTests
|
||||
{
|
||||
private static readonly Rational Fps24 = new(24, 1);
|
||||
private static readonly Rational Fps30 = new(30, 1);
|
||||
|
||||
private static ExportSettings Preset(string id)
|
||||
{
|
||||
var export = new ProjectSettings().Export;
|
||||
return export with { Preset = export.Preset.WithManual(id) };
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RateControlBFramesAndProfileFollowTheCodecAndDepth()
|
||||
{
|
||||
Assert.True(ExportRules.HasRateControl(VideoCodec.H264));
|
||||
Assert.True(ExportRules.HasRateControl(VideoCodec.Hevc));
|
||||
Assert.Null(ExportRules.RateControlBlocked(VideoCodec.Av1));
|
||||
foreach (var managed in new[] { VideoCodec.Mjpeg, VideoCodec.Gif, VideoCodec.Apng, VideoCodec.PngSequence, VideoCodec.JpegSequence })
|
||||
{
|
||||
Assert.False(ExportRules.HasRateControl(managed), $"{managed} has no rate control");
|
||||
Assert.NotNull(ExportRules.RateControlBlocked(managed), $"{managed}: the tooltip says why");
|
||||
Assert.NotNull(ExportRules.BFramesBlocked(managed, CodecProfile.Auto), $"{managed} takes no B-frames");
|
||||
Assert.Empty(ExportRules.Profiles(managed, 8));
|
||||
Assert.NotNull(ExportRules.ProfileBlocked(managed, 8));
|
||||
}
|
||||
|
||||
Assert.NotNull(ExportRules.BFramesBlocked(VideoCodec.H264, CodecProfile.H264Baseline), "Baseline takes no B-frames");
|
||||
Assert.Null(ExportRules.BFramesBlocked(VideoCodec.H264, CodecProfile.H264High));
|
||||
Assert.Null(ExportRules.BFramesBlocked(VideoCodec.Hevc, CodecProfile.HevcMain10));
|
||||
|
||||
Assert.SequenceEqual([CodecProfile.H264Baseline, CodecProfile.H264Main, CodecProfile.H264High], ExportRules.Profiles(VideoCodec.H264, 8));
|
||||
Assert.Null(ExportRules.ProfileBlocked(VideoCodec.H264, 8), "H.264 offers three profiles");
|
||||
Assert.SequenceEqual([CodecProfile.HevcMain], ExportRules.Profiles(VideoCodec.Hevc, 8));
|
||||
Assert.SequenceEqual([CodecProfile.HevcMain10], ExportRules.Profiles(VideoCodec.Hevc, 10), "HEVC at 10 bits is Main 10");
|
||||
Assert.NotNull(ExportRules.ProfileBlocked(VideoCodec.Hevc, 10), "one profile: nothing to choose");
|
||||
Assert.SequenceEqual([CodecProfile.Av1Main], ExportRules.Profiles(VideoCodec.Av1, 10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheKeyframeIntervalKeepsItsSecondsWhenTheFrameRateChanges()
|
||||
{
|
||||
Assert.Equal(36, ExportRules.GopFrames(1.5, Fps24));
|
||||
Assert.Equal(1, ExportRules.GopFrames(0.01, Fps24), "at least one frame");
|
||||
Assert.Approximately(1.5, ExportRules.GopSeconds(36, Fps24), 1e-9);
|
||||
Assert.Equal(30, ExportRules.RescaleGop(24, Fps24, Fps30), "1 s at 24 fps is 1 s at 30 fps");
|
||||
Assert.Equal(60, ExportRules.RescaleGop(48, Fps24, Fps30));
|
||||
Assert.Approximately(1.0, ExportRules.NearestKeyframeSeconds(31, Fps30), 1e-9, "shown as the nearest offered interval");
|
||||
Assert.Approximately(10.0, ExportRules.NearestKeyframeSeconds(10_000, Fps30), 1e-9, "at most the longest offered");
|
||||
Assert.Equal(20, ExportRules.KeyframeSeconds.Count);
|
||||
Assert.Approximately(0.5, ExportRules.KeyframeSeconds[0], 1e-9);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AStandardResolutionIsTheLandscapeBoxTheChosenProportionsFitIn()
|
||||
{
|
||||
var uhd = ExportRules.StandardResolutions.Single(r => r.Key == "4k");
|
||||
Assert.Equal((3840, 2160), (uhd.Width, uhd.Height));
|
||||
Assert.Equal("Export.Resolution.Uhd4k", uhd.LabelKey);
|
||||
Assert.True(ExportRules.StandardResolutions.All(r => Loc.L(r.LabelKey) != r.LabelKey), "every label is a resource");
|
||||
|
||||
Assert.Equal(ExportTab.PresetResolution, ExportTab.ResolutionKey(new ExportOverrides()));
|
||||
Assert.Equal(ExportTab.SourceResolution, ExportTab.ResolutionKey(new ExportOverrides { Width = 0, Height = 0 }));
|
||||
Assert.Equal("4k", ExportTab.ResolutionKey(new ExportOverrides { Width = 3840, Height = 2160 }));
|
||||
Assert.Equal(ExportTab.CustomResolution, ExportTab.ResolutionKey(new ExportOverrides { Width = 3000, Height = 2000 }));
|
||||
Assert.Equal(ExportTab.CustomResolution, ExportTab.ResolutionKey(new ExportOverrides { Width = 3840, Height = 2160 }, custom: true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void APlaybackThatIsNotTheDefaultNeedsSettingsFormat3()
|
||||
{
|
||||
var project = new ProjectSettings();
|
||||
Assert.True(project.RequiredFormat < 3);
|
||||
var reverse = project with { Export = project.Export with { Playback = new PlaybackSettings { Direction = PlaybackDirection.Reverse } } };
|
||||
Assert.Equal(3, reverse.RequiredFormat);
|
||||
Assert.NotNull(ServerJobs.NeedsNewerServer(ProcessingJobs.RequiredFormat(reverse, reverse.Export, 96, 64), 2), "a format 2 server cannot render it");
|
||||
Assert.Null(ServerJobs.NeedsNewerServer(ProcessingJobs.RequiredFormat(project, project.Export, 96, 64), 2));
|
||||
var faded = project with { Export = project.Export with { Playback = new PlaybackSettings { FadeIn = 1 } } };
|
||||
Assert.Equal(3, faded.RequiredFormat);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheCollapsedGroupsSummariseTheirValues()
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
Assert.Equal("Forward · no fades", ExportSummaries.Playback(null));
|
||||
Assert.Equal("Boomerang · ×2 · fades 1 s / 1.5 s · hold 2 s", ExportSummaries.Playback(new PlaybackSettings
|
||||
{
|
||||
Direction = PlaybackDirection.Boomerang,
|
||||
Loops = 2,
|
||||
FadeIn = 1,
|
||||
FadeOut = 1.5,
|
||||
HoldEnd = 2,
|
||||
}));
|
||||
Assert.Equal("Reverse · no fades", ExportSummaries.Playback(new PlaybackSettings { Direction = PlaybackDirection.Reverse }));
|
||||
Assert.Equal("Forward", ExportSummaries.DirectionLabel("unknown"), "an unknown direction plays forward");
|
||||
|
||||
var h264 = ExportResolver.Resolve(Preset("1080p-h264"));
|
||||
var encoding = ExportSummaries.Encoding(h264, 40_000_000);
|
||||
Assert.True(encoding.StartsWith(Loc.L("Export.RateControl." + h264.RateControl) + " · ", StringComparison.Ordinal), encoding);
|
||||
Assert.Contains("GOP ", encoding);
|
||||
Assert.Contains("B " + h264.BFrames.ToString(CultureInfo.InvariantCulture), encoding);
|
||||
Assert.True(encoding.EndsWith("High", StringComparison.Ordinal), encoding);
|
||||
var png = ExportSummaries.Encoding(ExportResolver.Resolve(Preset("png-sequence")), 0);
|
||||
Assert.False(png.Contains("GOP", StringComparison.Ordinal), "an image sequence has no rate control");
|
||||
|
||||
Assert.Equal("clip.mp4 · " + Loc.L("Editor.Export.Sync"), ExportSummaries.File("clip.mp4", "Renders", sync: true));
|
||||
Assert.Equal("Renders", ExportSummaries.File(null, "Renders", sync: false));
|
||||
|
||||
var footer = ExportSummaries.Footer("clip.mp4", null, 42, 1260);
|
||||
Assert.True(footer.StartsWith("clip.mp4 · ", StringComparison.Ordinal), footer);
|
||||
Assert.True(footer.EndsWith(Loc.Plural("Export.Footer.Frames", 1260), StringComparison.Ordinal), footer);
|
||||
Assert.Equal(3, footer.Split(" · ").Length, "no size or time without an estimate");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AGroupsOpenStateIsKeptAndSavedByTheApp()
|
||||
{
|
||||
var states = new GroupStates();
|
||||
states.Set("export.encoding", true);
|
||||
var store = new Dictionary<string, bool>(StringComparer.Ordinal);
|
||||
var saves = 0;
|
||||
states.Bind(store, () => saves++);
|
||||
Assert.True(store["export.encoding"], "a toggle made before the settings were attached stays");
|
||||
Assert.True(states.IsExpanded("export.encoding", fallback: false));
|
||||
Assert.False(states.IsExpanded("export.playback", fallback: false), "never toggled: the default");
|
||||
states.Set("export.playback", true);
|
||||
Assert.Equal(1, saves);
|
||||
Assert.True(store["export.playback"]);
|
||||
states.Set("export.playback", true);
|
||||
Assert.Equal(1, saves, "no change, no save");
|
||||
|
||||
var key = "test." + Guid.NewGuid().ToString("N");
|
||||
var group = new SettingGroup(key, "Export.Group.Encoding", "Tooltips.Export.Group.Encoding", expandedByDefault: false);
|
||||
Assert.False(group.IsExpanded);
|
||||
group.ToggleCommand.Execute(null);
|
||||
Assert.True(group.IsExpanded);
|
||||
Assert.True(new SettingGroup(key, "Export.Group.Encoding", "Tooltips.Export.Group.Encoding", expandedByDefault: false).IsExpanded,
|
||||
"another editor opens it as it was left");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheVideosLinkFiltersTheVideosSectionAndShowsIt()
|
||||
{
|
||||
var shown = new List<SectionKey>();
|
||||
Assert.False(VideosLink.Open([], shown.Add, Guid.NewGuid()), "no Videos section yet: nothing happens");
|
||||
var videos = new FakeVideos();
|
||||
var id = Guid.NewGuid();
|
||||
Assert.True(VideosLink.Open([videos], shown.Add, id));
|
||||
Assert.Equal(id, videos.Shown);
|
||||
Assert.SequenceEqual([SectionKey.Jobs], shown);
|
||||
videos.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>The Output panel on the synthetic sunset at 9:16: resolution, keyframes, playback, footer and preset groups.</summary>
|
||||
[Test]
|
||||
[WindowsOnly]
|
||||
[Timeout(300_000)]
|
||||
public Task ThePanelWritesTheOverridesAndThePlaybackItShows() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||
var project = new ProjectSettings();
|
||||
project = project with
|
||||
{
|
||||
Camera = project.Camera with { Aspect = project.Camera.Aspect.WithManual("9:16") },
|
||||
Export = project.Export with { Preset = project.Export.Preset.WithManual("1080p-h264") },
|
||||
};
|
||||
var content = EditorFixture.Content(EditorFixture.Sunset, project);
|
||||
var editor = new EditorViewModel(app.Shell, new EditorSession(new FakeSequenceSource(EditorFixture.Sunset, content), content, []), [], EncoderHost.Client);
|
||||
await using (editor)
|
||||
{
|
||||
var export = editor.Tabs.OfType<ExportTab>().Single();
|
||||
Assert.True(await editor.WhenIdleAsync(TimeSpan.FromSeconds(60)));
|
||||
|
||||
// 4K UHD at 9:16: the landscape box in the overrides, the portrait size rendered.
|
||||
Assert.Equal(ExportTab.PresetResolution, export.SelectedResolution?.Value);
|
||||
export.SelectedResolution = export.Resolutions.Single(r => Equals(r.Value, "4k"));
|
||||
Assert.True(await editor.WhenIdleAsync(TimeSpan.FromSeconds(60)));
|
||||
Assert.Equal<(int?, int?)>((3840, 2160), (editor.Session.Project.Export.Overrides.Width, editor.Session.Project.Export.Overrides.Height));
|
||||
Assert.Equal("2160 × 3840", export.OutputSizeText);
|
||||
Assert.False(export.IsCustomResolution);
|
||||
export.SelectedResolution = export.Resolutions.Single(r => Equals(r.Value, ExportTab.CustomResolution));
|
||||
Assert.True(export.IsCustomResolution, "Custom shows Width × Height");
|
||||
|
||||
// Keyframes: 1 s at the preset's 30 fps, then 24 fps keeps 1 s.
|
||||
export.SelectedKeyframes = export.KeyframeChoices.Single(c => (double)c.Value == 1.0);
|
||||
Assert.Equal(30, editor.Session.Project.Export.Overrides.GopFrames);
|
||||
export.SelectedFrameRate = export.FrameRates.Single(c => FrameRateText.TryParse((string)c.Value, out var r) && FrameRateText.AreEqual(r, Fps24));
|
||||
Assert.Equal(24, editor.Session.Project.Export.Overrides.GopFrames, "the interval keeps its seconds");
|
||||
Assert.Approximately(1.0, (double)export.SelectedKeyframes!.Value, 1e-9);
|
||||
|
||||
// Baseline takes no B-frames.
|
||||
Assert.True(export.CanChooseProfile);
|
||||
export.SelectedProfile = export.ProfileChoices.Single(c => Equals(c.Value, CodecProfile.H264Baseline));
|
||||
Assert.Equal(0, editor.Session.Project.Export.Overrides.BFrames);
|
||||
Assert.False(export.CanChooseBFrames);
|
||||
|
||||
// A reverse playback raises the settings format; Reset writes none again.
|
||||
Assert.True(export.IsPlaybackDefault);
|
||||
export.SelectedDirection = export.Directions.Single(d => Equals(d.Value, PlaybackDirection.Reverse));
|
||||
Assert.Equal(PlaybackDirection.Reverse, editor.Session.Project.Export.Playback?.Direction);
|
||||
Assert.Equal(3, editor.Session.Project.RequiredFormat);
|
||||
Assert.False(export.IsPlaybackDefault);
|
||||
export.FadeIn = 1.5;
|
||||
Assert.Equal(1.5, editor.Session.Project.Export.Playback?.FadeIn);
|
||||
Assert.True(await editor.WhenIdleAsync(TimeSpan.FromSeconds(60)));
|
||||
Assert.Equal("Reverse · fades 1.5 s / 0 s", export.PlaybackGroup.Summary);
|
||||
export.ResetPlaybackCommand.Execute(null);
|
||||
Assert.Null(editor.Session.Project.Export.Playback);
|
||||
Assert.True(editor.Session.Project.RequiredFormat < 3);
|
||||
|
||||
// The preset table: every preset once, in the built-in order of the groups, one group open at least.
|
||||
Assert.Equal(export.Presets.Count, export.PresetGroups.Sum(g => g.Rows.Count));
|
||||
var order = ExportPresets.BuiltIn.Select(p => p.Group).Distinct(StringComparer.Ordinal).ToList();
|
||||
Assert.SequenceEqual(order.Where(g => export.PresetGroups.Any(p => p.Key == g)), export.PresetGroups.Select(g => g.Key));
|
||||
Assert.True(export.PresetGroups.Any(g => g.IsExpanded));
|
||||
var social = export.PresetGroups.Single(g => g.Key == "social");
|
||||
Assert.Equal($"Social ({export.Presets.Count(p => p.Group == "social")})", social.Header, "a sequence preset sits in its export preset's group");
|
||||
Assert.True(social.Rows.Count >= 3);
|
||||
|
||||
// The footer: Batch (n) counts the ticked presets, Videos (n) the renders.
|
||||
Assert.Equal("Batch (0)", export.BatchText);
|
||||
export.Presets.First(p => p.CanBatch).IsInBatch = true;
|
||||
Assert.Equal("Batch (1)", export.BatchText);
|
||||
Assert.Equal(Loc.L("Export.Footer.Videos", content.Renders.Count.ToString("N0", Loc.Culture)), export.VideosText);
|
||||
Assert.NotNull(export.FooterSummary);
|
||||
}
|
||||
});
|
||||
|
||||
/// <summary>A Videos section as the shell would hold it.</summary>
|
||||
private sealed class FakeVideos() : SectionViewModel(SectionKey.Jobs, "Icon.Jobs"), IVideosSection
|
||||
{
|
||||
public Guid? Shown { get; private set; }
|
||||
|
||||
public void ShowSequence(Guid? sequenceId) => Shown = sequenceId;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user