Skip to content

Commit 32c51d5

Browse files
committed
Merge branch 'dev' of github.com:Flow-Launcher/Flow.Launcher into ProgressBarDispatcher
2 parents 6f0c254 + 9051e3e commit 32c51d5

File tree

14 files changed

+269
-127
lines changed

14 files changed

+269
-127
lines changed

Flow.Launcher.Core/Resource/Internationalization.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ public bool PromptShouldUsePinyin(string languageCodeToSet)
115115
if (languageToSet != AvailableLanguages.Chinese && languageToSet != AvailableLanguages.Chinese_TW)
116116
return false;
117117

118-
if (MessageBox.Show("Do you want to turn on search with Pinyin?", string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
118+
// No other languages should show the following text so just make it hard-coded
119+
// "Do you want to search with pinyin?"
120+
string text = languageToSet == AvailableLanguages.Chinese ? "是否启用拼音搜索?" : "是否啓用拼音搜索?" ;
121+
122+
if (MessageBox.Show(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
119123
return false;
120124

121125
return true;
@@ -221,4 +225,4 @@ public string LanguageFile(string folder, string language)
221225
}
222226
}
223227
}
224-
}
228+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
5+
namespace Flow.Launcher.Converters
6+
{
7+
public class DateTimeFormatToNowConverter : IValueConverter
8+
{
9+
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
return value is not string format ? null : DateTime.Now.ToString(format);
13+
}
14+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
15+
{
16+
throw new NotImplementedException();
17+
}
18+
}
19+
}

Flow.Launcher/Languages/en.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
6565
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
6666
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
67-
<system:String x:Key="ShouldUsePinyin">Should Use Pinyin</system:String>
68-
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese</system:String>
67+
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
68+
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
6969
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
7070

7171
<!-- Setting Plugin -->
@@ -149,7 +149,7 @@
149149
<system:String x:Key="builtinShortcuts">Built-in Shortcuts</system:String>
150150
<system:String x:Key="customQuery">Query</system:String>
151151
<system:String x:Key="customShortcut">Shortcut</system:String>
152-
<system:String x:Key="customShortcutExpansion">Expanded</system:String>
152+
<system:String x:Key="customShortcutExpansion">Expansion</system:String>
153153
<system:String x:Key="builtinShortcutDescription">Description</system:String>
154154
<system:String x:Key="delete">Delete</system:String>
155155
<system:String x:Key="edit">Edit</system:String>

Flow.Launcher/MainWindow.xaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,16 @@
231231
<StackPanel x:Name="ClockPanel"
232232
IsHitTestVisible="False"
233233
Style="{DynamicResource ClockPanel}">
234-
<TextBlock Style="{DynamicResource DateBox}"
235-
Text="{Binding DateText}"
236-
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" />
237-
<TextBlock Style="{DynamicResource ClockBox}"
234+
<TextBlock
235+
x:Name="ClockBox"
236+
Style="{DynamicResource ClockBox}"
238237
Text="{Binding ClockText}"
239238
Visibility="{Binding Settings.UseClock, Converter={StaticResource BooleanToVisibilityConverter}}" />
239+
<TextBlock
240+
x:Name="DateBox"
241+
Style="{DynamicResource DateBox}"
242+
Text="{Binding DateText}"
243+
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" />
240244
</StackPanel>
241245

242246
<Canvas Style="{DynamicResource SearchIconPosition}">

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
using ModernWpf.Controls;
3131
using System.Drawing;
3232
using System.Windows.Forms.Design.Behavior;
33+
using System.Security.Cryptography;
34+
using System.Runtime.CompilerServices;
35+
using Microsoft.VisualBasic.Devices;
36+
using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames;
3337

