Skip to content

Commit 6c53b7e

Browse files
Merge branch 'dev' into dev
2 parents 8fbf7a8 + 6607acb commit 6c53b7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+695
-292
lines changed

Flow.Launcher.Core/Resource/LocalizationConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Reflection;
55
using System.Windows.Data;
66

7-
namespace Flow.Launcher.Core
7+
namespace Flow.Launcher.Core.Resource
88
{
99
public class LocalizationConverter : IValueConverter
1010
{

Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.ComponentModel;
2-
using Flow.Launcher.Core.Resource;
32

4-
namespace Flow.Launcher.Core
3+
namespace Flow.Launcher.Core.Resource
54
{
65
public class LocalizedDescriptionAttribute : DescriptionAttribute
76
{

Flow.Launcher/Converters/TranslationConverter.cs renamed to Flow.Launcher.Core/Resource/TranslationConverter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using System;
22
using System.Globalization;
33
using System.Windows.Data;
4-
using Flow.Launcher.Core.Resource;
54

6-
namespace Flow.Launcher.Converters
5+
namespace Flow.Launcher.Core.Resource
76
{
8-
public class TranlationConverter : IValueConverter
7+
public class TranslationConverter : IValueConverter
98
{
109
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1110
{

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public CustomBrowserViewModel CustomBrowser
147147
/// </summary>
148148
public bool ShouldUsePinyin { get; set; } = false;
149149
public bool AlwaysPreview { get; set; } = false;
150+
public bool AlwaysStartEn { get; set; } = false;
150151

151152
[JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))]
152153
public SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular;

Flow.Launcher.Test/Flow.Launcher.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
<ItemGroup>
5151
<PackageReference Include="Moq" Version="4.16.1" />
52-
<PackageReference Include="nunit" Version="3.13.2" />
52+
<PackageReference Include="nunit" Version="3.13.3" />
5353
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Flow.Launcher.Test/Plugins/ExplorerTest.cs

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,5 +269,129 @@ public void GivenDirectoryInfoSearch_WhenSearchPatternHotKeyIsSearchAll_ThenSear
269269
// Then
270270
Assert.AreEqual(expectedString, resultString);
271271
}
272+
273+
[TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "irrelevant", false, true, "c:\\somefolder\\someotherfolder\\")]
274+
[TestCase("c:\\somefolder\\someotherfolder\\", ResultType.Folder, "irrelevant", true, true, "c:\\somefolder\\someotherfolder\\")]
275+
[TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "irrelevant", true, false, "p c:\\somefolder\\someotherfolder\\")]
276+
[TestCase("c:\\somefolder\\someotherfolder\\", ResultType.Folder, "irrelevant", false, false, "c:\\somefolder\\someotherfolder\\")]
277+
[TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "p", true, false, "p c:\\somefolder\\someotherfolder\\")]
278+
[TestCase("c:\\somefolder\\someotherfolder", ResultType.Folder, "", true, true, "c:\\somefolder\\someotherfolder\\")]
279+
public void GivenFolderResult_WhenGetPath_ThenPathShouldBeExpectedString(
280+
string path,
281+
ResultType type,
282+
string actionKeyword,
283+
bool pathSearchKeywordEnabled,
284+
bool searchActionKeywordEnabled,
285+
string expectedResult)
286+
{
287+
// Given
288+
var settings = new Settings()
289+
{
290+
PathSearchKeywordEnabled = pathSearchKeywordEnabled,
291+
PathSearchActionKeyword = "p",
292+
SearchActionKeywordEnabled = searchActionKeywordEnabled,
293+
SearchActionKeyword = Query.GlobalPluginWildcardSign
294+
};
295+
ResultManager.Init(new PluginInitContext(), settings);
296+
297+
// When
298+
var result = ResultManager.GetPathWithActionKeyword(path, type, actionKeyword);
299+
300+
// Then
301+
Assert.AreEqual(result, expectedResult);
302+
}
303+
304+
[TestCase("c:\\somefolder\\somefile", ResultType.File, "irrelevant", false, true, "e c:\\somefolder\\somefile")]
305+
[TestCase("c:\\somefolder\\somefile", ResultType.File, "p", true, false, "p c:\\somefolder\\somefile")]
306+
[TestCase("c:\\somefolder\\somefile", ResultType.File, "e", true, true, "e c:\\somefolder\\somefile")]
307+
[TestCase("c:\\somefolder\\somefile", ResultType.File, "irrelevant", false, false, "e c:\\somefolder\\somefile")]
308+
public void GivenFileResult_WhenGetPath_ThenPathShouldBeExpectedString(
309+
string path,
310+
ResultType type,
311+
string actionKeyword,
312+
bool pathSearchKeywordEnabled,
313+
bool searchActionKeywordEnabled,
314+
string expectedResult)
315+
{
316+
// Given
317+
var settings = new Settings()
318+
{
319+
PathSearchKeywordEnabled = pathSearchKeywordEnabled,
320+
PathSearchActionKeyword = "p",
321+
SearchActionKeywordEnabled = searchActionKeywordEnabled,
322+
SearchActionKeyword = "e"
323+
};
324+
ResultManager.Init(new PluginInitContext(), settings);
325+
326+
// When
327+
var result = ResultManager.GetPathWithActionKeyword(path, type, actionKeyword);
328+
329+
// Then
330+
Assert.AreEqual(result, expectedResult);
331+
}
332+
333+
[TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "q", false, false, "q somefolder")]
334+
[TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "i", true, false, "p c:\\somefolder\\")]
335+
[TestCase("somefolder", "c:\\somefolder\\", ResultType.Folder, "irrelevant", true, true, "c:\\somefolder\\")]
336+
public void GivenQueryWithFolderTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString(
337+
string title,
338+
string path,
339+
ResultType resultType,
340+
string actionKeyword,
341+
bool pathSearchKeywordEnabled,
342+
bool searchActionKeywordEnabled,
343+
string expectedResult)
344+
{
345+
// Given
346+
var query = new Query() { ActionKeyword = actionKeyword };
347+
var settings = new Settings()
348+
{
349+
PathSearchKeywordEnabled = pathSearchKeywordEnabled,
350+
PathSearchActionKeyword = "p",
351+
SearchActionKeywordEnabled = searchActionKeywordEnabled,
352+
SearchActionKeyword = Query.GlobalPluginWildcardSign,
353+
QuickAccessActionKeyword = "q",
354+
IndexSearchActionKeyword = "i"
355+
};
356+
ResultManager.Init(new PluginInitContext(), settings);
357+
358+
// When
359+
var result = ResultManager.GetAutoCompleteText(title, query, path, resultType);
360+
361+
// Then
362+
Assert.AreEqual(result, expectedResult);
363+
}
364+
365+
[TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "q", false, false, "q somefile")]
366+
[TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "i", true, false, "p c:\\somefolder\\somefile")]
367+
[TestCase("somefile", "c:\\somefolder\\somefile", ResultType.File, "irrelevant", true, true, "c:\\somefolder\\somefile")]
368+
public void GivenQueryWithFileTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString(
369+
string title,
370+
string path,
371+
ResultType resultType,
372+
string actionKeyword,
373+
bool pathSearchKeywordEnabled,
374+
bool searchActionKeywordEnabled,
375+
string expectedResult)
376+
{
377+
// Given
378+
var query = new Query() { ActionKeyword = actionKeyword };
379+
var settings = new Settings()
380+
{
381+
QuickAccessActionKeyword = "q",
382+
IndexSearchActionKeyword = "i",
383+
PathSearchActionKeyword = "p",
384+
PathSearchKeywordEnabled = pathSearchKeywordEnabled,
385+
SearchActionKeywordEnabled = searchActionKeywordEnabled,
386+
SearchActionKeyword = Query.GlobalPluginWildcardSign
387+
};
388+
ResultManager.Init(new PluginInitContext(), settings);
389+
390+
// When
391+
var result = ResultManager.GetAutoCompleteText(title, query, path, resultType);
392+
393+
// Then
394+
Assert.AreEqual(result, expectedResult);
395+
}
272396
}
273397
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
using System.Windows.Input;
5+
6+
namespace Flow.Launcher.Converters
7+
{
8+
internal class BoolToIMEConversionModeConverter : IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
if (value is bool v)
13+
{
14+
if (v)
15+
{
16+
return ImeConversionModeValues.Alphanumeric;
17+
}
18+
else
19+
{
20+
return ImeConversionModeValues.DoNotCare;
21+
}
22+
}
23+
return ImeConversionModeValues.DoNotCare;
24+
}
25+
26+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
27+
{
28+
throw new NotImplementedException();
29+
}
30+
}
31+
32+
internal class BoolToIMEStateConverter : IValueConverter
33+
{
34+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
35+
{
36+
if (value is bool v)
37+
{
38+
if (v)
39+
{
40+
return InputMethodState.Off;
41+
}
42+
else
43+
{
44+
return InputMethodState.DoNotCare;
45+
}
46+
}
47+
return InputMethodState.DoNotCare;
48+
}
49+
50+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
51+
{
52+
throw new NotImplementedException();
53+
}
54+
}
55+
}

