Finish ViedoViewer (except volume slider)

This commit is contained in:
Paddy Xu
2017-08-11 00:29:24 +03:00
parent 9ce0776d53
commit cd9b713c41
30 changed files with 426 additions and 164 deletions

View File

@@ -11,7 +11,8 @@
<Grid> <Grid>
<Rectangle Visibility="{Binding BackgroundVisibility, ElementName=imagePanel}"> <Rectangle Visibility="{Binding BackgroundVisibility, ElementName=imagePanel}">
<Rectangle.Fill> <Rectangle.Fill>
<ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background.png" AlignmentY="Top" Viewport="0,0,32,32" <ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background.png" AlignmentY="Top"
Viewport="0,0,32,32"
ViewportUnits="Absolute" Stretch="UniformToFill" TileMode="Tile" /> ViewportUnits="Absolute" Stretch="UniformToFill" TileMode="Tile" />
</Rectangle.Fill> </Rectangle.Fill>
</Rectangle> </Rectangle>

View File

@@ -37,6 +37,7 @@ namespace QuickLook.Plugin.ImageViewer
/// </summary> /// </summary>
public partial class ImagePanel : UserControl, INotifyPropertyChanged, IDisposable public partial class ImagePanel : UserControl, INotifyPropertyChanged, IDisposable
{ {
private Visibility _backgroundVisibility = Visibility.Visible;
private Point? _dragInitPos; private Point? _dragInitPos;
private Uri _imageSource; private Uri _imageSource;
private DateTime _lastZoomTime = DateTime.MinValue; private DateTime _lastZoomTime = DateTime.MinValue;
@@ -45,7 +46,6 @@ namespace QuickLook.Plugin.ImageViewer
private BitmapScalingMode _renderMode = BitmapScalingMode.HighQuality; private BitmapScalingMode _renderMode = BitmapScalingMode.HighQuality;
private BitmapSource _source; private BitmapSource _source;
private double _zoomFactor = 1d; private double _zoomFactor = 1d;
private Visibility _backgroundVisibility = Visibility.Visible;
private bool _zoomToFit = true; private bool _zoomToFit = true;

View File

@@ -66,6 +66,7 @@ namespace QuickLook.Plugin.ImageViewer
Directory.SetCurrentDirectory(App.AppPath); Directory.SetCurrentDirectory(App.AppPath);
context.TitlebarOverlap = true; context.TitlebarOverlap = true;
context.TitlebarAutoHide = true;
} }
public void View(string path, ContextObject context) public void View(string path, ContextObject context)

View File

@@ -45,4 +45,28 @@ namespace QuickLook.Plugin.VideoViewer
throw new NotImplementedException(); 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();
}
}
} }

View File

@@ -78,6 +78,7 @@ namespace QuickLook.Plugin.VideoViewer
} }
else else
{ {
context.TitlebarAutoHide = true;
context.UseDarkTheme = true; context.UseDarkTheme = true;
} }
} }

View File

@@ -59,9 +59,6 @@
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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"> <Reference Include="Meta.Vlc">
<HintPath>.\Meta.Vlc.dll</HintPath> <HintPath>.\Meta.Vlc.dll</HintPath>
</Reference> </Reference>
@@ -103,7 +100,6 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<None Include="key.snk" /> <None Include="key.snk" />
<None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj"> <ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
@@ -112,15 +108,11 @@
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\compact-disc.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="LibVlc\**"> <Content Include="LibVlc\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Resource Include="Resources\empty.png" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -43,7 +43,7 @@
</Border> </Border>
<Border ClipToBounds="True" Height="1" Visibility="Visible"> <Border ClipToBounds="True" Height="1" Visibility="Visible">
<Rectangle RadiusX="1" RadiusY="1" Margin="10,0,10,0" <Rectangle RadiusX="1" RadiusY="1" Margin="10,0,10,0"
Fill="{DynamicResource MainWindowBackground}" /> Fill="{DynamicResource WindowTextForegroundAlternative}" />
</Border> </Border>
</DockPanel> </DockPanel>
<Track x:Name="PART_Track"> <Track x:Name="PART_Track">

View File

