Refactor settings management in PLib video library manager. Replace dialog-based settings with a single-panel overlay for improved user experience. Update MainWindow and SettingsView to support new settings panel, and adjust ViewModels accordingly. Enhance README.md to reflect these changes.

This commit is contained in:
Leonid Pershin
2026-08-08 12:40:53 +03:00
parent 186dd900e1
commit 835937357e
12 changed files with 441 additions and 216 deletions
+173 -121
View File
@@ -1,121 +1,173 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- ============================ Card ============================ -->
<!--
The card is a Button so that keyboard focus, Enter/Space and the pointer all activate it
for free. Its template is reduced to a single surface Border because the Semi button
chrome would fight the artwork.
-->
<Style Selector="Button.card">
<Setter Property="Padding" Value="0" />
<Setter Property="Background" Value="Transparent" />
<!-- Without these the card keeps its desired size inside the grid cell the layout
hands it, which leaves the cards small and the grid full of gaps. -->
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="RenderTransform" Value="none" />
<Setter Property="Transitions">
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.16" Easing="CubicEaseOut" />
</Transitions>
</Setter>
<Setter Property="Template">
<ControlTemplate>
<Border Name="PART_Surface"
Background="{DynamicResource CardBackgroundBrush}"
BorderBrush="{DynamicResource CardBorderBrush}"
BorderThickness="1"
CornerRadius="14"
Padding="8,8,8,10">
<Border.Transitions>
<Transitions>
<BrushTransition Property="BorderBrush" Duration="0:0:0.16" />
</Transitions>
</Border.Transitions>
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Button.card:pointerover">
<Setter Property="RenderTransform" Value="scale(1.025)" />
</Style>
<Style Selector="Button.card:pointerover /template/ Border#PART_Surface">
<Setter Property="BorderBrush" Value="{DynamicResource CardHoverBorderBrush}" />
</Style>
<Style Selector="Button.card:pressed">
<Setter Property="RenderTransform" Value="scale(0.99)" />
</Style>
<Style Selector="Button.card:focus-visible /template/ Border#PART_Surface">
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
</Style>
<!-- Play affordance: invisible until the pointer is over the card. -->
<Style Selector="Border.playOverlay">
<Setter Property="Opacity" Value="0" />
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.16" Easing="CubicEaseOut" />
</Transitions>
</Setter>
</Style>
<Style Selector="Button.card:pointerover Border.playOverlay">
<Setter Property="Opacity" Value="1" />
</Style>
<!-- ============================ Text ============================ -->
<Style Selector="TextBlock.cardTitle">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="LineHeight" Value="18" />
<Setter Property="MaxLines" Value="2" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style Selector="TextBlock.cardMeta">
<Setter Property="Foreground" Value="{DynamicResource TextTertiaryBrush}" />
<Setter Property="FontSize" Value="11.5" />
</Style>
<Style Selector="TextBlock.sectionTitle">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="17" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="TextBlock.subtle">
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
<Setter Property="FontSize" Value="12.5" />
</Style>
<!-- ============================ Badge ============================ -->
<Style Selector="Border.badge">
<Setter Property="Background" Value="{DynamicResource BadgeBackgroundBrush}" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Padding" Value="6,2" />
</Style>
<Style Selector="Border.badge > TextBlock">
<Setter Property="Foreground" Value="{DynamicResource BadgeForegroundBrush}" />
<Setter Property="FontSize" Value="11" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>
</Styles>
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- ============================ Card ============================ -->
<!--
The card is a Button so that keyboard focus, Enter/Space and the pointer all activate it
for free. Its template is reduced to a single surface Border because the Semi button
chrome would fight the artwork.
-->
<Style Selector="Button.card">
<Setter Property="Padding" Value="0" />
<Setter Property="Background" Value="Transparent" />
<!-- Without these the card keeps its desired size inside the grid cell the layout
hands it, which leaves the cards small and the grid full of gaps. -->
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="RenderTransform" Value="none" />
<Setter Property="Transitions">
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.16" Easing="CubicEaseOut" />
</Transitions>
</Setter>
<Setter Property="Template">
<ControlTemplate>
<Border Name="PART_Surface"
Background="{DynamicResource CardBackgroundBrush}"
BorderBrush="{DynamicResource CardBorderBrush}"
BorderThickness="1"
CornerRadius="14"
Padding="8,8,8,10">
<Border.Transitions>
<Transitions>
<BrushTransition Property="BorderBrush" Duration="0:0:0.16" />
</Transitions>
</Border.Transitions>
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Button.card:pointerover">
<Setter Property="RenderTransform" Value="scale(1.025)" />
</Style>
<Style Selector="Button.card:pointerover /template/ Border#PART_Surface">
<Setter Property="BorderBrush" Value="{DynamicResource CardHoverBorderBrush}" />
</Style>
<Style Selector="Button.card:pressed">
<Setter Property="RenderTransform" Value="scale(0.99)" />
</Style>
<Style Selector="Button.card:focus-visible /template/ Border#PART_Surface">
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
</Style>
<!-- Play affordance: invisible until the pointer is over the card. -->
<Style Selector="Border.playOverlay">
<Setter Property="Opacity" Value="0" />
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.16" Easing="CubicEaseOut" />
</Transitions>
</Setter>
</Style>
<Style Selector="Button.card:pointerover Border.playOverlay">
<Setter Property="Opacity" Value="1" />
</Style>
<!-- ============================ Text ============================ -->
<Style Selector="TextBlock.cardTitle">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="LineHeight" Value="18" />
<Setter Property="MaxLines" Value="2" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style Selector="TextBlock.cardMeta">
<Setter Property="Foreground" Value="{DynamicResource TextTertiaryBrush}" />
<Setter Property="FontSize" Value="11.5" />
</Style>
<Style Selector="TextBlock.sectionTitle">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="FontSize" Value="17" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="TextBlock.subtle">
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
<Setter Property="FontSize" Value="12.5" />
</Style>
<!-- ======================== Settings overlay ======================== -->
<!--
The overlay stays in the tree and hides behind opacity rather than IsVisible: a collapsed
element has nothing to animate from, and the slide-in is the whole point. Nothing inside
is focusable while it is closed, because the panel's content is null until it opens.
-->
<Style Selector="Panel.settingsOverlay">
<Setter Property="Opacity" Value="0" />
<Setter Property="IsHitTestVisible" Value="False" />
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.16" Easing="CubicEaseOut" />
</Transitions>
</Setter>
</Style>
<Style Selector="Panel.settingsOverlay.open">
<Setter Property="Opacity" Value="1" />
<Setter Property="IsHitTestVisible" Value="True" />
</Style>
<!-- Click-anywhere-to-dismiss backdrop. A Button gets the click handling for free. -->
<Style Selector="Button.scrim">
<Setter Property="Background" Value="{DynamicResource OverlayBrush}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}" />
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Border.drawer">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Width" Value="470" />
<Setter Property="Background" Value="{DynamicResource PageBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SurfaceBorderBrush}" />
<Setter Property="BorderThickness" Value="1,0,0,0" />
<Setter Property="RenderTransform" Value="translateX(30px)" />
<Setter Property="Transitions">
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut" />
</Transitions>
</Setter>
</Style>
<Style Selector="Panel.settingsOverlay.open Border.drawer">
<Setter Property="RenderTransform" Value="none" />
</Style>
<!-- ============================ Badge ============================ -->
<Style Selector="Border.badge">
<Setter Property="Background" Value="{DynamicResource BadgeBackgroundBrush}" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Padding" Value="6,2" />
</Style>
<Style Selector="Border.badge > TextBlock">
<Setter Property="Foreground" Value="{DynamicResource BadgeForegroundBrush}" />
<Setter Property="FontSize" Value="11" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>
</Styles>