From 7b7e038900123a283953202235380eff16c6b48f Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 2 Sep 2022 15:12:32 +0900 Subject: [PATCH] - Add 'Always open priview' in settings --- .../UserSettings/Settings.cs | 5 +++-- Flow.Launcher/Languages/en.xaml | 2 ++ Flow.Launcher/MainWindow.xaml.cs | 18 ++++++++++++++++-- Flow.Launcher/SettingWindow.xaml | 16 ++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 8ecd6dc4b..1e3c47210 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; @@ -137,6 +137,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings /// when false Alphabet static service will always return empty results /// public bool ShouldUsePinyin { get; set; } = false; + public bool AlwaysPreview { get; set; } = false; [JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))] public SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular; @@ -220,4 +221,4 @@ namespace Flow.Launcher.Infrastructure.UserSettings Light, Dark } -} \ No newline at end of file +} diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index bdf745052..e5775c119 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -56,6 +56,8 @@ Changes minimum match score required for results. Should Use 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. 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 8adc788cc..266a0b17e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -44,7 +44,7 @@ namespace Flow.Launcher _viewModel = mainVM; _settings = settings; InitializeComponent(); - InitializePosition(); + InitializePosition(); animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); } @@ -108,6 +108,7 @@ namespace Flow.Launcher } UpdatePosition(); + PreviewReset(); Activate(); QueryTextBox.Focus(); _settings.ActivateTimes++; @@ -309,7 +310,7 @@ namespace Flow.Launcher return; _animating = true; - UpdatePosition(); + UpdatePosition(); Storyboard sb = new Storyboard(); Storyboard iconsb = new Storyboard(); CircleEase easing = new CircleEase(); // or whatever easing class you want @@ -542,6 +543,19 @@ namespace Flow.Launcher } } + public void PreviewReset() + { + if (_settings.AlwaysPreview == true) + { + ResultArea.SetValue(Grid.ColumnSpanProperty, 1); + Preview.Visibility = Visibility.Visible; + } + else + { + ResultArea.SetValue(Grid.ColumnSpanProperty, 2); + Preview.Visibility = Visibility.Collapsed; + } + } public void PreviewToggle() { diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index ba6569771..2585943be 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -657,6 +657,22 @@ + + + + + + + + +  + + + +