diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 1e80b2db2..8f503131c 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -82,9 +82,14 @@ namespace Flow.Launcher.Plugin public bool RoundedIcon { get; set; } = false; /// - /// Full image used for preview window + /// Full image used for preview panel /// - public string PreviewImage { get; set; } + public string PreviewImage { get; set; } = null; + + /// + /// Determines if the preview image should occupy the full width of the preveiw panel. + /// + public bool UseBigThumbnail { get; set; } = false; /// /// Delegate function, see @@ -234,5 +239,23 @@ namespace Flow.Launcher.Plugin /// /// #26a0da (blue) public string ProgressBarColor { get; set; } = "#26a0da"; + + /// + /// Suggests a result's file extension should use full width of the default preview panel. + /// + /// File extension. Dot included. + public static bool ShouldUseBigThumbnail(string extension) + { + return extension is ".jpg" + or ".png" + or ".avi" + or ".mkv" + or ".bmp" + or ".gif" + or ".wmv" + or ".mp3" + or ".flac" + or ".mp4"; + } } } diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 159e0728c..a8bb052b5 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -9,7 +9,6 @@ using Flow.Launcher.Plugin; using System.IO; using System.Drawing.Text; using System.Collections.Generic; -using System.Drawing; namespace Flow.Launcher.ViewModel { @@ -28,13 +27,6 @@ namespace Flow.Launcher.ViewModel } Result = result; - var extension = Path.GetExtension(result.PreviewImage); - if (!string.IsNullOrEmpty(extension)) - { - // only when explicitly specified PreviewImage - UseBigThumbnail = IsMedia(extension.ToLowerInvariant()); - } - if (Result.Glyph is { FontFamily: not null } glyph) { // Checks if it's a system installed font, which does not require path to be provided. @@ -177,21 +169,7 @@ namespace Flow.Launcher.ViewModel /// /// Determines if to use the full width of the preview panel /// - public bool UseBigThumbnail { get; set; } = false; - - public static bool IsMedia(string extension) - { - return extension is ".jpg" - or ".png" - or ".avi" - or ".mkv" - or ".bmp" - or ".gif" - or ".wmv" - or ".mp3" - or ".flac" - or ".mp4"; - } + public bool UseBigThumbnail => Result.UseBigThumbnail; public GlyphInfo Glyph { get; set; }