From ee0f8ef22a8563c3b53f697fb1b0f7cf02cc6ae3 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sat, 11 Dec 2021 11:52:43 -0600 Subject: [PATCH 001/229] Implement PluginSearch TextBox & ContentControl Lazy Load --- Flow.Launcher/SettingWindow.xaml | 16 ++++++++-- Flow.Launcher/SettingWindow.xaml.cs | 32 +++++++++++++++++-- Flow.Launcher/ViewModel/PluginViewModel.cs | 13 +++++++- .../ViewModel/SettingWindowViewModel.cs | 1 + 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index d8c94390b..7d144e3a1 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -901,6 +901,7 @@ + @@ -912,12 +913,23 @@ Text="{DynamicResource plugin}" TextAlignment="left" /> + + + ThemeManager.Current.ApplicationTheme = settings.ColorScheme switch { Constant.Light => ApplicationTheme.Light, @@ -370,5 +379,22 @@ namespace Flow.Launcher RefreshMaximizeRestoreButton(); } + private CollectionView pluginListView; + + private bool PluginFilter(object item) + { + if (string.IsNullOrEmpty(pluginFilterTxb.Text)) + return true; + if (item is PluginViewModel model) + { + return StringMatcher.FuzzySearch(pluginFilterTxb.Text, model.PluginPair.Metadata.Name).IsSearchPrecisionScoreMet(); + } + return false; + } + + private void OnPluginSearchTextChanged(object sender, TextChangedEventArgs e) + { + pluginListView.Refresh(); + } } -} +} \ No newline at end of file diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 209198822..864a60646 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -30,9 +30,20 @@ namespace Flow.Launcher.ViewModel get => !PluginPair.Metadata.Disabled; set => PluginPair.Metadata.Disabled = !value; } + public bool IsExpanded + { + get => _isExpanded; + set + { + _isExpanded = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(SettingControl)); + } + } private Control _settingControl; - public Control SettingControl => _settingControl ??= PluginPair.Plugin is not ISettingProvider settingProvider ? new Control() : settingProvider.CreateSettingPanel(); + private bool _isExpanded; + public Control SettingControl => IsExpanded ? _settingControl ??= PluginPair.Plugin is not ISettingProvider settingProvider ? new Control() : settingProvider.CreateSettingPanel() : null; public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed; public string InitilizaTime => PluginPair.Metadata.InitTime + "ms"; diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 342c85da2..7c9caf13c 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -19,6 +19,7 @@ using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; +using System.Windows.Data; namespace Flow.Launcher.ViewModel { From 2b134c8b9ab304bac7c0f1ed0be1649729ea3659 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 12 Dec 2021 06:49:15 +0900 Subject: [PATCH 002/229] Adjust Design & Add Searchbox in plugin store --- Flow.Launcher/SettingWindow.xaml | 66 +++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 7d144e3a1..b130fbfca 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -901,30 +901,38 @@ - - - - - - + + + + + + + @@ -1296,19 +1304,31 @@ Text="{DynamicResource pluginStore}" TextAlignment="left" /> - + Margin="5,18,0,0"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs new file mode 100644 index 000000000..feea064a4 --- /dev/null +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -0,0 +1,52 @@ +using Flow.Launcher.Core.Resource; +using Flow.Launcher.Helper; +using Flow.Launcher.Infrastructure.UserSettings; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows; +using System.Windows.Input; +using System.Windows.Controls; +using System.Collections.Generic; + +namespace Flow.Launcher +{ + public partial class CustomShortcutSetting : Window + { + private SettingWindow _settingWidow; + private bool update; + private CustomPluginHotkey updateCustomHotkey; + private Settings _settings; + + public string Key { get; set; } + public string Value { get; set; } + public ShortCutModel ShortCut => (Key, Value); + public CustomShortcutSetting() + { + InitializeComponent(); + } + + public CustomShortcutSetting((string, string) shortcut) + { + (Key, Value) = shortcut; + InitializeComponent(); + } + + private void BtnCancel_OnClick(object sender, RoutedEventArgs e) + { + DialogResult = false; + Close(); + } + + private void btnAdd_OnClick(object sender, RoutedEventArgs e) + { + DialogResult = true; + Close(); + } + + private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e) + { + DialogResult = false; + Close(); + } + } +} diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 35a6389ca..ef0bc4f14 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -12,6 +12,7 @@ false false en + false diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 25de530bc..401f532a2 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -115,6 +115,8 @@ Show result selection hotkey with results. Custom Query Hotkey Query + Shortcut + Expanded Delete Edit Add diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 2fe5d2353..47933f326 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2159,7 +2159,7 @@ diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index 25ce82424..292288473 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -34,9 +34,9 @@ namespace Flow.Launcher Close(); } - private void btnAdd_OnClick(object sender, RoutedEventArgs e) + private void BtnAdd_OnClick(object sender, RoutedEventArgs e) { - if (!update && _settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value))) + if (!update && (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value)) || _settings.BuiltinShortcuts.Contains(new CustomShortcutModel(Key, Value)))) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut")); return; diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index dc290ccd6..f15de6afe 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2223,7 +2223,7 @@ From 3c1451e319000ff3ef118b5f974ef42caf129074 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 8 Nov 2022 15:58:17 +0900 Subject: [PATCH 214/229] Change Plugin Store Icon Image Rendermode --- Flow.Launcher/SettingWindow.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 668269461..1892a62d3 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1608,6 +1608,7 @@ Height="32" Margin="18,24,0,0" HorizontalAlignment="Left" + RenderOptions.BitmapScalingMode="Fant" Source="{Binding IcoPath, IsAsync=True}" /> Date: Tue, 8 Nov 2022 18:45:58 +0900 Subject: [PATCH 215/229] Remove unused method --- Flow.Launcher/SettingWindow.xaml.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index dfddd137b..5634bb507 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -428,9 +428,6 @@ namespace Flow.Launcher } } - private void ShowStoreItem_Click(object sender, RoutedEventArgs e) - { - } private void RefreshPluginStoreEventHandler(object sender, RoutedEventArgs e) { if (pluginStoreFilterTxb.Text != lastPluginStoreSearch) From 6e76d87f6636148a209a434718ab70dc085c5a61 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 8 Nov 2022 19:34:40 +0900 Subject: [PATCH 216/229] Add VirtualPanel in other scrollviews --- Flow.Launcher/SettingWindow.xaml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 86f740d78..1ebe69e80 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -607,7 +607,8 @@ + ScrollViewer.CanContentScroll="False" + VirtualizingStackPanel.IsVirtualizing="True">