merge PR #154: add dedicated missing image icon

This commit is contained in:
Ioannis G 2020-10-11 20:02:26 +03:00 committed by GitHub
commit 82ebbcb811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 14 deletions

BIN
Doc/app_missing_img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View file

@ -23,8 +23,10 @@ namespace Flow.Launcher.Infrastructure
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion; public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
public static readonly int ThumbnailSize = 64; public static readonly int ThumbnailSize = 64;
public static readonly string DefaultIcon = Path.Combine(ProgramDirectory, "Images", "app.png"); private static readonly string ImagesDirectory = Path.Combine(ProgramDirectory, "Images");
public static readonly string ErrorIcon = Path.Combine(ProgramDirectory, "Images", "app_error.png"); 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 string PythonPath; public static string PythonPath;

View file

@ -38,7 +38,7 @@ namespace Flow.Launcher.Infrastructure.Image
_imageCache.Usage = LoadStorageToConcurrentDictionary(); _imageCache.Usage = LoadStorageToConcurrentDictionary();
foreach (var icon in new[] { Constant.DefaultIcon, Constant.ErrorIcon }) foreach (var icon in new[] { Constant.DefaultIcon, Constant.MissingImgIcon })
{ {
ImageSource img = new BitmapImage(new Uri(icon)); ImageSource img = new BitmapImage(new Uri(icon));
img.Freeze(); img.Freeze();
@ -106,7 +106,7 @@ namespace Flow.Launcher.Infrastructure.Image
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
return new ImageResult(_imageCache[Constant.ErrorIcon], ImageType.Error); return new ImageResult(_imageCache[Constant.MissingImgIcon], ImageType.Error);
} }
if (_imageCache.ContainsKey(path)) if (_imageCache.ContainsKey(path))
{ {
@ -139,7 +139,7 @@ namespace Flow.Launcher.Infrastructure.Image
Log.Exception($"|ImageLoader.Load|Failed to get thumbnail for {path} on first try", e); Log.Exception($"|ImageLoader.Load|Failed to get thumbnail for {path} on first try", e);
Log.Exception($"|ImageLoader.Load|Failed to get thumbnail for {path} on second try", e2); Log.Exception($"|ImageLoader.Load|Failed to get thumbnail for {path} on second try", e2);
ImageSource image = _imageCache[Constant.ErrorIcon]; ImageSource image = _imageCache[Constant.MissingImgIcon];
_imageCache[path] = image; _imageCache[path] = image;
imageResult = new ImageResult(image, ImageType.Error); imageResult = new ImageResult(image, ImageType.Error);
} }
@ -191,8 +191,8 @@ namespace Flow.Launcher.Infrastructure.Image
} }
else else
{ {
image = _imageCache[Constant.ErrorIcon]; image = _imageCache[Constant.MissingImgIcon];
path = Constant.ErrorIcon; path = Constant.MissingImgIcon;
} }
if (type != ImageType.Error) if (type != ImageType.Error)

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View file

@ -51,7 +51,7 @@ namespace Flow.Launcher.ViewModel
catch (Exception e) catch (Exception e)
{ {
Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e); Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e);
imagePath = Constant.ErrorIcon; imagePath = Constant.MissingImgIcon;
} }
} }

View file

@ -536,7 +536,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
ProgramLogger.LogException($"|UWP|ImageFromPath|{path}" + ProgramLogger.LogException($"|UWP|ImageFromPath|{path}" +
$"|Unable to get logo for {UserModelId} from {path} and" + $"|Unable to get logo for {UserModelId} from {path} and" +
$" located in {Package.Location}", new FileNotFoundException()); $" located in {Package.Location}", new FileNotFoundException());
return new BitmapImage(new Uri(Constant.ErrorIcon)); return new BitmapImage(new Uri(Constant.MissingImgIcon));
} }
} }
@ -586,7 +586,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
$"|Unable to convert background string {BackgroundColor} " + $"|Unable to convert background string {BackgroundColor} " +
$"to color for {Package.Location}", new InvalidOperationException()); $"to color for {Package.Location}", new InvalidOperationException());
return new BitmapImage(new Uri(Constant.ErrorIcon)); return new BitmapImage(new Uri(Constant.MissingImgIcon));
} }
} }
else else

View file

@ -16,6 +16,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.2.1")] [assembly: AssemblyVersion("1.3.0")]
[assembly: AssemblyFileVersion("1.2.1")] [assembly: AssemblyFileVersion("1.3.0")]
[assembly: AssemblyInformationalVersion("1.2.1")] [assembly: AssemblyInformationalVersion("1.3.0")]

View file

@ -1,4 +1,4 @@
version: '1.2.1.{build}' version: '1.3.0.{build}'
init: init:
- ps: | - ps: |