3438
namespace Flow.Launcher
3539
{
@@ -103,7 +107,6 @@ private void OnLoaded(object sender, RoutedEventArgs _)
103107
// since the default main window visibility is visible
104108
// so we need set focus during startup
105109
QueryTextBox.Focus();
106-
107110
_viewModel.PropertyChanged += (o, e) =>
108111
{
109112
switch (e.PropertyName)
@@ -211,7 +214,9 @@ private void InitializeNotifyIcon()
211214
Icon = Properties.Resources.app,
212215
Visible = !_settings.HideNotifyIcon
213216
};
217+
214218
contextMenu = new ContextMenu();
219+
215220
var openIcon = new FontIcon
216221
{
217222
Glyph = "\ue71e"
@@ -258,9 +263,11 @@ private void InitializeNotifyIcon()
258263
positionreset.Click += (o, e) => PositionReset();
259264
settings.Click += (o, e) => App.API.OpenSettingDialog();
260265
exit.Click += (o, e) => Close();
261-
contextMenu.Items.Add(open);
266+
262267
gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
263268
positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip");
269+
270+
contextMenu.Items.Add(open);
264271
contextMenu.Items.Add(gamemode);
265272
contextMenu.Items.Add(positionreset);
266273
contextMenu.Items.Add(settings);
@@ -368,45 +375,91 @@ public void WindowAnimator()
368375

369376
_animating = true;
370377
UpdatePosition();
371-
Storyboard sb = new Storyboard();
378+
379+
Storyboard windowsb = new Storyboard();
380+
Storyboard clocksb = new Storyboard();
372381
Storyboard iconsb = new Storyboard();
373-
CircleEase easing = new CircleEase(); // or whatever easing class you want
382+
CircleEase easing = new CircleEase();
374383
easing.EasingMode = EasingMode.EaseInOut;
375-
var da = new DoubleAnimation
384+
385+
var WindowOpacity = new DoubleAnimation
376386
{
377387
From = 0,
378388
To = 1,
379389
Duration = TimeSpan.FromSeconds(0.25),
380390
FillBehavior = FillBehavior.Stop
381391
};
382392

383-
var da2 = new DoubleAnimation
393+
var WindowMotion = new DoubleAnimation
384394
{
385395
From = Top + 10,
386396
To = Top,
387397
Duration = TimeSpan.FromSeconds(0.25),
388398
FillBehavior = FillBehavior.Stop
389399
};
390-
var da3 = new DoubleAnimation
400+
var IconMotion = new DoubleAnimation
391401
{
392402
From = 12,
393403
To = 0,
394404
EasingFunction = easing,
395405
Duration = TimeSpan.FromSeconds(0.36),
396406
FillBehavior = FillBehavior.Stop
397407
};
398-
Storyboard.SetTarget(da, this);
399-
Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty));
400-
Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty));
401-
Storyboard.SetTargetProperty(da3, new PropertyPath(TopProperty));
402-
sb.Children.Add(da);
403-
sb.Children.Add(da2);
404-
iconsb.Children.Add(da3);
405-
sb.Completed += (_, _) => _animating = false;
408+
409+
var ClockOpacity = new DoubleAnimation
410+
{
411+
From = 0,
412+
To = 1,
413+
EasingFunction = easing,
414+
Duration = TimeSpan.FromSeconds(0.36),
415+
FillBehavior = FillBehavior.Stop
416+
};
417+
double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style
418+
var IconOpacity = new DoubleAnimation
419+
{
420+
From = 0,
421+
To = TargetIconOpacity,
422+
EasingFunction = easing,
423+
Duration = TimeSpan.FromSeconds(0.36),
424+
FillBehavior = FillBehavior.Stop
425+
};
426+
427+
double right = ClockPanel.Margin.Right;
428+
var thicknessAnimation = new ThicknessAnimation
429+
{
430+
From = new Thickness(0, 12, right, 0),
431+
To = new Thickness(0, 0, right, 0),
432+
EasingFunction = easing,
433+
Duration = TimeSpan.FromSeconds(0.36),
434+
FillBehavior = FillBehavior.Stop
435+
};
436+
437+
Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty));
438+
Storyboard.SetTargetName(thicknessAnimation, "ClockPanel");
439+
Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty));
440+
Storyboard.SetTarget(WindowOpacity, this);
441+
Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty));
442+
Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty));
443+
Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty));
444+
Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty));
445+
446+
clocksb.Children.Add(thicknessAnimation);
447+
clocksb.Children.Add(ClockOpacity);
448+
windowsb.Children.Add(WindowOpacity);
449+
windowsb.Children.Add(WindowMotion);
450+
iconsb.Children.Add(IconMotion);
451+
iconsb.Children.Add(IconOpacity);
452+
453+
windowsb.Completed += (_, _) => _animating = false;
406454
_settings.WindowLeft = Left;
407455
_settings.WindowTop = Top;
456+
457+
if (QueryTextBox.Text.Length == 0)
458+
{
459+
clocksb.Begin(ClockPanel);
460+
}
408461
iconsb.Begin(SearchIcon);
409-
sb.Begin(FlowMainWindow);
462+
windowsb.Begin(FlowMainWindow);
410463
}
411464

