From 372d9bcbec7901c2924a4618d1eacbee605300a8 Mon Sep 17 00:00:00 2001 From: ema Date: Fri, 27 Dec 2024 21:03:21 +0800 Subject: [PATCH 1/2] Fix reading Translations file error --- QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs b/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs index b9ce1b9..96e1036 100644 --- a/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs +++ b/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs @@ -100,10 +100,11 @@ public void Dispose() private object CreateDownloadButton() { + string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config"); + var button = new Button { - Content = TranslationHelper.Get("WEBVIEW2_NOT_AVAILABLE", - domain: Assembly.GetExecutingAssembly().GetName().Name), + Content = TranslationHelper.Get("WEBVIEW2_NOT_AVAILABLE", translationFile), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Padding = new Thickness(20, 6, 20, 6) From a8b51808fb40cb6c4be996c9d294456746422190 Mon Sep 17 00:00:00 2001 From: ema Date: Thu, 29 May 2025 17:31:46 +0800 Subject: [PATCH 2/2] Fix Webview2 persist and width #3 #4 --- QuickLook.Common | 2 +- QuickLook.Plugin.PdfViewer-Native/Helper.cs | 2 +- QuickLook.Plugin.PdfViewer-Native/Plugin.cs | 13 +++++++++++-- QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/QuickLook.Common b/QuickLook.Common index e94c73f..474d7be 160000 --- a/QuickLook.Common +++ b/QuickLook.Common @@ -1 +1 @@ -Subproject commit e94c73fa276af53b55a50726d7d0cff14fa2d230 +Subproject commit 474d7be09e8a8f9bab36640b642659fb33d12c83 diff --git a/QuickLook.Plugin.PdfViewer-Native/Helper.cs b/QuickLook.Plugin.PdfViewer-Native/Helper.cs index fee4d07..dd6ba72 100644 --- a/QuickLook.Plugin.PdfViewer-Native/Helper.cs +++ b/QuickLook.Plugin.PdfViewer-Native/Helper.cs @@ -1,4 +1,4 @@ -// Copyright © 2021 Paddy Xu and Frank Becker +// Copyright © 2017-2025 QL-Win Contributors // // This file is part of QuickLook program. // diff --git a/QuickLook.Plugin.PdfViewer-Native/Plugin.cs b/QuickLook.Plugin.PdfViewer-Native/Plugin.cs index f74ea84..b98d64f 100644 --- a/QuickLook.Plugin.PdfViewer-Native/Plugin.cs +++ b/QuickLook.Plugin.PdfViewer-Native/Plugin.cs @@ -1,4 +1,4 @@ -// Copyright © 2024 ema +// Copyright © 2017-2025 QL-Win Contributors // // This file is part of QuickLook program. // @@ -25,6 +25,9 @@ namespace QuickLook.Plugin.PDFViewerNative; public class Plugin : IViewer { + private static double _width = 1000; + private static double _height = 1200; + public int Priority => 1; private WebpagePanel _panel; @@ -44,7 +47,7 @@ public bool CanHandle(string path) public void Prepare(string path, ContextObject context) { - context.PreferredSize = new Size(1280, 720); + context.SetPreferredSizeFit(new Size(_width, _height), 0.9d); } public void View(string path, ContextObject context) @@ -59,6 +62,12 @@ public void View(string path, ContextObject context) public void Cleanup() { + _width = _panel.ActualWidth; + _height = _panel.ActualHeight; + + _panel?.Dispose(); + _panel = null; + GC.SuppressFinalize(this); } } diff --git a/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs b/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs index 96e1036..5432d67 100644 --- a/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs +++ b/QuickLook.Plugin.PdfViewer-Native/WebpagePanel.cs @@ -1,4 +1,4 @@ -// Copyright © 2021 Paddy Xu and Frank Becker +// Copyright © 2017-2025 QL-Win Contributors // // This file is part of QuickLook program. //