Skip to content

Commit 5af272a

Browse files
committed
Merge branch 'dev' into add_nodejs_env
2 parents d2658c7 + 2e1b402 commit 5af272a

File tree

292 files changed

+8729
-2811
lines changed

Some content is hidden

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

292 files changed

+8729
-2811
lines changed

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<ItemGroup>
5656
<PackageReference Include="Droplex" Version="1.6.0" />
5757
<PackageReference Include="FSharp.Core" Version="6.0.6" />
58-
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.1.3" />
58+
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.1" />
5959
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
6060
</ItemGroup>
6161

Flow.Launcher.Core/Plugin/JsonRPCConfigurationModel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23

34
namespace Flow.Launcher.Core.Plugin
45
{
@@ -26,6 +27,8 @@ public class FieldAttributes
2627
public string Name { get; set; }
2728
public string Label { get; set; }
2829
public string Description { get; set; }
30+
public string urlLabel { get; set; }
31+
public Uri url { get; set; }
2932
public bool Validation { get; set; }
3033
public List<string> Options { get; set; }
3134
public string DefaultValue { get; set; }
@@ -40,4 +43,4 @@ public void Deconstruct(out string Name, out string Label, out string Descriptio
4043
DefaultValue = this.DefaultValue;
4144
}
4245
}
43-
}
46+
}

Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs

Lines changed: 174 additions & 25 deletions
Large diffs are not rendered by default.

Flow.Launcher.Infrastructure/Constant.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static class Constant
2929
public static readonly string DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
3030
public static readonly string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
3131
public static readonly string MissingImgIcon = Path.Combine(ImagesDirectory, "app_missing_img.png");
32+
public static readonly string LoadingImgIcon = Path.Combine(ImagesDirectory, "loading.png");
3233

3334
public static string PythonPath;
3435
public static string NodePath;

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<PackageReference Include="NLog.Schema" Version="4.7.10" />
5959
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
6060
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
61-
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
61+
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
6262
<!--ToolGood.Words.Pinyin v3.0.2.6 results in high memory usage when search with pinyin is enabled-->
6363
<!--Bumping to it or higher needs to test and ensure this is no longer a problem-->
6464
<PackageReference Include="ToolGood.Words.Pinyin" Version="3.0.1.4" />

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Concurrent;
33
using System.Collections.Generic;
4+
using System.Diagnostics;
45
using System.IO;
56
using System.Linq;
67
using System.Net;
@@ -21,8 +22,10 @@ public static class ImageLoader
2122
private static readonly ConcurrentDictionary<string, string> GuidToKey = new();
2223
private static IImageHashGenerator _hashGenerator;
2324
private static readonly bool EnableImageHash = true;
24-
public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
25-
public const int SmallIconSize = 32;
25+
public static ImageSource MissingImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
26+
public static ImageSource LoadingImage { get; } = new BitmapImage(new Uri(Constant.LoadingImgIcon));
27+
public const int SmallIconSize = 64;
28+
public const int FullIconSize = 256;
2629

2730

2831
private static readonly string[] ImageExtensions =
@@ -99,6 +102,7 @@ private enum ImageType
99102
Folder,
100103
Data,
101104
ImageFile,
105+
FullImageFile,
102106
Error,
103107
Cache
104108
}
@@ -111,7 +115,7 @@ private static async ValueTask<ImageResult> LoadInternalAsync(string path, bool
111115
{
112116
if (string.IsNullOrEmpty(path))
113117
{
114-
return new ImageResult(DefaultImage, ImageType.Error);
118+
return new ImageResult(MissingImage, ImageType.Error);
115119
}
116120

117121
if (ImageCache.ContainsKey(path, loadFullImage))
@@ -201,6 +205,7 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
201205
if (loadFullImage)
202206
{
203207
image = LoadFullImage(path);
208+
type = ImageType.FullImageFile;
204209
}
205210
else
206211
{
@@ -215,7 +220,7 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
215220
else
216221
{
217222
type = ImageType.File;
218-
image = GetThumbnail(path, ThumbnailOptions.None);
223+
image = GetThumbnail(path, ThumbnailOptions.None, loadFullImage ? FullIconSize : SmallIconSize);
219224
}
220225
}
221226
else
@@ -232,12 +237,12 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
232237
return new ImageResult(image, type);
233238
}
234239

235-
private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = ThumbnailOptions.ThumbnailOnly)
240+
private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = ThumbnailOptions.ThumbnailOnly, int size = SmallIconSize)
236241
{
237242
return WindowsThumbnailProvider.GetThumbnail(
238243
path,
239-
Constant.ThumbnailSize,
240-
Constant.ThumbnailSize,
244+
size,
245+
size,
241246
option);
242247
}
243248

