diff --git a/src/Artemis.Core/Plugins/PluginInfo.cs b/src/Artemis.Core/Plugins/PluginInfo.cs index 1eebd03c6..91e49eeab 100644 --- a/src/Artemis.Core/Plugins/PluginInfo.cs +++ b/src/Artemis.Core/Plugins/PluginInfo.cs @@ -29,6 +29,8 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject private Uri? _website; private Uri? _helpPage; private bool _hotReloadSupported; + private Uri? _license; + private string? _licenseName; internal PluginInfo() { @@ -103,6 +105,26 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject get => _helpPage; set => SetAndNotify(ref _helpPage, value); } + + /// + /// Gets or sets the help page of this plugin + /// + [JsonProperty] + public Uri? License + { + get => _license; + set => SetAndNotify(ref _license, value); + } + + /// + /// Gets or sets the author of this plugin + /// + [JsonProperty] + public string? LicenseName + { + get => _licenseName; + set => SetAndNotify(ref _licenseName, value); + } /// /// The plugins display icon that's shown in the settings see for diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index 6e174235d..7aadc91bf 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -43,30 +43,18 @@ public partial class ArtemisIcon : UserControl // If it's a string there are several options else if (Icon is string iconString) { + // An URI pointing to an image + if (ImageRegex.IsMatch(iconString)) + { + Image image = new() {Source = new Bitmap(iconString), VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch}; + RenderOptions.SetBitmapInterpolationMode(image, BitmapInterpolationMode.HighQuality); + Content = image; + } // An enum defined as a string - if (Enum.TryParse(iconString, true, out MaterialIconKind parsedIcon)) + else if (Enum.TryParse(iconString, true, out MaterialIconKind parsedIcon)) { Content = new MaterialIcon {Kind = parsedIcon, Width = Bounds.Width, Height = Bounds.Height}; } - // An URI pointing to an image - else if (ImageRegex.IsMatch(iconString)) - { - if (!Fill) - Content = new Image - { - Source = new Bitmap(iconString), - VerticalAlignment = VerticalAlignment.Stretch, - HorizontalAlignment = HorizontalAlignment.Stretch - }; - else - Content = new Border - { - Background = TextElement.GetForeground(this), - VerticalAlignment = VerticalAlignment.Stretch, - HorizontalAlignment = HorizontalAlignment.Stretch, - OpacityMask = new ImageBrush(new Bitmap(iconString)) - }; - } else { Content = new MaterialIcon {Kind = MaterialIconKind.QuestionMark, Width = Bounds.Width, Height = Bounds.Height}; @@ -87,10 +75,10 @@ public partial class ArtemisIcon : UserControl contentControl.Height = Bounds.Height; } } - + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property == IconProperty || e.Property == FillProperty) + if (e.Property == IconProperty) Update(); } @@ -119,21 +107,5 @@ public partial class ArtemisIcon : UserControl set => SetValue(IconProperty, value); } - /// - /// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the - /// theme - /// - public static readonly StyledProperty FillProperty = AvaloniaProperty.Register(nameof(Icon)); - - /// - /// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the - /// theme - /// - public bool Fill - { - get => GetValue(FillProperty); - set => SetValue(FillProperty, value); - } - #endregion } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Styles/Artemis.axaml b/src/Artemis.UI.Shared/Styles/Artemis.axaml index 988213ad4..e41674945 100644 --- a/src/Artemis.UI.Shared/Styles/Artemis.axaml +++ b/src/Artemis.UI.Shared/Styles/Artemis.axaml @@ -33,4 +33,5 @@ + \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Styles/Plugins.axaml b/src/Artemis.UI.Shared/Styles/Plugins.axaml new file mode 100644 index 000000000..05a5db2d1 --- /dev/null +++ b/src/Artemis.UI.Shared/Styles/Plugins.axaml @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Styles/TextBlock.axaml b/src/Artemis.UI.Shared/Styles/TextBlock.axaml index 4a2a605e2..9d3cf6ab4 100644 --- a/src/Artemis.UI.Shared/Styles/TextBlock.axaml +++ b/src/Artemis.UI.Shared/Styles/TextBlock.axaml @@ -45,4 +45,9 @@ + diff --git a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml index 080b36def..064ea7154 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml @@ -9,13 +9,13 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:DataType="local:DeviceSettingsViewModel" x:Class="Artemis.UI.Screens.Device.DeviceSettingsView"> - - + + @@ -28,7 +28,7 @@ Command="{CompiledBinding IdentifyDevice}"> - + diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml index 7943954b6..66dcbb1c0 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml @@ -4,6 +4,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" xmlns:plugins="clr-namespace:Artemis.UI.Screens.Plugins" + xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" + xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Plugins.PluginSettingsWindowView" x:DataType="plugins:PluginSettingsWindowViewModel" @@ -11,9 +14,63 @@ Title="{CompiledBinding DisplayName}" Width="800" Height="800" + MaxWidth="800" WindowStartupLocation="CenterOwner"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowViewModel.cs b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowViewModel.cs index 401deb4c0..2ef07a933 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowViewModel.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowViewModel.cs @@ -16,4 +16,5 @@ public class PluginSettingsWindowViewModel : ActivatableViewModelBase public PluginConfigurationViewModel ConfigurationViewModel { get; } public Plugin Plugin { get; } + public string LicenseButtonText => Plugin.Info.LicenseName ?? "View license"; } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/PluginView.axaml b/src/Artemis.UI/Screens/Plugins/PluginView.axaml index f35e54630..b9dc83c55 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginView.axaml @@ -12,7 +12,6 @@ - + - - + + + + + +