Merge branch 'Flow-Launcher:dev' into Allow10thResultHotkey

This commit is contained in:
VictoriousRaptor 2022-10-03 14:07:51 +08:00 committed by GitHub
commit bfbaaebd19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 4 deletions

View file

@ -66,6 +66,10 @@ namespace Flow.Launcher.Plugin
}
}
}
/// <summary>
/// Determines if Icon has a border radius
/// </summary>
public bool RoundedIcon { get; set; } = false;
/// <summary>
/// Delegate function, see <see cref="Icon"/>

View file

@ -79,6 +79,7 @@
<system:String x:Key="plugin_query_time">Query time:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<!-- Setting Plugin Store -->

View file

@ -82,13 +82,17 @@
BorderThickness="0">
<Image
x:Name="ImageIcon"
Width="32"
Height="32"
Width="{Binding IconXY}"
Height="{Binding IconXY}"
Margin="0,0,0,0"
HorizontalAlignment="Center"
Source="{Binding Image, TargetNullValue={x:Null}}"
Stretch="Uniform"
Visibility="{Binding ShowIcon}" />
Visibility="{Binding ShowIcon}">
<Image.Clip>
<EllipseGeometry RadiusX="{Binding IconRadius}" RadiusY="{Binding IconRadius}" Center="16 16"/>
</Image.Clip>
</Image>
</Border>
<Border
Margin="9,0,0,0"

View file

@ -1207,6 +1207,17 @@
</Hyperlink>
</TextBlock>
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Cursor="Hand"
FontSize="11"
Foreground="{DynamicResource PluginInfoColor}"
MouseUp="OnExternalPluginUninstallClick"
Text="{DynamicResource plugin_uninstall}"
TextDecorations="Underline" />
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Right"

View file

@ -1,4 +1,5 @@
using Flow.Launcher.Core.ExternalPlugins;
using Droplex;
using Flow.Launcher.Core.ExternalPlugins;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
@ -348,5 +349,17 @@ namespace Flow.Launcher
{
Plugins.ScrollIntoView(Plugins.SelectedItem);
}
private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
var id = viewModel.SelectedPlugin.PluginPair.Metadata.Name;
var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7");
var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0];
API.ChangeQuery($"{actionKeyword} uninstall {id}");
API.ShowMainWindow();
}
}
}
}

View file

@ -84,6 +84,19 @@ namespace Flow.Launcher.ViewModel
}
}
public double IconRadius
{
get
{
if (Result.RoundedIcon)
{
return IconXY / 2;
}
return IconXY;
}
}
public Visibility ShowGlyph
{
get
@ -175,6 +188,8 @@ namespace Flow.Launcher.ViewModel
public string QuerySuggestionText { get; set; }
public double IconXY { get; set; } = 32;
public override bool Equals(object obj)
{
return obj is ResultViewModel r && Result.Equals(r.Result);