mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-14 20:29:07 +00:00
Finish ViedoViewer (except volume slider)
This commit is contained in:
@@ -45,4 +45,28 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class VolumeToIconConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
private static readonly string[] Volumes = {"\xE992", "\xE993", "\xE994", "\xE995"};
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return Volumes[0];
|
||||
|
||||
var v = (int) value;
|
||||
if (v == 0)
|
||||
return Volumes[0];
|
||||
|
||||
v = Math.Min(v, 100);
|
||||
|
||||
return Volumes[1 + v / 34];
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@@ -78,6 +78,7 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
}
|
||||
else
|
||||
{
|
||||
context.TitlebarAutoHide = true;
|
||||
context.UseDarkTheme = true;
|
||||
}
|
||||
}
|
||||
|
@@ -59,9 +59,6 @@
|
||||
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Meta.Vlc">
|
||||
<HintPath>.\Meta.Vlc.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -103,7 +100,6 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<None Include="key.snk" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||
@@ -112,15 +108,11 @@
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\compact-disc.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="LibVlc\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Resource Include="Resources\empty.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@@ -43,7 +43,7 @@
|
||||
</Border>
|
||||
<Border ClipToBounds="True" Height="1" Visibility="Visible">
|
||||
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,10,0"
|
||||
Fill="{DynamicResource MainWindowBackground}" />
|
||||
Fill="{DynamicResource WindowTextForegroundAlternative}" />
|
||||
</Border>
|
||||
</DockPanel>
|
||||
<Track x:Name="PART_Track">
|
||||
|
@@ -3,7 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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"
|
||||
@@ -14,6 +13,7 @@
|
||||
<ResourceDictionary>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<local:TimeSpanToShortStringConverter x:Key="TimeSpanToShortStringConverter" />
|
||||
<local:VolumeToIconConverter x:Key="VolumeToIconConverter" />
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Styles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
@@ -42,7 +42,8 @@
|
||||
<BlurEffect Radius="100" />
|
||||
</Rectangle.Effect>
|
||||
<Rectangle.Fill>
|
||||
<ImageBrush ImageSource="{Binding ElementName=imageCoverArt, Path=Source}" Stretch="UniformToFill" Opacity="0.9" />
|
||||
<ImageBrush ImageSource="{Binding ElementName=viewerPanel, Path=CoverArt}" Stretch="UniformToFill"
|
||||
Opacity="0.9" />
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Image Grid.Column="0" x:Name="imageCoverArt" Margin="20,40,20,40">
|
||||
@@ -56,7 +57,7 @@
|
||||
<DataTrigger
|
||||
Binding="{Binding CoverArt, ElementName=viewerPanel, FallbackValue=0, TargetNullValue=0}"
|
||||
Value="0">
|
||||
<Setter Property="Source" Value="Resources/compact-disc.png" />
|
||||
<Setter Property="Source" Value="Resources/empty.png" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -67,7 +68,7 @@
|
||||
<DropShadowEffect ShadowDepth="0" BlurRadius="2" Opacity="0.7" Color="#B2FFFFFF" />
|
||||
</Grid.Effect>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -77,20 +78,20 @@
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="metaTitle" Grid.Row="1" FontSize="22" Padding="3"
|
||||
TextWrapping="Wrap"
|
||||
LineHeight="28" MaxHeight="80" TextTrimming="CharacterEllipsis" FontWeight="SemiBold">
|
||||
LineHeight="28" MaxHeight="80" TextTrimming="CharacterEllipsis">
|
||||
ときめきポポロン♪
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="metaArtists" Grid.Row="3" FontSize="14" Padding="3" TextTrimming="CharacterEllipsis"
|
||||
<TextBlock x:Name="metaArtists" Grid.Row="3" FontSize="14" Padding="3" TextTrimming="CharacterEllipsis"
|
||||
Foreground="{DynamicResource WindowTextForeground}">
|
||||
チマメ隊
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="metaAlbum" Grid.Row="4" FontSize="14" Padding="3" TextTrimming="CharacterEllipsis"
|
||||
<TextBlock x:Name="metaAlbum" Grid.Row="4" FontSize="14" Padding="3" TextTrimming="CharacterEllipsis"
|
||||
Foreground="{DynamicResource WindowTextForeground}">
|
||||
ときめきポポロン♪
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="metaLength" Grid.Row="5" FontSize="14" Padding="3" TextTrimming="CharacterEllipsis"
|
||||
<TextBlock x:Name="metaLength" Grid.Row="5" FontSize="14" Padding="3" TextTrimming="CharacterEllipsis"
|
||||
Foreground="{DynamicResource WindowTextForeground}"
|
||||
Text="{Binding ElementName=mediaElement, Path=Length, Converter={StaticResource TimeSpanToShortStringConverter}}"/>
|
||||
Text="{Binding ElementName=mediaElement, Path=Length, Converter={StaticResource TimeSpanToShortStringConverter}}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -99,8 +100,7 @@
|
||||
<Storyboard x:Key="ShowControlStoryboard" Completed="AutoHideViedoControlContainer">
|
||||
<DoubleAnimation
|
||||
Storyboard.Target="{Binding Source={x:Reference videoControlContainer}}"
|
||||
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05">
|
||||
</DoubleAnimation>
|
||||
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05" />
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="HideControlStoryboard">
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
@@ -119,7 +119,7 @@
|
||||
ColorOverlayVisibility="{Binding ElementName=viewerPanel, Path=HasVideo,Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<glassLayer:GlassLayer.Style>
|
||||
<Style TargetType="glassLayer:GlassLayer">
|
||||
<Setter Property="BlurredElement" Value="{Binding ElementName=viewerPanel}"></Setter>
|
||||
<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}" />
|
||||
@@ -129,38 +129,34 @@
|
||||
</glassLayer:GlassLayer.Style>
|
||||
</glassLayer:GlassLayer>
|
||||
<DockPanel>
|
||||
<Button x:Name="buttonPlayPause" Style="{StaticResource ControlButtonStyle}" 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}"
|
||||
<Button x:Name="buttonPlayPause" DockPanel.Dock="Left">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
|
||||
<Setter Property="Content" Value="" />
|
||||
<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>
|
||||
<Setter Property="Content" Value="" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<Button x:Name="buttonMute" Style="{StaticResource ControlButtonStyle}" 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 x:Name="buttonMute" DockPanel.Dock="Right">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
|
||||
<Setter Property="Content" Value="{Binding ElementName=mediaElement, Path=Volume, Converter={StaticResource VolumeToIconConverter}}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}"
|
||||
Value="True">
|
||||
<Setter Property="Content" Value="" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<Button Width="Auto" Style="{StaticResource ControlButtonStyle}" DockPanel.Dock="Right">
|
||||
<TextBlock DockPanel.Dock="Right" VerticalAlignment="Center" FontSize="11"
|
||||
<TextBlock DockPanel.Dock="Right" VerticalAlignment="Center" FontSize="11" FontFamily="{Binding ElementName=viewerPanel, Path=FontFamily}"
|
||||
Foreground="{DynamicResource CaptionButtonIconForeground}"
|
||||
Text="{Binding ElementName=mediaElement, Path=Time, Converter={StaticResource TimeSpanToShortStringConverter}}" />
|
||||
</Button>
|
||||
|
@@ -21,6 +21,7 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
@@ -62,13 +63,13 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
|
||||
_context = context;
|
||||
|
||||
buttonPlayPause.MouseLeftButtonUp += TogglePlayPause;
|
||||
buttonPlayPause.Click += TogglePlayPause;
|
||||
//buttonMute.MouseLeftButtonUp += (sender, e) =>
|
||||
//{
|
||||
// mediaElement.IsMuted = false;
|
||||
// buttonMute.Visibility = Visibility.Collapsed;
|
||||
//};
|
||||
buttonMute.MouseLeftButtonUp += (sender, e) => IsMuted = !IsMuted;
|
||||
buttonMute.Click += (sender, e) => IsMuted = !IsMuted;
|
||||
|
||||
sliderProgress.PreviewMouseDown += (sender, e) =>
|
||||
{
|
||||
@@ -91,7 +92,7 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
}
|
||||
};*/
|
||||
|
||||
PreviewMouseWheel += (sender, e) => ChangeVolume((double) e.Delta / 120 * 2);
|
||||
PreviewMouseWheel += (sender, e) => ChangeVolume((double) e.Delta / 120 * 4);
|
||||
}
|
||||
|
||||
public bool IsMuted
|
||||
@@ -228,8 +229,6 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
{
|
||||
var state = e.Value;
|
||||
|
||||
Debug.WriteLine(state);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case MediaState.Opening:
|
||||
@@ -268,6 +267,13 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
metaTitle.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Title);
|
||||
metaArtists.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Artist);
|
||||
metaAlbum.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Album);
|
||||
|
||||
metaArtists.Visibility = string.IsNullOrEmpty(metaArtists.Text)
|
||||
? Visibility.Collapsed
|
||||
: Visibility.Visible;
|
||||
metaAlbum.Visibility = string.IsNullOrEmpty(metaAlbum.Text)
|
||||
? Visibility.Collapsed
|
||||
: Visibility.Visible;
|
||||
}
|
||||
|
||||
private void DetermineTheme()
|
||||
@@ -308,7 +314,7 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
if (_wasPlaying) mediaElement.Play();
|
||||
}
|
||||
|
||||
private void TogglePlayPause(object sender, MouseButtonEventArgs e)
|
||||
private void TogglePlayPause(object sender, EventArgs e)
|
||||
{
|
||||
if (mediaElement.VlcMediaPlayer.IsPlaying)
|
||||
{
|
||||
|
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net452" />
|
||||
</packages>
|
Reference in New Issue
Block a user