From 91c9397b0fcff06405482f3b83a0eeac360ec74f Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 7 Sep 2022 14:15:16 +0900 Subject: [PATCH 01/48] - Quick Adjust Width Size by Ctrl + Plus/Minus --- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/MainWindow.xaml.cs | 44 +++++++++++++++++++++++++++++--- Flow.Launcher/SettingWindow.xaml | 2 ++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index bdf745052..0c7d19be0 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -124,6 +124,7 @@ Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. Window Width Size + You can quick adjust Ctrl+Plus/Minus Key in query box too. Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 2b7db38cf..a6dd9ddef 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Threading.Tasks; using System.Windows; @@ -478,6 +478,7 @@ namespace Flow.Launcher /// private void OnKeyDown(object sender, KeyEventArgs e) { + var specialKeyState = GlobalHotkey.CheckModifiers(); switch (e.Key) { case Key.Down: @@ -504,6 +505,12 @@ namespace Flow.Launcher _viewModel.LoadContextMenuCommand.Execute(null); e.Handled = true; } + if (specialKeyState.CtrlPressed) + { + + _settings.WindowSize = _settings.WindowSize + 100; + Left = Left - 50; + } break; case Key.Left: if (!_viewModel.SelectedIsFromQueryResults() && QueryTextBox.CaretIndex == 0) @@ -511,9 +518,39 @@ namespace Flow.Launcher _viewModel.EscCommand.Execute(null); e.Handled = true; } + if (specialKeyState.CtrlPressed) + { + if (_settings.WindowSize < 400) + { + } + else + { + _settings.WindowSize = _settings.WindowSize - 100; + Left = Left + 50; + } + } + break; + case Key.OemMinus: + if (specialKeyState.CtrlPressed) + { + if (_settings.WindowSize < 400) + { + } + else + { + _settings.WindowSize = _settings.WindowSize - 100; + Left = Left + 50; + } + } + break; + case Key.OemPlus: + if (specialKeyState.CtrlPressed) + { + _settings.WindowSize = _settings.WindowSize + 100; + Left = Left - 50; + } break; case Key.Back: - var specialKeyState = GlobalHotkey.CheckModifiers(); if (specialKeyState.CtrlPressed) { if (_viewModel.SelectedIsFromQueryResults() @@ -531,6 +568,7 @@ namespace Flow.Launcher } } break; + default: break; @@ -556,4 +594,4 @@ namespace Flow.Launcher } } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index ba6569771..cbb25247d 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1604,6 +1604,7 @@ + Date: Wed, 7 Sep 2022 14:45:07 +0900 Subject: [PATCH 02/48] - Add Quick adjust maxresultcount by CTRL+[ and ] --- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/MainWindow.xaml.cs | 18 ++++++++++++++++++ Flow.Launcher/SettingWindow.xaml | 12 +++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 0c7d19be0..6e3dd3a0e 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -41,6 +41,7 @@ Select last Query Empty last Query Maximum results shown + You can quick adjust CTRL+[ and CTRL+] in query box. Ignore hotkeys in fullscreen mode Disable Flow Launcher activation when a full screen application is active (Recommended for games). Default File Manager diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index a6dd9ddef..6837d60ed 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -550,6 +550,24 @@ namespace Flow.Launcher Left = Left - 50; } break; + case Key.OemOpenBrackets: + if (specialKeyState.CtrlPressed) + { + if (_settings.MaxResultsToShow < 2) + { + } + else + { + _settings.MaxResultsToShow = _settings.MaxResultsToShow - 1; + } + } + break; + case Key.OemCloseBrackets: + if (specialKeyState.CtrlPressed) + { + _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; + } + break; case Key.Back: if (specialKeyState.CtrlPressed) { diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index cbb25247d..5d62e627c 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -768,11 +768,13 @@ BorderThickness="0" Style="{DynamicResource SettingGroupBox}"> - + + + + Date: Thu, 8 Sep 2022 16:44:00 +0900 Subject: [PATCH 03/48] - Add Ctrl+F12 to Toggle Game mode --- Flow.Launcher/MainWindow.xaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6837d60ed..3366e7802 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -568,6 +568,12 @@ namespace Flow.Launcher _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; } break; + case Key.F12: + if (specialKeyState.CtrlPressed) + { + ToggleGameMode(); + } + break; case Key.Back: if (specialKeyState.CtrlPressed) { @@ -586,7 +592,6 @@ namespace Flow.Launcher } } break; - default: break; From 9cfb92b6f34b61dd12789c46bb41c0445da0c909 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 8 Sep 2022 18:09:21 +0900 Subject: [PATCH 04/48] Change Shortcut each other (+-,[]) --- Flow.Launcher/Languages/en.xaml | 4 ++-- Flow.Launcher/MainWindow.xaml.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 6e3dd3a0e..47041cdf0 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -41,7 +41,7 @@ Select last Query Empty last Query Maximum results shown - You can quick adjust CTRL+[ and CTRL+] in query box. + You can quick adjust CTRL+Plus and CTRL+Minus in query box. Ignore hotkeys in fullscreen mode Disable Flow Launcher activation when a full screen application is active (Recommended for games). Default File Manager @@ -125,7 +125,7 @@ Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. Window Width Size - You can quick adjust Ctrl+Plus/Minus Key in query box too. + You can quick adjust Ctrl+[, Ctrl+] in query box too. Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3366e7802..7c859b550 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -530,7 +530,7 @@ namespace Flow.Launcher } } break; - case Key.OemMinus: + case Key.OemCloseBrackets: if (specialKeyState.CtrlPressed) { if (_settings.WindowSize < 400) @@ -543,14 +543,14 @@ namespace Flow.Launcher } } break; - case Key.OemPlus: + case Key.OemOpenBrackets: if (specialKeyState.CtrlPressed) { _settings.WindowSize = _settings.WindowSize + 100; Left = Left - 50; } break; - case Key.OemOpenBrackets: + case Key.OemPlus: if (specialKeyState.CtrlPressed) { if (_settings.MaxResultsToShow < 2) @@ -562,7 +562,7 @@ namespace Flow.Launcher } } break; - case Key.OemCloseBrackets: + case Key.OemMinus: if (specialKeyState.CtrlPressed) { _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; From e67e4fd99e4fc8f9b388ec958be7136da37d16ba Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 14 Sep 2022 11:01:28 +0900 Subject: [PATCH 05/48] Adjust Keys assign --- Flow.Launcher/MainWindow.xaml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 7c859b550..b3262b7fd 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -530,7 +530,7 @@ namespace Flow.Launcher } } break; - case Key.OemCloseBrackets: + case Key.OemOpenBrackets: if (specialKeyState.CtrlPressed) { if (_settings.WindowSize < 400) @@ -543,14 +543,14 @@ namespace Flow.Launcher } } break; - case Key.OemOpenBrackets: + case Key.OemCloseBrackets: if (specialKeyState.CtrlPressed) { _settings.WindowSize = _settings.WindowSize + 100; Left = Left - 50; } break; - case Key.OemPlus: + case Key.OemMinus: if (specialKeyState.CtrlPressed) { if (_settings.MaxResultsToShow < 2) @@ -562,7 +562,7 @@ namespace Flow.Launcher } } break; - case Key.OemMinus: + case Key.OemPlus: if (specialKeyState.CtrlPressed) { _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; From 01c9be37bf795ad7087c6b649ee3b53c3529a4f1 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Mon, 19 Sep 2022 15:32:17 -0500 Subject: [PATCH 06/48] Use Command in ViewModel to control data change (Add MVVM Toolkit to generate RelayCommand) --- Flow.Launcher/Flow.Launcher.csproj | 1 + Flow.Launcher/MainWindow.xaml | 20 +++++- Flow.Launcher/MainWindow.xaml.cs | 80 +++------------------- Flow.Launcher/ViewModel/MainViewModel.cs | 87 ++++++++++++++++++------ 4 files changed, 98 insertions(+), 90 deletions(-) diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 66cc911ee..0db1915c5 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -83,6 +83,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 714fcc53f..7730c5658 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -32,7 +32,9 @@ Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WindowStartupLocation="Manual" WindowStyle="None" - mc:Ignorable="d"> + mc:Ignorable="d" + Left="{Binding Left, Mode=TwoWay}" + Top="{Binding Top, Mode=TwoWay}"> @@ -84,6 +86,22 @@ Modifiers="Ctrl" /> + + + + - { - if (args.PropertyName == nameof(Settings.WindowSize)) - { - OnPropertyChanged(nameof(MainWindowWidth)); - } - }; _historyItemsStorage = new FlowLauncherJsonStorage(); _userSelectedRecordStorage = new FlowLauncherJsonStorage(); @@ -82,6 +76,7 @@ namespace Flow.Launcher.ViewModel _selectedResults = Results; InitializeKeyCommands(); + RegisterViewUpdate(); RegisterResultsUpdatedEvent(); @@ -154,6 +149,8 @@ namespace Flow.Launcher.ViewModel } } + + private void InitializeKeyCommands() { EscCommand = new RelayCommand(_ => @@ -307,7 +304,7 @@ namespace Flow.Launcher.ViewModel Notification.Show( InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully") - ); + ); }), TaskScheduler.Default) .ConfigureAwait(false); }); @@ -318,9 +315,9 @@ namespace Flow.Launcher.ViewModel #region ViewModel Properties public ResultsViewModel Results { get; private set; } - + public ResultsViewModel ContextMenu { get; private set; } - + public ResultsViewModel History { get; private set; } public bool GameModeStatus { get; set; } @@ -336,6 +333,54 @@ namespace Flow.Launcher.ViewModel } } + + public double Top + { + get => _settings.WindowTop; + set + { + _settings.WindowTop = value; + OnPropertyChanged(); + } + } + public double Left + { + get => _settings.WindowLeft; + set + { + _settings.WindowLeft = value; + OnPropertyChanged(); + } + } + + [RelayCommand] + private void IncreaseWidth() + { + MainWindowWidth += 100; + Left -= 50; + } + + [RelayCommand] + private void DecreaseWidth() + { + if (MainWindowWidth < 400) return; + Left += 50; + MainWindowWidth -= 100; + } + + [RelayCommand] + private void IncreaseMaxResult() + { + _settings.MaxResultsToShow += 1; + } + + [RelayCommand] + private void DecreaseMaxResult() + { + if (_settings.MaxResultsToShow < 2) return; + _settings.MaxResultsToShow -= 1; + } + /// /// 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 @@ -411,7 +456,11 @@ namespace Flow.Launcher.ViewModel public Visibility SearchIconVisibility { get; set; } - public double MainWindowWidth => _settings.WindowSize; + public double MainWindowWidth + { + get => _settings.WindowSize; + set => _settings.WindowSize = value; + } public string PluginIconPath { get; set; } = null; @@ -592,7 +641,7 @@ namespace Flow.Launcher.ViewModel PluginIconPath = null; SearchIconVisibility = Visibility.Visible; } - + if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign) { @@ -903,18 +952,18 @@ namespace Flow.Launcher.ViewModel Clipboard.SetFileDropList(paths); App.API.ShowMsg( - App.API.GetTranslation("copy") - +" " - + (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), + App.API.GetTranslation("copy") + + " " + + (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), App.API.GetTranslation("completedSuccessfully")); } else { Clipboard.SetDataObject(copyText.ToString()); App.API.ShowMsg( - App.API.GetTranslation("copy") - + " " - + App.API.GetTranslation("textTitle"), + App.API.GetTranslation("copy") + + " " + + App.API.GetTranslation("textTitle"), App.API.GetTranslation("completedSuccessfully")); } } From 0baf04eb74558cf1422e25d99cd806f771609df3 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Tue, 27 Sep 2022 11:47:39 -0500 Subject: [PATCH 07/48] Merge branch 'dev' into QuickSizeAdjust & Work around dotnet/wpf#6792 --- Flow.Launcher.Plugin/Result.cs | 11 +++ Flow.Launcher/Flow.Launcher.csproj | 10 +++ Flow.Launcher/ReportWindow.xaml.cs | 1 - Flow.Launcher/ResultListBox.xaml | 6 +- Flow.Launcher/Themes/Base.xaml | 15 ++++ .../Search/ResultManager.cs | 88 ++++++++++++++++++- .../Search/SearchManager.cs | 9 +- .../Search/WindowsIndex/IndexSearch.cs | 6 +- global.json | 4 +- 9 files changed, 141 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 35c491d35..136395467 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -197,5 +197,16 @@ namespace Flow.Launcher.Plugin { return AsyncAction?.Invoke(context) ?? ValueTask.FromResult(Action?.Invoke(context) ?? false); } + + /// + /// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result + /// + public int? ProgressBar { get; set; } + + /// + /// Optionally set the color of the progress bar + /// + /// #26a0da (blue) + public string ProgressBarColor { get; set; } = "#26a0da"; } } diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 0db1915c5..813a44527 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -115,4 +115,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Flow.Launcher/ReportWindow.xaml.cs b/Flow.Launcher/ReportWindow.xaml.cs index 72c69d74d..4899edc14 100644 --- a/Flow.Launcher/ReportWindow.xaml.cs +++ b/Flow.Launcher/ReportWindow.xaml.cs @@ -77,7 +77,6 @@ namespace Flow.Launcher }; link.Inlines.Add(url); link.NavigateUri = new Uri(url); - link.RequestNavigate += (s, e) => SearchWeb.OpenInBrowserTab(e.Uri.ToString()); link.Click += (s, e) => SearchWeb.OpenInBrowserTab(url); paragraph.Inlines.Add(textBeforeUrl); diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index f7e820050..2c78f9bab 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -111,7 +111,11 @@ - + + + + + + - - - - - + Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" /> PluginManager.GetPluginForId(_plugin.ID) != null; public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version; public bool LabelNew => DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7) && !LabelUpdate; // Show Update Label show first. + + public string Category + { + get + { + string category = "None"; + if (DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7)) + { + category = "RecentlyUpdated"; + } + if (DateTime.Now - _plugin.DateAdded < TimeSpan.FromDays(7)) + { + category = "NewRelease"; + } + if (PluginManager.GetPluginForId(_plugin.ID) != null) + { + category = "Installed"; + } + + return category; + } + } } } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 11c2d5329..b1ed5a411 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -2,12 +2,14 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; @@ -326,7 +328,6 @@ namespace Flow.Launcher.ViewModel } - #endregion #region theme From b9afa1370ab36d359cc1f5b4bcc8d3bb3896f83e Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 23 Oct 2022 16:38:33 +0900 Subject: [PATCH 44/48] Adjust Label / Fix Order --- Flow.Launcher/Languages/en.xaml | 1 - Flow.Launcher/SettingWindow.xaml | 10 +++------- Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs | 4 +--- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 7 ++++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index d8dcb1d5b..578e5cd6a 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -95,7 +95,6 @@ Install Uninstall Update - Installed Plug-in already installed New Version This plug-in has been updated within the last 7 days diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index ba641eb6e..5081b4dad 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1558,19 +1558,15 @@ Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" /> - - + Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}" /> _plugin.IcoPath; public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null; - public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version; - public bool LabelNew => DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7) && !LabelUpdate; // Show Update Label show first. - + public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version; public string Category { get diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index b1ed5a411..fa63b9ba4 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -296,9 +296,10 @@ namespace Flow.Launcher.ViewModel private IList LabelMaker(IList list) { return list.Select(p=>new PluginStoreItemViewModel(p)) - .OrderByDescending(p=>p.LabelNew) - .ThenByDescending(p=>p.LabelUpdate) - .ThenBy(p=>p.LabelInstalled) + .OrderByDescending(p => p.Category == "NewRelease") + .ThenByDescending(p=>p.Category == "RecentlyUpdated") + .ThenByDescending(p => p.Category == "None") + .ThenByDescending(p => p.Category == "Installed") .ToList(); } From ad3fd4a049b83a9bc12a2064a1b977ee51dbbdab Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 23 Oct 2022 16:42:48 +0900 Subject: [PATCH 45/48] Fix Search / Removed Purple Icon --- Flow.Launcher/SettingWindow.xaml | 11 ----------- Flow.Launcher/SettingWindow.xaml.cs | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 5081b4dad..4346fd59a 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1556,17 +1556,6 @@ CornerRadius="36" ToolTip="{DynamicResource LabelUpdateToolTip}" Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" /> - Date: Fri, 28 Oct 2022 22:44:06 +1100 Subject: [PATCH 46/48] update category strings to constants --- Flow.Launcher/Converters/TextConverter.cs | 21 +++++-------------- .../ViewModel/PluginStoreItemViewModel.cs | 17 +++++++++------ .../ViewModel/SettingWindowViewModel.cs | 15 ++++--------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/Flow.Launcher/Converters/TextConverter.cs b/Flow.Launcher/Converters/TextConverter.cs index 905b728a3..90d445776 100644 --- a/Flow.Launcher/Converters/TextConverter.cs +++ b/Flow.Launcher/Converters/TextConverter.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; using System.Windows.Data; using Flow.Launcher.Core.Resource; +using Flow.Launcher.ViewModel; namespace Flow.Launcher.Converters { @@ -18,23 +13,17 @@ namespace Flow.Launcher.Converters var ID = value.ToString(); switch(ID) { - case "NewRelease": + case PluginStoreItemViewModel.NewRelease: return InternationalizationManager.Instance.GetTranslation("pluginStore_NewRelease"); - break; - case "RecentlyUpdated": + case PluginStoreItemViewModel.RecentlyUpdated: return InternationalizationManager.Instance.GetTranslation("pluginStore_RecentlyUpdated"); - break; - case "None": + case PluginStoreItemViewModel.None: return InternationalizationManager.Instance.GetTranslation("pluginStore_None"); - break; - case "installed": + case PluginStoreItemViewModel.Installed: return InternationalizationManager.Instance.GetTranslation("pluginStore_Installed"); - break; default: return ID; - break; } - } diff --git a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs index ad2e58d9a..622e41b1b 100644 --- a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using Flow.Launcher.Core.ExternalPlugins; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Plugin; @@ -27,23 +26,29 @@ namespace Flow.Launcher.ViewModel public string IcoPath => _plugin.IcoPath; public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null; - public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version; + public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version; + + internal const string None = "None"; + internal const string RecentlyUpdated = "RecentlyUpdated"; + internal const string NewRelease = "NewRelease"; + internal const string Installed = "Installed"; + public string Category { get { - string category = "None"; + string category = None; if (DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7)) { - category = "RecentlyUpdated"; + category = RecentlyUpdated; } if (DateTime.Now - _plugin.DateAdded < TimeSpan.FromDays(7)) { - category = "NewRelease"; + category = NewRelease; } if (PluginManager.GetPluginForId(_plugin.ID) != null) { - category = "Installed"; + category = Installed; } return category; diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index fa63b9ba4..d9c61986e 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -1,16 +1,11 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; using Flow.Launcher.Core; @@ -24,8 +19,6 @@ using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; -using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames; -using Windows.Management.Deployment.Preview; namespace Flow.Launcher.ViewModel { @@ -296,10 +289,10 @@ namespace Flow.Launcher.ViewModel private IList LabelMaker(IList list) { return list.Select(p=>new PluginStoreItemViewModel(p)) - .OrderByDescending(p => p.Category == "NewRelease") - .ThenByDescending(p=>p.Category == "RecentlyUpdated") - .ThenByDescending(p => p.Category == "None") - .ThenByDescending(p => p.Category == "Installed") + .OrderByDescending(p => p.Category == PluginStoreItemViewModel.NewRelease) + .ThenByDescending(p=>p.Category == PluginStoreItemViewModel.RecentlyUpdated) + .ThenByDescending(p => p.Category == PluginStoreItemViewModel.None) + .ThenByDescending(p => p.Category == PluginStoreItemViewModel.Installed) .ToList(); } From 3fcae23c5803052196bf677cf1985a62f74001d8 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 28 Oct 2022 23:15:00 +1100 Subject: [PATCH 47/48] move plugin install/uninstall/update calls from View to ViewModel --- Flow.Launcher/SettingWindow.xaml.cs | 60 +++++++------------ .../ViewModel/SettingWindowViewModel.cs | 10 ++++ 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index c309e2965..fc6be5d04 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -312,13 +312,32 @@ namespace Flow.Launcher { if (sender is Button { DataContext: PluginStoreItemViewModel plugin }) { - var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"); - var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0]; - API.ChangeQuery($"{actionKeyword} install {plugin.Name}"); - API.ShowMainWindow(); + viewModel.DisplayPluginQuery($"install {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7")); } } + private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + var name = viewModel.SelectedPlugin.PluginPair.Metadata.Name; + viewModel.DisplayPluginQuery($"uninstall {name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7")); + } + + } + + private void OnExternalPluginUninstallClick(object sender, RoutedEventArgs e) + { + if (sender is Button { DataContext: PluginStoreItemViewModel plugin }) + viewModel.DisplayPluginQuery($"uninstall {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7")); + } + + private void OnExternalPluginUpdateClick(object sender, RoutedEventArgs e) + { + if (sender is Button { DataContext: PluginStoreItemViewModel plugin }) + viewModel.DisplayPluginQuery($"update {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7")); + } + private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */ { if (Keyboard.FocusedElement is not TextBox textBox) @@ -477,39 +496,6 @@ namespace Flow.Launcher var top = (dip2.Y - this.ActualHeight) / 2 + dip1.Y - 20; return top; } - private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e) - { - if (e.ChangedButton == MouseButton.Left) - { - var id = viewModel.SelectedPlugin.PluginPair.Metadata.Name; - var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"); - var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0]; - API.ChangeQuery($"{actionKeyword} uninstall {id}"); - API.ShowMainWindow(); - } - } - - private void OnExternalPluginUninstallClick(object sender, RoutedEventArgs e) - { - if (sender is Button { DataContext: PluginStoreItemViewModel plugin }) - { - var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"); - var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0]; - API.ChangeQuery($"{actionKeyword} uninstall {plugin.Name}"); - API.ShowMainWindow(); - } - } - - private void OnExternalPluginUpdateClick(object sender, RoutedEventArgs e) - { - if (sender is Button { DataContext: PluginStoreItemViewModel plugin }) - { - var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"); - var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0]; - API.ChangeQuery($"{actionKeyword} update {plugin.Name}"); - API.ShowMainWindow(); - } - } } } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index d9c61986e..432699c4b 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -321,6 +321,16 @@ namespace Flow.Launcher.ViewModel OnPropertyChanged(nameof(ExternalPlugins)); } + internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0) + { + var actionKeyword = plugin.Metadata.ActionKeywords.Count == 0 + ? string.Empty + : plugin.Metadata.ActionKeywords[actionKeywordPosition]; + + App.API.ChangeQuery($"{actionKeyword} {queryToDisplay}"); + App.API.ShowMainWindow(); + } + #endregion From cea9c5b7d5deb02f95036788fc3aa5f5dce03de1 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 28 Oct 2022 23:35:22 +1100 Subject: [PATCH 48/48] update language file keys --- Flow.Launcher/Languages/da.xaml | 4 ++-- Flow.Launcher/Languages/de.xaml | 4 ++-- Flow.Launcher/Languages/es-419.xaml | 4 ++-- Flow.Launcher/Languages/fr.xaml | 4 ++-- Flow.Launcher/Languages/it.xaml | 4 ++-- Flow.Launcher/Languages/ja.xaml | 4 ++-- Flow.Launcher/Languages/ko.xaml | 4 ++-- Flow.Launcher/Languages/nb.xaml | 4 ++-- Flow.Launcher/Languages/nl.xaml | 4 ++-- Flow.Launcher/Languages/pl.xaml | 4 ++-- Flow.Launcher/Languages/pt-br.xaml | 4 ++-- Flow.Launcher/Languages/pt-pt.xaml | 4 ++-- Flow.Launcher/Languages/ru.xaml | 4 ++-- Flow.Launcher/Languages/sk.xaml | 4 ++-- Flow.Launcher/Languages/sr.xaml | 4 ++-- Flow.Launcher/Languages/tr.xaml | 4 ++-- Flow.Launcher/Languages/uk-UA.xaml | 4 ++-- Flow.Launcher/Languages/zh-cn.xaml | 4 ++-- Flow.Launcher/Languages/zh-tw.xaml | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Flow.Launcher/Languages/da.xaml b/Flow.Launcher/Languages/da.xaml index 7ec94fed1..25bd195dd 100644 --- a/Flow.Launcher/Languages/da.xaml +++ b/Flow.Launcher/Languages/da.xaml @@ -77,13 +77,13 @@ Søgetid: | Version Website - Uninstall + Uninstall Plugin Store Refresh - Install + Install Tema diff --git a/Flow.Launcher/Languages/de.xaml b/Flow.Launcher/Languages/de.xaml index a1b0b3b9b..ebd549adf 100644 --- a/Flow.Launcher/Languages/de.xaml +++ b/Flow.Launcher/Languages/de.xaml @@ -77,13 +77,13 @@ Abfragezeit: Version Webseite - Deinstallieren + Deinstallieren Erweiterungen laden Aktualisieren - Installieren + Installieren Design diff --git a/Flow.Launcher/Languages/es-419.xaml b/Flow.Launcher/Languages/es-419.xaml index 84a492d15..a410f4b32 100644 --- a/Flow.Launcher/Languages/es-419.xaml +++ b/Flow.Launcher/Languages/es-419.xaml @@ -77,13 +77,13 @@ Tiempo de consulta: | Versión Sitio web - Uninstall + Uninstall Tienda de Plugins Recargar - Instalar + Instalar Tema diff --git a/Flow.Launcher/Languages/fr.xaml b/Flow.Launcher/Languages/fr.xaml index 141d868a2..edc5e4f07 100644 --- a/Flow.Launcher/Languages/fr.xaml +++ b/Flow.Launcher/Languages/fr.xaml @@ -77,13 +77,13 @@ Utilisation : | Version Website - Désinstaller + Désinstaller Plugin Store Refresh - Install + Install Thèmes diff --git a/Flow.Launcher/Languages/it.xaml b/Flow.Launcher/Languages/it.xaml index 4304aead8..30a401875 100644 --- a/Flow.Launcher/Languages/it.xaml +++ b/Flow.Launcher/Languages/it.xaml @@ -77,13 +77,13 @@ Tempo ricerca: | Versione Sito Web - Disinstalla + Disinstalla Negozio dei Plugin Aggiorna - Installa + Installa Tema diff --git a/Flow.Launcher/Languages/ja.xaml b/Flow.Launcher/Languages/ja.xaml index 8c1386371..a2dcfb6a0 100644 --- a/Flow.Launcher/Languages/ja.xaml +++ b/Flow.Launcher/Languages/ja.xaml @@ -77,13 +77,13 @@ クエリ時間: | バージョン ウェブサイト - アンインストール + アンインストール プラグインストア Refresh - Install + Install テーマ diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index 809c5ccf8..acb68cb4f 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -77,13 +77,13 @@ 쿼리 시간: | 버전 웹사이트 - 제거 + 제거 플러그인 스토어 새로고침 - 설치 + 설치 테마 diff --git a/Flow.Launcher/Languages/nb.xaml b/Flow.Launcher/Languages/nb.xaml index e90a32347..0848e9d64 100644 --- a/Flow.Launcher/Languages/nb.xaml +++ b/Flow.Launcher/Languages/nb.xaml @@ -77,13 +77,13 @@ Query time: | Version Website - Uninstall + Uninstall Plugin Store Refresh - Install + Install Theme diff --git a/Flow.Launcher/Languages/nl.xaml b/Flow.Launcher/Languages/nl.xaml index 77a8e9e29..e398afa51 100644 --- a/Flow.Launcher/Languages/nl.xaml +++ b/Flow.Launcher/Languages/nl.xaml @@ -77,13 +77,13 @@ Query tijd: | Versie Website - Uninstall + Uninstall Plugin Winkel Vernieuwen - Installeren + Installeren Thema diff --git a/Flow.Launcher/Languages/pl.xaml b/Flow.Launcher/Languages/pl.xaml index bd7acd4e8..fc5badd69 100644 --- a/Flow.Launcher/Languages/pl.xaml +++ b/Flow.Launcher/Languages/pl.xaml @@ -77,13 +77,13 @@ Czas zapytania: | Version Website - Odinstalowywanie + Odinstalowywanie Plugin Store Refresh - Install + Install Skórka diff --git a/Flow.Launcher/Languages/pt-br.xaml b/Flow.Launcher/Languages/pt-br.xaml index 28ed30916..f6fc062c6 100644 --- a/Flow.Launcher/Languages/pt-br.xaml +++ b/Flow.Launcher/Languages/pt-br.xaml @@ -77,13 +77,13 @@ Tempo de consulta: | Version Website - Desinstalar + Desinstalar Plugin Store Refresh - Install + Install Tema diff --git a/Flow.Launcher/Languages/pt-pt.xaml b/Flow.Launcher/Languages/pt-pt.xaml index e7179e6e8..b19fc9924 100644 --- a/Flow.Launcher/Languages/pt-pt.xaml +++ b/Flow.Launcher/Languages/pt-pt.xaml @@ -77,13 +77,13 @@ Tempo de consulta: | Versão Site - Desinstalar + Desinstalar Loja de plugins Recarregar - Instalar + Instalar Tema diff --git a/Flow.Launcher/Languages/ru.xaml b/Flow.Launcher/Languages/ru.xaml index 2c8ca9fa3..87b3dd4ef 100644 --- a/Flow.Launcher/Languages/ru.xaml +++ b/Flow.Launcher/Languages/ru.xaml @@ -77,13 +77,13 @@ Запрос: | Version Website - Удалить + Удалить Plugin Store Refresh - Install + Install Тема diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index c4d5de6bf..ee703bcf8 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -77,13 +77,13 @@ Trvanie dopytu: | Verzia Webstránka - Odinštalovať + Odinštalovať Repozitár pluginov Obnoviť - Inštalovať + Inštalovať Motív diff --git a/Flow.Launcher/Languages/sr.xaml b/Flow.Launcher/Languages/sr.xaml index 61f619fd0..e805860dc 100644 --- a/Flow.Launcher/Languages/sr.xaml +++ b/Flow.Launcher/Languages/sr.xaml @@ -77,13 +77,13 @@ Vreme upita: | Version Website - Uninstall + Uninstall Plugin Store Refresh - Install + Install Tema diff --git a/Flow.Launcher/Languages/tr.xaml b/Flow.Launcher/Languages/tr.xaml index fb8e1d6f6..4a016ced8 100644 --- a/Flow.Launcher/Languages/tr.xaml +++ b/Flow.Launcher/Languages/tr.xaml @@ -77,13 +77,13 @@ Sorgu Süresi: Sürüm İnternet Sitesi - Kaldır + Kaldır Eklenti Mağazası Yenile - İndir + İndir Temalar diff --git a/Flow.Launcher/Languages/uk-UA.xaml b/Flow.Launcher/Languages/uk-UA.xaml index 8115a5dd1..a34ed4e8b 100644 --- a/Flow.Launcher/Languages/uk-UA.xaml +++ b/Flow.Launcher/Languages/uk-UA.xaml @@ -77,13 +77,13 @@ Запит: | Версія Сайт - Uninstall + Uninstall Магазин плагінів Оновити - Встановити + Встановити Тема diff --git a/Flow.Launcher/Languages/zh-cn.xaml b/Flow.Launcher/Languages/zh-cn.xaml index d80bfdaf6..b62736d16 100644 --- a/Flow.Launcher/Languages/zh-cn.xaml +++ b/Flow.Launcher/Languages/zh-cn.xaml @@ -77,13 +77,13 @@ 查询耗时: | 版本 官方网站 - 卸载 + 卸载 插件商店 刷新 - 安装 + 安装 主题 diff --git a/Flow.Launcher/Languages/zh-tw.xaml b/Flow.Launcher/Languages/zh-tw.xaml index 71cc887cf..69abbe401 100644 --- a/Flow.Launcher/Languages/zh-tw.xaml +++ b/Flow.Launcher/Languages/zh-tw.xaml @@ -77,13 +77,13 @@ 查詢耗時: | 版本 官方網站 - 解除安裝 + 解除安裝 外掛商店 重新整理 - 安裝 + 安裝 主題