mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 10:19:07 +00:00
add volume slider
This commit is contained in:
@@ -77,7 +77,7 @@
|
|||||||
<!-- Custom Slider Control -->
|
<!-- Custom Slider Control -->
|
||||||
<ControlTemplate x:Key="CustomSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
<ControlTemplate x:Key="CustomSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
||||||
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
|
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
|
||||||
<Rectangle x:Name="grip" Fill="{DynamicResource WindowTextForeground}" Width="8"
|
<Rectangle x:Name="grip" Fill="{DynamicResource WindowTextForeground}" Width="5"
|
||||||
Height="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}"
|
Height="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
StrokeThickness="0"
|
StrokeThickness="0"
|
||||||
UseLayoutRounding="True" Stretch="Fill" RadiusX="3" RadiusY="3" />
|
UseLayoutRounding="True" Stretch="Fill" RadiusX="3" RadiusY="3" />
|
||||||
@@ -101,18 +101,18 @@
|
|||||||
<RowDefinition Height="{TemplateBinding MinHeight}" />
|
<RowDefinition Height="{TemplateBinding MinHeight}" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DockPanel LastChildFill="True">
|
<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="4,0,-4,0"
|
<Rectangle RadiusX="1" RadiusY="1" Margin="4,0,-2,0"
|
||||||
Fill="{DynamicResource WindowTextForeground}" />
|
Fill="{DynamicResource WindowTextForeground}" />
|
||||||
</Border>
|
</Border>
|
||||||
<Border ClipToBounds="True" Height="3" Visibility="Visible">
|
<Border ClipToBounds="True" Height="1" Visibility="Visible">
|
||||||
<Rectangle x:Name="PART_NegativeSelection" RadiusX="1" RadiusY="1" Margin="8,0,4,0"
|
<Rectangle x:Name="PART_NegativeSelection" RadiusX="1" RadiusY="1" Margin="-2,0,4,0"
|
||||||
Fill="{DynamicResource MainWindowBackground}" />
|
Fill="{DynamicResource WindowTextForegroundAlternative}" />
|
||||||
</Border>
|
</Border>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<Track x:Name="PART_Track">
|
<Track x:Name="PART_Track">
|
||||||
<Track.Thumb>
|
<Track.Thumb>
|
||||||
<Thumb x:Name="Thumb" Focusable="False" Width="8" Height="{TemplateBinding MinHeight}"
|
<Thumb x:Name="Thumb" Focusable="False" Width="5" Height="{TemplateBinding MinHeight}"
|
||||||
OverridesDefaultStyle="True" Template="{StaticResource CustomSliderThumbTemplate}"
|
OverridesDefaultStyle="True" Template="{StaticResource CustomSliderThumbTemplate}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
</Track.Thumb>
|
</Track.Thumb>
|
||||||
@@ -124,9 +124,9 @@
|
|||||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
|
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="BorderBrush" Value="Transparent" />
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
<Setter Property="MinHeight" Value="16" />
|
<Setter Property="MinHeight" Value="14" />
|
||||||
<Setter Property="MaxHeight" Value="16" />
|
<Setter Property="MaxHeight" Value="14" />
|
||||||
<Setter Property="Height" Value="16" />
|
<Setter Property="Height" Value="14" />
|
||||||
<Setter Property="Minimum" Value="0" />
|
<Setter Property="Minimum" Value="0" />
|
||||||
<Setter Property="IsSnapToTickEnabled" Value="True" />
|
<Setter Property="IsSnapToTickEnabled" Value="True" />
|
||||||
<Setter Property="SmallChange" Value="0.01" />
|
<Setter Property="SmallChange" Value="0.01" />
|
||||||
|
@@ -156,7 +156,8 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Button.Style>
|
</Button.Style>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="buttonTime" Width="37" Style="{StaticResource ControlButtonStyle}" DockPanel.Dock="Right" Tag="Time">
|
<Button x:Name="buttonTime" Width="37" Style="{StaticResource ControlButtonStyle}"
|
||||||
|
DockPanel.Dock="Right" Tag="Time">
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="11"
|
<TextBlock VerticalAlignment="Center" FontSize="11"
|
||||||
FontFamily="{Binding ElementName=viewerPanel, Path=FontFamily}"
|
FontFamily="{Binding ElementName=viewerPanel, Path=FontFamily}"
|
||||||
Foreground="{DynamicResource CaptionButtonIconForeground}">
|
Foreground="{DynamicResource CaptionButtonIconForeground}">
|
||||||
@@ -181,32 +182,12 @@
|
|||||||
Value="{Binding Position, ElementName=mediaElement}" />
|
Value="{Binding Position, ElementName=mediaElement}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--<Grid Height="32" Width="100" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
<Grid x:Name="volumeSliderLayer" Background="Transparent" Visibility="Collapsed">
|
||||||
Background="{DynamicResource CaptionBackground}" Margin="0,0,0,32">
|
<Grid Height="32" Width="130" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||||
<Grid.Style>
|
Background="{DynamicResource CaptionButtonHoverBackground}" Margin="0,0,0,32">
|
||||||
<Style TargetType="Grid">
|
<Slider Style="{StaticResource CustomSliderStyle}" Width="110" Maximum="100"
|
||||||
<Setter Property="Opacity" Value="0" />
|
Value="{Binding ElementName=mediaElement, Path=Volume}" />
|
||||||
<Style.Triggers>
|
</Grid>
|
||||||
<DataTrigger Binding="{Binding ElementName=buttonMute, Path=IsMouseOver}" Value="True">
|
</Grid>
|
||||||
<DataTrigger.EnterActions>
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard TargetProperty="Opacity">
|
|
||||||
<DoubleAnimation To="1" Duration="0:0:0.1" />
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</DataTrigger.EnterActions>
|
|
||||||
<DataTrigger.ExitActions>
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard TargetProperty="Opacity">
|
|
||||||
<DoubleAnimation To="0" Duration="0:0:0.1" />
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</DataTrigger.ExitActions>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Grid.Style>
|
|
||||||
<Slider Style="{StaticResource CustomSliderStyle}" Width="100" Maximum="100" Value="{Binding ElementName=mediaElement, Path=Volume}" />
|
|
||||||
</Grid>-->
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
@@ -65,7 +65,8 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
|
|
||||||
buttonPlayPause.Click += TogglePlayPause;
|
buttonPlayPause.Click += TogglePlayPause;
|
||||||
buttonTime.Click += (sender, e) => buttonTime.Tag = (string) buttonTime.Tag == "Time" ? "Length" : "Time";
|
buttonTime.Click += (sender, e) => buttonTime.Tag = (string) buttonTime.Tag == "Time" ? "Length" : "Time";
|
||||||
buttonMute.Click += (sender, e) => IsMuted = !IsMuted;
|
buttonMute.Click += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
|
||||||
|
volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
sliderProgress.PreviewMouseDown += (sender, e) =>
|
sliderProgress.PreviewMouseDown += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user