mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Modules - Remove Name and Icon in favor PluginFeature attribute
This commit is contained in:
1 parent
730207ccd0
commit
2179c889a3
14 files changed
+54
-90
No files matched your search
@@ -142,7 +142,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
private void PopulateModules()
|
||||
{
|
||||
Modules.Clear();
|
||||
Modules.AddRange(_pluginManagementService.GetFeaturesOfType<Module>().Where(p => p.IsEnabled).OrderBy(m => m.DisplayName));
|
||||
Modules.AddRange(_pluginManagementService.GetFeaturesOfType<Module>().Where(p => p.IsEnabled).OrderBy(m => m.Info.Name));
|
||||
|
||||
if (SelectedModule == null)
|
||||
_dataModelUIService.UpdateModules(MainDataModel);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
<ColumnDefinition Width="40"/>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<shared:ArtemisIcon Grid.Column="0" Icon="{Binding Icon}" Width="24" Height="24" />
|
||||
<shared:ArtemisIcon Grid.Column="0" Icon="{Binding Plugin.Info.ResolvedIcon}" Width="24" Height="24" />
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource MaterialDesignSubtitle1TextBlock}" Text="{Binding Plugin.Info.Name}" />
|
||||
</Grid>
|
||||
|
||||
|
||||
+3
-7
@@ -1,29 +1,25 @@
|
||||
using System.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Settings.Debug.Tabs.Performance
|
||||
{
|
||||
public class PerformanceDebugPluginViewModel : Screen
|
||||
{
|
||||
public Plugin Plugin { get; }
|
||||
public object Icon { get; }
|
||||
|
||||
public PerformanceDebugPluginViewModel(Plugin plugin)
|
||||
{
|
||||
Plugin = plugin;
|
||||
Icon = PluginUtilities.GetPluginIcon(Plugin, Plugin.Info.Icon);
|
||||
}
|
||||
|
||||
public Plugin Plugin { get; }
|
||||
|
||||
public BindableCollection<PerformanceDebugProfilerViewModel> Profilers { get; } = new();
|
||||
|
||||
public void Update()
|
||||
{
|
||||
foreach (Profiler pluginProfiler in Plugin.Profilers.Where(p => p.Measurements.Any()))
|
||||
{
|
||||
if (Profilers.All(p => p.Profiler != pluginProfiler))
|
||||
Profilers.Add(new PerformanceDebugProfilerViewModel(pluginProfiler));
|
||||
}
|
||||
|
||||
foreach (PerformanceDebugProfilerViewModel profilerViewModel in Profilers)
|
||||
profilerViewModel.Update();
|
||||
|
||||
@@ -29,8 +29,9 @@
|
||||
|
||||
<!-- Icon column -->
|
||||
<shared:ArtemisIcon Grid.Column="0"
|
||||
Icon="{Binding FeatureInfo.Icon}"
|
||||
Icon="{Binding FeatureInfo.ResolvedIcon}"
|
||||
Width="20"
|
||||
Height="20"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding LoadException, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted, FallbackValue=Collapsed}" />
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<shared:ArtemisIcon Icon="{Binding Icon}"
|
||||
<shared:ArtemisIcon Icon="{Binding Plugin.Info.ResolvedIcon}"
|
||||
Width="48"
|
||||
Height="48"
|
||||
Margin="0 5 0 0"
|
||||
|
||||
@@ -45,8 +45,6 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
_dialogService = dialogService;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
_messageService = messageService;
|
||||
|
||||
Icon = PluginUtilities.GetPluginIcon(Plugin, Plugin.Info.Icon);
|
||||
}
|
||||
|
||||
public Plugin Plugin
|
||||
@@ -60,8 +58,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
get => _enabling;
|
||||
set => SetAndNotify(ref _enabling, value);
|
||||
}
|
||||
|
||||
public object Icon { get; set; }
|
||||
|
||||
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
|
||||
public bool CanOpenSettings => IsEnabled && Plugin.ConfigurationDialog != null;
|
||||
|
||||
@@ -102,7 +99,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
try
|
||||
{
|
||||
PluginConfigurationViewModel viewModel = (PluginConfigurationViewModel) Plugin.Kernel.Get(configurationViewModel.Type);
|
||||
_windowManager.ShowWindow(new PluginSettingsWindowViewModel(viewModel, Icon));
|
||||
_windowManager.ShowWindow(new PluginSettingsWindowViewModel(viewModel));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
{
|
||||
private readonly PluginConfigurationViewModel _configurationViewModel;
|
||||
|
||||
public PluginSettingsWindowViewModel(PluginConfigurationViewModel configurationViewModel, object icon)
|
||||
public PluginSettingsWindowViewModel(PluginConfigurationViewModel configurationViewModel)
|
||||
{
|
||||
_configurationViewModel = configurationViewModel ?? throw new ArgumentNullException(nameof(configurationViewModel));
|
||||
Icon = icon;
|
||||
Icon = configurationViewModel.Plugin.Info.Icon;
|
||||
}
|
||||
|
||||
public object Icon { get; }
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ namespace Artemis.UI.Screens.Sidebar.Dialogs.ProfileEdit
|
||||
: "any requirement is met";
|
||||
|
||||
Items.Clear();
|
||||
if (Module != null)
|
||||
if (Module?.ActivationRequirements != null)
|
||||
Items.AddRange(Module.ActivationRequirements.Select(_sidebarVmFactory.ModuleActivationRequirementViewModel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,8 @@ namespace Artemis.UI.Screens.Sidebar.Dialogs.ProfileEdit
|
||||
public ProfileModuleViewModel(Module module)
|
||||
{
|
||||
Module = module;
|
||||
Name = module.DisplayName;
|
||||
if (module.DisplayIcon != null)
|
||||
Icon = module.DisplayIcon.EndsWith(".svg") ? module.Plugin.ResolveRelativePath(module.DisplayIcon) : module.DisplayIcon;
|
||||
else
|
||||
Icon = PackIconKind.QuestionMark.ToString();
|
||||
Name = module.Info.Name;
|
||||
Icon = module.Info.ResolvedIcon ?? PackIconKind.QuestionMark.ToString();
|
||||
|
||||
Description = module.Info.Description;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user