From 477009d6d56c838f2f47d80940d5e5bc69fafa76 Mon Sep 17 00:00:00 2001 From: zaum Date: Fri, 18 Sep 2026 23:12:46 +0200 Subject: [PATCH 1/2] Add an optional auto-hiding toolbar --- .../Styles/MainWindowStyles.Dark.xaml | 1 + QuickLook.Common/Styles/MainWindowStyles.xaml | 1 + QuickLook/QuickLook.csproj | 3 + QuickLook/Translations.config | 29 ++++++ QuickLook/TrayIconManager.cs | 11 +++ QuickLook/ViewerWindow.Actions.cs | 2 + QuickLook/ViewerWindow.Properties.cs | 14 +++ QuickLook/ViewerWindow.xaml | 21 ++++- QuickLook/ViewerWindow.xaml.cs | 93 +++++++++++++++++-- Scripts/update-version.ps1 | 4 + 10 files changed, 168 insertions(+), 11 deletions(-) diff --git a/QuickLook.Common/Styles/MainWindowStyles.Dark.xaml b/QuickLook.Common/Styles/MainWindowStyles.Dark.xaml index ccc6054ed..813573f5b 100644 --- a/QuickLook.Common/Styles/MainWindowStyles.Dark.xaml +++ b/QuickLook.Common/Styles/MainWindowStyles.Dark.xaml @@ -1,6 +1,7 @@  + diff --git a/QuickLook.Common/Styles/MainWindowStyles.xaml b/QuickLook.Common/Styles/MainWindowStyles.xaml index deee5d596..f41acd0a6 100644 --- a/QuickLook.Common/Styles/MainWindowStyles.xaml +++ b/QuickLook.Common/Styles/MainWindowStyles.xaml @@ -6,6 +6,7 @@ 32 + diff --git a/QuickLook/QuickLook.csproj b/QuickLook/QuickLook.csproj index 7e4b06ddf..054544771 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -140,6 +140,9 @@ all + + all + diff --git a/QuickLook/Translations.config b/QuickLook/Translations.config index 9d01bc2b9..2c657f050 100644 --- a/QuickLook/Translations.config +++ b/QuickLook/Translations.config @@ -19,6 +19,7 @@ افتح مجلد البيانات إعادة تشغيل Close on Lost Focus + إخفاء شريط الأدوات أغلق البرنامج أنت تمتلك النسخة الأحدث من البرنامج كويك لووك {0} تم إصداره. إنقر هنا لفتح صفحة التحميل @@ -50,6 +51,7 @@ Adatmappa Megnyitása &Újraindítás Close on Lost Focus + Eszköztár elrejtése &Kilépés A legújabb verziót használja. QuickLook {0} megjelent. Kattintson ide a letöltési oldal megnyitásához. @@ -80,6 +82,7 @@ Otvoriť Priečinok S Údajmi &Reštart Close on Lost Focus + Skryť panel s nástrojmi &Ukončiť Máte nainštalovanú najnovšiu verziu QuickLook {0} nie je v aktuálnej verzii. Kliknite sem na otvorenie stránky pre stiahnutie. @@ -111,6 +114,7 @@ Buka Folder Data &Mulai Ulang Close on Lost Focus + Sembunyikan bilah alat &Keluar Anda saat ini menggunakan versi terbaru. QuickLook v. {0} dirilis. Klik disini untuk membuka halaman unduhan. @@ -147,6 +151,7 @@ 데이터 폴더 열기 다시 시작(&R) Close on Lost Focus + 도구 모음 숨기기 종료(&Q) 현재 최신 버전을 사용하고 있습니다. QuickLook {0}이 출시되었습니다. 여기를 클릭하여 다운로드 페이지를 여세요. @@ -177,6 +182,7 @@ Obre La Carpeta De Dades &Reinicia Close on Lost Focus + Amaga la barra d'eines &Surt Ja teniu l'última versió. S'ha alliberat el QuickLook {0}. Feu clic aquí per a obrir la pàgina de baixada. @@ -215,6 +221,7 @@ Datenordner öffnen &Neustart Close on Lost Focus + Symbolleiste ausblenden &Beenden Sie haben die neueste Version. QuickLook v{0} wurde veröffentlicht. Hier klicken um die Downloadseite zu öffnen. @@ -254,6 +261,7 @@ Open Data Folder &Restart Close on Lost Focus + Hide toolbar &Quit You are now on the latest version. QuickLook {0} has been released. Click here to open the download page. @@ -293,6 +301,7 @@ Abrir Carpeta De Datos &Reiniciar Close on Lost Focus + Ocultar barra de herramientas &Salir Está usando la última versión. QuickLook {0} está disponible. Haga clic aquí para abrir la página de descarga. @@ -327,6 +336,7 @@ Ouvrir Le Dossier De Données &Redémarrer Close on Lost Focus + Masquer la barre d'outils &Quitter Vous êtes maintenant sur la dernière version. QuickLook {0} est disponible. Cliquez ici pour ouvrir la page de téléchargement. @@ -361,6 +371,7 @@ Apri Cartella Dati &Riavvia Close on Lost Focus + Nascondi barra degli strumenti &Esci Stai usando l'ultima versione. QuickLook {0} è disponibile. Fai click qui per aprire la pagina di download. @@ -398,6 +409,7 @@ データフォルダを開く 再起動(&R) Close on Lost Focus + ツールバーを隠す 終了(&E) 最新版です QuickLook {0} がリリースされました。ここをクリックしてダウンロードページを開きます。 @@ -428,6 +440,7 @@ Åpne Datamappen &Start på nytt Close on Lost Focus + Skjul verktøylinje &Avslutt Du bruker nå siste versjon. QuickLook {0} er kommet ut. Klikk her for å åpne nedlastingssiden. @@ -457,6 +470,7 @@ Open Gegevensmap &Opnieuw starten Close on Lost Focus + Werkbalk verbergen &Sluiten U heeft de meest recente versie. QuickLook {0} is gereleased. Klik hier om de downloadpagina te openen. @@ -495,6 +509,7 @@ Otwórz Folder Danych &Uruchom ponownie Close on Lost Focus + Ukryj pasek narzędzi &Zakończ Używasz już najnowszej wersji. QuickLook {0} jest dostępny. Kliknij tutaj, aby otworzyć stronę z aktualizacją do pobrania. @@ -534,6 +549,7 @@ Abrir Pasta de Dados &Reiniciar Close on Lost Focus + Ocultar barra de ferramentas &Fechar Executando a versão mais recente. Nova versão disponível. QuickLook {0}. Clique aqui para abrir a página de download. @@ -564,6 +580,7 @@ Abrir Pasta De Dados &Reiniciar Close on Lost Focus + Ocultar barra de ferramentas &Fechar Está a executar a versão mais recente. Está disponível o QuickLook {0}. Clique aqui para abrir a página de download. @@ -600,6 +617,7 @@ Открыть Папку Данных &Перезапуск Close on Lost Focus + Скрыть панель инструментов &Выход Вы используете последнюю версию. Выпущен QuickLook {0}. Нажмите здесь для перехода на страницу загрузки. @@ -631,6 +649,7 @@ Veri Klasörünü Aç Yeniden &Başlat Close on Lost Focus + Araç çubuğunu gizle Çı&kış Son sürümü kullanıyorsunuz. QuickLook {0} sürümü yayınladı. İndirme sayfasını açmak için buraya tıklayın. @@ -669,6 +688,7 @@ Відкрити Папку Даних &Перезавантажити Close on Lost Focus + Сховати панель інструментів &Вийти Ви зараз на самій свіжій версії. Випущено QuickLook {0}. Натисніть тут, щоб відкрити сторінку завантаження. @@ -699,6 +719,7 @@ Mở Thư Mục Dữ Liệu &Khởi động lại Close on Lost Focus + Ẩn thanh công cụ &Thoát Bạn hiện đang sử dụng phiên bản mới nhất. Đã có phiên bản QuickLook {0}. Nhấp vào đây để mở trang tải xuống. @@ -737,6 +758,7 @@ 打开数据文件夹 重启 (&R) 失去焦点时关闭 + 隐藏工具栏 退出 (&Q) 当前已是最新版本 发现新版本:QuickLook {0} 点击这里打开下载页面 @@ -776,6 +798,7 @@ 開啟資料夾 重啟 (&R) 失去焦點時關閉 + 隱藏工具列 結束 Quicklook (&Q) 您正在使用最新版本。 QuickLook {0} 新版本已發布。請按一下此處開啟下載頁面。 @@ -808,6 +831,7 @@ डेटा फोल्डर उघडा &पुनः आरंभ Close on Lost Focus + टूलबार लपवा &बंद करा आपण आता नवीनतम आवृत्ती वापरत आहात. QuickLook ची नवीन आवृत्ती {0} उपलब्ध आहे. डाउनलोड पृष्ठ उघडण्यासाठी येथे क्लिक करा. @@ -837,6 +861,7 @@ डेटा फ़ोल्डर खोलें &पुनः प्रारंभ करें Close on Lost Focus + टूलबार छिपाएँ &बंद किजीए अब आप नवीनतम संस्करण पर हैं। QuickLook का नया संस्करण उपलब्ध है। डाउनलोड पेज खोलने के लिए यहां क्लिक करें। @@ -868,6 +893,7 @@ פתח את תיקיית הנתונים &אתחול מחדש Close on Lost Focus + הסתר סרגל כלים &צא אתה כעת על הגרסא האחרונה 'תצוגה מהירה' {0} שוחררה. לחץ כאן על מנת להוריד את העדכון @@ -898,6 +924,7 @@ Άνοιγμα Φακέλου Δεδομένων &Επανεκκίνηση Close on Lost Focus + Απόκρυψη γραμμής εργαλείων &Κλείσιμο Έχετε την πιο πρόσφατη έκδοση. Διαθέσιμη ενημέρωση {0} βρέθηκε. Κάντε κλικ εδώ για να ανοίξετε τη σελίδα λήψης. @@ -933,6 +960,7 @@ Öppna datamappen &Starta om Close on Lost Focus + Dölj verktygsfältet &Avsluta Du har den senaste versionen. QuickLook {0} har lanserats. Klicka här för att öppna nedladdningssidan. @@ -970,6 +998,7 @@ Deschideți folderul Date &Repornire Close on Lost Focus + Ascunde bara de instrumente &Ieșire Acum utilizați cea mai recentă versiune. A fost lansat QuickLook {0}. Faceți clic aici pentru a deschide pagina de descărcare. diff --git a/QuickLook/TrayIconManager.cs b/QuickLook/TrayIconManager.cs index ab831c930..56fe1c8cd 100644 --- a/QuickLook/TrayIconManager.cs +++ b/QuickLook/TrayIconManager.cs @@ -38,6 +38,7 @@ internal partial class TrayIconManager : IDisposable private readonly TrayMenuItem _itemAutorun = null!; private readonly TrayMenuItem _itemCloseOnLostFocus = null!; + private readonly TrayMenuItem _itemHideToolbar = null!; private TrayIconManager() { @@ -91,6 +92,15 @@ private TrayIconManager() SettingHelper.Set("CloseOnLostFocus", !current); }), }, + _itemHideToolbar = new TrayMenuItem() + { + Header = TranslationHelper.Get("Icon_HideToolbar"), + Command = new RelayCommand(() => + { + var current = SettingHelper.Get("HideToolbar", false); + SettingHelper.Set("HideToolbar", !current); + }), + }, new TrayMenuItem() { Header = TranslationHelper.Get("Icon_Restart"), @@ -109,6 +119,7 @@ private TrayIconManager() { _itemAutorun.IsChecked = AutoStartupHelper.IsAutorun(); _itemCloseOnLostFocus.IsChecked = SettingHelper.Get("CloseOnLostFocus", false); + _itemHideToolbar.IsChecked = SettingHelper.Get("HideToolbar", false); }; } diff --git a/QuickLook/ViewerWindow.Actions.cs b/QuickLook/ViewerWindow.Actions.cs index c5fb50506..57b754ac3 100644 --- a/QuickLook/ViewerWindow.Actions.cs +++ b/QuickLook/ViewerWindow.Actions.cs @@ -294,6 +294,8 @@ internal void BeginShow(IViewer matchedPlugin, string path, return; } + HideToolbar = SettingHelper.Get("HideToolbar", false); + if (ContextObject.IsBlocked) { ContextObject.ViewerContent = new System.Windows.Controls.TextBlock diff --git a/QuickLook/ViewerWindow.Properties.cs b/QuickLook/ViewerWindow.Properties.cs index 5f628e384..6aa7fdf90 100644 --- a/QuickLook/ViewerWindow.Properties.cs +++ b/QuickLook/ViewerWindow.Properties.cs @@ -44,6 +44,20 @@ public partial class ViewerWindow : INotifyPropertyChanged private Rect _preFullscreenBounds; private double _preFullscreenCaptionHeight; private Thickness _preFullscreenResizeBorderThickness; + private bool _hideToolbar; + + public bool HideToolbar + { + get => _hideToolbar; + private set + { + if (value == _hideToolbar) + return; + + _hideToolbar = value; + OnPropertyChanged(); + } + } public bool Pinned { diff --git a/QuickLook/ViewerWindow.xaml b/QuickLook/ViewerWindow.xaml index 147cf9bc1..f6202c8f6 100644 --- a/QuickLook/ViewerWindow.xaml +++ b/QuickLook/ViewerWindow.xaml @@ -61,6 +61,9 @@ + + + @@ -71,12 +74,11 @@ To="1" Duration="0:0:0.05" /> - + - - + @@ -229,7 +231,18 @@ + Visibility="{Binding ContextObject.TitlebarOverlap, ElementName=mainWindow, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"> + + + + _ignoreNextWindowSizeChange = true; windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer; + windowCaptionContainer.MouseLeave += HideWindowCaptionContainer; + _toolbarCursorTimer.Tick += UpdateToolbarVisibility; + _toolbarCursorTimer.Start(); Topmost = SettingHelper.Get("Topmost", false); buttonTop.Tag = Topmost ? "Top" : "Auto"; @@ -458,25 +464,98 @@ private void SaveWindowSizeOnSizeChanged(object sender, SizeChangedEventArgs e) private void ShowWindowCaptionContainer(object sender, MouseEventArgs e) { - var show = (Storyboard)windowCaptionContainer.FindResource("ShowCaptionContainerStoryboard"); + if (HideToolbar) + return; - if (windowCaptionContainer.Opacity == 0 || windowCaptionContainer.Opacity == 1) - show.Begin(); + ShowToolbar(); } private void AutoHideCaptionContainer(object sender, EventArgs e) { - if (!ContextObject.TitlebarAutoHide) + _toolbarAnimationRunning = false; + + if (!ContextObject.TitlebarAutoHide && !HideToolbar) return; - if (!ContextObject.TitlebarOverlap) + if (!ContextObject.TitlebarOverlap && !HideToolbar) return; - if (windowCaptionContainer.IsMouseOver) + if (windowCaptionContainer.IsMouseOver || IsPointerInToolbarKeepVisibleZone()) return; - var hide = (Storyboard)windowCaptionContainer.FindResource("HideCaptionContainerStoryboard"); + HideToolbarWithAnimation(); + } + + private void HideWindowCaptionContainer(object sender, MouseEventArgs e) + { + if (!HideToolbar || IsPointerInToolbarKeepVisibleZone()) + return; + + HideToolbarWithAnimation(); + } + + private void UpdateToolbarVisibility(object sender, EventArgs e) + { + if (!HideToolbar || !IsVisible || PresentationSource.FromVisual(windowFrameContainer) is null) + return; + + if (IsPointerInToolbarRevealZone()) + ShowToolbar(); + else if (windowCaptionContainer.Opacity >= 0.99 && !IsPointerInToolbarKeepVisibleZone()) + HideToolbarWithAnimation(); + } + + private void ShowToolbar() + { + if (_toolbarAnimationRunning || !HideToolbar && !ContextObject.TitlebarAutoHide || windowCaptionContainer.Opacity > 0.01) + return; + + _toolbarAnimationRunning = true; + var show = (Storyboard)windowCaptionContainer.FindResource("ShowCaptionContainerStoryboard"); + show.Begin(); + } + + private void HideToolbarWithAnimation() + { + if (_toolbarAnimationRunning) + return; + _toolbarAnimationRunning = true; + var hide = (Storyboard)windowCaptionContainer.FindResource("HideCaptionContainerStoryboard"); hide.Begin(); } + + private void FinishToolbarAnimation(object sender, EventArgs e) + { + _toolbarAnimationRunning = false; + } + + private bool IsPointerInToolbarRevealZone() + { + return GetPointerY() <= GetToolbarRevealHeight(); + } + + private bool IsPointerInToolbarKeepVisibleZone() + { + return GetPointerY() <= GetToolbarKeepVisibleHeight(); + } + + private double GetPointerY() + { + if (!IsVisible || PresentationSource.FromVisual(windowFrameContainer) is null) + return double.PositiveInfinity; + + var origin = windowFrameContainer.PointToScreen(new Point(0, 0)); + return Forms.Cursor.Position.Y - origin.Y; + } + + private double GetToolbarRevealHeight() + { + return ActualHeight * 0.35; + } + + private double GetToolbarKeepVisibleHeight() + { + return ActualHeight * 0.45; + } } diff --git a/Scripts/update-version.ps1 b/Scripts/update-version.ps1 index 58c4c6871..b47b2215e 100644 --- a/Scripts/update-version.ps1 +++ b/Scripts/update-version.ps1 @@ -1,6 +1,10 @@ $tag = git describe --always --tags "--abbrev=0" --exclude latest $revision = git describe --always --tags --exclude latest +if ($tag -notmatch '^\d+(\.\d+){0,3}$') { + $tag = '0.0.0.0' +} + $text = @" // This file is generated by update-version.ps1 From 4192e3dfd26b23106f3fd02c2f0aea68937be19f Mon Sep 17 00:00:00 2001 From: zaum Date: Sat, 19 Sep 2026 08:11:40 +0200 Subject: [PATCH 2/2] Fix ImageViewer metadata tooltips --- .../ImagePanel.xaml | 40 +++------ .../ImagePanel.xaml.cs | 42 ++++++--- .../Translations.config | 87 +++++++++++++++++++ 3 files changed, 128 insertions(+), 41 deletions(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml index e177a8509..a0f550962 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml @@ -102,6 +102,7 @@ Margin="0,0,8,0" Content="" Style="{StaticResource CaptionButtonStyle}" + ToolTip="{Binding CopyTooltip, ElementName=imagePanel}" Visibility="{Binding ElementName=imagePanel, Path=CopyIconVisibility}" />