Merge pull request #3260 from Jack251970/blank_settings_panel

Remove Useless Separate Line for Blank Settings Panel
This commit is contained in:
Jack Ye 2025-02-21 11:35:51 +08:00 committed by GitHub
commit 8ae53a2e4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 3 additions and 47 deletions

View file

@ -112,7 +112,7 @@ namespace Flow.Launcher.Core.Plugin
public Control CreateSettingPanel()
{
if (Settings == null || Settings.Count == 0)
return new();
return null;
var settingWindow = new UserControl();
var mainPanel = new Grid { Margin = settingPanelMargin, VerticalAlignment = VerticalAlignment.Center };

View file

@ -90,7 +90,7 @@ namespace Flow.Launcher.ViewModel
private Control _bottomPart2;
public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginDisplayBottomData() : null;
public bool HasSettingControl => PluginPair.Plugin is ISettingProvider;
public bool HasSettingControl => PluginPair.Plugin is ISettingProvider settingProvider && settingProvider.CreateSettingPanel() != null;
public Control SettingControl
=> IsExpanded
? _settingControl

View file

@ -42,7 +42,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
</ItemGroup>

View file

@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Controls;
namespace Flow.Launcher.Plugin.Url
{
public class Main : ISettingProvider,IPlugin, IPluginI18n
public class Main : IPlugin, IPluginI18n
{
//based on https://gist.github.com/dperini/729294
private const string urlPattern = "^" +
@ -43,7 +42,6 @@ namespace Flow.Launcher.Plugin.Url
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
private PluginInitContext context;
private Settings _settings;
public List<Result> Query(Query query)
{
@ -82,12 +80,6 @@ namespace Flow.Launcher.Plugin.Url
return new List<Result>(0);
}
public Control CreateSettingPanel()
{
return new SettingsControl(context.API,_settings);
}
public bool IsURL(string raw)
{
raw = raw.ToLower();

View file

@ -1,17 +0,0 @@
<UserControl
x:Class="Flow.Launcher.Plugin.Url.SettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="0"
d:DesignHeight="300"
d:DesignWidth="500"
mc:Ignorable="d">
<Grid Margin="40,40,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
</Grid>
</UserControl>

View file

@ -1,18 +0,0 @@
using System.Windows.Controls;
namespace Flow.Launcher.Plugin.Url
{
public partial class SettingsControl : UserControl
{
private Settings _settings;
private IPublicAPI _flowlauncherAPI;
public SettingsControl(IPublicAPI flowlauncherAPI,Settings settings)
{
InitializeComponent();
_settings = settings;
_flowlauncherAPI = flowlauncherAPI;
}
}
}