412465
private void OnMouseDown(object sender, MouseButtonEventArgs e)

Flow.Launcher/SettingWindow.xaml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
</Window.CommandBindings>
4040

4141
<Window.Resources>
42+
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
4243
<converters:BorderClipConverter x:Key="BorderClipConverter" />
4344
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
4445
<converters:TextConverter x:Key="TextConverter" />
@@ -1815,13 +1816,25 @@
18151816
</Grid.RowDefinitions>
18161817
<Border Grid.Row="0">
18171818
<TextBox
1819+
x:Name="QueryTextBox"
18181820
IsReadOnly="True"
18191821
Style="{DynamicResource QueryBoxStyle}"
18201822
Text="{DynamicResource hiThere}" />
18211823
</Border>
1822-
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
1823-
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}" />
1824-
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}" />
1824+
<StackPanel
1825+
x:Name="ClockPanel"
1826+
IsHitTestVisible="False"
1827+
Style="{DynamicResource ClockPanel}">
1828+
<TextBlock
1829+
x:Name="ClockBox"
1830+
Style="{DynamicResource ClockBox}"
1831+
Text="{Binding ClockText}"
1832+
Visibility="{Binding Settings.UseClock, Converter={StaticResource BooleanToVisibilityConverter}}" />
1833+
<TextBlock
1834+
x:Name="DateBox"
1835+
Style="{DynamicResource DateBox}"
1836+
Text="{Binding DateText}"
1837+
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" />
18251838
</StackPanel>
18261839
<Canvas Style="{DynamicResource SearchIconPosition}">
18271840
<Path
@@ -2162,6 +2175,12 @@
21622175
Grid.Row="0"
21632176
Grid.Column="2"
21642177
Orientation="Horizontal">
2178+
<TextBlock
2179+
Margin="0,0,10,0"
2180+
VerticalAlignment="Center"
2181+
FontSize="14"
2182+
Foreground="{DynamicResource Color04B}"
2183+
Text="{Binding ClockText}" />
21652184
<ComboBox
21662185
x:Name="TimeFormat"
21672186
Grid.Column="2"
@@ -2170,14 +2189,12 @@
21702189
VerticalAlignment="Center"
21712190
FontSize="14"
21722191
ItemsSource="{Binding TimeFormatList}"
2173-
SelectedValue="{Binding Settings.TimeFormat}"
2174-
SelectionChanged="PreviewClockAndDate" />
2192+
SelectedItem="{Binding TimeFormat}" />
21752193
<ui:ToggleSwitch
21762194
IsOn="{Binding UseClock, Mode=TwoWay}"
21772195
OffContent="{DynamicResource disable}"
21782196
OnContent="{DynamicResource enable}"
2179-
Style="{DynamicResource SideToggleSwitch}"
2180-
Toggled="PreviewClockAndDate" />
2197+
Style="{DynamicResource SideToggleSwitch}" />
21812198
</StackPanel>
21822199
<TextBlock Style="{StaticResource Glyph}">
21832200
&#xec92;
@@ -2200,6 +2217,12 @@
22002217
Grid.Row="0"
22012218
Grid.Column="2"
22022219
Orientation="Horizontal">
2220+
<TextBlock
2221+
Margin="0,0,10,0"
2222+
VerticalAlignment="Center"
2223+
FontSize="14"
2224+
Foreground="{DynamicResource Color04B}"
2225+
Text="{Binding DateText}" />
22032226
<ComboBox
22042227
x:Name="DateFormat"
22052228
Grid.Column="2"
@@ -2208,14 +2231,12 @@
22082231
VerticalAlignment="Center"
22092232
FontSize="14"
22102233
ItemsSource="{Binding DateFormatList}"
2211-
SelectedValue="{Binding Settings.DateFormat}"
2212-
SelectionChanged="PreviewClockAndDate" />
2234+
SelectedItem="{Binding DateFormat}" />
22132235
<ui:ToggleSwitch
22142236
IsOn="{Binding UseDate, Mode=TwoWay}"
22152237
OffContent="{DynamicResource disable}"
22162238
OnContent="{DynamicResource enable}"
2217-
Style="{DynamicResource SideToggleSwitch}"
2218-
Toggled="PreviewClockAndDate" />
2239+
Style="{DynamicResource SideToggleSwitch}" />
22192240
</StackPanel>
22202241
<TextBlock Style="{StaticResource Glyph}">
22212242
&#xe787;

0 commit comments

Comments
 (0)