From cc45deec8bd050cf433ce068cd22234feb7af9da Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Thu, 22 Dec 2022 21:48:37 +0800
Subject: [PATCH 01/25] Add preview hotky in settings
---
Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 9ae1748da..3971e5cc7 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"; // TODO: change to another value
public string Language
{
From 7f0e735cb65d16b8f0b602090c2a5e142da52281 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Thu, 22 Dec 2022 22:10:21 +0800
Subject: [PATCH 02/25] Use data binding
---
Flow.Launcher/MainWindow.xaml | 18 ++++++----
Flow.Launcher/MainWindow.xaml.cs | 23 ++-----------
Flow.Launcher/ViewModel/MainViewModel.cs | 43 +++++++++++++++++++++++-
3 files changed, 56 insertions(+), 28 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index 095382e76..faf9f670a 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -343,7 +343,7 @@
+ Grid.ColumnSpan="{Binding ResultAreaColumn}">
@@ -397,11 +397,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}}">
+
-
+
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index a645a702c..ac360e31c 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -633,30 +633,11 @@ 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;
- }
+ _viewModel.ResetPreview();
}
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.TogglePreview();
}
private void MoveQueryTextToEnd()
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 09bba6e5c..7db49bd79 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -104,7 +104,7 @@ namespace Flow.Launcher.ViewModel
RegisterResultsUpdatedEvent();
RegisterClockAndDateUpdateAsync();
- SetOpenResultModifiers();
+ SetOpenResultModifiers(); // TODO?
}
private void RegisterViewUpdate()
@@ -424,6 +424,43 @@ namespace Flow.Launcher.ViewModel
Settings.MaxResultsToShow -= 1;
}
+ [RelayCommand]
+ public void TogglePreview()
+ {
+ if (!PreviewVisible)
+ {
+ ShowPreview();
+ }
+ else
+ {
+ HidePreview();
+ }
+ }
+
+ private void ShowPreview()
+ {
+ ResultAreaColumn = 1;
+ PreviewVisible = true;
+ }
+
+ private void HidePreview()
+ {
+ ResultAreaColumn = 2;
+ PreviewVisible = false;
+ }
+
+ public void ResetPreview()
+ {
+ if (Settings.AlwaysPreview == true)
+ {
+ ShowPreview();
+ }
+ else
+ {
+ HidePreview();
+ }
+ }
+
///
/// 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
@@ -519,6 +556,10 @@ namespace Flow.Launcher.ViewModel
public bool StartWithEnglishMode => Settings.AlwaysStartEn;
+ public bool PreviewVisible { get; set; } = false;
+
+ public int ResultAreaColumn { get; set; } = 1;
+
#endregion
public void Query()
From 2476e2d77d9108ab9610c50c515931d3c5a7a5e8 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 23 Dec 2022 00:32:29 +0800
Subject: [PATCH 03/25] Only load preview when preview panel is open
---
Flow.Launcher/ViewModel/MainViewModel.cs | 18 ++++++++++++++
Flow.Launcher/ViewModel/ResultViewModel.cs | 28 ++++++++++++++--------
2 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 7db49bd79..93c6388b9 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -99,6 +99,15 @@ namespace Flow.Launcher.ViewModel
};
_selectedResults = Results;
+ Results.PropertyChanged += (_, args) =>
+ {
+ switch (args.PropertyName)
+ {
+ case nameof(Results.SelectedItem):
+ UpdatePreview();
+ break;
+ }
+ };
RegisterViewUpdate();
RegisterResultsUpdatedEvent();
@@ -441,6 +450,7 @@ namespace Flow.Launcher.ViewModel
{
ResultAreaColumn = 1;
PreviewVisible = true;
+ Results.SelectedItem?.LoadPreviewImage();
}
private void HidePreview()
@@ -461,6 +471,14 @@ namespace Flow.Launcher.ViewModel
}
}
+ private void UpdatePreview()
+ {
+ if (PreviewVisible)
+ {
+ Results.SelectedItem?.LoadPreviewImage();
+ }
+ }
+
///
/// 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
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index 0fadeccdf..aef336b1f 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -90,6 +90,14 @@ namespace Flow.Launcher.ViewModel
}
}
+ public bool UsePreviewImage
+ {
+ //todo binding
+ get => !ImgIconAvailable && !GlyphAvailable ||
+ Settings.UseGlyphIcons && !GlyphAvailable && ImgIconAvailable ||
+ !Settings.UseGlyphIcons && ImgIconAvailable;
+ }
+
public double IconRadius
{
get
@@ -153,16 +161,7 @@ namespace Flow.Launcher.ViewModel
public ImageSource PreviewImage
{
- get
- {
- if (!PreviewImageLoaded)
- {
- PreviewImageLoaded = true;
- _ = LoadPreviewImageAsync();
- }
-
- return previewImage;
- }
+ get => previewImage;
private set => previewImage = value;
}
@@ -223,6 +222,15 @@ namespace Flow.Launcher.ViewModel
}
}
+ public void LoadPreviewImage()
+ {
+ if (!PreviewImageLoaded && UsePreviewImage)
+ {
+ PreviewImageLoaded = true;
+ _ = LoadPreviewImageAsync();
+ }
+ }
+
public Result Result { get; }
public int ResultProgress
{
From 33c0af1fab09e732f79d21b2a0f5e80e4d014ee6 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 23 Dec 2022 00:47:01 +0800
Subject: [PATCH 04/25] Use ShowIcon to determine when to load
---
Flow.Launcher/ViewModel/ResultViewModel.cs | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index aef336b1f..276fe8500 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -90,14 +90,6 @@ namespace Flow.Launcher.ViewModel
}
}
- public bool UsePreviewImage
- {
- //todo binding
- get => !ImgIconAvailable && !GlyphAvailable ||
- Settings.UseGlyphIcons && !GlyphAvailable && ImgIconAvailable ||
- !Settings.UseGlyphIcons && ImgIconAvailable;
- }
-
public double IconRadius
{
get
@@ -224,7 +216,7 @@ namespace Flow.Launcher.ViewModel
public void LoadPreviewImage()
{
- if (!PreviewImageLoaded && UsePreviewImage)
+ if (!PreviewImageLoaded && ShowIcon == Visibility.Visible)
{
PreviewImageLoaded = true;
_ = LoadPreviewImageAsync();
From f2101026c3e8de39df97ee81e6e6ee59e5757bc6 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 23 Dec 2022 00:58:26 +0800
Subject: [PATCH 05/25] Use KeyBinding in xaml
---
Flow.Launcher/MainWindow.xaml | 3 +++
Flow.Launcher/MainWindow.xaml.cs | 5 -----
Flow.Launcher/ViewModel/MainViewModel.cs | 5 +++++
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index faf9f670a..79f40f192 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -181,6 +181,9 @@
Command="{Binding OpenResultCommand}"
CommandParameter="9"
Modifiers="{Binding OpenResultCommandModifiers}" />
+
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index ac360e31c..569353514 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -620,11 +620,6 @@ namespace Flow.Launcher
}
}
break;
- case Key.F1:
- PreviewToggle();
- e.Handled = true;
- break;
-
default:
break;
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 93c6388b9..4601bb04d 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -74,6 +74,9 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.AlwaysStartEn):
OnPropertyChanged(nameof(StartWithEnglishMode));
break;
+ case nameof(Settings.PreviewHotkey):
+ OnPropertyChanged(nameof(TogglePreviewHotkey));
+ break;
}
};
@@ -570,6 +573,8 @@ namespace Flow.Launcher.ViewModel
public string OpenResultCommandModifiers { get; private set; }
+ public string TogglePreviewHotkey => Settings.PreviewHotkey; // TODO: is hotkey combo possible?
+
public string Image => Constant.QueryTextBoxIconImagePath;
public bool StartWithEnglishMode => Settings.AlwaysStartEn;
From 4c2760e80ede00c60859af7f2169f8ce2f9695aa Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 23 Dec 2022 11:43:03 +0800
Subject: [PATCH 06/25] Comment F1 keybinding
---
Flow.Launcher/MainWindow.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index 79f40f192..b6b5dca46 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -43,7 +43,7 @@
-
+
Date: Fri, 23 Dec 2022 13:28:08 +0800
Subject: [PATCH 07/25] Delete unused function
---
Flow.Launcher/MainWindow.xaml.cs | 4 ----
1 file changed, 4 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index 569353514..67e0e7419 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -630,10 +630,6 @@ namespace Flow.Launcher
{
_viewModel.ResetPreview();
}
- public void PreviewToggle()
- {
- _viewModel.TogglePreview();
- }
private void MoveQueryTextToEnd()
{
From e625bf12edb69cc8f17ce7d53b651cdb52f15de1 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Sat, 24 Dec 2022 11:16:10 +0800
Subject: [PATCH 08/25] Remove comment
---
Flow.Launcher/MainWindow.xaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index b6b5dca46..698cf4184 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -43,7 +43,6 @@
-
Date: Mon, 26 Dec 2022 14:18:38 +0800
Subject: [PATCH 09/25] Remove todo
---
Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 3971e5cc7..a184520d0 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -18,7 +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"; // TODO: change to another value
+ public string PreviewHotkey { get; set; } = $"F1";
public string Language
{
From 68ae8a1df31981d0f3092d6a675a89661cd6189c Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 27 Dec 2022 11:53:10 +0800
Subject: [PATCH 10/25] Only call LoadPreviewImage when using default preview
---
Flow.Launcher/ViewModel/ResultViewModel.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index 276fe8500..f0f77d61f 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -216,10 +216,13 @@ namespace Flow.Launcher.ViewModel
public void LoadPreviewImage()
{
- if (!PreviewImageLoaded && ShowIcon == Visibility.Visible)
+ if (ShowDefaultPreview == Visibility.Visible)
{
- PreviewImageLoaded = true;
- _ = LoadPreviewImageAsync();
+ if (!PreviewImageLoaded && ShowIcon == Visibility.Visible)
+ {
+ PreviewImageLoaded = true;
+ _ = LoadPreviewImageAsync();
+ }
}
}
From 979aa3ddff72e43bb17eb6f0f6c13ee175916ba5 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 27 Dec 2022 15:21:06 +0800
Subject: [PATCH 11/25] Support hotkey modifiers
---
Flow.Launcher/MainWindow.xaml | 3 ++-
Flow.Launcher/ViewModel/MainViewModel.cs | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index e65ac258a..433c3ec7f 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -182,7 +182,8 @@
Modifiers="Ctrl"/>
+ Command="{Binding TogglePreviewCommand}"
+ Modifiers="{Binding TogglePreviewModifiers}"/>
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 3c603f90b..f7e6318ea 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -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
{
@@ -74,7 +75,7 @@ namespace Flow.Launcher.ViewModel
OnPropertyChanged(nameof(OpenResultCommandModifiers));
break;
case nameof(Settings.PreviewHotkey):
- OnPropertyChanged(nameof(TogglePreviewHotkey));
+ UpdatePreviewHotkey();
break;
}
};
@@ -114,6 +115,7 @@ namespace Flow.Launcher.ViewModel
RegisterViewUpdate();
RegisterResultsUpdatedEvent();
_ = RegisterClockAndDateUpdateAsync();
+ UpdatePreviewHotkey();
}
private void RegisterViewUpdate()
@@ -582,7 +584,9 @@ namespace Flow.Launcher.ViewModel
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
- public string TogglePreviewHotkey => Settings.PreviewHotkey; // TODO: is hotkey combo possible?
+ public Key TogglePreviewHotkey { get; set; }
+
+ public ModifierKeys TogglePreviewModifiers { get; set; }
public string Image => Constant.QueryTextBoxIconImagePath;
@@ -1014,6 +1018,14 @@ namespace Flow.Launcher.ViewModel
return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen() || GameModeStatus;
}
+ private void UpdatePreviewHotkey()
+ {
+ var converter = new KeyGestureConverter();
+ var key = (KeyGesture)converter.ConvertFromString(Settings.PreviewHotkey);
+ TogglePreviewHotkey = key.Key;
+ TogglePreviewModifiers = key.Modifiers;
+ }
+
#endregion
#region Public Methods
From 3ff7566daa7a8c709b56a74ac247ce9ec8b3774e Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 01:09:32 +0800
Subject: [PATCH 12/25] Use databinding for preview hotkey
---
.../Converters/StringToKeyBindingConverter.cs | 32 +++++++++++++++++++
Flow.Launcher/MainWindow.xaml | 5 +--
Flow.Launcher/ViewModel/MainViewModel.cs | 15 ++-------
3 files changed, 37 insertions(+), 15 deletions(-)
create mode 100644 Flow.Launcher/Converters/StringToKeyBindingConverter.cs
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/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index 433c3ec7f..d6aec2a60 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -40,6 +40,7 @@
+
@@ -181,9 +182,9 @@
Command="{Binding ToggleGameModeCommand}"
Modifiers="Ctrl"/>
+ Modifiers="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}"/>
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index f7e6318ea..a220251f3 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -75,7 +75,7 @@ namespace Flow.Launcher.ViewModel
OnPropertyChanged(nameof(OpenResultCommandModifiers));
break;
case nameof(Settings.PreviewHotkey):
- UpdatePreviewHotkey();
+ OnPropertyChanged(nameof(PreviewHotkey));
break;
}
};
@@ -115,7 +115,6 @@ namespace Flow.Launcher.ViewModel
RegisterViewUpdate();
RegisterResultsUpdatedEvent();
_ = RegisterClockAndDateUpdateAsync();
- UpdatePreviewHotkey();
}
private void RegisterViewUpdate()
@@ -584,9 +583,7 @@ namespace Flow.Launcher.ViewModel
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
- public Key TogglePreviewHotkey { get; set; }
-
- public ModifierKeys TogglePreviewModifiers { get; set; }
+ public string PreviewHotkey => Settings.PreviewHotkey;
public string Image => Constant.QueryTextBoxIconImagePath;
@@ -1018,14 +1015,6 @@ namespace Flow.Launcher.ViewModel
return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen() || GameModeStatus;
}
- private void UpdatePreviewHotkey()
- {
- var converter = new KeyGestureConverter();
- var key = (KeyGesture)converter.ConvertFromString(Settings.PreviewHotkey);
- TogglePreviewHotkey = key.Key;
- TogglePreviewModifiers = key.Modifiers;
- }
-
#endregion
#region Public Methods
From b2436833320941e5d0367e31441c62b2ef48221b Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 00:57:30 +0800
Subject: [PATCH 13/25] Add option to modify preview hotkey
---
Flow.Launcher/Languages/en.xaml | 4 ++-
Flow.Launcher/SettingWindow.xaml | 43 +++++++++++++++++++++++------
Flow.Launcher/SettingWindow.xaml.cs | 13 +++++++++
3 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 550b73f85..9a337b8d8 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -70,7 +70,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 starts. Press {0} to toggle preview.
Shadow effect is not allowed while current theme has blur effect enabled
@@ -153,6 +153,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/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index f10964fe0..4a9544042 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -2415,8 +2415,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Date: Wed, 28 Dec 2022 01:17:19 +0800
Subject: [PATCH 14/25] Move to proper location
---
Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index c7c1aaa40..a59ec7ecc 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -243,9 +243,6 @@ namespace Flow.Launcher.ViewModel
public List Languages => _translater.LoadAvailableLanguages();
public IEnumerable MaxResultsRange => Enumerable.Range(2, 16);
- public ObservableCollection CustomShortcuts => Settings.CustomShortcuts;
- public ObservableCollection BuiltinShortcuts => Settings.BuiltinShortcuts;
-
public string TestProxy()
{
var proxyServer = Settings.Proxy.Server;
@@ -742,6 +739,10 @@ namespace Flow.Launcher.ViewModel
#region shortcut
+ public ObservableCollection CustomShortcuts => Settings.CustomShortcuts;
+
+ public ObservableCollection BuiltinShortcuts => Settings.BuiltinShortcuts;
+
public CustomShortcutModel? SelectedCustomShortcut { get; set; }
public void DeleteSelectedCustomShortcut()
From 8f3ca61b21ad2e56f4bc1d7e408a7faafbce916b Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 01:25:07 +0800
Subject: [PATCH 15/25] Show Preview Hotkey in tooltip
---
Flow.Launcher/SettingWindow.xaml | 2 +-
Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index 4a9544042..74c768d6a 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -743,7 +743,7 @@
FocusVisualMargin="5"
IsOn="{Binding Settings.AlwaysPreview}"
Style="{DynamicResource SideToggleSwitch}"
- ToolTip="{DynamicResource AlwaysPreviewToolTip}" />
+ ToolTip="{Binding AlwaysPreviewToolTip}" />
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index a59ec7ecc..e4a30818c 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -243,6 +243,8 @@ namespace Flow.Launcher.ViewModel
public List Languages => _translater.LoadAvailableLanguages();
public IEnumerable MaxResultsRange => Enumerable.Range(2, 16);
+ public string AlwaysPreviewTooltip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
+
public string TestProxy()
{
var proxyServer = Settings.Proxy.Server;
From 9154da2ef86a0540a30342adee566195fb4a9ccb Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 01:31:12 +0800
Subject: [PATCH 16/25] Update tooltip to avoid untranslated fixed "F1"
---
Flow.Launcher/Languages/da.xaml | 2 +-
Flow.Launcher/Languages/de.xaml | 2 +-
Flow.Launcher/Languages/en.xaml | 2 +-
Flow.Launcher/Languages/es-419.xaml | 2 +-
Flow.Launcher/Languages/es.xaml | 2 +-
Flow.Launcher/Languages/fr.xaml | 2 +-
Flow.Launcher/Languages/it.xaml | 2 +-
Flow.Launcher/Languages/ja.xaml | 2 +-
Flow.Launcher/Languages/ko.xaml | 2 +-
Flow.Launcher/Languages/nb.xaml | 2 +-
Flow.Launcher/Languages/nl.xaml | 2 +-
Flow.Launcher/Languages/pl.xaml | 2 +-
Flow.Launcher/Languages/pt-br.xaml | 2 +-
Flow.Launcher/Languages/pt-pt.xaml | 2 +-
Flow.Launcher/Languages/ru.xaml | 2 +-
Flow.Launcher/Languages/sk.xaml | 2 +-
Flow.Launcher/Languages/sr.xaml | 2 +-
Flow.Launcher/Languages/tr.xaml | 2 +-
Flow.Launcher/Languages/uk-UA.xaml | 2 +-
Flow.Launcher/Languages/zh-cn.xaml | 2 +-
Flow.Launcher/Languages/zh-tw.xaml | 2 +-
21 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/Flow.Launcher/Languages/da.xaml b/Flow.Launcher/Languages/da.xaml
index e6eec4560..9e8ac107d 100644
--- a/Flow.Launcher/Languages/da.xaml
+++ b/Flow.Launcher/Languages/da.xaml
@@ -64,7 +64,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 2073fd424..abca18a51 100644
--- a/Flow.Launcher/Languages/de.xaml
+++ b/Flow.Launcher/Languages/de.xaml
@@ -64,7 +64,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 9a337b8d8..60cca92c9 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -70,7 +70,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 {0} 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/es-419.xaml b/Flow.Launcher/Languages/es-419.xaml
index 3a4317ca9..f8a34b1c6 100644
--- a/Flow.Launcher/Languages/es-419.xaml
+++ b/Flow.Launcher/Languages/es-419.xaml
@@ -64,7 +64,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 b3dbaf4ff..563f9de08 100644
--- a/Flow.Launcher/Languages/es.xaml
+++ b/Flow.Launcher/Languages/es.xaml
@@ -64,7 +64,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 4664b871d..dd00e7c69 100644
--- a/Flow.Launcher/Languages/fr.xaml
+++ b/Flow.Launcher/Languages/fr.xaml
@@ -64,7 +64,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 84fcad8c8..b49f51bfc 100644
--- a/Flow.Launcher/Languages/it.xaml
+++ b/Flow.Launcher/Languages/it.xaml
@@ -64,7 +64,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 816602f1c..c660e292c 100644
--- a/Flow.Launcher/Languages/ja.xaml
+++ b/Flow.Launcher/Languages/ja.xaml
@@ -64,7 +64,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 f89a28454..c6623039d 100644
--- a/Flow.Launcher/Languages/ko.xaml
+++ b/Flow.Launcher/Languages/ko.xaml
@@ -64,7 +64,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 5356890e3..04d45024c 100644
--- a/Flow.Launcher/Languages/nb.xaml
+++ b/Flow.Launcher/Languages/nb.xaml
@@ -64,7 +64,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 a7af3cc57..49ec400d1 100644
--- a/Flow.Launcher/Languages/nl.xaml
+++ b/Flow.Launcher/Languages/nl.xaml
@@ -64,7 +64,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 0a7ccf070..28bb07555 100644
--- a/Flow.Launcher/Languages/pl.xaml
+++ b/Flow.Launcher/Languages/pl.xaml
@@ -64,7 +64,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 c308d3367..338dc54d8 100644
--- a/Flow.Launcher/Languages/pt-br.xaml
+++ b/Flow.Launcher/Languages/pt-br.xaml
@@ -64,7 +64,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 a06d0e935..24e90baf5 100644
--- a/Flow.Launcher/Languages/pt-pt.xaml
+++ b/Flow.Launcher/Languages/pt-pt.xaml
@@ -64,7 +64,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 471f663eb..03f6874f1 100644
--- a/Flow.Launcher/Languages/ru.xaml
+++ b/Flow.Launcher/Languages/ru.xaml
@@ -64,7 +64,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 97223e46c..29c6d7750 100644
--- a/Flow.Launcher/Languages/sk.xaml
+++ b/Flow.Launcher/Languages/sk.xaml
@@ -64,7 +64,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 0ffb86fac..f7e346b72 100644
--- a/Flow.Launcher/Languages/sr.xaml
+++ b/Flow.Launcher/Languages/sr.xaml
@@ -64,7 +64,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 c9c11dbd5..a34295228 100644
--- a/Flow.Launcher/Languages/tr.xaml
+++ b/Flow.Launcher/Languages/tr.xaml
@@ -64,7 +64,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 e8b2048d8..c0750ed1c 100644
--- a/Flow.Launcher/Languages/uk-UA.xaml
+++ b/Flow.Launcher/Languages/uk-UA.xaml
@@ -64,7 +64,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 e4518d6c3..f188910ae 100644
--- a/Flow.Launcher/Languages/zh-cn.xaml
+++ b/Flow.Launcher/Languages/zh-cn.xaml
@@ -64,7 +64,7 @@
使用 Pinyin 搜索
允许使用拼音进行搜索.
始终打开预览
- Flow 启动时总是打开预览面板。按 F1 以切换预览。
+ Flow 启动时总是打开预览面板。按 {0} 以切换预览。
当前主题已启用模糊效果,不允许启用阴影效果
diff --git a/Flow.Launcher/Languages/zh-tw.xaml b/Flow.Launcher/Languages/zh-tw.xaml
index e5a8800f7..009dfe1d9 100644
--- a/Flow.Launcher/Languages/zh-tw.xaml
+++ b/Flow.Launcher/Languages/zh-tw.xaml
@@ -64,7 +64,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
From 0140e340f43c485e182ff16e83a3da48df6d303d Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 13:56:26 +0800
Subject: [PATCH 17/25] Update readme
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index dcc1da935..9861d67b8 100644
--- a/README.md
+++ b/README.md
@@ -274,12 +274,12 @@ And you can download
-
+
Languages => _translater.LoadAvailableLanguages();
public IEnumerable MaxResultsRange => Enumerable.Range(2, 16);
- public string AlwaysPreviewTooltip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
+ public string AlwaysPreviewToolTip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
public string TestProxy()
{
From 5970b1c68ea59cef1d0e2cff0e3d52d393307eee Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 18:08:43 +0800
Subject: [PATCH 19/25] Change glyph for preview hotkey
---
Flow.Launcher/SettingWindow.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index d39e50f84..7bccca642 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -2434,7 +2434,7 @@
Loaded="OnPreviewHotkeyControlLoaded"
LostFocus="OnPreviewHotkeyControlFocusLost" />
-
+
From 95aaa9f08573e8c6926cf62fec9297c71961f34e Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 23 Dec 2022 17:48:09 +0800
Subject: [PATCH 20/25] Add preview delegate
---
Flow.Launcher.Plugin/Result.cs | 2 ++
Flow.Launcher/ViewModel/ResultViewModel.cs | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
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/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index f0f77d61f..be5dacbfb 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -202,7 +202,7 @@ namespace Flow.Launcher.ViewModel
private async Task LoadPreviewImageAsync()
{
var imagePath = string.IsNullOrEmpty(Result.Preview.PreviewImagePath) ? Result.IcoPath : Result.Preview.PreviewImagePath;
- var iconDelegate = Result.Icon;
+ var iconDelegate = Result.Icon ?? Result.Preview.PreviewDelegate;
if (ImageLoader.CacheContainImage(imagePath, true))
{
previewImage = await LoadImageInternalAsync(imagePath, iconDelegate, true).ConfigureAwait(false);
From 617d2f5efb85c193cd6c1943f1b15e12614bf069 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 28 Dec 2022 21:37:53 +0800
Subject: [PATCH 21/25] Use separate variable for preview image
---
Flow.Launcher/MainWindow.xaml | 2 +-
Flow.Launcher/ViewModel/ResultViewModel.cs | 28 +++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index d6aec2a60..82f297b70 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -438,7 +438,7 @@
HorizontalAlignment="Center"
Source="{Binding PreviewImage}"
StretchDirection="DownOnly"
- Visibility="{Binding ShowIcon}">
+ Visibility="{Binding ShowPreviewImage, Converter={StaticResource BoolToVisibilityConverter}}">