Skip to content

Commit

Permalink
Merge from latest (#8)
Browse files Browse the repository at this point in the history
* Update Translations.config

* Update Translations.config

* Update Translations.config

* Create Privacy.md

* Rename Privacy.md to PRIVACY.md

* Update PRIVACY.md

* Update PRIVACY.md

* Fix QL-Win#579: search box changed in Windows 10 1909

* Fix QL-Win#579: also deal with non-English UIs

* don't bring existing window to the front

* Revert "Fix QL-Win#644: still use focusable window on Windows 7 and 8"

This reverts commit 452574e.

Revert "Fix QL-Win#644 step 1: correctly bring window back to top when clicked"

This reverts commit af608dc.

* Fix QL-Win#401: use the native image provider to render static GIFs

* Update Translations.config

Hungarian language added.

* Fix QL-Win#669: convert image to sRGB only when the original ColorSpace is RGB, sRGB, or scRGB

* Upgrade Magick.NET packages

* Fix QL-Win#669 again: stupid syntax mistake :(

* Bulk update NuGet packages

* Update Translations.config

Typo correction on line 61 and 69. Fixing slight translation mistakes and some words also replaced with more commonly used words.

* Support File Path longer than 260 (tweak needed: https://www.tenforums.com/tutorials/51704-enable-disable-win32-long-paths-windows-10-a.html)

* Add EXR to ImageViewer

* Add MXF to VideoViewer

* Decrease update checking frequency to monthly

* Fix QL-Win#715: add 1s timeout before any previewing request

* Fix QL-Win#711: adjust UI before loading any PDF page

* Fix QL-Win#729: add a config flag to hide the tray icon

* Fix QL-Win#731: use app folder for saving data in the portable mode

* Fix QL-Win#733: detect Markdown encoding

* Fix QL-Win#734: add AVIF format

* Update .appveyor.yml

* added german translation for newly added string

* fix a typo

* Fix QL-Win#744: Components are not correctly disposed upon exit

* Fix QL-Win#477: Add JFIF files

* Update bug_report.md

* typo

* Fix QL-Win#420, QL-Win#452, QL-Win#757: windows positioning for monitors with different DPIs

* Update Common to fix plugin resize

* Fix QL-Win#759: fix thumbnail orientation for some camera models

* Fix QL-Win#760, support CR3

* removed dup of ".asf" and added ".mka" for testing

Co-authored-by: Piteriuz <piteriuz@outlook.com>
Co-authored-by: Pengfei Xu <xupaddy@gmail.com>
Co-authored-by: Bobcruise <bobcruise07@gmail.com>
Co-authored-by: davinhanif <39960696+davinhanif@users.noreply.github.com>
Co-authored-by: Alexander Raab <alexander.raab1@gmx.de>
  • Loading branch information
6 people authored Dec 21, 2020
1 parent 431bf8e commit d14fa5b
Show file tree
Hide file tree
Showing 46 changed files with 473 additions and 260 deletions.
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ deploy:
artifact: QuickLook-$(APPVEYOR_REPO_TAG_NAME)
draft: true
on:
branch: master
APPVEYOR_REPO_TAG: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ A clear and concise description of what you expected to happen.
- QuickLook Version: [e.g. 0.3.3 from Windows Store]

**Screenshots and Exception Log**
If applicable, add screenshots and logs to help explain your problem. The log file is located in `%APPDATA%\pooi.moe\QuickLook\QuickLook.Exception.log` (`.msi` or `.zip` version) or `%LOCALAPPDATA%\Packages\21090PaddyXu.QuickLook_egxr34yet59cg\LocalCache\Roaming\pooi.moe\QuickLook\QuickLook.Exception.log` (Windows Store version).
If applicable, add screenshots and logs to help explain your problem. The log file is located in [one of several locations](https://github.com/QL-Win/QuickLook/wiki/Differences-Between-Distributions#user-data-location).
23 changes: 23 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# QuickLook Privacy Policy

## Website

When accessing our Website, QuickLook website will learn certain information about you during your visit. How we will handle information we learn about you depends upon what you do when visiting our site.

If you visit our site to read or download information on our pages, we collect and store only the following information about you:

* The name of the domain from which you access the Internet
* The date and time you access our site
* The Internet address of the website you used to link directly to our site.
* Third party vendors, including Google and GitHub, use cookies to serve ads based on a user’s prior visits to your website.
* If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message.

The information collected is for statistical purposes. QuickLook website may use software programs to create summary statistics, which are used for such purposes as assessing the number of visitors to the different sections of our site, what information is of most and least interest, determining technical design specifications, and identifying system performance or problem areas.

QuickLook website will not obtain personally-identifying information about you when you visit our site, unless you choose to provide such information to us, nor will such information be sold or otherwise transferred to unaffiliated third parties without the approval of the user at the time of collection.

## Desktop

The software application doesn’t collect anything personal information from you.

The software application exchange data only with https://github.com using the GitHub Releases API. If you are viewing a remote content via the software, data exchange will happen between you and the remote content.
2 changes: 1 addition & 1 deletion QuickLook.Native/QuickLook.Native32/DOpus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
auto b = new WCHAR[size];
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, -1, b, size);

wcscpy_s(buffer, MAX_PATH, b);
wcscpy_s(buffer, MAX_PATH_EX, b); // DOpus supports Long Path

delete[] b;
return; // we now cares only the first result
Expand Down
7 changes: 4 additions & 3 deletions QuickLook.Native/QuickLook.Native32/DialogHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ void DialogHook::GetSelected(PWCHAR buffer)
if (!IsWow64Process(GetCurrentProcess(), &isSelfWoW64))
return;

// if QuickLook is 64bit and target is 32bit, obtain result from the helper
if (isTargetWoW64 && !isSelfWoW64)
{
// if self is 64bit and target is 32bit, do this
GetSelectedFromWoW64HookHelper(buffer);
}
else
Expand All @@ -72,7 +72,8 @@ void DialogHook::GetSelected(PWCHAR buffer)
return;

SendMessage(hwndfg, WM_HOOK_NOTIFY, 0, 0);
wcscpy_s(buffer, MAX_PATH, filePathBuffer);

GetLongPathName(filePathBuffer, buffer, MAX_PATH_EX);
}
}

