Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
15e34e0
- Layout Adjust
onesounds Sep 2, 2022
766e13b
- Adjust Layout
onesounds Sep 2, 2022
e8ccd46
- Add Preview Toggle (F2 Key)
onesounds Sep 2, 2022
7b7e038
- Add 'Always open priview' in settings
onesounds Sep 2, 2022
b00ab13
- Add Preview Bar Color in themes
onesounds Sep 2, 2022
a090b10
Add field images to be displayed in previews
Garulf Sep 2, 2022
f5a511a
Add FullImageFIle type
Garulf Sep 2, 2022
832c41f
Override type if we load the full image
Garulf Sep 2, 2022
a53b961
Append full image type to path if we're caching a full imagefile
Garulf Sep 2, 2022
a76304a
Load full image from cache
Garulf Sep 2, 2022
a9d1181
Try to load full image from cache first
Garulf Sep 2, 2022
29e5b4f
Add logic for detecting if full image exists in cache
Garulf Sep 2, 2022
5f92f5b
Add binding for preview image
Garulf Sep 2, 2022
9ed008f
Add preview image binding
Garulf Sep 2, 2022
5aaaf37
Fix not loading full image
Garulf Sep 2, 2022
c2d2fc0
Fix caching
Garulf Sep 2, 2022
733ebb8
Add support for customized usercontrol
taooceros Sep 13, 2022
ea728cc
Add WindowsAPICodePack for HighResThumb
onesounds Sep 16, 2022
b502f2a
- Adjust Layout
onesounds Sep 16, 2022
bb0c57d
- remove test customcontrol in program plugin
onesounds Sep 16, 2022
af2909b
Fix Blank Preview when no result with query.
onesounds Sep 16, 2022
e5a5a8c
- Rollabck to latest stable code
onesounds Oct 2, 2022
aaf5e9f
Merge branch 'dev' into ImagePreview
onesounds Oct 2, 2022
af56370
Merge branch 'dev' into ImagePreview
onesounds Oct 3, 2022
20f61f5
Removed MSApiCodePack
onesounds Oct 25, 2022
80db9b8
Merge Dev
onesounds Nov 13, 2022
7fd06da
Fix Conflict
onesounds Nov 13, 2022
6b85e1a
Merge branch 'dev' into ImagePreview
onesounds Nov 16, 2022
1d674c4
Split Preview Style
onesounds Nov 18, 2022
cdb583c
Merge Dev
onesounds Nov 18, 2022
14bb856
Merge Dev
onesounds Nov 25, 2022
00a4d62
- Temp Fix Confict / Change F2 to F1
onesounds Nov 25, 2022
124318f
- Adjust Themes for Preview
onesounds Nov 25, 2022
5c6244a
Add Preview Seperator color from middle seperator color
onesounds Nov 25, 2022
6d91351
Add Auto Hide Preview Separator
onesounds Nov 25, 2022
65d4aed
- Fix Display Preview Panel when First Launch
onesounds Nov 25, 2022
250627a
Load large Thumbnail when load full image
taooceros Nov 25, 2022
d96ddd3
different width for image/video vs other file type
taooceros Nov 25, 2022
c622eda
Add FileType / Ignore Case Senstive
onesounds Nov 25, 2022
c59449d
Change String
onesounds Nov 26, 2022
24e526b
fix typo
VictoriousRaptor Nov 26, 2022
9cdbb3a
fix uwp preview image
VictoriousRaptor Nov 26, 2022
41822f9
Merge branch 'ImagePreview' of https://github.com/onesounds/Flow.Laun…
VictoriousRaptor Nov 26, 2022
3c229fc
Update preview tooltip
VictoriousRaptor Nov 26, 2022
ab54833
Merge branch 'dev' into ImagePreview
onesounds Nov 26, 2022
ca6c6cb
Use loading.png for loading time image placeholder
taooceros Nov 26, 2022
6be5680
Merge Image Loading
onesounds Nov 26, 2022
91a46f7
Fix Conflict
onesounds Nov 26, 2022
e5a19cc
Change Loading Icon / Rmove Opacity in Darker Theme
onesounds Nov 26, 2022
3aa3cf3
Fix List Icon Blurry
onesounds Nov 26, 2022
a70b13d
- Change PreviewExtension base Subtitle from IcoPath (For Fix the Lar…
onesounds Nov 26, 2022
48c67c7
Remove Uwp Icon's Backgorund color
onesounds Nov 26, 2022
ed5c50e
Fix BulletLight Selected Glyph / Add Glyph Layout
onesounds Nov 26, 2022
cf3d88f
Add Glyph Color Style
onesounds Nov 27, 2022
bca2145
Add Darker Theme (Garul'fs request)
onesounds Nov 27, 2022
f59cfc0
Merge branch 'dev' into ImagePreview
onesounds Nov 27, 2022
26a7139
Add flac/mp3 (for large coverart)
onesounds Nov 27, 2022
1e8fe93
Change Loading Image / Change Stretch for small icons (under 128)
onesounds Nov 27, 2022
5a077f9
Fix preview image size when PreviewImage is null
VictoriousRaptor Nov 27, 2022
c40b0b9
set IsMedia() to static
VictoriousRaptor Nov 27, 2022
98760b0
Remove MinHeight
onesounds Nov 27, 2022
06e5ec4
Adjust Custom Preview Panel Layout
onesounds Nov 27, 2022
a2b2e89
Rename var
VictoriousRaptor Nov 28, 2022
76f5c6c
Revert "Remove Uwp Icon's Backgorund color" to avoid conflict
VictoriousRaptor Nov 29, 2022
5a7eb62
Let result provider determine should use big thumbnail
VictoriousRaptor Nov 29, 2022
4856399
Make IconDelegate async when calling it
VictoriousRaptor Nov 29, 2022
f6d5bf3
Trigger OnPropertyChanged of Image
VictoriousRaptor Nov 29, 2022
e7baaaf
Separate image load logic
VictoriousRaptor Nov 29, 2022
aeb72d2
Separate image loading logic
VictoriousRaptor Nov 29, 2022
19d29e8
update description
VictoriousRaptor Nov 29, 2022
f548310
Merge branch 'dev' into ImagePreview
onesounds Dec 1, 2022
bf9b464
Merge Dev
onesounds Dec 1, 2022
564721b
Set preview image for uwp apps
VictoriousRaptor Dec 3, 2022
e2a46ed
Merge branch 'dev' into ImagePreview
VictoriousRaptor Dec 5, 2022
ccab608
fix unnecessary using
VictoriousRaptor Dec 5, 2022
ce2948e
Merge branch 'ImagePreview' of https://github.com/onesounds/Flow.Laun…
VictoriousRaptor Dec 5, 2022
2194e3c
Preview image for explorer
VictoriousRaptor Dec 5, 2022
53b1781
Renaming method and property
VictoriousRaptor Dec 5, 2022
6c54ad8
refactor preview info
VictoriousRaptor Dec 5, 2022
fa84f44
Merge branch 'dev' into ImagePreview
onesounds Dec 5, 2022
89b5242
Adjust Preview Area Heights
onesounds Dec 5, 2022
4c846e2
Fix Reserved Glyph Area
onesounds Dec 5, 2022
075a1a3
Adjust Preview area Size / Add Source Resize Logic
onesounds Dec 6, 2022
05dca1a
Merge branch 'ImagePreview' of https://github.com/onesounds/Flow.Laun…
VictoriousRaptor Dec 6, 2022
46f8d42
- Changed UWP preview target image
onesounds Dec 6, 2022
d52496b
Merge branch 'ImagePreview' of https://github.com/onesounds/Flow.Laun…
onesounds Dec 6, 2022
fd395c1
Adjust non-media icon sizes
onesounds Dec 6, 2022
f509f56
Fix file extension case sensitive issue
VictoriousRaptor Dec 7, 2022
219ca53
revert
VictoriousRaptor Dec 7, 2022
0231c32
Use square44x44logo for preview to avoid big margin
VictoriousRaptor Dec 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Flow.Launcher.Infrastructure/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static class Constant
public static readonly string DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
public static readonly string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
public static readonly string MissingImgIcon = Path.Combine(ImagesDirectory, "app_missing_img.png");
public static readonly string LoadingImgIcon = Path.Combine(ImagesDirectory, "loading.png");

public static string PythonPath;

Expand Down
50 changes: 42 additions & 8 deletions Flow.Launcher.Infrastructure/Image/ImageLoader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
Expand All @@ -21,8 +22,10 @@ public static class ImageLoader
private static readonly ConcurrentDictionary<string, string> GuidToKey = new();
private static IImageHashGenerator _hashGenerator;
private static readonly bool EnableImageHash = true;
public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
public const int SmallIconSize = 32;
public static ImageSource MissingImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
public static ImageSource LoadingImage { get; } = new BitmapImage(new Uri(Constant.LoadingImgIcon));
public const int SmallIconSize = 64;
public const int FullIconSize = 256;


private static readonly string[] ImageExtensions =
Expand Down Expand Up @@ -99,6 +102,7 @@ private enum ImageType
Folder,
Data,
ImageFile,
FullImageFile,
Error,
Cache
}
Expand All @@ -111,7 +115,7 @@ private static async ValueTask<ImageResult> LoadInternalAsync(string path, bool
{
if (string.IsNullOrEmpty(path))
{
return new ImageResult(DefaultImage, ImageType.Error);
return new ImageResult(MissingImage, ImageType.Error);
}

if (ImageCache.ContainsKey(path, loadFullImage))
Expand Down Expand Up @@ -201,6 +205,7 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
if (loadFullImage)
{
image = LoadFullImage(path);
type = ImageType.FullImageFile;
}
else
{
Expand All @@ -215,7 +220,7 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
else
{
type = ImageType.File;
image = GetThumbnail(path, ThumbnailOptions.None);
image = GetThumbnail(path, ThumbnailOptions.None, loadFullImage ? FullIconSize : SmallIconSize);
}
}
else
Expand All @@ -232,12 +237,12 @@ private static ImageResult GetThumbnailResult(ref string path, bool loadFullImag
return new ImageResult(image, type);
}

private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = ThumbnailOptions.ThumbnailOnly)
private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = ThumbnailOptions.ThumbnailOnly, int size = SmallIconSize)
{
return WindowsThumbnailProvider.GetThumbnail(
path,
Constant.ThumbnailSize,
Constant.ThumbnailSize,
size,
size,
option);
}

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

Expand All @@ -263,6 +272,7 @@ public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullI
}
else
{ // new guid

GuidToKey[hash] = path;
}
}
Expand All @@ -279,9 +289,33 @@ private static BitmapImage LoadFullImage(string path)
BitmapImage image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.UriSource = new Uri(path);
image.UriSource = new Uri(path);
image.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
image.EndInit();

