mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-10 20:38:32 +00:00
Plugin Settings - When searching, search in plugin and features
Plugin Settings - Never scroll inside feature list, just show everything if a plugin has many features
This commit is contained in:
parent
37b8c2c3e9
commit
10a10b9149
@ -95,5 +95,16 @@ public class PluginFeatureInfo : IPrerequisitesSubject
|
||||
return Instance?.Id ?? "Uninitialized feature";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a boolean indicating whether this feature info matches the provided search string
|
||||
/// </summary>
|
||||
/// <param name="search">The search string to match</param>
|
||||
/// <returns>A boolean indicating whether this plugin info matches the provided search string</returns>
|
||||
public bool MatchesSearch(string search)
|
||||
{
|
||||
return Name.Contains(search, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
(Description != null && Description.Contains(search, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
internal PluginFeatureEntity Entity { get; }
|
||||
}
|
||||
@ -155,19 +155,30 @@ public class PluginInfo : IPrerequisitesSubject
|
||||
{
|
||||
return PlatformPrerequisites.All(p => p.IsMet());
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Name} v{Version} - {Guid}";
|
||||
}
|
||||
|
||||
|
||||
private bool MatchesMinimumVersion()
|
||||
{
|
||||
if (Constants.CurrentVersion == "local")
|
||||
return true;
|
||||
|
||||
|
||||
Version currentVersion = new(Constants.CurrentVersion);
|
||||
return currentVersion >= MinimumVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a boolean indicating whether this plugin info matches the provided search string
|
||||
/// </summary>
|
||||
/// <param name="search">The search string to match</param>
|
||||
/// <returns>A boolean indicating whether this plugin info matches the provided search string</returns>
|
||||
public bool MatchesSearch(string search)
|
||||
{
|
||||
return Name.Contains(search, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
(Description != null && Description.Contains(search, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@
|
||||
<Border Grid.Column="1" BorderBrush="{DynamicResource ButtonBorderBrush}" BorderThickness="1 0 0 0" Margin="10 0 0 0" Padding="10 0 0 0">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<TextBlock Classes="h5">Plugin features</TextBlock>
|
||||
<ListBox Grid.Row="1" MaxHeight="135" ItemsSource="{CompiledBinding PluginFeatures}" />
|
||||
<ListBox Grid.Row="1" ItemsSource="{CompiledBinding PluginFeatures}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="plugins:PluginSettingsViewModel">
|
||||
<ContentControl Content="{CompiledBinding}" Height="200" />
|
||||
<ContentControl Content="{CompiledBinding}" MinHeight="200" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
@ -112,8 +112,7 @@ public partial class PluginsTabViewModel : RoutableScreen
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return _ => true;
|
||||
|
||||
return data => data.Info.Name.Contains(text, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
(data.Info.Description != null && data.Info.Description.Contains(text, StringComparison.InvariantCultureIgnoreCase));
|
||||
return data => data.Info.MatchesSearch(text) || data.Features.Any(f => f.MatchesSearch(text));
|
||||
}
|
||||
|
||||
public async Task GetMorePlugins()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user