dark theme; wip videopleyer

This commit is contained in:
Paddy Xu
2017-08-06 23:33:01 +03:00
parent 56cb31fd2a
commit 2b3338cc43
16 changed files with 227 additions and 304 deletions

View File

@@ -69,6 +69,8 @@ namespace QuickLook.Plugin.VideoViewer
windowSize.Height = Math.Max(def.Height, windowSize.Height);
context.SetPreferredSizeFit(windowSize, 0.6);
context.UseDarkTheme = true;
context.TitlebarOverlap = true;
}
public void View(string path, ContextObject context)

View File

@@ -1,31 +1,51 @@
<!--
This file is a part of unosquare/ffmediaelement project: <https://github.com/unosquare/ffmediaelement>
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ControlButtonStyle" TargetType="Grid">
<Setter Property="Height" Value="35" />
<Setter Property="Width" Value="35" />
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#22FFFFFF" />
<SolidColorBrush x:Key="CaptionButtonPressBackground" Color="#44FFFFFF" />
<Style x:Key="CaptionButtonBaseStyle" TargetType="Button">
<Setter Property="Focusable" Value="False" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonIconForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
</Style>
<Style x:Key="CaptionButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonBaseStyle}">
<Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" />
<Setter Property="Padding" Value="9,9,9,9" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}" BorderThickness="0"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#22FFFFFF" />
<Setter Property="Background" Value="{DynamicResource CaptionButtonHoverBackground}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource CaptionButtonPressBackground}" />
</Trigger>
</Style.Triggers>
</Style>
<SolidColorBrush x:Key="CustomSliderForegroundBrush" Color="#FFEFEFEF" />
<SolidColorBrush x:Key="CustomSliderBackgroundBrush" Color="#55ffffff" />
<SolidColorBrush x:Key="CustomSliderBackgroundBrush" Color="#EE000000" />
<SolidColorBrush x:Key="CustomSliderHighlightBrush" Color="#FFEFEFEF" />
<!-- Postion Slider Control -->
<ControlTemplate x:Key="PositionSliderThumbTemplate" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M 0,0 A 180,180 180 1 1 1,1 Z" Fill="Transparent" Stretch="Fill"
Stroke="{StaticResource CustomSliderForegroundBrush}" StrokeThickness="2.5" UseLayoutRounding="True"
Stroke="{StaticResource CustomSliderForegroundBrush}" StrokeThickness="1" UseLayoutRounding="True"
VerticalAlignment="Center"
Margin="-1,-1" />
</Grid>
@@ -49,12 +69,12 @@
<RowDefinition Height="{TemplateBinding MinHeight}" />
</Grid.RowDefinitions>
<DockPanel LastChildFill="True">
<Border ClipToBounds="True" x:Name="PART_SelectionRange" Height="3" Visibility="Visible">
<Border ClipToBounds="True" x:Name="PART_SelectionRange" Height="1" Visibility="Visible">
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,-10,0"
Fill="{StaticResource CustomSliderForegroundBrush}" />
</Border>
<Border ClipToBounds="True" Height="3" Visibility="Visible">
<Rectangle RadiusX="1" RadiusY="1" Margin="20,0,10,0"
<Border ClipToBounds="True" Height="1" Visibility="Visible">
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,10,0"
Fill="{StaticResource CustomSliderBackgroundBrush}" />
</Border>
</DockPanel>
@@ -73,10 +93,11 @@
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="MinHeight" Value="20" />
<Setter Property="MaxHeight" Value="20" />
<Setter Property="Height" Value="20" />
<Setter Property="MinHeight" Value="10" />
<Setter Property="MaxHeight" Value="10" />
<Setter Property="Height" Value="10" />
<Setter Property="Minimum" Value="0" />
<Setter Property="Focusable" Value="False" />
<Setter Property="AutoToolTipPlacement" Value="None" />
<Setter Property="IsMoveToPointEnabled" Value="True" />
<Setter Property="VerticalAlignment" Value="Center" />

View File

