mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #1709 from VictoriousRaptor/LazyLoadPreview
Lazy load preview image
This commit is contained in:
commit
f42f87c766
35 changed files with 258 additions and 90 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<ImageSource> LoadAsync(string path, bool loadFullImage = false)
|
||||
{
|
||||
var imageResult = await LoadInternalAsync(path, loadFullImage);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -246,12 +246,14 @@ namespace Flow.Launcher.Plugin
|
|||
/// </summary>
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
32
Flow.Launcher/Converters/StringToKeyBindingConverter.cs
Normal file
32
Flow.Launcher/Converters/StringToKeyBindingConverter.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Pinyin aktivieren</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Ermöglicht die Verwendung von Pinyin für die Suche. Pinyin ist das Standardsystem der romanisierten Schreibweise für die Übersetzung von chinesischen Texten.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Der Schatteneffekt ist nicht zulässig, wenn das aktuelle Thema den Weichzeichneffekt aktiviert hat</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview.</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
@ -156,6 +156,8 @@
|
|||
<system:String x:Key="hotkey">Hotkey</system:String>
|
||||
<system:String x:Key="flowlauncherHotkey">Flow Launcher Hotkey</system:String>
|
||||
<system:String x:Key="flowlauncherHotkeyToolTip">Enter shortcut to show/hide Flow Launcher.</system:String>
|
||||
<system:String x:Key="previewHotkey">Preview Hotkey</system:String>
|
||||
<system:String x:Key="previewHotkeyToolTip">Enter shortcut to show/hide preview in search window.</system:String>
|
||||
<system:String x:Key="openResultModifiers">Open Result Modifier Key</system:String>
|
||||
<system:String x:Key="openResultModifiersToolTip">Select a modifier key to open selected result via keyboard.</system:String>
|
||||
<system:String x:Key="showOpenResultHotkey">Show Hotkey</system:String>
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">El efecto de sombra no está permitido mientras el tema actual tenga el efecto de desenfoque habilitado</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Buscar con Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Permite utilizar Pinyin para la búsqueda. Pinyin es el sistema estándar de ortografía romanizado para traducir chino.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Mostrar siempre vista previa</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Muestra siempre el panel de vista previa al iniciar Flow. Pulse F1 para mostrar/ocultar la vista previa. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Muestra siempre el panel de vista previa al iniciar Flow. Pulse {0} para mostrar/ocultar la vista previa. </system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">El efecto de sombra no está permitido mientras el tema actual tenga el efecto de desenfoque activado</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Devrait utiliser le pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Dovrebbe usare il Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Consente di utilizzare il Pinyin per la ricerca. Il Pinyin è il sistema standard di ortografia romanizzata per la traduzione del cinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">L'effetto ombra non è consentito mentre il tema corrente ha un effetto di sfocatura abilitato</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">항상 Pinyin 사용</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Pinyin을 사용하여 검색할 수 있습니다. Pinyin (병음) 은 로마자 중국어 입력 방식입니다.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">항상 미리보기</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">항상 미리보기 패널이 열린 상태로 Flow를 시작합니다. F1키로 미리보기를 on/off 합니다. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">항상 미리보기 패널이 열린 상태로 Flow를 시작합니다. {0} 키로 미리보기를 on/off 합니다. </system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">반투명 흐림 효과를 사용하는 경우, 그림자 효과를 쓸 수 없습니다.</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Zou Pinyin moeten gebruiken</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Zorgt ervoor dat Pinyin gebruikt kan worden om te zoeken. Pinyin is het standaard systeem van geromaniseerde spelling voor het vertalen van Chinees.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Schaduw effect is niet toegestaan omdat het huidige thema een vervagingseffect heeft</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Pesquisar com Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Permite a utilização de Pinyin para pesquisar. Pinyin é um sistema normalizado de ortografia romanizada para tradução de mandarim.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Pré-visualizar sempre</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Abrir painel de pré-visualização ao iniciar a aplicação. Prima F1 para comutar esta opção. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Abrir painel de pré-visualização ao iniciar a aplicação. Prima {0} para comutar esta opção. </system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">O efeito sombra não é permitido com este tema porque o efeito desfocar está ativo</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Vyhľadávanie pomocou pchin-jin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Umožňuje vyhľadávanie pomocou pchin-jin. Pchin-jin je systém zápisu čínskeho jazyka pomocou písmen latinky.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Vždy zobraziť náhľad</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Pri spustení Flowu vždy otvoriť panel s náhľadom. Stlačením klávesu F1 prepnete náhľad. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Pri spustení Flowu vždy otvoriť panel s náhľadom. Stlačením klávesu {0} prepnete náhľad. </system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Efekt tieňa nie je povolený, kým má aktuálny motív povolený efekt rozostrenia</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Pinyin kullanılmalı</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">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.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Mevcut temada bulanıklık efekti etkinken gölge efektine izin verilmez</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">Використовувати піньїнь</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Дозволяє використовувати пінїнь для пошуку. Піньїнь - це стандартна система написання для перекладу китайської.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Ефект тіні не дозволено, коли поточна тема має ефект розмиття</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">使用 Pinyin 搜索</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">允许使用拼音进行搜索.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">始终打开预览</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Flow 启动时总是打开预览面板。按 F1 以切换预览。 </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Flow 启动时总是打开预览面板。按 {0} 以切换预览。 </system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">当前主题已启用模糊效果,不允许启用阴影效果</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<system:String x:Key="ShouldUsePinyin">拼音搜索</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">允許使用拼音來搜索.</system:String>
|
||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@
|
|||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<converters:BoolToIMEConversionModeConverter x:Key="BoolToIMEConversionModeConverter"/>
|
||||
<converters:BoolToIMEStateConverter x:Key="BoolToIMEStateConverter"/>
|
||||
<converters:StringToKeyBindingConverter x:Key="StringToKeyBindingConverter"/>
|
||||
</Window.Resources>
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
|
||||
<KeyBinding Key="F1" Command="{Binding StartHelpCommand}" />
|
||||
<KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" />
|
||||
<KeyBinding Key="Tab" Command="{Binding AutocompleteQueryCommand}" />
|
||||
<KeyBinding
|
||||
|
|
@ -181,6 +181,10 @@
|
|||
Key="F12"
|
||||
Command="{Binding ToggleGameModeCommand}"
|
||||
Modifiers="Ctrl"/>
|
||||
<KeyBinding
|
||||
Key="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding TogglePreviewCommand}"
|
||||
Modifiers="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}"/>
|
||||
</Window.InputBindings>
|
||||
<Grid>
|
||||
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">
|
||||
|
|
@ -343,7 +347,7 @@
|
|||
<StackPanel
|
||||
x:Name="ResultArea"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2">
|
||||
Grid.ColumnSpan="{Binding ResultAreaColumn}">
|
||||
<Border Style="{DynamicResource WindowRadius}">
|
||||
<Border.Clip>
|
||||
<MultiBinding Converter="{StaticResource BorderClipConverter}">
|
||||
|
|
@ -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">
|
||||
<Border Style="{DynamicResource PreviewBorderStyle}" Visibility="{Binding ShowDefaultPreview}">
|
||||
Visibility="{Binding PreviewVisible, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Border
|
||||
Style="{DynamicResource PreviewBorderStyle}"
|
||||
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
|
||||
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
|
||||
Visibility="{Binding ShowDefaultPreview}">
|
||||
<Grid
|
||||
Margin="20,0,10,0"
|
||||
VerticalAlignment="Stretch"
|
||||
|
|
@ -432,7 +438,7 @@
|
|||
HorizontalAlignment="Center"
|
||||
Source="{Binding PreviewImage}"
|
||||
StretchDirection="DownOnly"
|
||||
Visibility="{Binding ShowIcon}">
|
||||
Visibility="{Binding ShowPreviewImage}">
|
||||
<Image.Style>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="MaxWidth" Value="96" />
|
||||
|
|
@ -472,7 +478,11 @@
|
|||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Style="{DynamicResource PreviewBorderStyle}" Visibility="{Binding ShowCustomizedPreview}">
|
||||
<Border
|
||||
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
|
||||
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
|
||||
Style="{DynamicResource PreviewBorderStyle}"
|
||||
Visibility="{Binding ShowCustomizedPreview}">
|
||||
<ContentControl Content="{Binding Result.PreviewPanel.Value}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -609,11 +609,6 @@ namespace Flow.Launcher
|
|||
}
|
||||
}
|
||||
break;
|
||||
case Key.F1:
|
||||
PreviewToggle();
|
||||
e.Handled = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
|
|
@ -622,31 +617,7 @@ namespace Flow.Launcher
|
|||
|
||||
public void PreviewReset()
|
||||
{
|
||||
if (_settings.AlwaysPreview == true)
|
||||
{
|
||||
ResultArea.SetValue(Grid.ColumnSpanProperty, 1);
|
||||
Preview.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
ResultArea.SetValue(Grid.ColumnSpanProperty, 2);
|
||||
Preview.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
public void PreviewToggle()
|
||||
{
|
||||
|
||||
if (Preview.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
ResultArea.SetValue(Grid.ColumnSpanProperty, 1);
|
||||
Preview.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
ResultArea.SetValue(Grid.ColumnSpanProperty, 2);
|
||||
Preview.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
_viewModel.ResetPreview();
|
||||
}
|
||||
|
||||
private void MoveQueryTextToEnd()
|
||||
|
|
|
|||
|
|
@ -736,14 +736,14 @@
|
|||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource AlwaysPreview}" />
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource AlwaysPreviewToolTip}" />
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{Binding AlwaysPreviewToolTip}" />
|
||||
</StackPanel>
|
||||
<ui:ToggleSwitch
|
||||
Grid.Column="2"
|
||||
FocusVisualMargin="5"
|
||||
IsOn="{Binding Settings.AlwaysPreview}"
|
||||
Style="{DynamicResource SideToggleSwitch}"
|
||||
ToolTip="{DynamicResource AlwaysPreviewToolTip}" />
|
||||
ToolTip="{Binding AlwaysPreviewToolTip}" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
|
|
@ -2434,8 +2434,33 @@
|
|||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2">
|
||||
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource previewHotkey}"/>
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource previewHotkeyToolTip}" />
|
||||
</StackPanel>
|
||||
<flowlauncher:HotkeyControl
|
||||
x:Name="PreviewHotkeyControl"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Width="300"
|
||||
Height="35"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Right"
|
||||
Loaded="OnPreviewHotkeyControlLoaded"
|
||||
LostFocus="OnPreviewHotkeyControlFocusLost" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Grid.Row="3"
|
||||
Margin="0,12,0,0"
|
||||
Padding="0"
|
||||
CornerRadius="5"
|
||||
|
|
@ -2492,7 +2517,7 @@
|
|||
</Border>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Row="4"
|
||||
Margin="0,10,12,10"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -2500,7 +2525,7 @@
|
|||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource customQueryHotkey}" />
|
||||
<ListView
|
||||
Grid.Row="4"
|
||||
Grid.Row="5"
|
||||
MinHeight="160"
|
||||
Margin="0,0,0,0"
|
||||
Background="{DynamicResource Color02B}"
|
||||
|
|
@ -2529,7 +2554,7 @@
|
|||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel
|
||||
Grid.Row="5"
|
||||
Grid.Row="6"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
|
|
@ -2552,7 +2577,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="6"
|
||||
Grid.Row="7"
|
||||
Margin="0,0,12,2"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -2561,7 +2586,7 @@
|
|||
Text="{DynamicResource customQueryShortcut}" />
|
||||
<ListView
|
||||
Name="customShortcutView"
|
||||
Grid.Row="7"
|
||||
Grid.Row="8"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,0"
|
||||
Background="{DynamicResource Color02B}"
|
||||
|
|
@ -2590,7 +2615,7 @@
|
|||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel
|
||||
Grid.Row="8"
|
||||
Grid.Row="9"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
|
|
@ -2613,7 +2638,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="9"
|
||||
Grid.Row="10"
|
||||
Margin="0,0,12,2"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -2621,7 +2646,7 @@
|
|||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource builtinShortcuts}" />
|
||||
<ListView
|
||||
Grid.Row="10"
|
||||
Grid.Row="11"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,20"
|
||||
Background="{DynamicResource Color02B}"
|
||||
|
|
|
|||
|
|
@ -123,6 +123,19 @@ namespace Flow.Launcher
|
|||
}
|
||||
}
|
||||
|
||||
private void OnPreviewHotkeyControlLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = PreviewHotkeyControl.SetHotkeyAsync(settings.PreviewHotkey, false);
|
||||
}
|
||||
|
||||
private void OnPreviewHotkeyControlFocusLost(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (PreviewHotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
settings.PreviewHotkey = PreviewHotkeyControl.CurrentHotkey.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var item = viewModel.SelectedCustomPluginHotkey;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ using System.IO;
|
|||
using System.Collections.Specialized;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -73,6 +74,9 @@ namespace Flow.Launcher.ViewModel
|
|||
case nameof(Settings.OpenResultModifiers):
|
||||
OnPropertyChanged(nameof(OpenResultCommandModifiers));
|
||||
break;
|
||||
case nameof(Settings.PreviewHotkey):
|
||||
OnPropertyChanged(nameof(PreviewHotkey));
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -98,6 +102,15 @@ namespace Flow.Launcher.ViewModel
|
|||
};
|
||||
_selectedResults = Results;
|
||||
|
||||
Results.PropertyChanged += (_, args) =>
|
||||
{
|
||||
switch (args.PropertyName)
|
||||
{
|
||||
case nameof(Results.SelectedItem):
|
||||
UpdatePreview();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
RegisterViewUpdate();
|
||||
RegisterResultsUpdatedEvent();
|
||||
|
|
@ -433,6 +446,52 @@ namespace Flow.Launcher.ViewModel
|
|||
Settings.MaxResultsToShow -= 1;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void TogglePreview()
|
||||
{
|
||||
if (!PreviewVisible)
|
||||
{
|
||||
ShowPreview();
|
||||
}
|
||||
else
|
||||
{
|
||||
HidePreview();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowPreview()
|
||||
{
|
||||
ResultAreaColumn = 1;
|
||||
PreviewVisible = true;
|
||||
Results.SelectedItem?.LoadPreviewImage();
|
||||
}
|
||||
|
||||
private void HidePreview()
|
||||
{
|
||||
ResultAreaColumn = 2;
|
||||
PreviewVisible = false;
|
||||
}
|
||||
|
||||
public void ResetPreview()
|
||||
{
|
||||
if (Settings.AlwaysPreview == true)
|
||||
{
|
||||
ShowPreview();
|
||||
}
|
||||
else
|
||||
{
|
||||
HidePreview();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePreview()
|
||||
{
|
||||
if (PreviewVisible)
|
||||
{
|
||||
Results.SelectedItem?.LoadPreviewImage();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// we need move cursor to end when we manually changed query
|
||||
/// but we don't want to move cursor to end when query is updated from TextBox
|
||||
|
|
@ -524,10 +583,16 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string PreviewHotkey => Settings.PreviewHotkey;
|
||||
|
||||
public string Image => Constant.QueryTextBoxIconImagePath;
|
||||
|
||||
public bool StartWithEnglishMode => Settings.AlwaysStartEn;
|
||||
|
||||
public bool PreviewVisible { get; set; } = false;
|
||||
|
||||
public int ResultAreaColumn { get; set; } = 1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Query
|
||||
|
|
|
|||
|
|
@ -90,6 +90,22 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public Visibility ShowPreviewImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PreviewImageAvailable)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fall back to icon
|
||||
return ShowIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double IconRadius
|
||||
{
|
||||
get
|
||||
|
|
@ -120,6 +136,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
private bool ImgIconAvailable => !string.IsNullOrEmpty(Result.IcoPath) || Result.Icon is not null;
|
||||
|
||||
private bool PreviewImageAvailable => !string.IsNullOrEmpty(Result.Preview.PreviewImagePath) || Result.Preview.PreviewDelegate != null;
|
||||
|
||||
public string OpenResultModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip)
|
||||
|
|
@ -153,16 +171,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public ImageSource PreviewImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!PreviewImageLoaded)
|
||||
{
|
||||
PreviewImageLoaded = true;
|
||||
_ = LoadPreviewImageAsync();
|
||||
}
|
||||
|
||||
return previewImage;
|
||||
}
|
||||
get => previewImage;
|
||||
private set => previewImage = value;
|
||||
}
|
||||
|
||||
|
|
@ -197,9 +206,9 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var imagePath = Result.IcoPath;
|
||||
var iconDelegate = Result.Icon;
|
||||
if (ImageLoader.CacheContainImage(imagePath, false))
|
||||
if (ImageLoader.TryGetValue(imagePath, false, out ImageSource img))
|
||||
{
|
||||
image = await LoadImageInternalAsync(imagePath, iconDelegate, false).ConfigureAwait(false);
|
||||
image = img;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -210,11 +219,11 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
private async Task LoadPreviewImageAsync()
|
||||
{
|
||||
var imagePath = string.IsNullOrEmpty(Result.Preview.PreviewImagePath) ? Result.IcoPath : Result.Preview.PreviewImagePath;
|
||||
var iconDelegate = Result.Icon;
|
||||
if (ImageLoader.CacheContainImage(imagePath, true))
|
||||
var imagePath = Result.Preview.PreviewImagePath ?? Result.IcoPath;
|
||||
var iconDelegate = Result.Preview.PreviewDelegate ?? Result.Icon;
|
||||
if (ImageLoader.TryGetValue(imagePath, true, out ImageSource img))
|
||||
{
|
||||
previewImage = await LoadImageInternalAsync(imagePath, iconDelegate, true).ConfigureAwait(false);
|
||||
previewImage = img;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -223,6 +232,18 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadPreviewImage()
|
||||
{
|
||||
if (ShowDefaultPreview == Visibility.Visible)
|
||||
{
|
||||
if (!PreviewImageLoaded && ShowPreviewImage == Visibility.Visible)
|
||||
{
|
||||
PreviewImageLoaded = true;
|
||||
_ = LoadPreviewImageAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Result Result { get; }
|
||||
public int ResultProgress
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ using System.Windows.Controls;
|
|||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ namespace Flow.Launcher.ViewModel
|
|||
case nameof(Settings.Language):
|
||||
OnPropertyChanged(nameof(ClockText));
|
||||
OnPropertyChanged(nameof(DateText));
|
||||
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
|
||||
break;
|
||||
case nameof(Settings.PreviewHotkey):
|
||||
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
@ -266,8 +270,7 @@ namespace Flow.Launcher.ViewModel
|
|||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||
|
||||
public ObservableCollection<CustomShortcutModel> CustomShortcuts => Settings.CustomShortcuts;
|
||||
public ObservableCollection<BuiltinShortcutModel> BuiltinShortcuts => Settings.BuiltinShortcuts;
|
||||
public string AlwaysPreviewToolTip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
|
||||
|
||||
public string TestProxy()
|
||||
{
|
||||
|
|
@ -767,6 +770,10 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
#region shortcut
|
||||
|
||||
public ObservableCollection<CustomShortcutModel> CustomShortcuts => Settings.CustomShortcuts;
|
||||
|
||||
public ObservableCollection<BuiltinShortcutModel> BuiltinShortcuts => Settings.BuiltinShortcuts;
|
||||
|
||||
public CustomShortcutModel? SelectedCustomShortcut { get; set; }
|
||||
|
||||
public void DeleteSelectedCustomShortcut()
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ And you can download <a href="https://github.com/Flow-Launcher/Flow.Launcher/dis
|
|||
| <kbd>Ctrl</kbd> +<kbd>C</kbd> | Copy the actual folder / file |
|
||||
| <kbd>Ctrl</kbd> +<kbd>I</kbd> | Open flow's settings |
|
||||
| <kbd>F5</kbd> | Reload all plugin data |
|
||||
| <kbd>Ctrl</kbd> + <kbd>F12</kbd> | Toggle Game Mode when in search window. |
|
||||
| <kbd>Ctrl</kbd> + <kbd>F12</kbd> | Toggle Game Mode when in search window |
|
||||
| <kbd>Ctrl</kbd> + <kbd>+</kbd>,<kbd>-</kbd> | Quickly change maximum results shown |
|
||||
| <kbd>Ctrl</kbd> + <kbd>[</kbd>,<kbd>]</kbd> | Quickly change search window width |
|
||||
| <kbd>Ctrl</kbd> + <kbd>H</kbd> | Open search history |
|
||||
|
|
|
|||
Loading…
Reference in a new issue