Flow.Launcher/CustomShortcutSetting.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
<TextBlock
6565
Grid.Column="0"
6666
Margin="0,0,0,0"
67-
FontFamily="Segoe UI"
6867
FontSize="20"
6968
FontWeight="SemiBold"
7069
Text="{DynamicResource customQueryShortcut}"

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Infrastructure.Hotkey;
1+
using Flow.Launcher.Infrastructure.Hotkey;
22
using Flow.Launcher.Infrastructure.UserSettings;
33
using System;
44
using NHotkey;
@@ -25,7 +25,7 @@ internal static void Initialize(MainViewModel mainVM)
2525

2626
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
2727
{
28-
if (!mainViewModel.ShouldIgnoreHotkeys() && !mainViewModel.GameModeStatus)
28+
if (!mainViewModel.ShouldIgnoreHotkeys())
2929
mainViewModel.ToggleFlowLauncher();
3030
}
3131

@@ -74,7 +74,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey)
7474
{
7575
SetHotkey(hotkey.Hotkey, (s, e) =>
7676
{
77-
if (mainViewModel.ShouldIgnoreHotkeys() || mainViewModel.GameModeStatus)
77+
if (mainViewModel.ShouldIgnoreHotkeys())
7878
return;
7979

8080
mainViewModel.Show();

Flow.Launcher/Languages/en.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<system:String x:Key="copy">Copy</system:String>
1919
<system:String x:Key="cut">Cut</system:String>
2020
<system:String x:Key="paste">Paste</system:String>
21+
<system:String x:Key="undo">Undo</system:String>
22+
<system:String x:Key="selectAll">Select All</system:String>
2123
<system:String x:Key="fileTitle">File</system:String>
2224
<system:String x:Key="folderTitle">Folder</system:String>
2325
<system:String x:Key="textTitle">Text</system:String>
@@ -55,6 +57,8 @@
5557
<system:String x:Key="defaultFileManagerToolTip">Select the file manager to use when opening the folder.</system:String>
5658
<system:String x:Key="defaultBrowser">Default Web Browser</system:String>
5759
<system:String x:Key="defaultBrowserToolTip">Setting for New Tab, New Window, Private Mode.</system:String>
60+
<system:String x:Key="typingStartEn">Always Start Typing in English Mode</system:String>
61+
<system:String x:Key="typingStartEnTooltip">Temporarily change your input method to English mode when activating Flow.</system:String>
5862
<system:String x:Key="pythonDirectory">Python Directory</system:String>
5963
<system:String x:Key="autoUpdates">Auto Update</system:String>
6064
<system:String x:Key="selectPythonDirectory">Select</system:String>
@@ -66,7 +70,7 @@
6670
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
6771
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
6872
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
69-
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
73+
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview.</system:String>
7074
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
7175

7276
<!-- Setting Plugin -->

0 commit comments

Comments
 (0)