diff --git a/Flow.Launcher.Infrastructure/Image/ImageCache.cs b/Flow.Launcher.Infrastructure/Image/ImageCache.cs index 2fd2291d4..4b36a1414 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageCache.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageCache.cs @@ -87,6 +87,21 @@ namespace Flow.Launcher.Infrastructure.Image return key is not null && Data.ContainsKey((key, isFullImage)) && Data[(key, isFullImage)].imageSource != null; } + public bool TryGetValue(string key, bool isFullImage, out ImageSource image) + { + if (key is not null) + { + bool hasKey = Data.TryGetValue((key, isFullImage), out var imageUsage); + image = hasKey ? imageUsage.imageSource : null; + return hasKey; + } + else + { + image = null; + return false; + } + } + public int CacheSize() { return Data.Count; diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index deb858a79..401a95253 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -251,6 +251,11 @@ namespace Flow.Launcher.Infrastructure.Image return ImageCache.ContainsKey(path, false) && ImageCache[path, loadFullImage] != null; } + public static bool TryGetValue(string path, bool loadFullImage, out ImageSource image) + { + return ImageCache.TryGetValue(path, loadFullImage, out image); + } + public static async ValueTask LoadAsync(string path, bool loadFullImage = false) { var imageResult = await LoadInternalAsync(path, loadFullImage); diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 9ae1748da..a184520d0 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -18,6 +18,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string ColorScheme { get; set; } = "System"; public bool ShowOpenResultHotkey { get; set; } = true; public double WindowSize { get; set; } = 580; + public string PreviewHotkey { get; set; } = $"F1"; public string Language { diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 912a23a6f..dadf220e3 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -246,12 +246,14 @@ namespace Flow.Launcher.Plugin /// public bool IsMedia { get; set; } public string Description { get; set; } + public IconDelegate PreviewDelegate { get; set; } public static PreviewInfo Default { get; } = new() { PreviewImagePath = null, Description = null, IsMedia = false, + PreviewDelegate = null, }; } } diff --git a/Flow.Launcher/Converters/StringToKeyBindingConverter.cs b/Flow.Launcher/Converters/StringToKeyBindingConverter.cs new file mode 100644 index 000000000..3675f06fc --- /dev/null +++ b/Flow.Launcher/Converters/StringToKeyBindingConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Input; + +namespace Flow.Launcher.Converters +{ + class StringToKeyBindingConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var mode = parameter as string; + var hotkeyStr = value as string; + var converter = new KeyGestureConverter(); + var key = (KeyGesture)converter.ConvertFromString(hotkeyStr); + if (mode == "key") + { + return key.Key; + } + else if (mode == "modifiers") + { + return key.Modifiers; + } + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Flow.Launcher/Languages/da.xaml b/Flow.Launcher/Languages/da.xaml index cc3d9d527..0778d4f97 100644 --- a/Flow.Launcher/Languages/da.xaml +++ b/Flow.Launcher/Languages/da.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/de.xaml b/Flow.Launcher/Languages/de.xaml index dc7d669f4..025eba3b4 100644 --- a/Flow.Launcher/Languages/de.xaml +++ b/Flow.Launcher/Languages/de.xaml @@ -63,7 +63,7 @@ Pinyin aktivieren Ermöglicht die Verwendung von Pinyin für die Suche. Pinyin ist das Standardsystem der romanisierten Schreibweise für die Übersetzung von chinesischen Texten. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Der Schatteneffekt ist nicht zulässig, wenn das aktuelle Thema den Weichzeichneffekt aktiviert hat diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 5c7caafd7..430bdef26 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -73,7 +73,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled @@ -156,6 +156,8 @@ Hotkey Flow Launcher Hotkey Enter shortcut to show/hide Flow Launcher. + Preview Hotkey + Enter shortcut to show/hide preview in search window. Open Result Modifier Key Select a modifier key to open selected result via keyboard. Show Hotkey diff --git a/Flow.Launcher/Languages/es-419.xaml b/Flow.Launcher/Languages/es-419.xaml index 3ac0e22d8..212e8c1fe 100644 --- a/Flow.Launcher/Languages/es-419.xaml +++ b/Flow.Launcher/Languages/es-419.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. El efecto de sombra no está permitido mientras el tema actual tenga el efecto de desenfoque habilitado diff --git a/Flow.Launcher/Languages/es.xaml b/Flow.Launcher/Languages/es.xaml index 03fdfb21c..f2f5b7709 100644 --- a/Flow.Launcher/Languages/es.xaml +++ b/Flow.Launcher/Languages/es.xaml @@ -63,7 +63,7 @@ Buscar con Pinyin Permite utilizar Pinyin para la búsqueda. Pinyin es el sistema estándar de ortografía romanizado para traducir chino. Mostrar siempre vista previa - Muestra siempre el panel de vista previa al iniciar Flow. Pulse F1 para mostrar/ocultar la vista previa. + Muestra siempre el panel de vista previa al iniciar Flow. Pulse {0} para mostrar/ocultar la vista previa. El efecto de sombra no está permitido mientras el tema actual tenga el efecto de desenfoque activado diff --git a/Flow.Launcher/Languages/fr.xaml b/Flow.Launcher/Languages/fr.xaml index 7ebd158c2..4820757ba 100644 --- a/Flow.Launcher/Languages/fr.xaml +++ b/Flow.Launcher/Languages/fr.xaml @@ -63,7 +63,7 @@ Devrait utiliser le pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/it.xaml b/Flow.Launcher/Languages/it.xaml index 1aabba84d..2b1b16cab 100644 --- a/Flow.Launcher/Languages/it.xaml +++ b/Flow.Launcher/Languages/it.xaml @@ -63,7 +63,7 @@ Dovrebbe usare il Pinyin Consente di utilizzare il Pinyin per la ricerca. Il Pinyin è il sistema standard di ortografia romanizzata per la traduzione del cinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. L'effetto ombra non è consentito mentre il tema corrente ha un effetto di sfocatura abilitato diff --git a/Flow.Launcher/Languages/ja.xaml b/Flow.Launcher/Languages/ja.xaml index d93021301..4a743abd5 100644 --- a/Flow.Launcher/Languages/ja.xaml +++ b/Flow.Launcher/Languages/ja.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index 3c79cc045..9efebbaf6 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -63,7 +63,7 @@ 항상 Pinyin 사용 Pinyin을 사용하여 검색할 수 있습니다. Pinyin (병음) 은 로마자 중국어 입력 방식입니다. 항상 미리보기 - 항상 미리보기 패널이 열린 상태로 Flow를 시작합니다. F1키로 미리보기를 on/off 합니다. + 항상 미리보기 패널이 열린 상태로 Flow를 시작합니다. {0} 키로 미리보기를 on/off 합니다. 반투명 흐림 효과를 사용하는 경우, 그림자 효과를 쓸 수 없습니다. diff --git a/Flow.Launcher/Languages/nb.xaml b/Flow.Launcher/Languages/nb.xaml index 017a2064a..11d88a32b 100644 --- a/Flow.Launcher/Languages/nb.xaml +++ b/Flow.Launcher/Languages/nb.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/nl.xaml b/Flow.Launcher/Languages/nl.xaml index 19ea7cda6..322a96be4 100644 --- a/Flow.Launcher/Languages/nl.xaml +++ b/Flow.Launcher/Languages/nl.xaml @@ -63,7 +63,7 @@ Zou Pinyin moeten gebruiken Zorgt ervoor dat Pinyin gebruikt kan worden om te zoeken. Pinyin is het standaard systeem van geromaniseerde spelling voor het vertalen van Chinees. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Schaduw effect is niet toegestaan omdat het huidige thema een vervagingseffect heeft diff --git a/Flow.Launcher/Languages/pl.xaml b/Flow.Launcher/Languages/pl.xaml index 17ad0fec7..9df50d6db 100644 --- a/Flow.Launcher/Languages/pl.xaml +++ b/Flow.Launcher/Languages/pl.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/pt-br.xaml b/Flow.Launcher/Languages/pt-br.xaml index 23dfbc561..8649be772 100644 --- a/Flow.Launcher/Languages/pt-br.xaml +++ b/Flow.Launcher/Languages/pt-br.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/pt-pt.xaml b/Flow.Launcher/Languages/pt-pt.xaml index 1590d0896..f9e8357af 100644 --- a/Flow.Launcher/Languages/pt-pt.xaml +++ b/Flow.Launcher/Languages/pt-pt.xaml @@ -63,7 +63,7 @@ Pesquisar com Pinyin Permite a utilização de Pinyin para pesquisar. Pinyin é um sistema normalizado de ortografia romanizada para tradução de mandarim. Pré-visualizar sempre - Abrir painel de pré-visualização ao iniciar a aplicação. Prima F1 para comutar esta opção. + Abrir painel de pré-visualização ao iniciar a aplicação. Prima {0} para comutar esta opção. O efeito sombra não é permitido com este tema porque o efeito desfocar está ativo diff --git a/Flow.Launcher/Languages/ru.xaml b/Flow.Launcher/Languages/ru.xaml index d6582c588..be104b988 100644 --- a/Flow.Launcher/Languages/ru.xaml +++ b/Flow.Launcher/Languages/ru.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index 00ce6b7ca..3f08eac90 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -63,7 +63,7 @@ Vyhľadávanie pomocou pchin-jin Umožňuje vyhľadávanie pomocou pchin-jin. Pchin-jin je systém zápisu čínskeho jazyka pomocou písmen latinky. Vždy zobraziť náhľad - Pri spustení Flowu vždy otvoriť panel s náhľadom. Stlačením klávesu F1 prepnete náhľad. + Pri spustení Flowu vždy otvoriť panel s náhľadom. Stlačením klávesu {0} prepnete náhľad. Efekt tieňa nie je povolený, kým má aktuálny motív povolený efekt rozostrenia diff --git a/Flow.Launcher/Languages/sr.xaml b/Flow.Launcher/Languages/sr.xaml index f32b44652..7f710286e 100644 --- a/Flow.Launcher/Languages/sr.xaml +++ b/Flow.Launcher/Languages/sr.xaml @@ -63,7 +63,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/Languages/tr.xaml b/Flow.Launcher/Languages/tr.xaml index d47f0a740..c9b2bf70e 100644 --- a/Flow.Launcher/Languages/tr.xaml +++ b/Flow.Launcher/Languages/tr.xaml @@ -63,7 +63,7 @@ Pinyin kullanılmalı Arama yapmak için Pinyin'in kullanılmasına izin verir. Pinyin, Çince'yi çevirmek için standart romanlaştırılmış yazım sistemidir. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Mevcut temada bulanıklık efekti etkinken gölge efektine izin verilmez diff --git a/Flow.Launcher/Languages/uk-UA.xaml b/Flow.Launcher/Languages/uk-UA.xaml index c31bebe25..88c251429 100644 --- a/Flow.Launcher/Languages/uk-UA.xaml +++ b/Flow.Launcher/Languages/uk-UA.xaml @@ -63,7 +63,7 @@ Використовувати піньїнь Дозволяє використовувати пінїнь для пошуку. Піньїнь - це стандартна система написання для перекладу китайської. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Ефект тіні не дозволено, коли поточна тема має ефект розмиття diff --git a/Flow.Launcher/Languages/zh-cn.xaml b/Flow.Launcher/Languages/zh-cn.xaml index d96948951..acb17b8b9 100644 --- a/Flow.Launcher/Languages/zh-cn.xaml +++ b/Flow.Launcher/Languages/zh-cn.xaml @@ -63,7 +63,7 @@ 使用 Pinyin 搜索 允许使用拼音进行搜索. 始终打开预览 - Flow 启动时总是打开预览面板。按 F1 以切换预览。 + Flow 启动时总是打开预览面板。按 {0} 以切换预览。 当前主题已启用模糊效果,不允许启用阴影效果 diff --git a/Flow.Launcher/Languages/zh-tw.xaml b/Flow.Launcher/Languages/zh-tw.xaml index 3757c7d4d..8fa1b001a 100644 --- a/Flow.Launcher/Languages/zh-tw.xaml +++ b/Flow.Launcher/Languages/zh-tw.xaml @@ -63,7 +63,7 @@ 拼音搜索 允許使用拼音來搜索. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 5ed9ba802..6ef8353d3 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -40,10 +40,10 @@ + - + @@ -343,7 +347,7 @@ + Grid.ColumnSpan="{Binding ResultAreaColumn}"> @@ -397,11 +401,13 @@ x:Name="Preview" Grid.Column="1" VerticalAlignment="Stretch" - d:DataContext="{d:DesignInstance vm:ResultViewModel}" - DataContext="{Binding SelectedItem, ElementName=ResultListBox}" Style="{DynamicResource PreviewArea}" - Visibility="Collapsed"> - + Visibility="{Binding PreviewVisible, Converter={StaticResource BoolToVisibilityConverter}}"> + + Visibility="{Binding ShowPreviewImage}">