[FileExplorer]Adds PerceivedType to SVG and QOI thumbnails (#29848)

This commit is contained in:
Pedro Lamas
2023-11-20 12:12:09 +00:00
committed by GitHub
parent c095cdde4e
commit d7f0d0e5c1
2 changed files with 11 additions and 4 deletions

View File

@@ -170,6 +170,7 @@ inline registry::ChangeSet getSvgThumbnailHandlerChangeSet(const std::wstring in
L"SvgThumbnailProvider",
L"Svg Thumbnail Provider",
NonLocalizable::ExtSVG,
L"image",
L"Picture");
}
@@ -222,7 +223,9 @@ inline registry::ChangeSet getQoiThumbnailHandlerChangeSet(const std::wstring in
(fs::path{ installationDir } / LR"d(PowerToys.QoiThumbnailProviderCpp.dll)d").wstring(),
L"QoiThumbnailProvider",
L"Qoi Thumbnail Provider",
NonLocalizable::ExtQOI);
NonLocalizable::ExtQOI,
L"image",
L"Picture");
}
inline registry::ChangeSet getRegistryPreviewSetDefaultAppChangeSet(const std::wstring installationDir, const bool perUser)

View File

@@ -395,6 +395,7 @@ namespace registry
std::wstring className,
std::wstring displayName,
std::vector<std::wstring> fileTypes,
std::wstring perceivedType = L"",
std::wstring fileKindType = L"")
{
const HKEY scope = perUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
@@ -436,9 +437,8 @@ namespace registry
for (const auto& fileType : fileTypes)
{
std::wstring fileAssociationPath = L"Software\\Classes\\";
fileAssociationPath += fileType;
fileAssociationPath += L"\\shellex\\";
std::wstring fileTypePath = L"Software\\Classes\\" + fileType;
std::wstring fileAssociationPath = fileTypePath + L"\\shellex\\";
fileAssociationPath += handlerType == PreviewHandlerType::preview ? IPREVIEW_HANDLER_CLSID : ITHUMBNAIL_PROVIDER_CLSID;
changes.push_back({ scope, fileAssociationPath, std::nullopt, handlerClsid });
if (!fileKindType.empty())
@@ -448,6 +448,10 @@ namespace registry
std::wstring kindMapPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\KindMap";
changes.push_back({ HKEY_LOCAL_MACHINE, kindMapPath, fileType, fileKindType, false});
}
if (!perceivedType.empty())
{
changes.push_back({ scope, fileTypePath, L"PerceivedType", perceivedType });
}
if (handlerType == PreviewHandlerType::preview && fileType == L".reg")
{
// this regfile registry key has precedence over Software\Classes\.reg for .reg files