@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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:vlc="clr-namespace:Meta.Vlc.Wpf;assembly=Meta.Vlc.Wpf"
xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer" xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer"
xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer;assembly=QuickLook" xmlns:glassLayer="clr-namespace:QuickLook.Controls.GlassLayer;assembly=QuickLook"
@@ -14,6 +13,7 @@
<ResourceDictionary> <ResourceDictionary>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<local:TimeSpanToShortStringConverter x:Key="TimeSpanToShortStringConverter" /> <local:TimeSpanToShortStringConverter x:Key="TimeSpanToShortStringConverter" />
<local:VolumeToIconConverter x:Key="VolumeToIconConverter" />
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles.xaml" /> <ResourceDictionary Source="Styles.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
@@ -42,7 +42,8 @@
<BlurEffect Radius="100" /> <BlurEffect Radius="100" />
</Rectangle.Effect> </Rectangle.Effect>
<Rectangle.Fill> <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.Fill>
</Rectangle> </Rectangle>
<Image Grid.Column="0" x:Name="imageCoverArt" Margin="20,40,20,40"> <Image Grid.Column="0" x:Name="imageCoverArt" Margin="20,40,20,40">
@@ -56,7 +57,7 @@
<DataTrigger <DataTrigger
Binding="{Binding CoverArt, ElementName=viewerPanel, FallbackValue=0, TargetNullValue=0}" Binding="{Binding CoverArt, ElementName=viewerPanel, FallbackValue=0, TargetNullValue=0}"
Value="0"> Value="0">
<Setter Property="Source" Value="Resources/compact-disc.png" /> <Setter Property="Source" Value="Resources/empty.png" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
@@ -67,7 +68,7 @@
<DropShadowEffect ShadowDepth="0" BlurRadius="2" Opacity="0.7" Color="#B2FFFFFF" /> <DropShadowEffect ShadowDepth="0" BlurRadius="2" Opacity="0.7" Color="#B2FFFFFF" />
</Grid.Effect> </Grid.Effect>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="60" /> <RowDefinition Height="70" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="10" /> <RowDefinition Height="10" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@@ -77,7 +78,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock x:Name="metaTitle" Grid.Row="1" FontSize="22" Padding="3" <TextBlock x:Name="metaTitle" Grid.Row="1" FontSize="22" Padding="3"
TextWrapping="Wrap" TextWrapping="Wrap"
LineHeight="28" MaxHeight="80" TextTrimming="CharacterEllipsis" FontWeight="SemiBold"> LineHeight="28" MaxHeight="80" TextTrimming="CharacterEllipsis">
ときめきポポロン♪ ときめきポポロン♪
</TextBlock> </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"
@@ -90,7 +91,7 @@
</TextBlock> </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}" Foreground="{DynamicResource WindowTextForeground}"
Text="{Binding ElementName=mediaElement, Path=Length, Converter={StaticResource TimeSpanToShortStringConverter}}"/> Text="{Binding ElementName=mediaElement, Path=Length, Converter={StaticResource TimeSpanToShortStringConverter}}" />
</Grid> </Grid>
</Grid> </Grid>
@@ -99,8 +100,7 @@
<Storyboard x:Key="ShowControlStoryboard" Completed="AutoHideViedoControlContainer"> <Storyboard x:Key="ShowControlStoryboard" Completed="AutoHideViedoControlContainer">
<DoubleAnimation <DoubleAnimation
Storyboard.Target="{Binding Source={x:Reference videoControlContainer}}" Storyboard.Target="{Binding Source={x:Reference videoControlContainer}}"
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05"> Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05" />
</DoubleAnimation>
</Storyboard> </Storyboard>
<Storyboard x:Key="HideControlStoryboard"> <Storyboard x:Key="HideControlStoryboard">
<DoubleAnimationUsingKeyFrames <DoubleAnimationUsingKeyFrames
@@ -119,7 +119,7 @@
ColorOverlayVisibility="{Binding ElementName=viewerPanel, Path=HasVideo,Converter={StaticResource BooleanToVisibilityConverter}}"> ColorOverlayVisibility="{Binding ElementName=viewerPanel, Path=HasVideo,Converter={StaticResource BooleanToVisibilityConverter}}">
<glassLayer:GlassLayer.Style> <glassLayer:GlassLayer.Style>
<Style TargetType="glassLayer:GlassLayer"> <Style TargetType="glassLayer:GlassLayer">
<Setter Property="BlurredElement" Value="{Binding ElementName=viewerPanel}"></Setter> <Setter Property="BlurredElement" Value="{Binding ElementName=mediaElement}" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=viewerPanel,Path=HasVideo}" Value="True"> <DataTrigger Binding="{Binding ElementName=viewerPanel,Path=HasVideo}" Value="True">
<Setter Property="BlurredElement" Value="{Binding ElementName=mediaElement}" /> <Setter Property="BlurredElement" Value="{Binding ElementName=mediaElement}" />
@@ -129,38 +129,34 @@
</glassLayer:GlassLayer.Style> </glassLayer:GlassLayer.Style>
</glassLayer:GlassLayer> </glassLayer:GlassLayer>
<DockPanel> <DockPanel>
<Button x:Name="buttonPlayPause" Style="{StaticResource ControlButtonStyle}" DockPanel.Dock="Left"> <Button x:Name="buttonPlayPause" DockPanel.Dock="Left">
<fa:ImageAwesome Foreground="{DynamicResource CaptionButtonIconForeground}"> <Button.Style>
<fa:ImageAwesome.Style> <Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
<Style> <Setter Property="Content" Value="&#xE769;" />
<Setter Property="fa:ImageAwesome.Icon" Value="Pause" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}" <DataTrigger Binding="{Binding IsPlaying, ElementName=viewerPanel}"
Value="False"> Value="False">
<Setter Property="fa:ImageAwesome.Icon" Value="Play" /> <Setter Property="Content" Value="&#xE768;" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</fa:ImageAwesome.Style> </Button.Style>
</fa:ImageAwesome>
</Button> </Button>
<Button x:Name="buttonMute" Style="{StaticResource ControlButtonStyle}" DockPanel.Dock="Right"> <Button x:Name="buttonMute" DockPanel.Dock="Right">
<fa:ImageAwesome Icon="VolumeUp" Foreground="{DynamicResource CaptionButtonIconForeground}"> <Button.Style>
<fa:ImageAwesome.Style> <Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
<Style TargetType="fa:ImageAwesome"> <Setter Property="Content" Value="{Binding ElementName=mediaElement, Path=Volume, Converter={StaticResource VolumeToIconConverter}}" />
<Setter Property="Icon" Value="VolumeOff" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}" <DataTrigger Binding="{Binding IsMuted, ElementName=viewerPanel}"
Value="False"> Value="True">
<Setter Property="Icon" Value="VolumeUp" /> <Setter Property="Content" Value="&#xE74F;" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</fa:ImageAwesome.Style> </Button.Style>
</fa:ImageAwesome>
</Button> </Button>
<Button Width="Auto" Style="{StaticResource ControlButtonStyle}" DockPanel.Dock="Right"> <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}" Foreground="{DynamicResource CaptionButtonIconForeground}"
Text="{Binding ElementName=mediaElement, Path=Time, Converter={StaticResource TimeSpanToShortStringConverter}}" /> Text="{Binding ElementName=mediaElement, Path=Time, Converter={StaticResource TimeSpanToShortStringConverter}}" />
</Button> </Button>

