mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Finished most of the refactor except databindings
This commit is contained in:
1 parent
7fff1a593f
commit
fea454ad12
56 files changed
+866
-459
No files matched your search
@@ -6,9 +6,17 @@
|
||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Tabs.General"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:dataTemplateSelectors="clr-namespace:Artemis.UI.DataTemplateSelectors"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance local:GeneralSettingsTabViewModel}">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Artemis.UI;component/ResourceDictionaries/LayerBrushDescriptors.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<StackPanel Margin="15" MaxWidth="800">
|
||||
<!-- General settings -->
|
||||
@@ -187,6 +195,39 @@
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding ShowDataModelValues}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Default brush</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Sets the default brush that is applied to new layers
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ComboBox Width="132"
|
||||
Margin="0 2"
|
||||
Padding="0 -1"
|
||||
Height="15"
|
||||
materialDesign:ComboBoxAssist.ClassicMode="True"
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding Path=LayerBrushDescriptors}"
|
||||
SelectedValue="{Binding Path=SelectedLayerBrushDescriptor}"
|
||||
ItemTemplateSelector="{dataTemplateSelectors:ComboBoxTemplateSelector
|
||||
SelectedItemTemplate={StaticResource SimpleLayerBrushDescriptorTemplate},
|
||||
DropdownItemsTemplate={StaticResource ExtendedLayerBrushDescriptorTemplate}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared;
|
||||
@@ -22,8 +23,9 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
private List<Tuple<string, double>> _renderScales;
|
||||
private List<int> _sampleSizes;
|
||||
private List<Tuple<string, int>> _targetFrameRates;
|
||||
private readonly PluginSetting<LayerBrushReference> _defaultLayerBrushDescriptor;
|
||||
|
||||
public GeneralSettingsTabViewModel(IDialogService dialogService, IDebugService debugService, ISettingsService settingsService)
|
||||
public GeneralSettingsTabViewModel(IDialogService dialogService, IDebugService debugService, ISettingsService settingsService, IPluginService pluginService)
|
||||
{
|
||||
DisplayName = "GENERAL";
|
||||
|
||||
@@ -43,6 +45,27 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
|
||||
// Anything else is kinda broken right now
|
||||
SampleSizes = new List<int> {1, 9};
|
||||
|
||||
var layerBrushProviders = pluginService.GetPluginsOfType<LayerBrushProvider>();
|
||||
|
||||
LayerBrushDescriptors = new BindableCollection<LayerBrushDescriptor>(layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors));
|
||||
_defaultLayerBrushDescriptor = _settingsService.GetSetting("ProfileEditor.DefaultLayerBrushDescriptor", new LayerBrushReference
|
||||
{
|
||||
BrushPluginGuid = Guid.Parse("92a9d6ba-6f7a-4937-94d5-c1d715b4141a"),
|
||||
BrushType = "ColorBrush"
|
||||
});
|
||||
}
|
||||
|
||||
public BindableCollection<LayerBrushDescriptor> LayerBrushDescriptors { get; }
|
||||
|
||||
public LayerBrushDescriptor SelectedLayerBrushDescriptor
|
||||
{
|
||||
get => LayerBrushDescriptors.FirstOrDefault(d => d.MatchesLayerBrushReference(_defaultLayerBrushDescriptor.Value));
|
||||
set
|
||||
{
|
||||
_defaultLayerBrushDescriptor.Value = new LayerBrushReference(value);
|
||||
_defaultLayerBrushDescriptor.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public BindableCollection<ValueDescription> LogLevels { get; }
|
||||
@@ -66,7 +89,6 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
set => SetAndNotify(ref _sampleSizes, value);
|
||||
}
|
||||
|
||||
|
||||
public bool StartWithWindows
|
||||
{
|
||||
get => _settingsService.GetSetting("UI.AutoRun", false).Value;
|
||||
|
||||
Reference in new issue
Block a user