Expand Down Expand Up @@ -114,7 +115,7 @@ void DialogHook::GetSelectedFromWoW64HookHelper(PWCHAR buffer)
SendMessage(hHelperWnd, WM_HOOK_NOTIFY, 0, 0);

// the sharedBuffer should now ready
wcscpy_s(buffer, MAX_PATH, sharedBuffer);
GetLongPathName(sharedBuffer, buffer, MAX_PATH_EX);

UnmapViewOfFile(sharedBuffer);
CloseHandle(hMapFile);
Expand Down
2 changes: 1 addition & 1 deletion QuickLook.Native/QuickLook.Native32/Everything.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void Everything::GetSelected(PWCHAR buffer)

auto p = wcsstr(pText, L"\r\n");
auto l = p == nullptr ? wcslen(pText) : p - pText;
wcsncpy_s(buffer, MAX_PATH, pText, l);
wcsncpy_s(buffer, MAX_PATH_EX, pText, l); // Everything supports Long Path

GlobalUnlock(hData);

Expand Down
39 changes: 35 additions & 4 deletions QuickLook.Native/QuickLook.Native32/HelperMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
if (n < 1)
return;

DragQueryFile(HDROP(medium.hGlobal), 0, buffer, MAX_PATH - 1);
WCHAR localBuffer[MAX_PATH] = { '\0' };
DragQueryFile(HDROP(medium.hGlobal), 0, localBuffer, MAX_PATH);

GetLongPathName(localBuffer, buffer, MAX_PATH_EX);
}

bool HelperMethods::IsListaryToolbarVisible()
Expand Down Expand Up @@ -88,13 +91,27 @@ bool HelperMethods::IsListaryToolbarVisible()
return found;
}

