mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Plugins - Added author, website and repository properties to plugin info
This commit is contained in:
parent
f1eefe0761
commit
a6602626a3
@ -12,15 +12,19 @@ namespace Artemis.Core
|
|||||||
[JsonObject(MemberSerialization.OptIn)]
|
[JsonObject(MemberSerialization.OptIn)]
|
||||||
public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
|
public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
|
||||||
{
|
{
|
||||||
private bool _autoEnableFeatures = true;
|
|
||||||
private string? _description;
|
|
||||||
private Guid _guid;
|
private Guid _guid;
|
||||||
|
private string? _description;
|
||||||
|
private string? _author;
|
||||||
|
private Uri? _website;
|
||||||
|
private Uri? _repository;
|
||||||
private string? _icon;
|
private string? _icon;
|
||||||
private string _main = null!;
|
private string _main = null!;
|
||||||
|
private bool _autoEnableFeatures = true;
|
||||||
private string _name = null!;
|
private string _name = null!;
|
||||||
private Plugin _plugin = null!;
|
private Plugin _plugin = null!;
|
||||||
private bool _requiresAdmin;
|
|
||||||
private Version _version = null!;
|
private Version _version = null!;
|
||||||
|
private bool _requiresAdmin;
|
||||||
|
|
||||||
|
|
||||||
internal PluginInfo()
|
internal PluginInfo()
|
||||||
{
|
{
|
||||||
@ -56,6 +60,36 @@ namespace Artemis.Core
|
|||||||
set => SetAndNotify(ref _description, value);
|
set => SetAndNotify(ref _description, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the author of this plugin
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty]
|
||||||
|
public string? Author
|
||||||
|
{
|
||||||
|
get => _author;
|
||||||
|
set => SetAndNotify(ref _author, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the website of this plugin or its author
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty]
|
||||||
|
public Uri? Website
|
||||||
|
{
|
||||||
|
get => _website;
|
||||||
|
set => SetAndNotify(ref _website, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the repository of this plugin
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty]
|
||||||
|
public Uri? Repository
|
||||||
|
{
|
||||||
|
get => _repository;
|
||||||
|
set => SetAndNotify(ref _repository, value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The plugins display icon that's shown in the settings see <see href="https://materialdesignicons.com" /> for
|
/// The plugins display icon that's shown in the settings see <see href="https://materialdesignicons.com" /> for
|
||||||
/// available icons
|
/// available icons
|
||||||
@ -118,12 +152,6 @@ namespace Artemis.Core
|
|||||||
internal set => SetAndNotify(ref _plugin, value);
|
internal set => SetAndNotify(ref _plugin, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public List<PluginPrerequisite> Prerequisites { get; } = new();
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public bool ArePrerequisitesMet() => Prerequisites.All(p => p.IsMet());
|
|
||||||
|
|
||||||
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";
|
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -131,5 +159,14 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
return $"{Name} v{Version} - {Guid}";
|
return $"{Name} v{Version} - {Guid}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public List<PluginPrerequisite> Prerequisites { get; } = new();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool ArePrerequisitesMet()
|
||||||
|
{
|
||||||
|
return Prerequisites.All(p => p.IsMet());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ namespace Artemis.UI.Behaviors
|
|||||||
|
|
||||||
private static bool TextIsEmpty(string text)
|
private static bool TextIsEmpty(string text)
|
||||||
{
|
{
|
||||||
return text.Length == 0;
|
return string.IsNullOrEmpty(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TextIsNotContainingTermToBeHighlighted(string text, string termToBeHighlighted)
|
private static bool TextIsNotContainingTermToBeHighlighted(string text, string termToBeHighlighted)
|
||||||
|
|||||||
@ -15,29 +15,29 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" />
|
||||||
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" />
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<shared:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<materialDesign:Card Width="900">
|
<materialDesign:Card Width="900">
|
||||||
<Grid Margin="8">
|
<Grid Margin="8">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="4*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="5*" />
|
||||||
<ColumnDefinition Width="3*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid Grid.Row="0" Grid.ColumnSpan="2" Margin="0 10">
|
<Grid Grid.Row="0" Margin="0 10">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="80" />
|
<ColumnDefinition Width="80" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
Height="48"
|
Height="48"
|
||||||
Margin="0 5 0 0"
|
Margin="0 5 0 0"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="3"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Top" />
|
VerticalAlignment="Top" />
|
||||||
|
|
||||||
@ -59,6 +59,12 @@
|
|||||||
|
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
|
||||||
|
Text="{Binding Plugin.Info.Author}"
|
||||||
|
Visibility="{Binding Plugin.Info.Author, Converter={StaticResource NullToVisibilityConverter}, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Grid.Row="2"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
behaviors:HighlightTermBehavior.TermToBeHighlighted="{Binding Parent.SearchPluginInput}"
|
behaviors:HighlightTermBehavior.TermToBeHighlighted="{Binding Parent.SearchPluginInput}"
|
||||||
behaviors:HighlightTermBehavior.Text="{Binding Plugin.Info.Description}"
|
behaviors:HighlightTermBehavior.Text="{Binding Plugin.Info.Description}"
|
||||||
@ -68,8 +74,12 @@
|
|||||||
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" />
|
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" Grid.Column="0">
|
||||||
<StackPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Orientation="Horizontal">
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel VerticalAlignment="Bottom" Orientation="Horizontal">
|
||||||
<Button VerticalAlignment="Bottom"
|
<Button VerticalAlignment="Bottom"
|
||||||
Style="{StaticResource MaterialDesignRaisedButton}"
|
Style="{StaticResource MaterialDesignRaisedButton}"
|
||||||
ToolTip="Open the plugins settings window"
|
ToolTip="Open the plugins settings window"
|
||||||
@ -96,20 +106,20 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Separator />
|
<Separator />
|
||||||
<Button Command="{s:Action InstallPrerequisites}" >
|
<Button Command="{s:Action InstallPrerequisites}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="CheckAll" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
<materialDesign:PackIcon Kind="CheckAll" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
<TextBlock VerticalAlignment="Center">Install prerequisites</TextBlock>
|
<TextBlock VerticalAlignment="Center">Install prerequisites</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{s:Action RemovePrerequisites}" >
|
<Button Command="{s:Action RemovePrerequisites}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Delete" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
<materialDesign:PackIcon Kind="Delete" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
<TextBlock VerticalAlignment="Center">Remove prerequisites</TextBlock>
|
<TextBlock VerticalAlignment="Center">Remove prerequisites</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Separator />
|
<Separator />
|
||||||
<Button Command="{s:Action RemoveSettings}" >
|
<Button Command="{s:Action RemoveSettings}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="DatabaseRemove" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
<materialDesign:PackIcon Kind="DatabaseRemove" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
<TextBlock VerticalAlignment="Center">Clear plugin settings</TextBlock>
|
<TextBlock VerticalAlignment="Center">Clear plugin settings</TextBlock>
|
||||||
@ -123,10 +133,29 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:PopupBox>
|
</materialDesign:PopupBox>
|
||||||
|
|
||||||
|
<Button Height="40"
|
||||||
|
Width="40"
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
ToolTip="{Binding Plugin.Info.Website}"
|
||||||
|
Visibility="{Binding Plugin.Info.Website, Converter={StaticResource NullToVisibilityConverter}, Mode=OneWay}"
|
||||||
|
Command="{s:Action OpenUri}"
|
||||||
|
CommandParameter="{Binding Plugin.Info.Website}">
|
||||||
|
<materialDesign:PackIcon Kind="Web" Width="20" Height="20" />
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Height="40"
|
||||||
|
Width="40"
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
ToolTip="{Binding Plugin.Info.Repository}"
|
||||||
|
Visibility="{Binding Plugin.Info.Repository, Converter={StaticResource NullToVisibilityConverter}, Mode=OneWay}"
|
||||||
|
Command="{s:Action OpenUri}"
|
||||||
|
CommandParameter="{Binding Plugin.Info.Repository}">
|
||||||
|
<materialDesign:PackIcon Kind="Git" Width="20" Height="20" />
|
||||||
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<CheckBox Grid.Row="0"
|
||||||
<CheckBox Grid.Row="1"
|
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
@ -142,7 +171,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
|
||||||
<ProgressBar Grid.Row="1"
|
<ProgressBar Grid.Row="0"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
@ -150,8 +179,9 @@
|
|||||||
Visibility="{Binding Enabling, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
|
Visibility="{Binding Enabling, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
|
||||||
Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0"
|
Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0"
|
||||||
IsIndeterminate="True" />
|
IsIndeterminate="True" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Border Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" BorderBrush="{StaticResource MaterialDesignDivider}" BorderThickness="1 0 0 0" Margin="10 0 0 0" Padding="10 0 0 0">
|
<Border Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" BorderBrush="{StaticResource MaterialDesignDivider}" BorderThickness="1 0 0 0" Margin="10 0 0 0" Padding="10 0 0 0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|||||||
@ -219,6 +219,11 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OpenUri(Uri uri)
|
||||||
|
{
|
||||||
|
Core.Utilities.OpenUrl(uri.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
private void PluginManagementServiceOnPluginToggled(object? sender, PluginEventArgs e)
|
private void PluginManagementServiceOnPluginToggled(object? sender, PluginEventArgs e)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(nameof(IsEnabled));
|
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user