mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use separate variable for preview image
This commit is contained in:
parent
95aaa9f085
commit
617d2f5efb
2 changed files with 28 additions and 2 deletions
|
|
@ -438,7 +438,7 @@
|
|||
HorizontalAlignment="Center"
|
||||
Source="{Binding PreviewImage}"
|
||||
StretchDirection="DownOnly"
|
||||
Visibility="{Binding ShowIcon}">
|
||||
Visibility="{Binding ShowPreviewImage, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Image.Style>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="MaxWidth" Value="96" />
|
||||
|
|
|
|||
|
|
@ -90,6 +90,30 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public bool ShowPreviewImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Result.Preview.PreviewImagePath) || Result.Preview.PreviewDelegate != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fall back to Icon
|
||||
if (!ImgIconAvailable && !GlyphAvailable)
|
||||
return true;
|
||||
|
||||
// Although user can choose to use glyph icons, plugins may choose to supply only image icons.
|
||||
// In this case we ignore the setting because otherwise icons will not display as intended
|
||||
if (Settings.UseGlyphIcons && !GlyphAvailable && ImgIconAvailable)
|
||||
return true;
|
||||
|
||||
return !Settings.UseGlyphIcons && ImgIconAvailable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double IconRadius
|
||||
{
|
||||
get
|
||||
|
|
@ -120,6 +144,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
private bool ImgIconAvailable => !string.IsNullOrEmpty(Result.IcoPath) || Result.Icon is not null;
|
||||
|
||||
private bool PreviewImageAvailable => !string.IsNullOrEmpty(Result.Preview.PreviewImagePath) || Result.Preview.PreviewDelegate != null;
|
||||
|
||||
public string OpenResultModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip)
|
||||
|
|
@ -218,7 +244,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
if (ShowDefaultPreview == Visibility.Visible)
|
||||
{
|
||||
if (!PreviewImageLoaded && ShowIcon == Visibility.Visible)
|
||||
if (!PreviewImageLoaded && ShowPreviewImage)
|
||||
{
|
||||
PreviewImageLoaded = true;
|
||||
_ = LoadPreviewImageAsync();
|
||||
|
|
|
|||
Loading…
Reference in a new issue