diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 5c99bc239..4568e92f3 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -115,7 +115,11 @@ namespace Flow.Launcher.Core.Resource if (languageToSet != AvailableLanguages.Chinese && languageToSet != AvailableLanguages.Chinese_TW) return false; - if (MessageBox.Show("Do you want to turn on search with Pinyin?", string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) + // No other languages should show the following text so just make it hard-coded + // "Do you want to search with pinyin?" + string text = languageToSet == AvailableLanguages.Chinese ? "是否启用拼音搜索?" : "是否啓用拼音搜索?" ; + + if (MessageBox.Show(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No) return false; return true; @@ -221,4 +225,4 @@ namespace Flow.Launcher.Core.Resource } } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs b/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs new file mode 100644 index 000000000..3c46fd01a --- /dev/null +++ b/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs @@ -0,0 +1,19 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Flow.Launcher.Converters +{ + public class DateTimeFormatToNowConverter : IValueConverter + { + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value is not string format ? null : DateTime.Now.ToString(format); + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index de494da4b..89e886c61 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -64,8 +64,8 @@ When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window. Query Search Precision 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 + Search with Pinyin + Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Shadow effect is not allowed while current theme has blur effect enabled @@ -149,7 +149,7 @@ Built-in Shortcuts Query Shortcut - Expanded + Expansion Description Delete Edit diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index e0dc8043c..308ce1399 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -231,12 +231,16 @@ - - + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index efa43000b..59576b75c 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -30,6 +30,10 @@ using System.Windows.Data; using ModernWpf.Controls; using System.Drawing; using System.Windows.Forms.Design.Behavior; +using System.Security.Cryptography; +using System.Runtime.CompilerServices; +using Microsoft.VisualBasic.Devices; +using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames; namespace Flow.Launcher { @@ -103,7 +107,6 @@ namespace Flow.Launcher // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); - _viewModel.PropertyChanged += (o, e) => { switch (e.PropertyName) @@ -211,7 +214,9 @@ namespace Flow.Launcher Icon = Properties.Resources.app, Visible = !_settings.HideNotifyIcon }; + contextMenu = new ContextMenu(); + var openIcon = new FontIcon { Glyph = "\ue71e" @@ -258,9 +263,11 @@ namespace Flow.Launcher positionreset.Click += (o, e) => PositionReset(); settings.Click += (o, e) => App.API.OpenSettingDialog(); exit.Click += (o, e) => Close(); - contextMenu.Items.Add(open); + gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip"); positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip"); + + contextMenu.Items.Add(open); contextMenu.Items.Add(gamemode); contextMenu.Items.Add(positionreset); contextMenu.Items.Add(settings); @@ -368,11 +375,14 @@ namespace Flow.Launcher _animating = true; UpdatePosition(); - Storyboard sb = new Storyboard(); + + Storyboard windowsb = new Storyboard(); + Storyboard clocksb = new Storyboard(); Storyboard iconsb = new Storyboard(); - CircleEase easing = new CircleEase(); // or whatever easing class you want + CircleEase easing = new CircleEase(); easing.EasingMode = EasingMode.EaseInOut; - var da = new DoubleAnimation + + var WindowOpacity = new DoubleAnimation { From = 0, To = 1, @@ -380,14 +390,14 @@ namespace Flow.Launcher FillBehavior = FillBehavior.Stop }; - var da2 = new DoubleAnimation + var WindowMotion = new DoubleAnimation { From = Top + 10, To = Top, Duration = TimeSpan.FromSeconds(0.25), FillBehavior = FillBehavior.Stop }; - var da3 = new DoubleAnimation + var IconMotion = new DoubleAnimation { From = 12, To = 0, @@ -395,18 +405,61 @@ namespace Flow.Launcher Duration = TimeSpan.FromSeconds(0.36), FillBehavior = FillBehavior.Stop }; - Storyboard.SetTarget(da, this); - Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty)); - Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty)); - Storyboard.SetTargetProperty(da3, new PropertyPath(TopProperty)); - sb.Children.Add(da); - sb.Children.Add(da2); - iconsb.Children.Add(da3); - sb.Completed += (_, _) => _animating = false; + + var ClockOpacity = new DoubleAnimation + { + From = 0, + To = 1, + EasingFunction = easing, + Duration = TimeSpan.FromSeconds(0.36), + FillBehavior = FillBehavior.Stop + }; + double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style + var IconOpacity = new DoubleAnimation + { + From = 0, + To = TargetIconOpacity, + EasingFunction = easing, + Duration = TimeSpan.FromSeconds(0.36), + FillBehavior = FillBehavior.Stop + }; + + double right = ClockPanel.Margin.Right; + var thicknessAnimation = new ThicknessAnimation + { + From = new Thickness(0, 12, right, 0), + To = new Thickness(0, 0, right, 0), + EasingFunction = easing, + Duration = TimeSpan.FromSeconds(0.36), + FillBehavior = FillBehavior.Stop + }; + + Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty)); + Storyboard.SetTargetName(thicknessAnimation, "ClockPanel"); + Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty)); + Storyboard.SetTarget(WindowOpacity, this); + Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty)); + Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty)); + Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty)); + Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty)); + + clocksb.Children.Add(thicknessAnimation); + clocksb.Children.Add(ClockOpacity); + windowsb.Children.Add(WindowOpacity); + windowsb.Children.Add(WindowMotion); + iconsb.Children.Add(IconMotion); + iconsb.Children.Add(IconOpacity); + + windowsb.Completed += (_, _) => _animating = false; _settings.WindowLeft = Left; _settings.WindowTop = Top; + + if (QueryTextBox.Text.Length == 0) + { + clocksb.Begin(ClockPanel); + } iconsb.Begin(SearchIcon); - sb.Begin(FlowMainWindow); + windowsb.Begin(FlowMainWindow); } private void OnMouseDown(object sender, MouseButtonEventArgs e) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 5584983a9..c3473a167 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -39,6 +39,7 @@ + @@ -1815,13 +1816,25 @@ - - - + + + + + SelectedItem="{Binding TimeFormat}" /> + Style="{DynamicResource SideToggleSwitch}" />  @@ -2200,6 +2217,12 @@ Grid.Row="0" Grid.Column="2" Orientation="Horizontal"> + + SelectedItem="{Binding DateFormat}" /> + Style="{DynamicResource SideToggleSwitch}" />  diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 0100c31d1..9ceb9789d 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -10,17 +10,14 @@ using Flow.Launcher.ViewModel; using ModernWpf; using ModernWpf.Controls; using System; -using System.Drawing.Printing; using System.IO; using System.Windows; -using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Navigation; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; using Button = System.Windows.Controls.Button; using Control = System.Windows.Controls.Control; using KeyEventArgs = System.Windows.Input.KeyEventArgs; @@ -44,6 +41,7 @@ namespace Flow.Launcher API = api; InitializePosition(); InitializeComponent(); + } #region General @@ -64,7 +62,6 @@ namespace Flow.Launcher pluginStoreView.Filter = PluginStoreFilter; InitializePosition(); - ClockDisplay(); } private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e) @@ -514,34 +511,6 @@ namespace Flow.Launcher } } - private void PreviewClockAndDate(object sender, RoutedEventArgs e) - { - ClockDisplay(); - } - - public void ClockDisplay() - { - if (settings.UseClock) - { - ClockBox.Visibility = Visibility.Visible; - ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat); - } - else - { - ClockBox.Visibility = Visibility.Collapsed; - } - - if (settings.UseDate) - { - DateBox.Visibility = Visibility.Visible; - DateBox.Text = DateTime.Now.ToString(settings.DateFormat); - } - else - { - DateBox.Visibility = Visibility.Collapsed; - } - } - public void InitializePosition() { if (settings.SettingWindowTop >= 0 && settings.SettingWindowLeft >= 0) @@ -556,6 +525,7 @@ namespace Flow.Launcher } WindowState = settings.SettingWindowState; } + public double WindowLeft() { var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 77b0fd1c5..cb0921b80 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"> - + - @@ -368,6 +367,12 @@ + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index 7e1ae911a..c5f701c46 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -123,6 +123,7 @@ x:Key="DateBox" BasedOn="{StaticResource BaseDateBox}" 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 ad16f390e..6a4a07c56 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -159,12 +159,12 @@ x:Key="ClockBox" BasedOn="{StaticResource BaseClockBox}" TargetType="{x:Type TextBlock}"> - + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index df6d20bb4..39c13d28c 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -169,6 +169,7 @@ BasedOn="{StaticResource BaseClockBox}" TargetType="{x:Type TextBlock}"> +