@@ -254,6 +259,10 @@ public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullI
254259
if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache)
255260
{ // we need to get image hash
256261
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
262+
if (imageResult.ImageType == ImageType.FullImageFile)
263+
{
264+
path = $"{path}_{ImageType.FullImageFile}";
265+
}
257266
if (hash != null)
258267
{
259268

@@ -263,6 +272,7 @@ public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullI
263272
}
264273
else
265274
{ // new guid
275+
266276
GuidToKey[hash] = path;
267277
}
268278
}
@@ -279,9 +289,33 @@ private static BitmapImage LoadFullImage(string path)
279289
BitmapImage image = new BitmapImage();
280290
image.BeginInit();
281291
image.CacheOption = BitmapCacheOption.OnLoad;
282-
image.UriSource = new Uri(path);
292+
image.UriSource = new Uri(path);
283293
image.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
284294
image.EndInit();
295+
296+
if (image.PixelWidth > 320)
297+
{
298+
BitmapImage resizedWidth = new BitmapImage();
299+
resizedWidth.BeginInit();
300+
resizedWidth.CacheOption = BitmapCacheOption.OnLoad;
301+
resizedWidth.UriSource = new Uri(path);
302+
resizedWidth.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
303+
resizedWidth.DecodePixelWidth = 320;
304+
resizedWidth.EndInit();
305+
306+
if (resizedWidth.PixelHeight > 320)
307+
{
308+
BitmapImage resizedHeight = new BitmapImage();
309+
resizedHeight.BeginInit();
310+
resizedHeight.CacheOption = BitmapCacheOption.OnLoad;
311+
resizedHeight.UriSource = new Uri(path);
312+
resizedHeight.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
313+
resizedHeight.DecodePixelHeight = 320;
314+
resizedHeight.EndInit();
315+
return resizedHeight;
316+
}
317+
return resizedWidth;
318+
}
285319
return image;
286320
}
287321
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public CustomBrowserViewModel CustomBrowser
146146
/// when false Alphabet static service will always return empty results
147147
/// </summary>
148148
public bool ShouldUsePinyin { get; set; } = false;
149+
public bool AlwaysPreview { get; set; } = false;
149150

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

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ public interface IPublicAPI
183183
/// <param name="oldActionKeyword">The actionkeyword that is supposed to be removed</param>
184184
void RemoveActionKeyword(string pluginId, string oldActionKeyword);
185185

186+
/// <summary>
187+
/// Check whether specific ActionKeyword is assigned to any of the plugin
188+
/// </summary>
189+
/// <param name="actionKeyword">The actionkeyword for checking</param>
190+
/// <returns>True if the actionkeyword is already assigned, False otherwise</returns>
191+
bool ActionKeywordAssigned(string actionKeyword);
192+
186193
/// <summary>
187194
/// Log debug message
188195
/// Message will only be logged in Debug mode

Flow.Launcher.Plugin/Result.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Threading.Tasks;
5+
using System.Windows.Controls;
56
using System.Windows.Media;
67

78
namespace Flow.Launcher.Plugin
@@ -203,6 +204,11 @@ public override string ToString()
203204
/// </summary>
204205
public string SubTitleToolTip { get; set; }
205206

207+
/// <summary>
208+
/// Customized Preview Panel
209+
/// </summary>
210+
public Lazy<UserControl> PreviewPanel { get; set; }
211+
206212
/// <summary>
207213
/// Run this result, asynchronously
208214
/// </summary>
@@ -223,5 +229,30 @@ public ValueTask<bool> ExecuteAsync(ActionContext context)
223229
/// </summary>
224230
/// <default>#26a0da (blue)</default>
225231
public string ProgressBarColor { get; set; } = "#26a0da";
232+
233+
public PreviewInfo Preview { get; set; } = PreviewInfo.Default;
234+
235+
/// <summary>
236+
/// Info of the preview image.
237+
/// </summary>
238+
public record PreviewInfo
239+
{
240+
/// <summary>
241+
/// Full image used for preview panel
242+
/// </summary>
243+
public string PreviewImagePath { get; set; }
244+
/// <summary>
245+
/// Determines if the preview image should occupy the full width of the preveiw panel.
246+
/// </summary>
247+
public bool IsMedia { get; set; }
248+
public string Description { get; set; }
249+
250+
public static PreviewInfo Default { get; } = new()
251+
{
252+
PreviewImagePath = null,
253+
Description = null,
254+
IsMedia = false,
255+
};
256+
}
226257
}
227258
}

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>

0 commit comments

Comments
 (0)