@@ -6,9 +6,9 @@
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:vlc="clr-namespace:Meta.Vlc.Wpf;assembly=Meta.Vlc.Wpf"
xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer"
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer;assembly=QuickLook"
mc:Ignorable="d"
x:Name="viewerPanel"
Background="#CC4E4E4E"
d:DesignHeight="450" d:DesignWidth="450">
<Grid>
<Grid.Resources>
@@ -43,128 +43,48 @@
</Image.Style>
</Image>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="100">
<Grid.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Offset="0.0" Color="#00000000" />
<GradientStop Offset="0.25" Color="#66000000" />
<GradientStop Offset="1" Color="#D6000000" />
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="30" />
<RowDefinition Height="75" />
</Grid.RowDefinitions>
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"
Value="True" />
<Condition Binding="{Binding HasVideo, ElementName=viewerPanel}" Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</MultiDataTrigger.EnterActions>
<MultiDataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</MultiDataTrigger.ExitActions>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Slider Grid.Row="1" x:Name="sliderProgress" Style="{StaticResource PositionSliderStyle}"
SmallChange="0.00001" LargeChange="0.01" Maximum="1"
Value="{Binding Position, ElementName=mediaElement}" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="149" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" Orientation="Horizontal" Margin="10,0,0,0">
<StackPanel.Style>
<Style TargetType="StackPanel">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding HasAudio, ElementName=viewerPanel}" Value="False">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<Grid x:Name="buttonMute" Style="{StaticResource ControlButtonStyle}">
<fa:ImageAwesome Height="23" Width="23" Foreground="#FFEFEFEF">
<fa:ImageAwesome.Style>
<Style TargetType="fa:ImageAwesome">
<Setter Property="Icon" Value="VolumeOff" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}"
Value="False">
<Setter Property="Icon" Value="VolumeUp" />
</DataTrigger>
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</Grid>
<Slider Style="{StaticResource CustomSliderStyle}" Width="75" Maximum="100"
Value="{Binding Volume, ElementName=mediaElement}"
Visibility="{Binding IsMuted, ElementName=viewerPanel, Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
BorderThickness="0,0,5,0" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Grid x:Name="buttonBackward" Style="{StaticResource ControlButtonStyle}">
<fa:ImageAwesome Icon="Backward" Height="23" Width="23" Foreground="#FFEFEFEF" />
</Grid>
<Grid Width="3" />
<Grid x:Name="buttonPlayPause" Style="{StaticResource ControlButtonStyle}">
<fa:ImageAwesome Height="23" Width="23" Foreground="#FFEFEFEF">
<fa:ImageAwesome.Style>
<Style>
<Setter Property="fa:ImageAwesome.Icon" Value="Pause" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}"
Value="False">
<Setter Property="fa:ImageAwesome.Icon" Value="Play" />
</DataTrigger>
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</Grid>
<Grid Width="3" />
<Grid x:Name="buttonStop" Style="{StaticResource ControlButtonStyle}">
<fa:ImageAwesome Icon="Stop" Height="21" Width="21" Foreground="#FFEFEFEF" />
</Grid>
<Grid Width="3" />
<Grid x:Name="buttonForward" Style="{StaticResource ControlButtonStyle}">
<fa:ImageAwesome Icon="Forward" Height="23" Width="23" Foreground="#FFEFEFEF" />
</Grid>
</StackPanel>
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center"
Orientation="Horizontal" Margin="0,0,10,0">
<TextBlock FontSize="14" Foreground="#FFEFEFEF"
Text="{Binding Time, StringFormat=hh\\:mm\\:ss, ElementName=mediaElement}" />
<TextBlock FontSize="14" Text=" / " Foreground="#FFEFEFEF" />
<TextBlock FontSize="14" Foreground="#FFEFEFEF"
Text="{Binding Length, StringFormat=hh\\:mm\\:ss, ElementName=mediaElement}" />
</StackPanel>
</Grid>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="32">
<glassLayer:GlassLayer BlurredElement="{Binding ElementName=mediaElement}" OverlayColor="#FF3B3B3B" />
<DockPanel>
<Button x:Name="buttonPlayPause" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Left">
<fa:ImageAwesome Foreground="{DynamicResource CaptionButtonIconForeground}">
<fa:ImageAwesome.Style>
<Style>
<Setter Property="fa:ImageAwesome.Icon" Value="Pause" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}"
Value="False">
<Setter Property="fa:ImageAwesome.Icon" Value="Play" />
</DataTrigger>
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</Button>
<Button x:Name="buttonMute" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Right">
<fa:ImageAwesome Icon="VolumeUp" Foreground="{DynamicResource CaptionButtonIconForeground}">
<fa:ImageAwesome.Style>
<Style TargetType="fa:ImageAwesome">
<Setter Property="Icon" Value="VolumeOff" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}"
Value="False">
<Setter Property="Icon" Value="VolumeUp" />
</DataTrigger>
</Style.Triggers>
</Style>
</fa:ImageAwesome.Style>
</fa:ImageAwesome>
</Button>
<Button Width="Auto" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Right">
<TextBlock DockPanel.Dock="Right" VerticalAlignment="Center" FontSize="11"
Foreground="{DynamicResource CaptionButtonIconForeground}"
Text="{Binding Time, StringFormat=hh\\:mm\\:ss, ElementName=mediaElement}"/>
</Button>
<Slider x:Name="sliderProgress" Style="{StaticResource PositionSliderStyle}"
SmallChange="0.00001" LargeChange="0.01" Maximum="1"
Value="{Binding Position, ElementName=mediaElement}" />
</DockPanel>
</Grid>
</Grid>
</UserControl>

View File

@@ -60,9 +60,6 @@ namespace QuickLook.Plugin.VideoViewer
// buttonMute.Visibility = Visibility.Collapsed;
//};
buttonMute.MouseLeftButtonUp += (sender, e) => IsMuted = !IsMuted;
buttonStop.MouseLeftButtonUp += PlayerStop;
buttonBackward.MouseLeftButtonUp += (sender, e) => Seek(TimeSpan.FromSeconds(-10));
buttonForward.MouseLeftButtonUp += (sender, e) => Seek(TimeSpan.FromSeconds(10));
sliderProgress.PreviewMouseDown += (sender, e) =>
{