// Windows 10 1909 replaced the search box in the File Explorer by a UWP control.
// gti.flags is always 0 for UWP applications.
bool HelperMethods::IsExplorerSearchBoxFocused()
{
auto* hwnd = GetFocusedControl();

WCHAR classBuffer[MAX_PATH] = { '\0' };
if (FAILED(GetClassName(hwnd, classBuffer, MAX_PATH)))
return false;

return wcscmp(classBuffer, L"Windows.UI.Core.CoreWindow") == 0;
}

bool HelperMethods::IsCursorActivated(HWND hwnd)
{
auto tId = GetWindowThreadProcessId(hwnd, nullptr);

GUITHREADINFO gui = {sizeof gui};
GetGUIThreadInfo(tId, &gui);
return gui.flags || gui.hwndCaret || IsListaryToolbarVisible();
GUITHREADINFO gti = { sizeof gti };
GetGUIThreadInfo(tId, &gti);

return gti.flags || gti.hwndCaret || IsListaryToolbarVisible();
}

bool HelperMethods::IsUWP()
Expand All @@ -108,3 +125,17 @@ bool HelperMethods::IsUWP()
UINT32 pn = 0;
return pGCPFN(&pn, nullptr) == ERROR_INSUFFICIENT_BUFFER;
}

HWND HelperMethods::GetFocusedControl()
{
auto tid = GetWindowThreadProcessId(GetForegroundWindow(), nullptr);

if (0 == AttachThreadInput(GetCurrentThreadId(), tid, TRUE))
return nullptr;

auto* hwnd = GetFocus();

AttachThreadInput(GetCurrentThreadId(), tid, FALSE);

return hwnd;
}
2 changes: 2 additions & 0 deletions QuickLook.Native/QuickLook.Native32/HelperMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class HelperMethods
static void GetSelectedInternal(CComQIPtr<IWebBrowserApp> pWebBrowserApp, PWCHAR buffer);
static void ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer);
static bool IsCursorActivated(HWND hwndfg);
static bool IsExplorerSearchBoxFocused();
static bool HelperMethods::IsUWP();

private:
static bool IsListaryToolbarVisible();
static HWND GetFocusedControl();
};
12 changes: 9 additions & 3 deletions QuickLook.Native/QuickLook.Native32/Shell32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Shell32::FocusedWindowType Shell32::GetFocusedWindowType()
if (HelperMethods::IsCursorActivated(hwndfg))
return INVALID;

WCHAR classBuffer[MAX_PATH] = {'\0'};
WCHAR classBuffer[MAX_PATH] = { '\0' };
if (FAILED(GetClassName(hwndfg, classBuffer, MAX_PATH)))
return INVALID;