if (image.PixelWidth > 320)
{
BitmapImage resizedWidth = new BitmapImage();
resizedWidth.BeginInit();
resizedWidth.CacheOption = BitmapCacheOption.OnLoad;
resizedWidth.UriSource = new Uri(path);
resizedWidth.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
resizedWidth.DecodePixelWidth = 320;
resizedWidth.EndInit();

if (resizedWidth.PixelHeight > 320)
{
BitmapImage resizedHeight = new BitmapImage();
resizedHeight.BeginInit();
resizedHeight.CacheOption = BitmapCacheOption.OnLoad;
resizedHeight.UriSource = new Uri(path);
resizedHeight.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
resizedHeight.DecodePixelHeight = 320;
resizedHeight.EndInit();
return resizedHeight;
}
return resizedWidth;
}
return image;
}
}
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public CustomBrowserViewModel CustomBrowser
/// when false Alphabet static service will always return empty results
/// </summary>
public bool ShouldUsePinyin { get; set; } = false;
public bool AlwaysPreview { get; set; } = false;

[JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))]
public SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular;
Expand Down
31 changes: 31 additions & 0 deletions Flow.Launcher.Plugin/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media;

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

/// <summary>
/// Customized Preview Panel
/// </summary>
public Lazy<UserControl> PreviewPanel { get; set; }

/// <summary>
/// Run this result, asynchronously
/// </summary>
Expand All @@ -223,5 +229,30 @@ public ValueTask<bool> ExecuteAsync(ActionContext context)
/// </summary>
/// <default>#26a0da (blue)</default>
public string ProgressBarColor { get; set; } = "#26a0da";

public PreviewInfo Preview { get; set; } = PreviewInfo.Default;

/// <summary>
/// Info of the preview image.
/// </summary>
public record PreviewInfo
{
/// <summary>
/// Full image used for preview panel
/// </summary>
public string PreviewImagePath { get; set; }
/// <summary>
/// Determines if the preview image should occupy the full width of the preveiw panel.
/// </summary>
public bool IsMedia { get; set; }
public string Description { get; set; }

public static PreviewInfo Default { get; } = new()
{
PreviewImagePath = null,
Description = null,
IsMedia = false,
};
}
}
}
Binary file added Flow.Launcher/Images/loading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>

<!-- Setting Plugin -->
Expand Down
Loading