Use black icon when OS is in Light Mode; upgrade SDK

This commit is contained in:
Paddy Xu
2019-05-26 18:21:15 +03:00
parent 68248ce80f
commit cdf3b261ef
15 changed files with 111 additions and 27 deletions

View File

@@ -15,20 +15,20 @@
<ProjectGuid>{D31EE321-C2B0-4984-B749-736F7DE509F1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>QuickLookNative32</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>QuickLook.Native32</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@@ -35,20 +35,20 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{794E4DCF-F715-4836-9D30-ABD296586D23}</ProjectGuid>
<RootNamespace>QuickLookNative64</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>QuickLook.Native64</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@@ -15,20 +15,20 @@
<ProjectGuid>{2C58F9B2-D8FA-4586-942B-5170CECE5963}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>QuickLookWoW64HookHelper</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>QuickLook.WoW64HookHelper</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@@ -0,0 +1,41 @@
// Copyright © 2019 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 Microsoft.Win32;
namespace QuickLook.Helpers
{
internal class OSThemeHelper
{
public static bool AppsUseDarkTheme()
{
var value = Registry.GetValue(
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
"AppsUseLightTheme", 1);
return value != null && (int)value == 0;
}
public static bool SystemUsesDarkTheme()
{
var value = Registry.GetValue(
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
"SystemUsesLightTheme", 0);
return value == null || (int)value == 0;
}
}
}

View File

@@ -19,7 +19,7 @@ namespace QuickLook.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -80,6 +80,36 @@ namespace QuickLook.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon app_black {
get {
object obj = ResourceManager.GetObject("app_black", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon app_black_16 {
get {
object obj = ResourceManager.GetObject("app_black_16", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap app_black_png {
get {
object obj = ResourceManager.GetObject("app_black_png", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -124,6 +124,15 @@
<data name="app_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\app_16.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="app_black" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\app_black.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="app_black_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\app_black_16.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="app_black_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\app_black.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="app_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\app.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

View File

@@ -94,7 +94,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll</HintPath>
<HintPath>$(SystemRoot)\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="Microsoft.CSharp" />
@@ -103,13 +103,13 @@
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="windows">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0\Facade\windows.winmd</HintPath>
<HintPath>$(SystemRoot)\..\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0\Facade\windows.winmd</HintPath>
</Reference>
<Reference Include="Windows.Foundation.FoundationContract">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\10.0.17134.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd</HintPath>
<HintPath>$(SystemRoot)\..\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd</HintPath>
</Reference>
<Reference Include="Windows.Foundation.UniversalApiContract">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\10.0.17134.0\Windows.Foundation.UniversalApiContract\6.0.0.0\Windows.Foundation.UniversalApiContract.winmd</HintPath>
<HintPath>$(SystemRoot)\..\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.UniversalApiContract\7.0.0.0\Windows.Foundation.UniversalApiContract.winmd</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
@@ -142,6 +142,7 @@
<Compile Include="Controls\BusyDecorator\BackgroundVisualHost.cs" />
<Compile Include="Controls\BusyDecorator\BusyDecorator.cs" />
<Compile Include="Controls\BusyDecorator\VisualTargetPresentationSource.cs" />
<Compile Include="Helpers\OSThemeHelper.cs" />
<Compile Include="Helpers\ShareHelper.cs" />
<Compile Include="NativeMethods\ShellLink.cs" />
<Compile Include="PipeServerManager.cs" />
@@ -196,6 +197,9 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Resource Include="Resources\app_black.ico" />
<Resource Include="Resources\app_black.png" />
<Resource Include="Resources\app_black_16.ico" />
<Resource Include="Resources\app.png" />
<Resource Include="Resources\app_white.png" />
<None Include="packages.config" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -74,9 +74,12 @@ namespace QuickLook
{
var scale = DpiHelper.GetCurrentScaleFactor().Vertical;
if (App.IsWin10)
return scale > 1 ? Resources.app_white : Resources.app_white_16;
if (!App.IsWin10)
return scale > 1 ? Resources.app : Resources.app_16;
return OSThemeHelper.SystemUsesDarkTheme()
? (scale > 1 ? Resources.app_white : Resources.app_white_16)
: (scale > 1 ? Resources.app_black : Resources.app_black_16);
}
public static void ShowNotification(string title, string content, bool isError = false, int timeout = 5000,

View File

@@ -19,9 +19,9 @@ using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using Microsoft.Win32;
using QuickLook.Common.Annotations;
using QuickLook.Common.Plugin;
using QuickLook.Helpers;
namespace QuickLook
{
@@ -73,10 +73,7 @@ namespace QuickLook
switch (theme)
{
case Themes.None:
var t = Registry.GetValue(
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
"AppsUseLightTheme", 1);
isDark = t != null && (int) t == 0;
isDark = OSThemeHelper.AppsUseDarkTheme();
break;
case Themes.Dark:
case Themes.Light:

View File

@@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
Update-Version("..\Build\Appx\AppxManifest.xml")
# generate resources
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makepri.exe'
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe'
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
# packing
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makeappx.exe'
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe'
$folder = '..\Build\Appx\'
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx

View File

@@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
Update-Version("..\Build\Appx\AppxManifest.xml")
# generate resources
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makepri.exe'
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe'
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
# packing
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makeappx.exe'
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe'
$folder = '..\Build\Appx\'
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx

View File

@@ -1,4 +1,4 @@
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\signtool.exe'
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe'
$files = gci '..\Build\QuickLook-*.appx' | %{('"{0}"' -f $_.FullName)}
$timestampUrl = 'http://time.certum.pl/'