From 15e34e08c6f3c6df4334f2e4331bfba4afe77f04 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 2 Sep 2022 12:33:32 +0900 Subject: [PATCH 01/73] - Layout Adjust --- Flow.Launcher/MainWindow.xaml | 98 +++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 714fcc53fa1..8743bde2f6b 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -233,11 +233,11 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + From 766e13b0e75e0aa7c009379d4afa214309eb3127 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 2 Sep 2022 13:15:52 +0900 Subject: [PATCH 02/73] - Adjust Layout --- Flow.Launcher/MainWindow.xaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 8743bde2f6b..17dccc893d6 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -254,7 +254,7 @@ - + @@ -303,18 +303,20 @@ - - + + + - + - + - + + From e8ccd46589e9c9efd6be1620df6a8299c8afb7b7 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 2 Sep 2022 14:35:25 +0900 Subject: [PATCH 03/73] - Add Preview Toggle (F2 Key) - Fix Seperate line for toggle - Block preview when nothing result --- Flow.Launcher/MainWindow.xaml | 8 ++++---- Flow.Launcher/MainWindow.xaml.cs | 26 ++++++++++++++++++++++++-- Flow.Launcher/ResultListBox.xaml | 1 + Flow.Launcher/Themes/Base.xaml | 32 +++++++++++++++++++++++++++++++- 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 17dccc893d6..545dba94fe1 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -237,7 +237,7 @@ + Style="{DynamicResource SeparatorStyle}" Visibility="Visible" /> - + @@ -303,8 +303,8 @@ - - + + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 2b7db38cff2..8adc788ccbf 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; @@ -531,12 +531,34 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; + case Key.F2: + PreviewToggle(); + e.Handled = true; + break; + default: break; } } + public void PreviewToggle() + { + + if (Preview.Visibility == Visibility.Collapsed) + { + ResultArea.SetValue(Grid.ColumnSpanProperty, 1); + //HotkeyArea.SetValue(Visibility, Visibility.Collapsed); + Preview.Visibility = Visibility.Visible; + } + else + { + ResultArea.SetValue(Grid.ColumnSpanProperty, 2); + //HotkeyArea.SetValue(Visibility, Visibility.Visible); + Preview.Visibility = Visibility.Collapsed; + } + } + private void MoveQueryTextToEnd() { // QueryTextBox seems to be update with a DispatcherPriority as low as ContextIdle. @@ -556,4 +578,4 @@ public void InitializeColorScheme() } } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index f7e82005008..646a43eda18 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -56,6 +56,7 @@ - @@ -268,6 +282,22 @@ + + diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 1082be3201c..913477b530c 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -243,6 +243,7 @@ + @@ -250,6 +251,7 @@ + @@ -281,6 +283,15 @@ + + - + diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml index 636fe7b6d38..2ddb9ae0992 100644 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ b/Flow.Launcher/Themes/Discord Dark.xaml @@ -100,4 +100,7 @@ + diff --git a/Flow.Launcher/Themes/Dracula.xaml b/Flow.Launcher/Themes/Dracula.xaml index c661d33e331..c46dcff1643 100644 --- a/Flow.Launcher/Themes/Dracula.xaml +++ b/Flow.Launcher/Themes/Dracula.xaml @@ -100,4 +100,8 @@ + + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index 06649978bd9..84bd8c6eac4 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -74,5 +74,9 @@ - + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Light.xaml b/Flow.Launcher/Themes/Light.xaml index 10c99594143..dae40e9eb12 100644 --- a/Flow.Launcher/Themes/Light.xaml +++ b/Flow.Launcher/Themes/Light.xaml @@ -70,4 +70,7 @@ + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Metro Server.xaml b/Flow.Launcher/Themes/Metro Server.xaml index 016e6af9dd0..98edffcb651 100644 --- a/Flow.Launcher/Themes/Metro Server.xaml +++ b/Flow.Launcher/Themes/Metro Server.xaml @@ -56,4 +56,7 @@ + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml index 413effa518b..3c9cc2678b4 100644 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ b/Flow.Launcher/Themes/Nord Darker.xaml @@ -71,4 +71,7 @@ + diff --git a/Flow.Launcher/Themes/Nord.xaml b/Flow.Launcher/Themes/Nord.xaml index 2fcc11ef2bd..4d8ffee394f 100644 --- a/Flow.Launcher/Themes/Nord.xaml +++ b/Flow.Launcher/Themes/Nord.xaml @@ -70,4 +70,7 @@ + diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index 82fff06ff84..57648be7ac5 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -99,4 +99,7 @@ + diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index 6f487a89521..c08df312ed9 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -102,4 +102,7 @@ + diff --git a/Flow.Launcher/Themes/Win11Dark.xaml b/Flow.Launcher/Themes/Win11Dark.xaml index 31f6fb9561b..0f92b5c28e3 100644 --- a/Flow.Launcher/Themes/Win11Dark.xaml +++ b/Flow.Launcher/Themes/Win11Dark.xaml @@ -156,4 +156,7 @@ + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 33aa6cdee38..4747f0423c8 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -100,4 +100,7 @@ + diff --git a/Flow.Launcher/Themes/Win11System.xaml b/Flow.Launcher/Themes/Win11System.xaml index bcc83be9fdf..b3f4255083a 100644 --- a/Flow.Launcher/Themes/Win11System.xaml +++ b/Flow.Launcher/Themes/Win11System.xaml @@ -156,4 +156,7 @@ + From a090b10b1e859ddd866410dd113df738e35a352e Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 05:57:06 -0400 Subject: [PATCH 06/73] Add field images to be displayed in previews --- Flow.Launcher.Plugin/Result.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 35c491d35f8..7451d29c7a4 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -67,6 +67,11 @@ public string IcoPath } } + /// + /// Full image used for preview window + /// + public string PreviewImage { get; set; } + /// /// Delegate function, see /// From f5a511a4f1655b0e19edc0738ccb14355120cd53 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:36:57 -0400 Subject: [PATCH 07/73] Add FullImageFIle type --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 8c1d7d74fbf..b2ebbc33607 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -95,6 +95,7 @@ private enum ImageType Folder, Data, ImageFile, + FullImageFile, Error, Cache } From 832c41f3dd88a1d1f92c1c7730cb35971ce4408e Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:37:25 -0400 Subject: [PATCH 08/73] Override type if we load the full image --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index b2ebbc33607..7df44f8c43d 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -174,6 +174,7 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag if (loadFullImage) { image = LoadFullImage(path); + type = ImageType.FullImageFile; } else { From a53b961406d48ca46ca587182abd068853346639 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:38:25 -0400 Subject: [PATCH 09/73] Append full image type to path if we're caching a full imagefile --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 7df44f8c43d..d0743ef13e3 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -228,6 +228,10 @@ public static ImageSource Load(string path, bool loadFullImage = false) if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache) { // we need to get image hash string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null; + if (imageResult.ImageType == ImageType.FullImageFile) + { + path = path + ImageType.FullImageFile; + } if (hash != null) { From a76304ac516dfda2225ad717e48218759b5d4c3d Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:38:49 -0400 Subject: [PATCH 10/73] Load full image from cache --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index d0743ef13e3..77d1e19b371 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -114,7 +114,10 @@ private static ImageResult LoadInternal(string path, bool loadFullImage = false) { return new ImageResult(ImageCache[path], ImageType.Cache); } - + if (loadFullImage && ImageCache.ContainsKey(path + ImageType.FullImageFile)) + { + return new ImageResult(ImageCache[path + ImageType.FullImageFile], ImageType.Cache); + } if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase)) { var imageSource = new BitmapImage(new Uri(path)); From a9d11816f5d75b9356820ebdb7681ed095912f30 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:39:32 -0400 Subject: [PATCH 11/73] Try to load full image from cache first --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 77d1e19b371..89f982b9043 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -110,14 +110,15 @@ private static ImageResult LoadInternal(string path, bool loadFullImage = false) { return new ImageResult(ImageCache[Constant.MissingImgIcon], ImageType.Error); } - if (ImageCache.ContainsKey(path)) - { - return new ImageResult(ImageCache[path], ImageType.Cache); - } if (loadFullImage && ImageCache.ContainsKey(path + ImageType.FullImageFile)) { return new ImageResult(ImageCache[path + ImageType.FullImageFile], ImageType.Cache); } + if (ImageCache.ContainsKey(path)) + { + return new ImageResult(ImageCache[path], ImageType.Cache); + } + if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase)) { var imageSource = new BitmapImage(new Uri(path)); From 29e5b4fcf74308e294c5d3adc5406df3ca5fb838 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:40:00 -0400 Subject: [PATCH 12/73] Add logic for detecting if full image exists in cache --- Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 89f982b9043..198ad5933da 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -219,8 +219,12 @@ private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = option); } - public static bool CacheContainImage(string path) + public static bool CacheContainImage(string path, bool fullImage = false) { + if (fullImage) + { + return ImageCache.ContainsKey(path + ImageType.FullImageFile); + } return ImageCache.ContainsKey(path) && ImageCache[path] != null; } From 5f92f5b93b42ebdf2e75d4ba068e9e52a9c8716a Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:40:18 -0400 Subject: [PATCH 13/73] Add binding for preview image --- 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 d3d42ff3a17..2126c490687 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -311,7 +311,7 @@ - + From 9ed008fef63022c7d15e57c757ab310c736f6af9 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 07:40:37 -0400 Subject: [PATCH 14/73] Add preview image binding --- Flow.Launcher/ViewModel/ResultViewModel.cs | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 4d32d792dd0..ab02abbef06 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -112,8 +112,10 @@ public Visibility ShowGlyph : Result.SubTitleToolTip; private volatile bool ImageLoaded; + private volatile bool PreviewImageLoaded; private ImageSource image = ImageLoader.DefaultImage; + private ImageSource previewImage = ImageLoader.DefaultImage; public ImageSource Image { @@ -130,6 +132,21 @@ public ImageSource Image private set => image = value; } + public ImageSource PreviewImage + { + get + { + if (!PreviewImageLoaded) + { + PreviewImageLoaded = true; + _ = LoadPreviewImageAsync(); + } + + return previewImage; + } + private set => previewImage = value; + } + public GlyphInfo Glyph { get; set; } private async ValueTask LoadImageAsync() @@ -161,6 +178,36 @@ private async ValueTask LoadImageAsync() Image = await Task.Run(() => ImageLoader.Load(imagePath)).ConfigureAwait(false); } + + private async ValueTask LoadPreviewImageAsync() + { + var imagePath = Result.PreviewImage ?? Result.IcoPath; + if (string.IsNullOrEmpty(imagePath) && Result.Icon != null) + { + try + { + previewImage = Result.Icon(); + return; + } + catch (Exception e) + { + Log.Exception( + $"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", + e); + } + } + + if (ImageLoader.CacheContainImage(imagePath, true)) + { + // will get here either when icoPath has value\icon delegate is null\when had exception in delegate + previewImage = ImageLoader.Load(imagePath, true); + return; + } + + // We need to modify the property not field here to trigger the OnPropertyChanged event + PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); + } + public Result Result { get; } public string QuerySuggestionText { get; set; } From 5aaaf37f0cf3531b177ac76582a033f9a2c08c11 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 08:10:52 -0400 Subject: [PATCH 15/73] Fix not loading full image --- .../Image/ImageLoader.cs | 13 ++++++------ Flow.Launcher/ViewModel/ResultViewModel.cs | 20 ------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 198ad5933da..3c5c8b9b6d9 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -101,7 +101,7 @@ private enum ImageType } private static ImageResult LoadInternal(string path, bool loadFullImage = false) - { +{ ImageResult imageResult; try @@ -114,7 +114,7 @@ private static ImageResult LoadInternal(string path, bool loadFullImage = false) { return new ImageResult(ImageCache[path + ImageType.FullImageFile], ImageType.Cache); } - if (ImageCache.ContainsKey(path)) + if (!loadFullImage && ImageCache.ContainsKey(path)) { return new ImageResult(ImageCache[path], ImageType.Cache); } @@ -236,10 +236,7 @@ public static ImageSource Load(string path, bool loadFullImage = false) if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache) { // we need to get image hash string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null; - if (imageResult.ImageType == ImageType.FullImageFile) - { - path = path + ImageType.FullImageFile; - } + if (hash != null) { @@ -249,6 +246,10 @@ public static ImageSource Load(string path, bool loadFullImage = false) } else { // new guid + if (imageResult.ImageType == ImageType.FullImageFile) + { + path = path + ImageType.FullImageFile; + } GuidToKey[hash] = path; } } diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index ab02abbef06..1e6ee2b92ab 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -182,27 +182,7 @@ private async ValueTask LoadImageAsync() private async ValueTask LoadPreviewImageAsync() { var imagePath = Result.PreviewImage ?? Result.IcoPath; - if (string.IsNullOrEmpty(imagePath) && Result.Icon != null) - { - try - { - previewImage = Result.Icon(); - return; - } - catch (Exception e) - { - Log.Exception( - $"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", - e); - } - } - if (ImageLoader.CacheContainImage(imagePath, true)) - { - // will get here either when icoPath has value\icon delegate is null\when had exception in delegate - previewImage = ImageLoader.Load(imagePath, true); - return; - } // We need to modify the property not field here to trigger the OnPropertyChanged event PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); From c2d2fc00922ba0ba8912b6133d1b0489f89269d6 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 2 Sep 2022 08:36:07 -0400 Subject: [PATCH 16/73] Fix caching --- .../Image/ImageLoader.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 3c5c8b9b6d9..ef034e19482 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -110,9 +110,9 @@ private static ImageResult LoadInternal(string path, bool loadFullImage = false) { return new ImageResult(ImageCache[Constant.MissingImgIcon], ImageType.Error); } - if (loadFullImage && ImageCache.ContainsKey(path + ImageType.FullImageFile)) + if (loadFullImage && ImageCache.ContainsKey($"{path}_{ImageType.FullImageFile}")) { - return new ImageResult(ImageCache[path + ImageType.FullImageFile], ImageType.Cache); + return new ImageResult(ImageCache[$"{path}_{ImageType.FullImageFile}"], ImageType.Cache); } if (!loadFullImage && ImageCache.ContainsKey(path)) { @@ -223,7 +223,7 @@ public static bool CacheContainImage(string path, bool fullImage = false) { if (fullImage) { - return ImageCache.ContainsKey(path + ImageType.FullImageFile); + return ImageCache.ContainsKey($"{path}_{ImageType.FullImageFile}"); } return ImageCache.ContainsKey(path) && ImageCache[path] != null; } @@ -236,7 +236,10 @@ public static ImageSource Load(string path, bool loadFullImage = false) if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache) { // we need to get image hash string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null; - + if (imageResult.ImageType == ImageType.FullImageFile) + { + path = $"{path}_{ImageType.FullImageFile}"; + } if (hash != null) { @@ -246,10 +249,7 @@ public static ImageSource Load(string path, bool loadFullImage = false) } else { // new guid - if (imageResult.ImageType == ImageType.FullImageFile) - { - path = path + ImageType.FullImageFile; - } + GuidToKey[hash] = path; } } From 733ebb8ac1e1874668b693f86754ef2bdbbeadd5 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Tue, 13 Sep 2022 17:34:11 -0500 Subject: [PATCH 17/73] Add support for customized usercontrol --- Flow.Launcher.Plugin/Result.cs | 6 + Flow.Launcher/MainWindow.xaml | 165 +++++++++++------- Flow.Launcher/ViewModel/ResultViewModel.cs | 6 +- .../Programs/Win32.cs | 10 ++ 4 files changed, 122 insertions(+), 65 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 7451d29c7a4..b51288fe376 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using System.Windows.Controls; using System.Windows.Media; namespace Flow.Launcher.Plugin @@ -193,6 +194,11 @@ public override string ToString() /// public string SubTitleToolTip { get; set; } + /// + /// Customized Preview Panel + /// + public Lazy PreviewPanel { get; set; } + /// /// Run this result, asynchronously /// diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 2126c490687..54c577f8449 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -12,7 +12,6 @@ Title="Flow Launcher" MinWidth="{Binding MainWindowWidth, Mode=OneWay}" MaxWidth="{Binding MainWindowWidth, Mode=OneWay}" - d:DataContext="{d:DesignInstance vm:MainViewModel}" AllowDrop="True" AllowsTransparency="True" Background="Transparent" @@ -235,9 +234,10 @@ + Width="Auto" + HorizontalAlignment="Stretch" + Style="{DynamicResource SeparatorStyle}" + Visibility="Visible" /> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + - diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 1e6ee2b92ab..372fb40e595 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -15,7 +15,7 @@ namespace Flow.Launcher.ViewModel public class ResultViewModel : BaseModel { private static PrivateFontCollection fontCollection = new(); - private static Dictionary fonts = new(); + private static Dictionary fonts = new(); public ResultViewModel(Result result, Settings settings) { @@ -67,6 +67,10 @@ public ResultViewModel(Result result, Settings settings) public Visibility ShowOpenResultHotkey => Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Collapsed; + public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed; + + public Visibility ShowCustomizedPrewview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible; + public Visibility ShowIcon { get diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 6a8b232e94e..812bb01a03a 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -17,6 +17,7 @@ using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch; using System.Diagnostics.CodeAnalysis; using System.Threading.Channels; +using System.Windows.Controls; namespace Flow.Launcher.Plugin.Program.Programs { @@ -104,6 +105,15 @@ public Result Result(string query, IPublicAPI api) Score = matchResult.Score, TitleHighlightData = matchResult.MatchData, ContextData = this, + PreviewPanel = new Lazy(() => + { + var control = new UserControl(); + control.Content = new TextBlock() + { + Text = "test" + }; + return control; + }), Action = c => { var runAsAdmin = ( From ea728ccc7d5b2d8cd6fc5d23ee1f0b6ee8d5ea75 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 16 Sep 2022 15:04:18 +0900 Subject: [PATCH 18/73] Add WindowsAPICodePack for HighResThumb --- Flow.Launcher/Flow.Launcher.csproj | 1 + Flow.Launcher/MainWindow.xaml.cs | 2 -- Flow.Launcher/ViewModel/ResultViewModel.cs | 7 ++++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 66cc911ee87..52267e16cdc 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -97,6 +97,7 @@ + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 266a0b17e2e..a9cd2eff0e6 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -562,13 +562,11 @@ public void PreviewToggle() if (Preview.Visibility == Visibility.Collapsed) { ResultArea.SetValue(Grid.ColumnSpanProperty, 1); - //HotkeyArea.SetValue(Visibility, Visibility.Collapsed); Preview.Visibility = Visibility.Visible; } else { ResultArea.SetValue(Grid.ColumnSpanProperty, 2); - //HotkeyArea.SetValue(Visibility, Visibility.Visible); Preview.Visibility = Visibility.Collapsed; } } diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 372fb40e595..6feb9d501b0 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -9,6 +9,8 @@ using System.IO; using System.Drawing.Text; using System.Collections.Generic; +using Microsoft.WindowsAPICodePack.Shell; +using System.Drawing; namespace Flow.Launcher.ViewModel { @@ -186,10 +188,9 @@ private async ValueTask LoadImageAsync() private async ValueTask LoadPreviewImageAsync() { var imagePath = Result.PreviewImage ?? Result.IcoPath; - - // We need to modify the property not field here to trigger the OnPropertyChanged event - PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); + //PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); + PreviewImage = ShellFile.FromFilePath(imagePath).Thumbnail.LargeBitmapSource; } public Result Result { get; } From b502f2af1be5017f8d12938d9feca7850fd73a83 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 16 Sep 2022 16:07:55 +0900 Subject: [PATCH 19/73] - Adjust Layout - Change Preview High Resolution --- Flow.Launcher/MainWindow.xaml | 11 ++++++----- Flow.Launcher/ViewModel/ResultViewModel.cs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 54c577f8449..136a90fcf41 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -313,7 +313,7 @@ Visibility="Collapsed"> @@ -325,8 +325,9 @@ x:Name="ImageIcon" Grid.Row="0" Grid.Column="0" - Height="128" - Margin="0,0,0,8" + MaxWidth="{Binding ActualWidth, ElementName=Preview}" + MaxHeight="400" + Margin="0,10,0,8" HorizontalAlignment="Center" Source="{Binding PreviewImage}" Visibility="{Binding ShowIcon}" /> @@ -343,10 +344,10 @@ ImageLoader.Load(imagePath, true)).ConfigureAwait(false); - PreviewImage = ShellFile.FromFilePath(imagePath).Thumbnail.LargeBitmapSource; + PreviewImage = ShellFile.FromFilePath(imagePath).Thumbnail.ExtraLargeBitmapSource; } public Result Result { get; } From bb0c57d3d2fadd70d5925d6636f59e5116fb8265 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 16 Sep 2022 20:33:54 +0900 Subject: [PATCH 20/73] - remove test customcontrol in program plugin - change small icon in result to folder thumbnail --- Flow.Launcher/ViewModel/ResultViewModel.cs | 5 +++-- Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs | 9 --------- Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs | 4 ++-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 2ea11602980..2ccf3b41695 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -181,7 +181,8 @@ private async ValueTask LoadImageAsync() } // We need to modify the property not field here to trigger the OnPropertyChanged event - Image = await Task.Run(() => ImageLoader.Load(imagePath)).ConfigureAwait(false); + //Image = await Task.Run(() => ImageLoader.Load(imagePath)).ConfigureAwait(false); + Image = ShellFolder.FromParsingName(imagePath).Thumbnail.MediumBitmapSource; } @@ -190,7 +191,7 @@ private async ValueTask LoadPreviewImageAsync() var imagePath = Result.PreviewImage ?? Result.IcoPath; // We need to modify the property not field here to trigger the OnPropertyChanged event //PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); - PreviewImage = ShellFile.FromFilePath(imagePath).Thumbnail.ExtraLargeBitmapSource; + PreviewImage = ShellFolder.FromParsingName(imagePath).Thumbnail.LargeBitmapSource; } public Result Result { get; } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 812bb01a03a..64a40954c22 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -105,15 +105,6 @@ public Result Result(string query, IPublicAPI api) Score = matchResult.Score, TitleHighlightData = matchResult.MatchData, ContextData = this, - PreviewPanel = new Lazy(() => - { - var control = new UserControl(); - control.Content = new TextBlock() - { - Text = "test" - }; - return control; - }), Action = c => { var runAsAdmin = ( diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs index b136e3b8b46..179745e2d2f 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -192,4 +192,4 @@ public string GetTranslatedPluginDescription() public event ResultUpdatedEventHandler ResultsUpdated; } -} \ No newline at end of file +} From af2909b9d1d3ba9ec0160edc097b9974ad107672 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 16 Sep 2022 21:25:00 +0900 Subject: [PATCH 21/73] Fix Blank Preview when no result with query. --- Flow.Launcher/MainWindow.xaml | 4 ++-- Flow.Launcher/Themes/Base.xaml | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 136a90fcf41..00cc77e6bdb 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -318,8 +318,8 @@ Background="Transparent"> - - + + - - @@ -297,7 +299,6 @@ - From e5a5a8c34dc1a8ed762e7efee3868f13e62c1454 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 2 Oct 2022 12:30:35 +0900 Subject: [PATCH 22/73] - Rollabck to latest stable code - Fix Binding Error --- Flow.Launcher/MainWindow.xaml | 2 +- Flow.Launcher/SettingWindow.xaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 00cc77e6bdb..bcbea498ac4 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -254,7 +254,7 @@ - + diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 2585943be3c..484170e27ae 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1565,7 +1565,7 @@ - From 20f61f523929fb85c5baea08d0d7139248d53cfb Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 26 Oct 2022 00:34:35 +0900 Subject: [PATCH 23/73] Removed MSApiCodePack --- Flow.Launcher/Flow.Launcher.csproj | 1 - Flow.Launcher/ViewModel/ResultViewModel.cs | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 52267e16cdc..66cc911ee87 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -97,7 +97,6 @@ - diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index d72f4f858a2..1e2531ec0a2 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -9,7 +9,6 @@ using System.IO; using System.Drawing.Text; using System.Collections.Generic; -using Microsoft.WindowsAPICodePack.Shell; using System.Drawing; namespace Flow.Launcher.ViewModel @@ -194,8 +193,7 @@ private async ValueTask LoadImageAsync() } // We need to modify the property not field here to trigger the OnPropertyChanged event - //Image = await Task.Run(() => ImageLoader.Load(imagePath)).ConfigureAwait(false); - Image = ShellFolder.FromParsingName(imagePath).Thumbnail.MediumBitmapSource; + Image = await Task.Run(() => ImageLoader.Load(imagePath)).ConfigureAwait(false); } @@ -203,8 +201,7 @@ private async ValueTask LoadPreviewImageAsync() { var imagePath = Result.PreviewImage ?? Result.IcoPath; // We need to modify the property not field here to trigger the OnPropertyChanged event - //PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); - PreviewImage = ShellFolder.FromParsingName(imagePath).Thumbnail.LargeBitmapSource; + PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); } public Result Result { get; } From 7fd06dae31d6f360c7373124b7d9757c4cf492c2 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 14 Nov 2022 02:07:46 +0900 Subject: [PATCH 24/73] Fix Conflict --- Flow.Launcher/MainWindow.xaml | 52 ----------------------------------- 1 file changed, 52 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 1f536974e9b..cb7cc07aea1 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -390,58 +390,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 1d674c4d0e2a71a95a8533d2d2700cd0c576173e Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 19 Nov 2022 00:03:01 +0900 Subject: [PATCH 25/73] Split Preview Style --- Flow.Launcher/MainWindow.xaml | 198 +++++++++++---------- Flow.Launcher/Themes/Atom.xaml | 17 +- Flow.Launcher/Themes/Base.xaml | 35 +++- Flow.Launcher/Themes/BlackAndWhite.xaml | 74 ++++++-- Flow.Launcher/Themes/BlurBlack Darker.xaml | 13 ++ Flow.Launcher/Themes/BlurBlack.xaml | 12 ++ Flow.Launcher/Themes/BlurWhite.xaml | 12 ++ Flow.Launcher/Themes/Darker Glass.xaml | 19 +- Flow.Launcher/Themes/Darker.xaml | 12 ++ Flow.Launcher/Themes/Discord Dark.xaml | 19 +- Flow.Launcher/Themes/Dracula.xaml | 20 ++- Flow.Launcher/Themes/Gray.xaml | 12 ++ Flow.Launcher/Themes/League.xaml | 19 +- Flow.Launcher/Themes/Light.xaml | 115 ++++++++---- Flow.Launcher/Themes/Metro Server.xaml | 17 +- Flow.Launcher/Themes/Nord Darker.xaml | 14 +- Flow.Launcher/Themes/Nord.xaml | 17 +- Flow.Launcher/Themes/Pink.xaml | 13 ++ Flow.Launcher/Themes/Sublime.xaml | 17 +- Flow.Launcher/Themes/Win10Light.xaml | 17 +- Flow.Launcher/Themes/Win11Dark.xaml | 17 +- Flow.Launcher/Themes/Win11Light.xaml | 12 ++ Flow.Launcher/Themes/Win11System.xaml | 19 +- 23 files changed, 563 insertions(+), 157 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index cb7cc07aea1..8a9e026a2ab 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -1,4 +1,5 @@ - - - - - - + + + + - - - - - - - - - - - + + - - - - + - - - - - - - - - - - - + - - - - + + + - - + - - - - + + + - - + + - + - + Text="{Binding DateText}" + Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" /> + - - - - + Style="{DynamicResource PreviewItemSubTitleStyle}" + Text="{Binding Result.SubTitle}" /> diff --git a/Flow.Launcher/Themes/Atom.xaml b/Flow.Launcher/Themes/Atom.xaml index c1fcd90d115..87c2e6e831a 100644 --- a/Flow.Launcher/Themes/Atom.xaml +++ b/Flow.Launcher/Themes/Atom.xaml @@ -167,7 +167,22 @@ TargetType="{x:Type TextBlock}"> - + + diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 92b842c6938..0bc64ddfd17 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"> - + + + + + + + + diff --git a/Flow.Launcher/Themes/BlackAndWhite.xaml b/Flow.Launcher/Themes/BlackAndWhite.xaml index 395f5d614bc..5c7b03d2636 100644 --- a/Flow.Launcher/Themes/BlackAndWhite.xaml +++ b/Flow.Launcher/Themes/BlackAndWhite.xaml @@ -1,44 +1,80 @@ - + - - - - - - - - - #494949 - @@ -50,4 +86,16 @@ + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/BlurBlack Darker.xaml b/Flow.Launcher/Themes/BlurBlack Darker.xaml index 6dc0db45e67..9e8a6f09574 100644 --- a/Flow.Launcher/Themes/BlurBlack Darker.xaml +++ b/Flow.Launcher/Themes/BlurBlack Darker.xaml @@ -156,4 +156,17 @@ + + diff --git a/Flow.Launcher/Themes/BlurBlack.xaml b/Flow.Launcher/Themes/BlurBlack.xaml index 5a0023d4a19..60237fdac8b 100644 --- a/Flow.Launcher/Themes/BlurBlack.xaml +++ b/Flow.Launcher/Themes/BlurBlack.xaml @@ -137,4 +137,16 @@ + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index 6308f9e47a4..f0532799001 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -157,4 +157,16 @@ + + diff --git a/Flow.Launcher/Themes/Darker Glass.xaml b/Flow.Launcher/Themes/Darker Glass.xaml index 41f2d16bf99..80a9c353b51 100644 --- a/Flow.Launcher/Themes/Darker Glass.xaml +++ b/Flow.Launcher/Themes/Darker Glass.xaml @@ -150,7 +150,24 @@ TargetType="{x:Type TextBlock}"> - + + + + diff --git a/Flow.Launcher/Themes/Darker.xaml b/Flow.Launcher/Themes/Darker.xaml index b255c4d9eb4..3c4438384bd 100644 --- a/Flow.Launcher/Themes/Darker.xaml +++ b/Flow.Launcher/Themes/Darker.xaml @@ -94,4 +94,16 @@ TargetType="{x:Type TextBlock}"> + + diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml index b8872385ef0..df0f143cbb3 100644 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ b/Flow.Launcher/Themes/Discord Dark.xaml @@ -165,7 +165,22 @@ TargetType="{x:Type TextBlock}"> - + + + diff --git a/Flow.Launcher/Themes/Dracula.xaml b/Flow.Launcher/Themes/Dracula.xaml index 0dd97b9fe2d..93cad211e8d 100644 --- a/Flow.Launcher/Themes/Dracula.xaml +++ b/Flow.Launcher/Themes/Dracula.xaml @@ -167,8 +167,22 @@ TargetType="{x:Type TextBlock}"> - - + + + diff --git a/Flow.Launcher/Themes/Gray.xaml b/Flow.Launcher/Themes/Gray.xaml index 1cacc8ec22d..487c9a839fc 100644 --- a/Flow.Launcher/Themes/Gray.xaml +++ b/Flow.Launcher/Themes/Gray.xaml @@ -126,4 +126,16 @@ TargetType="{x:Type TextBlock}"> + + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index d926f0519e3..70f63cb761f 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -130,9 +130,24 @@ TargetType="{x:Type TextBlock}"> - + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Light.xaml b/Flow.Launcher/Themes/Light.xaml index dae40e9eb12..97dd09a79a8 100644 --- a/Flow.Launcher/Themes/Light.xaml +++ b/Flow.Launcher/Themes/Light.xaml @@ -1,63 +1,103 @@ - + - + - - - - - - + - - - #d9d9d9 - - - - - + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Metro Server.xaml b/Flow.Launcher/Themes/Metro Server.xaml index 1b6795b5947..d6b3ed52b51 100644 --- a/Flow.Launcher/Themes/Metro Server.xaml +++ b/Flow.Launcher/Themes/Metro Server.xaml @@ -110,7 +110,22 @@ - + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml index 3946b91ff6c..9f32a3add8a 100644 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ b/Flow.Launcher/Themes/Nord Darker.xaml @@ -131,5 +131,17 @@ + + + diff --git a/Flow.Launcher/Themes/Nord.xaml b/Flow.Launcher/Themes/Nord.xaml index dafb83c39ca..8c9a092ccf2 100644 --- a/Flow.Launcher/Themes/Nord.xaml +++ b/Flow.Launcher/Themes/Nord.xaml @@ -128,7 +128,22 @@ TargetType="{x:Type TextBlock}"> - + + diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index 7e1ae911a7a..f3fd4cdaced 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -125,4 +125,17 @@ TargetType="{x:Type TextBlock}"> + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index 4cc2248f35d..0373467cdc8 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -164,7 +164,22 @@ TargetType="{x:Type TextBlock}"> - + + diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index 7d3ae2cac5c..af3c45260cf 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -167,7 +167,22 @@ TargetType="{x:Type TextBlock}"> - + + diff --git a/Flow.Launcher/Themes/Win11Dark.xaml b/Flow.Launcher/Themes/Win11Dark.xaml index 1558bd1f403..edf765a2df3 100644 --- a/Flow.Launcher/Themes/Win11Dark.xaml +++ b/Flow.Launcher/Themes/Win11Dark.xaml @@ -168,7 +168,22 @@ TargetType="{x:Type TextBlock}"> - + + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 731246565f3..d55974570b6 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -179,4 +179,16 @@ + + diff --git a/Flow.Launcher/Themes/Win11System.xaml b/Flow.Launcher/Themes/Win11System.xaml index d136d24a8f9..1d1a4d4372a 100644 --- a/Flow.Launcher/Themes/Win11System.xaml +++ b/Flow.Launcher/Themes/Win11System.xaml @@ -168,7 +168,24 @@ TargetType="{x:Type TextBlock}"> - + + From 00a4d62b2220b37838338c5f06e4e6bb0859f9d1 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 25 Nov 2022 22:03:17 +0900 Subject: [PATCH 26/73] - Temp Fix Confict / Change F2 to F1 --- Flow.Launcher/Languages/en.xaml | 2 +- Flow.Launcher/MainWindow.xaml.cs | 2 +- Flow.Launcher/ViewModel/ResultViewModel.cs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 2b47935abcb..73f7158d6a3 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -67,7 +67,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always open preview when start search - If uncheck, preview not showing when start launch. Please use F2 key + If uncheck, preview not showing when start launch. Please use F1 key Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 623b4f3c72d..4db2ade691a 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -619,7 +619,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.F2: + case Key.F1: PreviewToggle(); e.Handled = true; break; diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 37b83825108..25a48204d28 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -202,8 +202,10 @@ private async Task LoadImageAsync() private async ValueTask LoadPreviewImageAsync() { var imagePath = Result.PreviewImage ?? Result.IcoPath; + var loadFullImage = (Path.GetExtension(imagePath) ?? "").Equals(".url", StringComparison.OrdinalIgnoreCase); // We need to modify the property not field here to trigger the OnPropertyChanged event - PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); + //PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false); + PreviewImage = await ImageLoader.LoadAsync(imagePath, loadFullImage).ConfigureAwait(false); } public Result Result { get; } From 124318f96ab2e88c6202908f43b6625fee08ed67 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 26 Nov 2022 00:32:48 +0900 Subject: [PATCH 27/73] - Adjust Themes for Preview --- Flow.Launcher/Themes/Base.xaml | 8 ++++---- Flow.Launcher/Themes/BlurBlack Darker.xaml | 16 +++++++++++++++- Flow.Launcher/Themes/BlurBlack.xaml | 15 +++++++++++++++ Flow.Launcher/Themes/BlurWhite.xaml | 6 ++++++ Flow.Launcher/Themes/Bullet Light.xaml | 20 +++++++++++++++++++- Flow.Launcher/Themes/Circle Light.xaml | 8 ++++---- Flow.Launcher/Themes/Circle System.xaml | 20 +++++++++++++++++++- Flow.Launcher/Themes/Cyan Dark.xaml | 21 ++++++++++++++++++++- Flow.Launcher/Themes/Darker Glass.xaml | 2 +- Flow.Launcher/Themes/Discord Dark.xaml | 3 ++- Flow.Launcher/Themes/Dracula.xaml | 3 ++- Flow.Launcher/Themes/Gray.xaml | 16 +++++++++++++--- Flow.Launcher/Themes/League.xaml | 5 ++--- Flow.Launcher/Themes/Midnight.xaml | 7 ++++--- Flow.Launcher/Themes/Nord Darker.xaml | 14 +++++++++++++- Flow.Launcher/Themes/Pink.xaml | 16 +++++++++++++++- Flow.Launcher/Themes/Sublime.xaml | 1 + Flow.Launcher/Themes/Ubuntu.xaml | 20 +++++++++++++++++++- Flow.Launcher/Themes/Win10Light.xaml | 3 ++- Flow.Launcher/Themes/Win11Dark.xaml | 1 + Flow.Launcher/Themes/Win11Light.xaml | 8 ++++++-- Flow.Launcher/Themes/Win11System.xaml | 1 + 22 files changed, 184 insertions(+), 30 deletions(-) diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 776ce001952..e28e60e072e 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -414,6 +414,7 @@ diff --git a/Flow.Launcher/Themes/BlurBlack Darker.xaml b/Flow.Launcher/Themes/BlurBlack Darker.xaml index 904c7ead41d..a8de180d866 100644 --- a/Flow.Launcher/Themes/BlurBlack Darker.xaml +++ b/Flow.Launcher/Themes/BlurBlack Darker.xaml @@ -37,7 +37,6 @@ x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}"> - @@ -48,6 +47,15 @@ + + + + + + + @@ -181,4 +181,22 @@ TargetType="{x:Type TextBlock}"> + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Circle Light.xaml b/Flow.Launcher/Themes/Circle Light.xaml index 316023ab3a7..57e0da8326b 100644 --- a/Flow.Launcher/Themes/Circle Light.xaml +++ b/Flow.Launcher/Themes/Circle Light.xaml @@ -69,7 +69,7 @@ x:Key="SeparatorStyle" BasedOn="{StaticResource BaseSeparatorStyle}" TargetType="{x:Type Rectangle}"> - + @@ -167,18 +167,18 @@ x:Key="PreviewBorderStyle" BasedOn="{StaticResource BasePreviewBorderStyle}" TargetType="{x:Type Border}"> - + diff --git a/Flow.Launcher/Themes/Circle System.xaml b/Flow.Launcher/Themes/Circle System.xaml index b00f03e7601..811b278fa74 100644 --- a/Flow.Launcher/Themes/Circle System.xaml +++ b/Flow.Launcher/Themes/Circle System.xaml @@ -70,7 +70,7 @@ x:Key="SeparatorStyle" BasedOn="{StaticResource BaseSeparatorStyle}" TargetType="{x:Type Rectangle}"> - + @@ -164,4 +164,22 @@ TargetType="{x:Type TextBlock}"> + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Cyan Dark.xaml b/Flow.Launcher/Themes/Cyan Dark.xaml index c79044f0051..77e4b06bc42 100644 --- a/Flow.Launcher/Themes/Cyan Dark.xaml +++ b/Flow.Launcher/Themes/Cyan Dark.xaml @@ -164,7 +164,7 @@ 0 0 - 0 0 0 0 + 0 0 0 4 + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Darker Glass.xaml b/Flow.Launcher/Themes/Darker Glass.xaml index 1f079de052c..d97789b907f 100644 --- a/Flow.Launcher/Themes/Darker Glass.xaml +++ b/Flow.Launcher/Themes/Darker Glass.xaml @@ -5,7 +5,7 @@ - + 0 0 0 8 + + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index f014ed05593..7b42b1cd903 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -141,9 +141,8 @@ x:Key="PreviewBorderStyle" BasedOn="{StaticResource BasePreviewBorderStyle}" TargetType="{x:Type Border}"> - - - + + diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml index 20f9b16c4c8..d7641afec8f 100644 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ b/Flow.Launcher/Themes/Nord Darker.xaml @@ -3,6 +3,7 @@ + 0 0 0 8 + - + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index e03ab7c43cf..9f46a8077c8 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -5,6 +5,7 @@ + 0 0 0 8 + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index c03f6ce1d14..28737d14ed4 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -5,6 +5,7 @@ + 0 0 0 4 - + diff --git a/Flow.Launcher/Themes/Win11System.xaml b/Flow.Launcher/Themes/Win11System.xaml index 93b761ba28c..63d7af0736c 100644 --- a/Flow.Launcher/Themes/Win11System.xaml +++ b/Flow.Launcher/Themes/Win11System.xaml @@ -6,6 +6,7 @@ + 0 0 0 8 @@ -325,57 +326,57 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + VerticalAlignment="Center"> + + + + + + + diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index e28e60e072e..e3ad6360ec5 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -478,7 +478,8 @@ + - - - + - - - - + + + - @@ -351,14 +338,16 @@ - - - + + + - @@ -367,52 +356,64 @@ - - - + + + - - - - + - + - - - + + + + + - - + diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index fca37a35932..1bfaa9c5269 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -20,47 +20,51 @@ public class ResultViewModel : BaseModel public ResultViewModel(Result result, Settings settings) { - if (result != null) + Settings = settings; + + if (result == null) { - Result = result; + return; + } + Result = result; + + PreviewExtension = Path.GetExtension(result.PreviewImage ?? result.IcoPath); - if (Result.Glyph is { FontFamily: not null } glyph) + if (Result.Glyph is { FontFamily: not null } glyph) + { + // Checks if it's a system installed font, which does not require path to be provided. + if (glyph.FontFamily.EndsWith(".ttf") || glyph.FontFamily.EndsWith(".otf")) { - // Checks if it's a system installed font, which does not require path to be provided. - if (glyph.FontFamily.EndsWith(".ttf") || glyph.FontFamily.EndsWith(".otf")) - { - string fontFamilyPath = glyph.FontFamily; + string fontFamilyPath = glyph.FontFamily; - if (!Path.IsPathRooted(fontFamilyPath)) - { - fontFamilyPath = Path.Combine(Result.PluginDirectory, fontFamilyPath); - } + if (!Path.IsPathRooted(fontFamilyPath)) + { + fontFamilyPath = Path.Combine(Result.PluginDirectory, fontFamilyPath); + } - if (fonts.ContainsKey(fontFamilyPath)) - { - Glyph = glyph with - { - FontFamily = fonts[fontFamilyPath] - }; - } - else + if (fonts.ContainsKey(fontFamilyPath)) + { + Glyph = glyph with { - fontCollection.AddFontFile(fontFamilyPath); - fonts[fontFamilyPath] = $"{Path.GetDirectoryName(fontFamilyPath)}/#{fontCollection.Families[^1].Name}"; - Glyph = glyph with - { - FontFamily = fonts[fontFamilyPath] - }; - } + FontFamily = fonts[fontFamilyPath] + }; } else { - Glyph = glyph; + fontCollection.AddFontFile(fontFamilyPath); + fonts[fontFamilyPath] = $"{Path.GetDirectoryName(fontFamilyPath)}/#{fontCollection.Families[^1].Name}"; + Glyph = glyph with + { + FontFamily = fonts[fontFamilyPath] + }; } } + else + { + Glyph = glyph; + } } - Settings = settings; } private Settings Settings { get; } @@ -165,6 +169,13 @@ public ImageSource PreviewImage private set => previewImage = value; } + public string PreviewExtension { get; set; } + + public bool PreviewIsImageOrVideo => PreviewExtension is ".jpg" + or ".png" + or ".gif" + or ".mp4"; + public GlyphInfo Glyph { get; set; } private async Task LoadImageAsync() From c622edab99bcffc901de1cd55fdf8610c514d49e Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 26 Nov 2022 06:12:23 +0900 Subject: [PATCH 33/73] Add FileType / Ignore Case Senstive --- Flow.Launcher/ViewModel/ResultViewModel.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 1bfaa9c5269..20ea9cf7cc8 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -29,6 +29,11 @@ public ResultViewModel(Result result, Settings settings) Result = result; PreviewExtension = Path.GetExtension(result.PreviewImage ?? result.IcoPath); + if (PreviewExtension != null) + { + PreviewExtension = PreviewExtension.ToLowerInvariant(); + + } if (Result.Glyph is { FontFamily: not null } glyph) { @@ -173,7 +178,11 @@ public ImageSource PreviewImage public bool PreviewIsImageOrVideo => PreviewExtension is ".jpg" or ".png" + or ".avi" + or ".mkv" + or ".bmp" or ".gif" + or ".wmv" or ".mp4"; public GlyphInfo Glyph { get; set; } From c59449debd0b5c10ee792ffb359263c49ca04ae3 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 26 Nov 2022 15:31:22 +0900 Subject: [PATCH 34/73] Change String --- Flow.Launcher/Languages/en.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index abc81744e98..ffb3b30eb70 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -66,8 +66,8 @@ Changes minimum match score required for results. Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. - Always display preview panel when open flow - If uncheck, preview not showing when start flow. Please use F1 key to toggle. + Always Preview + Preview will display when start flow. Shadow effect is not allowed while current theme has blur effect enabled From 24e526b03d71c313f3890da742f5c9583a7b9a6b Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 26 Nov 2022 14:33:42 +0800 Subject: [PATCH 35/73] fix typo --- Flow.Launcher/MainWindow.xaml | 2 +- Flow.Launcher/ViewModel/ResultViewModel.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 1207034ae2d..231b0019bcf 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -429,7 +429,7 @@ + Visibility="{Binding ShowCustomizedPreview}" /> diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 20ea9cf7cc8..9e277495117 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -32,8 +32,8 @@ public ResultViewModel(Result result, Settings settings) if (PreviewExtension != null) { PreviewExtension = PreviewExtension.ToLowerInvariant(); - } + else if () if (Result.Glyph is { FontFamily: not null } glyph) { @@ -79,7 +79,7 @@ public ResultViewModel(Result result, Settings settings) public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed; - public Visibility ShowCustomizedPrewview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible; + public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible; public Visibility ShowIcon { From 9cdbb3ada1d7c13c4799c37925a6f4511c8f3a75 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 26 Nov 2022 14:51:11 +0800 Subject: [PATCH 36/73] fix uwp preview image --- Flow.Launcher/ViewModel/ResultViewModel.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 9e277495117..d58ecdfc3b1 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -33,7 +33,6 @@ public ResultViewModel(Result result, Settings settings) { PreviewExtension = PreviewExtension.ToLowerInvariant(); } - else if () if (Result.Glyph is { FontFamily: not null } glyph) { @@ -222,7 +221,16 @@ private async Task LoadImageAsync() private async Task LoadPreviewImageAsync() { var imagePath = Result.PreviewImage ?? Result.IcoPath; - PreviewImage = await ImageLoader.LoadAsync(imagePath, true).ConfigureAwait(false); + if (imagePath == null && Result.Icon != null) + { + // For UWP programs from program plugin + // TODO: Consider https://github.com/Flow-Launcher/Flow.Launcher/pull/1492#issuecomment-1304829947 + PreviewImage = Result.Icon(); + } + else + { + PreviewImage = await ImageLoader.LoadAsync(imagePath, true).ConfigureAwait(false); + } } public Result Result { get; } From 3c229fc69f9dcfb27cf5b38d4b6b526d429aa39a Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 26 Nov 2022 14:56:37 +0800 Subject: [PATCH 37/73] Update preview tooltip --- Flow.Launcher/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index ffb3b30eb70..a8511bb4e8a 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -67,7 +67,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Preview will display when start flow. + Always open preview panel when Flow starts. Press F1 to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled From ca6c6cb62a939fa074dfaf863feb60601f0e29f9 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sat, 26 Nov 2022 10:16:04 -0600 Subject: [PATCH 38/73] Use loading.png for loading time image placeholder --- Flow.Launcher.Infrastructure/Constant.cs | 1 + Flow.Launcher.Infrastructure/Image/ImageLoader.cs | 5 +++-- Flow.Launcher/Images/loading.png | Bin 0 -> 164 bytes Flow.Launcher/ViewModel/PluginViewModel.cs | 4 ++-- Flow.Launcher/ViewModel/ResultViewModel.cs | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 Flow.Launcher/Images/loading.png diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index b0eebd2df5d..56f421e30cc 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -29,6 +29,7 @@ public static class Constant public static readonly string DefaultIcon = Path.Combine(ImagesDirectory, "app.png"); public static readonly string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png"); public static readonly string MissingImgIcon = Path.Combine(ImagesDirectory, "app_missing_img.png"); + public static readonly string LoadingImgIcon = Path.Combine(ImagesDirectory, "loading.png"); public static string PythonPath; diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index 13022137960..416c66d246c 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -21,7 +21,8 @@ public static class ImageLoader private static readonly ConcurrentDictionary GuidToKey = new(); private static IImageHashGenerator _hashGenerator; private static readonly bool EnableImageHash = true; - public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon)); + public static ImageSource MissingImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon)); + public static ImageSource LoadingImage { get; } = new BitmapImage(new Uri(Constant.LoadingImgIcon)); public const int SmallIconSize = 32; @@ -111,7 +112,7 @@ private static async ValueTask LoadInternalAsync(string path, bool { if (string.IsNullOrEmpty(path)) { - return new ImageResult(DefaultImage, ImageType.Error); + return new ImageResult(MissingImage, ImageType.Error); } if (ImageCache.ContainsKey(path, loadFullImage)) diff --git a/Flow.Launcher/Images/loading.png b/Flow.Launcher/Images/loading.png new file mode 100644 index 0000000000000000000000000000000000000000..2e2263a4daace5e6b301afeec8a9adb669ed97b8 GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWw1GZk{fVAr-gYoM+@@aNuAu_?xn9_nmDO0^8VLs|2_2weoWy e1Rl&6O<*{)gvqG9A?z^FL PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed; public string InitilizaTime => PluginPair.Metadata.InitTime + "ms"; diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 2d61f6cabd3..53a7ffbb2c0 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -126,7 +126,7 @@ public Visibility ShowGlyph private volatile bool ImageLoaded; - private ImageSource image = ImageLoader.DefaultImage; + private ImageSource image = ImageLoader.LoadingImage; public ImageSource Image { @@ -168,7 +168,7 @@ private async Task LoadImageAsync() if (ImageLoader.CacheContainImage(imagePath)) { // will get here either when icoPath has value\icon delegate is null\when had exception in delegate - image = await ImageLoader.LoadAsync(imagePath, loadFullImage); + image = await ImageLoader.LoadAsync(imagePath, loadFullImage).ConfigureAwait(false); return; } From 91a46f7cad36fd527127108210e1a6e42c8b9746 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 27 Nov 2022 01:29:04 +0900 Subject: [PATCH 39/73] Fix Conflict --- Flow.Launcher/ViewModel/ResultViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index d63fed7eed4..ece8ae92ca7 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -141,7 +141,7 @@ public Visibility ShowGlyph private volatile bool PreviewImageLoaded; private ImageSource image = ImageLoader.LoadingImage; - private ImageSource previewImage = ImageLoader.DefaultImage; + private ImageSource previewImage = ImageLoader.LoadingImage; public ImageSource Image { From e5a19cc9e0545d9cb4e966aa0e7bfa748a8419b2 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 27 Nov 2022 01:42:17 +0900 Subject: [PATCH 40/73] Change Loading Icon / Rmove Opacity in Darker Theme --- Flow.Launcher/Images/loading.png | Bin 164 -> 1435 bytes Flow.Launcher/Themes/Darker Glass.xaml | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Flow.Launcher/Images/loading.png b/Flow.Launcher/Images/loading.png index 2e2263a4daace5e6b301afeec8a9adb669ed97b8..ee6d1b85a790166ad9ad2ec8cbf953d34f52695b 100644 GIT binary patch literal 1435 zcmbVMJ#W)M7&a|Jw5SpSAt9tn#$7tzMs+yf7&U!c@6b zT<0T5zLO{Tzc%*!5g#VP((PCfPMuA@W5UyC=LO;Tj#u4a8}x1Nwtg(?65$ZUTHfbmF?9k-rmHfBQ0JP7rKxW_=F*` z>$id!b}gyT3;8_RRwc0yVVjnePXvk^_L^9r5fQVBE@J?Im^GEm{5+}S%oR}wx~_tZ z3QQSfp{_&S6o-$*#YK(_*NZDdVSHstO~yi~s+~?p=@<%)8meZRrV4ab*JX~7<6gi} zR}SKt5kry0IPyZ~(LhWXQJuD#C2>^;Huzym8^l9DagV886snp65}W!!2dB8O9ku$x z9juZT@kzj9j@43Z*rbfcP5KY&^mvZ|?pxbVW$deq@24VSw!Fp77&>HMbX@I)L|rE_ zZAX|aZ*ete5^F+OhzMdds#4k-MQUxNvZx!%oOr3`1rF`Rmv>ztMZ}0DB~g<#P1dtj zpg|qLj5Z5Q2*3bpQ^#|A`#}u@X7oK!o-+<&=s>W8p-Uqlaf3Y{HHaDp4M|Mh2n)1D zBQBV0XY{qOZCDOsh5}5=MN8r~E1u`TIY3X){%LVf=f~Ymb{n;t2eBO3b{X=wLGz(1rXsRyDbSPVI__< z-1d&_fdOr&NjT|$!aab+)MXtMk$i)D>%eqUx$6h ejo&%M`(=FP``DQ`uV>FC?X$eRT6}fw?!!N`wYuH_ literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWw1GZk{fVAr-gYoM+@@aNuAu_?xn9_nmDO0^8VLs|2_2weoWy e1Rl&6O<*{)gvqG9A?z^FL - + - - - - + - - - - + + + - @@ -338,16 +351,14 @@ - - - + + + - @@ -356,43 +367,52 @@ - - - + + + - - - - + - + - - + + + + + + - - + - - + diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 5c6a0ac68ed..e1d2d160614 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -406,6 +406,15 @@ + - + + diff --git a/Flow.Launcher/Themes/BlurBlack.xaml b/Flow.Launcher/Themes/BlurBlack.xaml index 2cd36756577..0f126429242 100644 --- a/Flow.Launcher/Themes/BlurBlack.xaml +++ b/Flow.Launcher/Themes/BlurBlack.xaml @@ -162,4 +162,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index 4fa39441ad2..4406724b8ec 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -173,4 +173,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Bullet Light.xaml b/Flow.Launcher/Themes/Bullet Light.xaml index 6a2b5cfbbc1..1f776a2eee4 100644 --- a/Flow.Launcher/Themes/Bullet Light.xaml +++ b/Flow.Launcher/Themes/Bullet Light.xaml @@ -200,4 +200,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Circle Light.xaml b/Flow.Launcher/Themes/Circle Light.xaml index 57e0da8326b..e52e3a9570f 100644 --- a/Flow.Launcher/Themes/Circle Light.xaml +++ b/Flow.Launcher/Themes/Circle Light.xaml @@ -181,4 +181,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Circle System.xaml b/Flow.Launcher/Themes/Circle System.xaml index 811b278fa74..2b2ce7ca33d 100644 --- a/Flow.Launcher/Themes/Circle System.xaml +++ b/Flow.Launcher/Themes/Circle System.xaml @@ -182,4 +182,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Cyan Dark.xaml b/Flow.Launcher/Themes/Cyan Dark.xaml index 77e4b06bc42..60bc090022f 100644 --- a/Flow.Launcher/Themes/Cyan Dark.xaml +++ b/Flow.Launcher/Themes/Cyan Dark.xaml @@ -202,4 +202,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Darker Glass.xaml b/Flow.Launcher/Themes/Darker Glass.xaml index 140234e01d0..89b6dfa0181 100644 --- a/Flow.Launcher/Themes/Darker Glass.xaml +++ b/Flow.Launcher/Themes/Darker Glass.xaml @@ -165,5 +165,10 @@ TargetType="{x:Type TextBlock}"> - + diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml index ec957dd947b..5315c7644a1 100644 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ b/Flow.Launcher/Themes/Discord Dark.xaml @@ -183,4 +183,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Dracula.xaml b/Flow.Launcher/Themes/Dracula.xaml index c156d888507..ce335072862 100644 --- a/Flow.Launcher/Themes/Dracula.xaml +++ b/Flow.Launcher/Themes/Dracula.xaml @@ -185,4 +185,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Gray.xaml b/Flow.Launcher/Themes/Gray.xaml index cf93d3a6048..d8d344e216d 100644 --- a/Flow.Launcher/Themes/Gray.xaml +++ b/Flow.Launcher/Themes/Gray.xaml @@ -186,4 +186,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index 7b42b1cd903..7fbe56187ad 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -156,4 +156,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Midnight.xaml b/Flow.Launcher/Themes/Midnight.xaml index b00cde676a6..91ff620d54e 100644 --- a/Flow.Launcher/Themes/Midnight.xaml +++ b/Flow.Launcher/Themes/Midnight.xaml @@ -182,4 +182,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml index d7641afec8f..d9ddb307664 100644 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ b/Flow.Launcher/Themes/Nord Darker.xaml @@ -155,4 +155,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index f0d234007dc..dc97e432055 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -152,4 +152,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index 9f46a8077c8..6df69ad3e72 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -182,4 +182,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Ubuntu.xaml b/Flow.Launcher/Themes/Ubuntu.xaml index 244d80309d5..33f232699a4 100644 --- a/Flow.Launcher/Themes/Ubuntu.xaml +++ b/Flow.Launcher/Themes/Ubuntu.xaml @@ -206,4 +206,10 @@ TargetType="{x:Type TextBlock}"> + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index 28737d14ed4..5f837bdb393 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -184,4 +184,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Win11Dark.xaml b/Flow.Launcher/Themes/Win11Dark.xaml index 89e83d86e76..5abb96cce0d 100644 --- a/Flow.Launcher/Themes/Win11Dark.xaml +++ b/Flow.Launcher/Themes/Win11Dark.xaml @@ -186,4 +186,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 47125eb4bf0..e2c37236cbf 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -200,4 +200,10 @@ TargetType="{x:Type TextBlock}"> + diff --git a/Flow.Launcher/Themes/Win11System.xaml b/Flow.Launcher/Themes/Win11System.xaml index 63d7af0736c..df09249beb6 100644 --- a/Flow.Launcher/Themes/Win11System.xaml +++ b/Flow.Launcher/Themes/Win11System.xaml @@ -194,4 +194,10 @@ + From bca2145aeaa7b73c181ed3c12c26dc05d1dda90c Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 27 Nov 2022 15:48:37 +0900 Subject: [PATCH 46/73] Add Darker Theme (Garul'fs request) --- Flow.Launcher/Themes/Darker.xaml | 100 +++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Flow.Launcher/Themes/Darker.xaml diff --git a/Flow.Launcher/Themes/Darker.xaml b/Flow.Launcher/Themes/Darker.xaml new file mode 100644 index 00000000000..d1abbe9789f --- /dev/null +++ b/Flow.Launcher/Themes/Darker.xaml @@ -0,0 +1,100 @@ + + + + + 0 0 0 8 + + + + + + + + #4d4d4d + + + + + + From 26a713985c739e3e6c9a612a3595dabb98796949 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 27 Nov 2022 16:58:26 +0900 Subject: [PATCH 47/73] Add flac/mp3 (for large coverart) --- Flow.Launcher/ViewModel/ResultViewModel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 1eded59c77b..99528a9a74c 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -182,6 +182,8 @@ public ImageSource PreviewImage or ".bmp" or ".gif" or ".wmv" + or ".mp3" + or ".flac" or ".mp4"; public GlyphInfo Glyph { get; set; } From 1e8fe9342b5794a98df8a22dc5e77ea688b9a90f Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 27 Nov 2022 17:54:56 +0900 Subject: [PATCH 48/73] Change Loading Image / Change Stretch for small icons (under 128) --- Flow.Launcher/Images/loading.png | Bin 1435 -> 274 bytes Flow.Launcher/MainWindow.xaml | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/Images/loading.png b/Flow.Launcher/Images/loading.png index ee6d1b85a790166ad9ad2ec8cbf953d34f52695b..1600b5967ed39c48a5dea2678d9f57a70412603d 100644 GIT binary patch delta 246 zcmbQuJ&9?8O1)%>YeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_p*Lo-U3d z6}R5ZI>_6gAi#1p;&iBoWXO)Q52m*(dGVB|eRE&5;qlv7$G1+|vd$@?2>>E5XG;J8 literal 1435 zcmbVMJ#W)M7&a|Jw5SpSAt9tn#$7tzMs+yf7&U!c@6b zT<0T5zLO{Tzc%*!5g#VP((PCfPMuA@W5UyC=LO;Tj#u4a8}x1Nwtg(?65$ZUTHfbmF?9k-rmHfBQ0JP7rKxW_=F*` z>$id!b}gyT3;8_RRwc0yVVjnePXvk^_L^9r5fQVBE@J?Im^GEm{5+}S%oR}wx~_tZ z3QQSfp{_&S6o-$*#YK(_*NZDdVSHstO~yi~s+~?p=@<%)8meZRrV4ab*JX~7<6gi} zR}SKt5kry0IPyZ~(LhWXQJuD#C2>^;Huzym8^l9DagV886snp65}W!!2dB8O9ku$x z9juZT@kzj9j@43Z*rbfcP5KY&^mvZ|?pxbVW$deq@24VSw!Fp77&>HMbX@I)L|rE_ zZAX|aZ*ete5^F+OhzMdds#4k-MQUxNvZx!%oOr3`1rF`Rmv>ztMZ}0DB~g<#P1dtj zpg|qLj5Z5Q2*3bpQ^#|A`#}u@X7oK!o-+<&=s>W8p-Uqlaf3Y{HHaDp4M|Mh2n)1D zBQBV0XY{qOZCDOsh5}5=MN8r~E1u`TIY3X){%LVf=f~Ymb{n;t2eBO3b{X=wLGz(1rXsRyDbSPVI__< z-1d&_fdOr&NjT|$!aab+)MXtMk$i)D>%eqUx$6h ejo&%M`(=FP``DQ`uV>FC?X$eRT6}fw?!!N`wYuH_ diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 10e97074b7a..6d1c0958bdd 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -413,11 +413,12 @@ + - + + + + + +