View File

@@ -21,6 +21,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
@@ -62,13 +63,13 @@ namespace QuickLook.Plugin.VideoViewer
_context = context; _context = context;
buttonPlayPause.MouseLeftButtonUp += TogglePlayPause; buttonPlayPause.Click += TogglePlayPause;
//buttonMute.MouseLeftButtonUp += (sender, e) => //buttonMute.MouseLeftButtonUp += (sender, e) =>
//{ //{
// mediaElement.IsMuted = false; // mediaElement.IsMuted = false;
// buttonMute.Visibility = Visibility.Collapsed; // buttonMute.Visibility = Visibility.Collapsed;
//}; //};
buttonMute.MouseLeftButtonUp += (sender, e) => IsMuted = !IsMuted; buttonMute.Click += (sender, e) => IsMuted = !IsMuted;
sliderProgress.PreviewMouseDown += (sender, e) => 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 public bool IsMuted
@@ -228,8 +229,6 @@ namespace QuickLook.Plugin.VideoViewer
{ {
var state = e.Value; var state = e.Value;
Debug.WriteLine(state);
switch (state) switch (state)
{ {
case MediaState.Opening: case MediaState.Opening:
@@ -268,6 +267,13 @@ namespace QuickLook.Plugin.VideoViewer
metaTitle.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Title); metaTitle.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Title);
metaArtists.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Artist); metaArtists.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Artist);
metaAlbum.Text = mediaElement.VlcMediaPlayer.Media.GetMeta(MetaDataType.Album); 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() private void DetermineTheme()
@@ -308,7 +314,7 @@ namespace QuickLook.Plugin.VideoViewer
if (_wasPlaying) mediaElement.Play(); if (_wasPlaying) mediaElement.Play();
} }
private void TogglePlayPause(object sender, MouseButtonEventArgs e) private void TogglePlayPause(object sender, EventArgs e)
{ {
if (mediaElement.VlcMediaPlayer.IsPlaying) if (mediaElement.VlcMediaPlayer.IsPlaying)
{ {

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net452" />
</packages>

View File

@@ -9,8 +9,6 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/ScrollBarStyleDictionary.xaml" /> <ResourceDictionary Source="Styles/ScrollBarStyleDictionary.xaml" />
<ResourceDictionary Source="Styles/BusyDecorator.xaml" />
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>

View File

@@ -29,6 +29,11 @@ namespace QuickLook.Controls.BusyDecorator
{ {
private readonly BackgroundVisualHost _busyHost = new BackgroundVisualHost(); private readonly BackgroundVisualHost _busyHost = new BackgroundVisualHost();
private readonly ResourceDictionary _styles = new ResourceDictionary
{
Source = new Uri("pack://application:,,,/QuickLook;component/Controls/BusyDecorator/BusyDecorator.xaml")
};
static BusyDecorator() static BusyDecorator()
{ {
DefaultStyleKeyProperty.OverrideMetadata( DefaultStyleKeyProperty.OverrideMetadata(
@@ -38,6 +43,8 @@ namespace QuickLook.Controls.BusyDecorator
public BusyDecorator() public BusyDecorator()
{ {
Resources.MergedDictionaries.Add(_styles);
AddLogicalChild(_busyHost); AddLogicalChild(_busyHost);
AddVisualChild(_busyHost); AddVisualChild(_busyHost);
@@ -85,9 +92,11 @@ namespace QuickLook.Controls.BusyDecorator
private void SetBinding(DependencyObject obj, DependencyProperty source, DependencyProperty target) private void SetBinding(DependencyObject obj, DependencyProperty source, DependencyProperty target)
{ {
var b = new Binding(); var b = new Binding
b.Source = this; {
b.Path = new PropertyPath(source); Source = this,
Path = new PropertyPath(source)
};
BindingOperations.SetBinding(obj, target, b); BindingOperations.SetBinding(obj, target, b);
} }

View File

@@ -1,9 +1,6 @@
<ResourceDictionary <ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:local="clr-namespace:QuickLook"
xmlns:controls="clr-namespace:QuickLook.Controls"
xmlns:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator"> xmlns:busyDecorator="clr-namespace:QuickLook.Controls.BusyDecorator">
<Style TargetType="{x:Type busyDecorator:BusyDecorator}"> <Style TargetType="{x:Type busyDecorator:BusyDecorator}">
@@ -13,7 +10,7 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Control}"> <ControlTemplate TargetType="{x:Type Control}">
<fa:ImageAwesome Width="40" Height="40" Icon="Cog" Spin="True" SpinDuration="1" /> <busyDecorator:SpinIcon FontFamily="Segoe MDL2 Assets" FontSize="40" Spin="True">&#xE72C;</busyDecorator:SpinIcon>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>

View File

@@ -0,0 +1,97 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace QuickLook.Controls.BusyDecorator
{
/// <summary>
/// Control extensions
/// </summary>
internal static class ControlExtensions
{
/// <summary>
/// The key used for storing the spinner Storyboard.
/// </summary>
private static readonly string SpinnerStoryBoardName = $"{typeof(FrameworkElement).Name}Spinner";
/// <summary>
/// Start the spinning animation
/// </summary>
/// <typeparam name="T">FrameworkElement and ISpinable</typeparam>
/// <param name="control">Control to apply the rotation </param>
public static void BeginSpin<T>(this T control)
where T : FrameworkElement, ISpinable
{
var transformGroup = control.RenderTransform as TransformGroup ?? new TransformGroup();
var rotateTransform = transformGroup.Children.OfType<RotateTransform>().FirstOrDefault();
if (rotateTransform != null)
{
rotateTransform.Angle = 0;
}
else
{
transformGroup.Children.Add(new RotateTransform(0.0));
control.RenderTransform = transformGroup;
control.RenderTransformOrigin = new Point(0.5, 0.5);
}
var storyboard = new Storyboard();
var animation = new DoubleAnimation
{
From = 0,
To = 360,
AutoReverse = false,
RepeatBehavior = RepeatBehavior.Forever,
Duration = new Duration(TimeSpan.FromSeconds(control.SpinDuration))
};
storyboard.Children.Add(animation);
Storyboard.SetTarget(animation, control);
Storyboard.SetTargetProperty(animation,
new PropertyPath("(0).(1)[0].(2)", UIElement.RenderTransformProperty,
TransformGroup.ChildrenProperty, RotateTransform.AngleProperty));
storyboard.Begin();
control.Resources.Add(SpinnerStoryBoardName, storyboard);
}
/// <summary>
/// Stop the spinning animation
/// </summary>
/// <typeparam name="T">FrameworkElement and ISpinable</typeparam>
/// <param name="control">Control to stop the rotation.</param>
public static void StopSpin<T>(this T control)
where T : FrameworkElement, ISpinable
{
var storyboard = control.Resources[SpinnerStoryBoardName] as Storyboard;
if (storyboard == null) return;
storyboard.Stop();
control.Resources.Remove(SpinnerStoryBoardName);
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace QuickLook.Controls.BusyDecorator
{
/// <summary>
/// Represents a spinable control
/// </summary>
internal interface ISpinable
{
/// <summary>
/// Gets or sets the current spin (angle) animation of the icon.
/// </summary>
bool Spin { get; set; }
/// <summary>
/// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation.
/// </summary>
double SpinDuration { get; set; }
}
}

View File

@@ -0,0 +1,90 @@
// Copyright © 2017 Paddy Xu
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Windows;
using System.Windows.Controls;
namespace QuickLook.Controls.BusyDecorator
{
internal class SpinIcon : TextBlock, ISpinable
{
#region public bool Spin
/// <summary>
/// Identifies the Spin dependency property.
/// </summary>
public static DependencyProperty SpinProperty =
DependencyProperty.Register("Spin", typeof(bool), typeof(SpinIcon),
new PropertyMetadata(false, OnSpinPropertyChanged));
private static void OnSpinPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var b = d as SpinIcon;
if (b == null) return;
if ((bool) e.NewValue)
b.BeginSpin();
else
b.StopSpin();
}
/// <summary>
/// Gets or sets the current spin (angle) animation of the icon.
/// </summary>
public bool Spin
{
get => (bool) GetValue(SpinProperty);
set => SetValue(SpinProperty, value);
}
#endregion public bool Spin
#region public double SpinDuration
/// <summary>
/// Identifies the SpinDuration dependency property.
/// </summary>
public static DependencyProperty SpinDurationProperty =
DependencyProperty.Register("SpinDuration", typeof(double), typeof(SpinIcon),
new PropertyMetadata(1d, SpinDurationChanged));
private static void SpinDurationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var b = d as SpinIcon;
if (null == b || !b.Spin || !(e.NewValue is double) ||
e.NewValue.Equals(e.OldValue)) return;
b.StopSpin();
b.BeginSpin();
}
/// <summary>
/// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation.
/// </summary>
public double SpinDuration
{
get => (double) GetValue(SpinDurationProperty);
set => SetValue(SpinDurationProperty, value);
}
#endregion public double SpinDuration
}
}

View File

@@ -10,7 +10,8 @@
<Grid> <Grid>
<Rectangle Panel.ZIndex="100" Visibility="{Binding ElementName=glassLayer, Path=NoiseVisibility}"> <Rectangle Panel.ZIndex="100" Visibility="{Binding ElementName=glassLayer, Path=NoiseVisibility}">
<Rectangle.Fill> <Rectangle.Fill>
<ImageBrush x:Name="noiseBrush" ImageSource="100-50-5-monochrome.png" AlignmentY="Top" ViewportUnits="Absolute" <ImageBrush x:Name="noiseBrush" ImageSource="100-50-5-monochrome.png" AlignmentY="Top"
ViewportUnits="Absolute"
Opacity="0.5" Opacity="0.5"
Viewport="0,0,100,100" TileMode="FlipY" Stretch="UniformToFill" /> Viewport="0,0,100,100" TileMode="FlipY" Stretch="UniformToFill" />
</Rectangle.Fill> </Rectangle.Fill>

View File

@@ -15,13 +15,10 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Drawing;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
using QuickLook.Helpers; using QuickLook.Helpers;
using Color = System.Windows.Media.Color;
using Size = System.Windows.Size;
namespace QuickLook.Controls.GlassLayer namespace QuickLook.Controls.GlassLayer
{ {
@@ -72,7 +69,6 @@ namespace QuickLook.Controls.GlassLayer
/// </summary> /// </summary>
public SolidColorBrush OverlayColor public SolidColorBrush OverlayColor
{ {
get => (SolidColorBrush) GetValue(OverlayColorProperty); get => (SolidColorBrush) GetValue(OverlayColorProperty);
set => SetValue(OverlayColorProperty, value); set => SetValue(OverlayColorProperty, value);

View File

@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Windows.Media; using System.Windows;
namespace QuickLook namespace QuickLook
{ {
@@ -23,8 +23,8 @@ namespace QuickLook
{ {
public MainWindowNoTransparent() public MainWindowNoTransparent()
{ {
Background = new SolidColorBrush(Colors.White);
AllowsTransparency = false; AllowsTransparency = false;
windowFrameContainer.Margin = new Thickness(0);
} }
} }
} }

View File

@@ -1,6 +1,5 @@
<controls:MainWindowBase <controls:MainWindowBase
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -16,16 +15,17 @@
Focusable="False" WindowStyle="None" Focusable="False" WindowStyle="None"
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" Background="Transparent"
ShowActivated="False" ShowInTaskbar="True"> ShowActivated="False" ShowInTaskbar="False">
<controls:MainWindowBase.Resources> <controls:MainWindowBase.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" /> <converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
<converters:BooleanToKeyTimeConverter x:Key="BooleanToKeyTimeConverter" />
<converters:WindowStateToThicknessConverter x:Key="WindowStateToThicknessConverter" /> <converters:WindowStateToThicknessConverter x:Key="WindowStateToThicknessConverter" />
<converters:BooleanToResizeBorderThicknessConverter x:Key="BooleanToResizeBorderThicknessConverter" /> <converters:BooleanToResizeBorderThicknessConverter x:Key="BooleanToResizeBorderThicknessConverter" />
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" /> <converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<converters:ScaledValueConverter x:Key="ScaledValueConverter" />
</ResourceDictionary> </ResourceDictionary>
</controls:MainWindowBase.Resources> </controls:MainWindowBase.Resources>
<controls:MainWindowBase.Style> <controls:MainWindowBase.Style>
@@ -66,8 +66,7 @@
<Storyboard x:Key="ShowCaptionContainerStoryboard" Completed="AutoHideCaptionContainer"> <Storyboard x:Key="ShowCaptionContainerStoryboard" Completed="AutoHideCaptionContainer">
<DoubleAnimation <DoubleAnimation
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}" Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05"> Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05" />
</DoubleAnimation>
</Storyboard> </Storyboard>
<Storyboard x:Key="HideCaptionContainerStoryboard"> <Storyboard x:Key="HideCaptionContainerStoryboard">
<DoubleAnimationUsingKeyFrames <DoubleAnimationUsingKeyFrames
@@ -81,36 +80,26 @@
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
</Grid.Resources> </Grid.Resources>
<glassLayer:GlassLayer OverlayColor="{DynamicResource CaptionBackground}" BlurredElement="{Binding ElementName=containerPanel}" <glassLayer:GlassLayer OverlayColor="{DynamicResource CaptionBackground}"
BlurredElement="{Binding ElementName=containerPanel}"
ColorOverlayVisibility="{Binding ContextObject.TitlebarColourVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}" ColorOverlayVisibility="{Binding ContextObject.TitlebarColourVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
GlassVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}" GlassVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
NoiseVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}" /> NoiseVisibility="{Binding ContextObject.TitlebarBlurVisibility, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}" />
<DockPanel> <DockPanel>
<Button x:Name="buttonCloseWindow" Style="{StaticResource CaptionCloseButtonStyle}" <Button DockPanel.Dock="Right" x:Name="buttonCloseWindow" Style="{StaticResource CaptionCloseButtonStyle}" Content="&#xE894;"/>
DockPanel.Dock="Right"> <Button DockPanel.Dock="Right" x:Name="buttonWindowStatus"
<fa:ImageAwesome Icon="TimesCircle" Visibility="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}">
Foreground="{DynamicResource CaptionButtonIconForeground}" /> <Button.Style>
</Button> <Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
<Button x:Name="buttonWindowStatus" Style="{StaticResource CaptionButtonStyle}" <Setter Property="Content" Value="&#xE740;" />
Visibility="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityConverter}}"
DockPanel.Dock="Right">
<fa:ImageAwesome Foreground="{DynamicResource CaptionButtonIconForeground}">
<fa:ImageAwesome.Style>
<Style TargetType="{x:Type fa:ImageAwesome}">
<Setter Property="Icon" Value="WindowMaximize" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}" <DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}"
Value="Maximized"> Value="Maximized">
<Setter Property="Icon" Value="WindowRestore" /> <Setter Property="Content" Value="&#xE73F;" />
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, ElementName=mainWindow}"
Value="Normal">
<Setter Property="Icon" Value="WindowMaximize" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</fa:ImageAwesome.Style> </Button.Style>
</fa:ImageAwesome>
</Button> </Button>
<Button x:Name="buttonOpenWith" DockPanel.Dock="Right" <Button x:Name="buttonOpenWith" DockPanel.Dock="Right"
Style="{StaticResource CaptionTextButtonStyle}"> Style="{StaticResource CaptionTextButtonStyle}">
@@ -120,12 +109,36 @@
</TextBlock> </TextBlock>
</Button.Content> </Button.Content>
</Button> </Button>
<Button DockPanel.Dock="Left" x:Name="buttonPin" Style="{StaticResource CaptionButtonStyle}"> <Button DockPanel.Dock="Left" x:Name="buttonPin" Tag="Auto">
<fa:ImageAwesome Icon="ThumbTack" Foreground="{DynamicResource CaptionButtonIconForeground}" /> <Button.Resources>
</Button> <Grid x:Key="ContentPin">
<Button x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}" DockPanel.Dock="Left"> <TextBlock>&#xE840;</TextBlock>
<fa:ImageAwesome Icon="ShareAlt" Foreground="{DynamicResource CaptionButtonIconForeground}" /> <TextBlock>&#xE842;</TextBlock>
</Grid>
<Grid x:Key="ContentPinTop">
<TextBlock>&#xE840;</TextBlock>
<TextBlock>&#xE842;</TextBlock>
<TextBlock>&#xE889;</TextBlock>
</Grid>
</Button.Resources>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource CaptionButtonStyle}">
<Setter Property="Content" Value="&#xE840;" />
<Style.Triggers>
<Trigger Property="Tag" Value="Auto">
<Setter Property="Content" Value="&#xE840;" />
</Trigger>
<Trigger Property="Tag" Value="PinTop">
<Setter Property="Content" Value="{StaticResource ContentPinTop}" />
</Trigger>
<Trigger Property="Tag" Value="Pin">
<Setter Property="Content" Value="{StaticResource ContentPin}" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button> </Button>
<Button DockPanel.Dock="Left" x:Name="buttonShare" Style="{StaticResource CaptionButtonStyle}" Content="&#xE72D;" />
<Grid x:Name="titleArea" Background="Transparent"> <Grid x:Name="titleArea" Background="Transparent">
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="12" <TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="12"
HorizontalAlignment="Left" TextTrimming="CharacterEllipsis" HorizontalAlignment="Left" TextTrimming="CharacterEllipsis"

View File

@@ -23,6 +23,8 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
@@ -40,13 +42,13 @@ namespace QuickLook
/// </summary> /// </summary>
public partial class MainWindowTransparent : MainWindowBase, INotifyPropertyChanged public partial class MainWindowTransparent : MainWindowBase, INotifyPropertyChanged
{ {
private string _path;
private bool _pinned;
private bool _restoreForDragMove;
private readonly ResourceDictionary _darkDict = new ResourceDictionary private readonly ResourceDictionary _darkDict = new ResourceDictionary
{ {
Source = new Uri("pack://application:,,,/QuickLook;component/Styles/MainWindowStyles.Dark.xaml") Source = new Uri("pack://application:,,,/QuickLook;component/Styles/MainWindowStyles.Dark.xaml")
}; };
private string _path;
private bool _pinned;
private bool _restoreForDragMove;
internal MainWindowTransparent() internal MainWindowTransparent()
{ {
@@ -67,14 +69,12 @@ namespace QuickLook
{ {
if (Pinned) if (Pinned)
{ {
buttonCloseWindow.RaiseEvent( Topmost = !Topmost;
new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left) buttonPin.Tag = Topmost ? "PinTop" : "Pin";
{
RoutedEvent = MouseLeftButtonUpEvent
});
return; return;
} }
Pinned = true; Pinned = true;
buttonPin.Tag = "Pin";
ViewWindowManager.GetInstance().ForgetCurrentWindow(); ViewWindowManager.GetInstance().ForgetCurrentWindow();
}; };
@@ -101,6 +101,22 @@ namespace QuickLook
(sender, e) => RunWith("rundll32.exe", $"shell32.dll,OpenAs_RunDLL {_path}"); (sender, e) => RunWith("rundll32.exe", $"shell32.dll,OpenAs_RunDLL {_path}");
} }
public bool Pinned
{
get => _pinned;
private set
{
_pinned = value;
OnPropertyChanged();
}
}
public IViewer Plugin { get; private set; }
public ContextObject ContextObject { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
private void ShowWindowCaptionContainer(object sender, MouseEventArgs e) private void ShowWindowCaptionContainer(object sender, MouseEventArgs e)
{ {
var show = (Storyboard) windowCaptionContainer.FindResource("ShowCaptionContainerStoryboard"); var show = (Storyboard) windowCaptionContainer.FindResource("ShowCaptionContainerStoryboard");
@@ -125,23 +141,6 @@ namespace QuickLook
hide.Begin(); hide.Begin();
} }
public bool Pinned
{
get => _pinned;
private set
{
_pinned = value;
OnPropertyChanged();
}
}
public IViewer Plugin { get; private set; }
public ContextObject ContextObject { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
private void WindowDragMoveEnd(object sender, MouseButtonEventArgs e) private void WindowDragMoveEnd(object sender, MouseButtonEventArgs e)
{ {
_restoreForDragMove = false; _restoreForDragMove = false;
@@ -201,7 +200,7 @@ namespace QuickLook
Process.Start(new ProcessStartInfo(with) Process.Start(new ProcessStartInfo(with)
{ {
Arguments = arg, Arguments = arg,
WorkingDirectory = System.IO.Path.GetDirectoryName(_path) WorkingDirectory = Path.GetDirectoryName(_path)
}); });
} }
catch (Exception e) catch (Exception e)
@@ -219,7 +218,7 @@ namespace QuickLook
{ {
Process.Start(new ProcessStartInfo(_path) Process.Start(new ProcessStartInfo(_path)
{ {
WorkingDirectory = System.IO.Path.GetDirectoryName(_path) WorkingDirectory = Path.GetDirectoryName(_path)
}); });
} }
catch (Exception e) catch (Exception e)
@@ -351,7 +350,7 @@ namespace QuickLook
if (Directory.Exists(_path)) if (Directory.Exists(_path))
{ {
AddToInlines("MW_BrowseFolder", System.IO.Path.GetFileName(_path)); AddToInlines("MW_BrowseFolder", Path.GetFileName(_path));
return; return;
} }
var isExe = FileHelper.IsExecutable(_path, out string appFriendlyName); var isExe = FileHelper.IsExecutable(_path, out string appFriendlyName);
@@ -368,7 +367,7 @@ namespace QuickLook
return; return;
} }
// assoc not found // assoc not found
AddToInlines("MW_Open", System.IO.Path.GetFileName(_path)); AddToInlines("MW_Open", Path.GetFileName(_path));
void AddToInlines(string str, string replaceWith) void AddToInlines(string str, string replaceWith)
{ {
@@ -395,6 +394,7 @@ namespace QuickLook
WindowState = WindowState.Normal; WindowState = WindowState.Normal;
Hide(); Hide();
//Dispatcher.BeginInvoke(new Action(Hide), DispatcherPriority.ApplicationIdle);
ProcessHelper.PerformAggressiveGC(); ProcessHelper.PerformAggressiveGC();
} }
@@ -418,13 +418,13 @@ namespace QuickLook
{ {
if (dark) if (dark)
{ {
if (!Application.Current.Resources.MergedDictionaries.Contains(_darkDict)) if (!Resources.MergedDictionaries.Contains(_darkDict))
Application.Current.Resources.MergedDictionaries.Add(_darkDict); Resources.MergedDictionaries.Add(_darkDict);
} }
else else
{ {
if (Application.Current.Resources.MergedDictionaries.Contains(_darkDict)) if (Resources.MergedDictionaries.Contains(_darkDict))
Application.Current.Resources.MergedDictionaries.Remove(_darkDict); Resources.MergedDictionaries.Remove(_darkDict);
} }
} }
} }

View File

@@ -6,6 +6,13 @@
xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel" xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel"
FontSize="14" FontSize="14"
mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True"> mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="15" /> <RowDefinition Height="15" />

View File

@@ -35,6 +35,9 @@ namespace QuickLook.Plugin.InfoPanel
public InfoPanel() public InfoPanel()
{ {
InitializeComponent(); InitializeComponent();
// apply global theme
Resources.MergedDictionaries[0].Clear();
} }
public bool Stop public bool Stop

View File

@@ -76,6 +76,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
@@ -84,10 +85,6 @@
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@@ -112,6 +109,8 @@
<Compile Include="..\GitVersion.cs"> <Compile Include="..\GitVersion.cs">
<Link>Properties\GitVersion.cs</Link> <Link>Properties\GitVersion.cs</Link>
</Compile> </Compile>
<Compile Include="Controls\BusyDecorator\ISpinable.cs" />
<Compile Include="Controls\BusyDecorator\SpinIcon.cs" />
<Compile Include="Controls\GlassLayer\GaussianBlurEffect.cs" /> <Compile Include="Controls\GlassLayer\GaussianBlurEffect.cs" />
<Compile Include="Controls\GlassLayer\GlassLayer.xaml.cs"> <Compile Include="Controls\GlassLayer\GlassLayer.xaml.cs">
<DependentUpon>GlassLayer.xaml</DependentUpon> <DependentUpon>GlassLayer.xaml</DependentUpon>
@@ -124,6 +123,7 @@
<Compile Include="Converters\BooleanToResizeBorderThicknessConverter.cs" /> <Compile Include="Converters\BooleanToResizeBorderThicknessConverter.cs" />
<Compile Include="Converters\ScaledValueConverter.cs" /> <Compile Include="Converters\ScaledValueConverter.cs" />
<Compile Include="ExtensionMethods\BitmapExtensions.cs" /> <Compile Include="ExtensionMethods\BitmapExtensions.cs" />
<Compile Include="Controls\BusyDecorator\ControlExtensions.cs" />
<Compile Include="ExtensionMethods\EnumerableExtensions.cs" /> <Compile Include="ExtensionMethods\EnumerableExtensions.cs" />
<Compile Include="ExtensionMethods\FileExtensions.cs" /> <Compile Include="ExtensionMethods\FileExtensions.cs" />
<Compile Include="FocusMonitor.cs" /> <Compile Include="FocusMonitor.cs" />
@@ -192,7 +192,7 @@
<DependentUpon>MainWindowTransparent.xaml</DependentUpon> <DependentUpon>MainWindowTransparent.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="Styles\BusyDecorator.xaml"> <Page Include="Controls\BusyDecorator\BusyDecorator.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>

View File

@@ -5,7 +5,7 @@
<Color x:Key="MainWindowShadowColor">Gray</Color> <Color x:Key="MainWindowShadowColor">Gray</Color>
<SolidColorBrush x:Key="MainWindowBackground" Color="#FF565656" /> <SolidColorBrush x:Key="MainWindowBackground" Color="#FF565656" />
<SolidColorBrush x:Key="WindowTextForeground" Color="#E5EFEFEF" /> <SolidColorBrush x:Key="WindowTextForeground" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="WindowTextForegroundAlternative" Color="#E5EFEFEF" /> <SolidColorBrush x:Key="WindowTextForegroundAlternative" Color="#E5D4D4D4" />
<SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FFB9B9B9" /> <SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FFB9B9B9" />
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5EFEFEF" /> <SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#22FFFFFF" /> <SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#22FFFFFF" />

View File

@@ -10,7 +10,7 @@
<SolidColorBrush x:Key="WindowTextForeground" Color="#E50E0E0E" /> <SolidColorBrush x:Key="WindowTextForeground" Color="#E50E0E0E" />
<SolidColorBrush x:Key="WindowTextForegroundAlternative" Color="#E5626262" /> <SolidColorBrush x:Key="WindowTextForegroundAlternative" Color="#E5626262" />
<SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FF3D3D3D" /> <SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FF3D3D3D" />
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5868686" /> <SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E50E0E0E" />
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#44FFFFFF" /> <SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#44FFFFFF" />
<SolidColorBrush x:Key="CaptionButtonPressBackground" Color="#88FFFFFF" /> <SolidColorBrush x:Key="CaptionButtonPressBackground" Color="#88FFFFFF" />
<SolidColorBrush x:Key="CaptionCloseButtonHoverBackground" Color="#FFE81123" /> <SolidColorBrush x:Key="CaptionCloseButtonHoverBackground" Color="#FFE81123" />
@@ -56,7 +56,9 @@
<Style x:Key="CaptionButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonBaseStyle}"> <Style x:Key="CaptionButtonStyle" TargetType="Button" BasedOn="{StaticResource CaptionButtonBaseStyle}">
<Setter Property="Width" Value="40" /> <Setter Property="Width" Value="40" />
<Setter Property="Height" Value="32" /> <Setter Property="Height" Value="32" />
<Setter Property="Padding" Value="9,9,9,9" /> <Setter Property="FontSize" Value="13" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonIconForeground}" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Button}"> <ControlTemplate TargetType="{x:Type Button}">

View File

@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" /> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
</packages> </packages>