mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 09:19:06 +00:00
256 lines
14 KiB
XML
256 lines
14 KiB
XML
<UserControl x:Class="QuickLook.Plugin.VideoViewer.ViewerPanel"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:mediakit="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=QuickLook.WPFMediaKit"
|
|
x:Name="viewerPanel"
|
|
d:DesignHeight="300"
|
|
d:DesignWidth="500"
|
|
mc:Ignorable="d">
|
|
<UserControl.Resources>
|
|
<ResourceDictionary>
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
|
<local:TimeTickToShortStringConverter x:Key="TimeTickToShortStringConverter" />
|
|
<local:VolumeToIconConverter x:Key="VolumeToIconConverter" />
|
|
<local:CoverArtConverter x:Key="CoverArtConverter" />
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="Styles.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
</ResourceDictionary>
|
|
</UserControl.Resources>
|
|
<Grid>
|
|
<mediakit:MediaUriElement x:Name="mediaElement" />
|
|
<Grid x:Name="coverArtPersenter"
|
|
Background="{StaticResource MainWindowBackground}"
|
|
ClipToBounds="True">
|
|
<Grid.Style>
|
|
<Style TargetType="Grid">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding HasVideo, ElementName=viewerPanel}" Value="False">
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Grid.Style>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="4*" />
|
|
<ColumnDefinition Width="6*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Rectangle Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Margin="-50">
|
|
<Rectangle.Effect>
|
|
<BlurEffect Radius="100" />
|
|
</Rectangle.Effect>
|
|
<Rectangle.Fill>
|
|
<ImageBrush ImageSource="{Binding ElementName=viewerPanel, Path=CoverArt}" Stretch="UniformToFill" />
|
|
</Rectangle.Fill>
|
|
</Rectangle>
|
|
<Rectangle Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Fill="{DynamicResource MainWindowBackground}"
|
|
Opacity="0.6" />
|
|
<Image x:Name="imageCoverArt"
|
|
Grid.Column="0"
|
|
Margin="20,40,20,40"
|
|
Source="{Binding CoverArt, ElementName=viewerPanel, Converter={StaticResource CoverArtConverter}}">
|
|
<Image.Effect>
|
|
<DropShadowEffect BlurRadius="6"
|
|
Direction="0"
|
|
ShadowDepth="0"
|
|
Color="#FF898989" />
|
|
</Image.Effect>
|
|
</Image>
|
|
<Grid Grid.Column="1">
|
|
<Grid.Effect>
|
|
<DropShadowEffect BlurRadius="2"
|
|
Opacity="0.7"
|
|
ShadowDepth="0"
|
|
Color="#B2FFFFFF" />
|
|
</Grid.Effect>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="70" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="10" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<TextBlock x:Name="metaTitle"
|
|
Grid.Row="1"
|
|
MaxHeight="80"
|
|
Padding="3"
|
|
FontSize="22"
|
|
LineHeight="28"
|
|
TextTrimming="CharacterEllipsis"
|
|
TextWrapping="Wrap" />
|
|
<TextBlock x:Name="metaArtists"
|
|
Grid.Row="3"
|
|
Padding="3"
|
|
FontSize="14"
|
|
Foreground="{DynamicResource WindowTextForeground}"
|
|
TextTrimming="CharacterEllipsis" />
|
|
<TextBlock x:Name="metaAlbum"
|
|
Grid.Row="4"
|
|
Padding="3"
|
|
FontSize="14"
|
|
Foreground="{DynamicResource WindowTextForeground}"
|
|
TextTrimming="CharacterEllipsis" />
|
|
<TextBlock x:Name="metaLength"
|
|
Grid.Row="5"
|
|
Padding="3"
|
|
FontSize="14"
|
|
Foreground="{DynamicResource WindowTextForeground}"
|
|
Text="{Binding ElementName=mediaElement, Path=MediaDuration, Converter={StaticResource TimeTickToShortStringConverter}}"
|
|
TextTrimming="CharacterEllipsis" />
|
|
<TextBlock x:Name="metaLyric"
|
|
Grid.Row="6"
|
|
Margin="0,0,8,0"
|
|
Padding="3"
|
|
FontSize="14"
|
|
Foreground="{DynamicResource WindowTextForeground}"
|
|
TextWrapping="Wrap"
|
|
Visibility="Collapsed" />
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<Grid x:Name="videoControlContainer"
|
|
Height="32"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Bottom">
|
|
<Grid.Style>
|
|
<Style TargetType="Grid">
|
|
<Setter Property="Opacity" Value="1" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding HasVideo, ElementName=viewerPanel}" Value="True">
|
|
<Setter Property="Opacity" Value="0" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Grid.Style>
|
|
<Grid.Resources>
|
|
<Storyboard x:Key="ShowControlStoryboard" Completed="AutoHideViedoControlContainer">
|
|
<DoubleAnimation Storyboard.Target="{Binding Source={x:Reference videoControlContainer}}"
|
|
Storyboard.TargetProperty="Opacity"
|
|
To="1"
|
|
Duration="0:0:0.05" />
|
|
</Storyboard>
|
|
<Storyboard x:Key="HideControlStoryboard">
|
|
<DoubleAnimationUsingKeyFrames Storyboard.Target="{Binding Source={x:Reference videoControlContainer}}" Storyboard.TargetProperty="Opacity">
|
|
<DoubleAnimationUsingKeyFrames.KeyFrames>
|
|
<LinearDoubleKeyFrame KeyTime="0:0:0" Value="1" />
|
|
<LinearDoubleKeyFrame KeyTime="0:0:1" Value="1" />
|
|
<LinearDoubleKeyFrame KeyTime="0:0:1.05" Value="0" />
|
|
</DoubleAnimationUsingKeyFrames.KeyFrames>
|
|
</DoubleAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</Grid.Resources>
|
|
<!-- Keep glassLayer:GlassLayer here for the dependency testing -->
|
|
<!-- xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer;assembly=QuickLook" -->
|
|
<!--<glassLayer:GlassLayer ColorOverlayVisibility="{Binding ElementName=viewerPanel, Path=HasVideo, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
GlassVisibility="{Binding ElementName=viewerPanel, Path=HasVideo, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
OverlayColor="{DynamicResource CaptionBackground}">
|
|
<glassLayer:GlassLayer.Style>
|
|
<Style TargetType="glassLayer:GlassLayer">
|
|
<Setter Property="BlurredElement" Value="{Binding ElementName=mediaElement}" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding ElementName=viewerPanel, Path=HasVideo}" Value="True">
|
|
<Setter Property="BlurredElement" Value="{Binding ElementName=mediaElement}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</glassLayer:GlassLayer.Style>
|
|
</glassLayer:GlassLayer>-->
|
|
<DockPanel Margin="8,0,8,0">
|
|
<Button x:Name="buttonPlayPause"
|
|
DockPanel.Dock="Left"
|
|
ToolTip="Play/Pause">
|
|
<Button.Style>
|
|
<Style BasedOn="{StaticResource ControlButtonStyle}" TargetType="Button">
|
|
<Setter Property="Content" Value="" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}" Value="False">
|
|
<Setter Property="Content" Value="" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Button.Style>
|
|
</Button>
|
|
<Button x:Name="buttonLoop"
|
|
DockPanel.Dock="Left"
|
|
ToolTip="Loop">
|
|
<Button.Style>
|
|
<Style BasedOn="{StaticResource ControlButtonStyle}" TargetType="Button">
|
|
<Setter Property="Content" Value="" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding ShouldLoop, ElementName=viewerPanel}" Value="True">
|
|
<Setter Property="Content" Value="" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Button.Style>
|
|
</Button>
|
|
<Button x:Name="buttonMute"
|
|
DockPanel.Dock="Right"
|
|
ToolTip="Volume">
|
|
<Button.Style>
|
|
<Style BasedOn="{StaticResource ControlButtonStyle}" TargetType="Button">
|
|
<Setter Property="Content" Value="{Binding ElementName=viewerPanel, Path=LinearVolume, Converter={StaticResource VolumeToIconConverter}}" />
|
|
</Style>
|
|
</Button.Style>
|
|
</Button>
|
|
<Button x:Name="buttonTime"
|
|
Width="NaN"
|
|
MinWidth="37"
|
|
DockPanel.Dock="Right"
|
|
Style="{StaticResource ControlButtonStyle}"
|
|
Tag="Time"
|
|
ToolTip="Time Elapsed/Remaining">
|
|
<TextBlock VerticalAlignment="Center"
|
|
FontFamily="{Binding ElementName=viewerPanel, Path=FontFamily}"
|
|
FontSize="11"
|
|
Foreground="{DynamicResource CaptionButtonIconForeground}">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding ElementName=buttonTime, Path=Tag}" Value="Time">
|
|
<Setter Property="Text" Value="{Binding ElementName=mediaElement, Path=MediaPosition, Converter={StaticResource TimeTickToShortStringConverter}}" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding ElementName=buttonTime, Path=Tag}" Value="Length">
|
|
<Setter Property="Text" Value="{Binding ElementName=mediaElement, Path=MediaDuration, Converter={StaticResource TimeTickToShortStringConverter}}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</Button>
|
|
<Slider x:Name="sliderProgress"
|
|
Delay="1"
|
|
LargeChange="1"
|
|
Maximum="{Binding ElementName=mediaElement, Path=MediaDuration}"
|
|
SmallChange="1"
|
|
Style="{StaticResource PositionSliderStyle}"
|
|
Value="{Binding MediaPosition, ElementName=mediaElement}" />
|
|
</DockPanel>
|
|
</Grid>
|
|
<Grid x:Name="volumeSliderLayer"
|
|
Background="Transparent"
|
|
Visibility="Collapsed">
|
|
<Grid Width="130"
|
|
Height="32"
|
|
Margin="0,0,0,32"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Bottom"
|
|
Background="{DynamicResource CaptionButtonHoverBackground}">
|
|
<Slider Width="110"
|
|
Maximum="1"
|
|
Style="{StaticResource CustomSliderStyle}"
|
|
Value="{Binding ElementName=viewerPanel, Path=LinearVolume}" />
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl> |