Expand All @@ -53,13 +53,19 @@ Shell32::FocusedWindowType Shell32::GetFocusedWindowType()
}
if (wcscmp(classBuffer, L"ExploreWClass") == 0 || wcscmp(classBuffer, L"CabinetWClass") == 0)
{
return EXPLORER;
if (!HelperMethods::IsExplorerSearchBoxFocused())
{
return EXPLORER;
}
}
if (wcscmp(classBuffer, L"#32770") == 0)
{
if (FindWindowEx(hwndfg, nullptr, L"DUIViewWndClassName", nullptr) != nullptr)
{
return DIALOG;
if (!HelperMethods::IsExplorerSearchBoxFocused())
{
return DIALOG;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions QuickLook.Native/QuickLook.Native32/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@
#include<Shellapi.h>
#include<Psapi.h>
#include<AppModel.h>

#define MAX_PATH_EX 32767
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

void GetCurrentSelection()
{
WCHAR dllBuffer[MAX_PATH] = {'\0'};
// This function runs inside the target process. Some of them may already support Long Path.
// Therefore, we must assume all of them support Long Path to avoid buffer overflow.
WCHAR dllBuffer[MAX_PATH_EX] = {'\0'};
pGCS(dllBuffer);

auto hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, SHARED_MEM_NAME);
Expand All @@ -95,7 +97,7 @@ void GetCurrentSelection()
return;
}

wcscpy_s(buffer, MAX_PATH, dllBuffer);
wcscpy_s(buffer, MAX_PATH_EX, dllBuffer);

UnmapViewOfFile(buffer);
CloseHandle(hMapFile);
Expand Down
1 change: 1 addition & 0 deletions QuickLook.Native/QuickLook.WoW64HookHelper/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@


// TODO: reference additional headers your program requires here
#define MAX_PATH_EX 32767
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,28 @@
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="SharpCompress, Version=0.23.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>..\..\packages\SharpCompress.0.23.0\lib\net45\SharpCompress.dll</HintPath>
<Reference Include="SharpCompress, Version=0.25.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>..\..\packages\SharpCompress.0.25.1\lib\net46\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="UtfUnknown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=90217ce7a23260d4, processorArchitecture=MSIL">
<HintPath>..\..\packages\UTF.Unknown.2.0.0-rc1\lib\net40\UtfUnknown.dll</HintPath>
<HintPath>..\..\packages\UTF.Unknown.2.3.0\lib\net40\UtfUnknown.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpCompress" version="0.23.0" targetFramework="net462" />
<package id="UTF.Unknown" version="2.0.0-rc1" targetFramework="net462" />
<package id="SharpCompress" version="0.25.1" targetFramework="net462" />
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net462" />
<package id="UTF.Unknown" version="2.3.0" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using CsvHelper;
using CsvHelper.Configuration;

namespace QuickLook.Plugin.CsvViewer
{
Expand All @@ -46,7 +48,7 @@ public void LoadFile(string path)

using (var sr = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
{
var conf = new CsvHelper.Configuration.Configuration() {MissingFieldFound = null, BadDataFound = null};
var conf = new Configuration {MissingFieldFound = null, BadDataFound = null};

using (var parser = new CsvParser(sr, conf))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="CsvHelper, Version=12.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\..\packages\CsvHelper.12.1.2\lib\net45\CsvHelper.dll</HintPath>
<HintPath>..\..\packages\CsvHelper.12.3.2\lib\net45\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
Expand Down
4 changes: 3 additions & 1 deletion QuickLook.Plugin/QuickLook.Plugin.CsvViewer/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CsvHelper" version="12.1.2" targetFramework="net462" />
<package id="CsvHelper" version="12.3.2" targetFramework="net462" />
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ internal class GifProvider : AnimationProvider
private Bitmap _fileHandle;
private BitmapSource _frame;
private bool _isPlaying;
private NativeProvider _nativeProvider;

public GifProvider(string path, MetaProvider meta) : base(path, meta)
{
if (!ImageAnimator.CanAnimate(Image.FromFile(path)))
{
_nativeProvider = new NativeProvider(path, meta);
return;
}

_fileHandle = (Bitmap) Image.FromFile(path);

_fileHandle.SetResolution(DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Horizontal,
Expand All @@ -47,18 +54,21 @@ public GifProvider(string path, MetaProvider meta) : base(path, meta)

public override void Dispose()
{
if (_fileHandle == null)
return;
_nativeProvider?.Dispose();
_nativeProvider = null;

ImageAnimator.StopAnimate(_fileHandle, OnFrameChanged);
_fileHandle.Dispose();
_fileHandle?.Dispose();

_fileHandle = null;
_frame = null;
}

public override Task<BitmapSource> GetThumbnail(Size renderSize)
{
if (_nativeProvider != null)
return _nativeProvider.GetThumbnail(renderSize);

return new Task<BitmapSource>(() =>
{
_frame = _fileHandle.ToBitmapSource();
Expand All @@ -68,6 +78,9 @@ public override Task<BitmapSource> GetThumbnail(Size renderSize)

public override Task<BitmapSource> GetRenderedFrame(int index)
{
if (_nativeProvider != null)
return _nativeProvider.GetRenderedFrame(index);

return new Task<BitmapSource>(() =>
{
if (!_isPlaying)
Expand Down
Loading

0 comments on commit d14fa5b

Please sign in to comment.