mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
UI - Moved color scheme code away from tray VM
UI - Cleaned up settings page code Core - Changed default framerate to 30
This commit is contained in:
1 parent
da123e2fe2
commit
ef4e5b4c3b
14 files changed
+504
-463
No files matched your search
@@ -1,27 +1,32 @@
|
||||
<UserControl x:Class="Artemis.UI.Screens.Settings.Tabs.General.GeneralSettingsTabView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance local:GeneralSettingsTabViewModel}">
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:Converters="clr-namespace:Artemis.UI.Converters" x:Class="Artemis.UI.Screens.Settings.Tabs.General.GeneralSettingsTabView"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance {x:Type local:GeneralSettingsTabViewModel}}">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Artemis.UI;component/ResourceDictionaries/LayerBrushDescriptors.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
<Converters:NormalizedPercentageConverter x:Key="NormalizedPercentageConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<StackPanel Margin="15" MaxWidth="800">
|
||||
<!-- General settings -->
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">General</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">
|
||||
<Run Text="General" />
|
||||
</TextBlock>
|
||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||
<StackPanel Margin="15">
|
||||
<Grid>
|
||||
@@ -37,7 +42,7 @@
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Start up with Windows</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding StartWithWindows}" />
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding UIAutoRun.Value}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
@@ -55,7 +60,9 @@
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Start up with Windows minimized</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding StartMinimized}" IsEnabled="{Binding StartWithWindows}" />
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||
IsChecked="{Binding UIShowOnStartup.Value, Converter={StaticResource InverseBooleanConverter}}"
|
||||
IsEnabled="{Binding UIAutoRun.Value}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
@@ -72,14 +79,14 @@
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Startup delay</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Set the amount of seconds to wait before running Artemis with Windows. <LineBreak />
|
||||
If some devices don't work because Artemis starts before the manufacturer's software, try increasing this value.
|
||||
<Run Text="Set the amount of seconds to wait before running Artemis with Windows." /><LineBreak />
|
||||
<Run Text="If some devices don't work because Artemis starts before the manufacturer's software, try increasing this value." />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBox Style="{StaticResource MaterialDesignFilledTextBox}"
|
||||
Text="{Binding AutoRunDelay}"
|
||||
IsEnabled="{Binding StartWithWindows}"
|
||||
Text="{Binding UIAutoRunDelay.Value}"
|
||||
IsEnabled="{Binding UIAutoRun.Value}"
|
||||
Width="100"
|
||||
materialDesign:TextFieldAssist.SuffixText="sec"
|
||||
materialDesign:HintAssist.IsFloating="false" />
|
||||
@@ -105,7 +112,7 @@
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ComboBox Style="{StaticResource MaterialDesignFilledComboBox}"
|
||||
Width="100"
|
||||
SelectedValue="{Binding SelectedColorScheme}"
|
||||
SelectedValue="{Binding UIColorScheme.Value}"
|
||||
ItemsSource="{Binding ColorSchemes}"
|
||||
SelectedValuePath="Value"
|
||||
DisplayMemberPath="Description"
|
||||
@@ -124,7 +131,9 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Log level</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Log level
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Sets the logging level, a higher logging level will result in more log files.
|
||||
</TextBlock>
|
||||
@@ -132,7 +141,7 @@
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ComboBox Style="{StaticResource MaterialDesignFilledComboBox}"
|
||||
Width="100"
|
||||
SelectedValue="{Binding SelectedLogLevel}"
|
||||
SelectedValue="{Binding CoreLoggingLevel.Value}"
|
||||
ItemsSource="{Binding LogLevels}"
|
||||
SelectedValuePath="Value"
|
||||
DisplayMemberPath="Description"
|
||||
@@ -151,22 +160,24 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Logs</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Logs
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}">
|
||||
Opens the directory where logs are stored.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowLogsFolder}" Width="150">
|
||||
SHOW LOGS
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowLogsFolder}" Width="150" Content="SHOW LOGS" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- Web server settings -->
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Web server</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">
|
||||
Web server
|
||||
</TextBlock>
|
||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||
<StackPanel Margin="15">
|
||||
<Grid>
|
||||
@@ -179,14 +190,18 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Web server port</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Web server port
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Artemis runs a local web server that can be used to externally interact with the application. <LineBreak />
|
||||
This web server can only be accessed by applications running on your own computer, e.g. supported games.
|
||||
<Run Text="Artemis runs a local web server that can be used to externally interact with the application." /><LineBreak />
|
||||
<Run Text="This web server can only be accessed by applications running on your own computer, e.g. supported games." />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBox Style="{StaticResource MaterialDesignFilledTextBox}" Text="{Binding WebServerPortSetting.Value}" Width="100"
|
||||
<TextBox Style="{StaticResource MaterialDesignFilledTextBox}"
|
||||
Text="{Binding WebServerPort.Value}"
|
||||
Width="100"
|
||||
materialDesign:HintAssist.IsFloating="false" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -194,7 +209,9 @@
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- Update settings -->
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Updating</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">
|
||||
<Run Text="Updating" />
|
||||
</TextBlock>
|
||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||
<StackPanel Margin="15">
|
||||
<Grid>
|
||||
@@ -207,13 +224,15 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Check for updates</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Check for updates
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
If enabled, we'll check for updates on startup and periodically while running.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding CheckForUpdates}" />
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding UICheckForUpdates.Value}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
@@ -228,22 +247,24 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Update</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Update
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}">
|
||||
Use the button on the right to check for updates now.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action OfferUpdatesIfFound}" Width="150">
|
||||
CHECK NOW
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action OfferUpdatesIfFound}" Width="150" Content="CHECK NOW" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- Profile editor settings -->
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Profile editor</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">
|
||||
<Run Text="Profile editor" />
|
||||
</TextBlock>
|
||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||
<StackPanel Margin="15">
|
||||
<Grid>
|
||||
@@ -256,16 +277,17 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Show condition data model values</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Show condition data model values
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
While selecting a condition target, show the current values of the data model
|
||||
While selecting a condition target, show the current values of the data model.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding ShowDataModelValues}" />
|
||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding ProfileEditorShowDataModelValues.Value}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
|
||||
<Grid>
|
||||
@@ -278,7 +300,9 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Default brush</TextBlock>
|
||||
<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>
|
||||
@@ -290,18 +314,18 @@
|
||||
materialDesign:ValidationAssist.UsePopup="True"
|
||||
materialDesign:HintAssist.IsFloating="false"
|
||||
HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding Path=LayerBrushDescriptors}"
|
||||
SelectedValue="{Binding Path=SelectedLayerBrushDescriptor}"
|
||||
ItemTemplateSelector="{dataTemplateSelectors:ComboBoxTemplateSelector
|
||||
SelectedItemTemplate={StaticResource SimpleLayerBrushDescriptorTemplate},
|
||||
DropdownItemsTemplate={StaticResource ExtendedLayerBrushDescriptorTemplate}}" />
|
||||
ItemsSource="{Binding LayerBrushDescriptors}"
|
||||
SelectedValue="{Binding SelectedLayerBrushDescriptor}"
|
||||
ItemTemplateSelector="{dataTemplateSelectors:ComboBoxTemplateSelector DropdownItemsTemplate={StaticResource ExtendedLayerBrushDescriptorTemplate}, SelectedItemTemplate={StaticResource SimpleLayerBrushDescriptorTemplate}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- Rendering settings -->
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Rendering</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">
|
||||
Rendering
|
||||
</TextBlock>
|
||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||
<StackPanel Margin="15">
|
||||
<Grid>
|
||||
@@ -314,15 +338,17 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Preferred render method</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Preferred render method
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Software-based rendering is done purely on the CPU while Vulkan uses GPU-acceleration
|
||||
Software-based rendering is done purely on the CPU while Vulkan uses GPU-acceleration.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<ComboBox Style="{StaticResource MaterialDesignFilledComboBox}"
|
||||
Width="100"
|
||||
SelectedItem="{Binding PreferredGraphicsContext}"
|
||||
SelectedItem="{Binding CorePreferredGraphicsContext.Value}"
|
||||
materialDesign:HintAssist.IsFloating="false">
|
||||
<system:String>Software</system:String>
|
||||
<system:String>Vulkan</system:String>
|
||||
@@ -341,7 +367,9 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Render scale</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Render scale
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Sets the resolution Artemis renders at, higher scale means more CPU-usage, especially on large surfaces.
|
||||
</TextBlock>
|
||||
@@ -367,9 +395,12 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Target framerate</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Target frame rate
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||
Sets the FPS Artemis tries to render at, higher FPS means more CPU-usage but smoother animations.
|
||||
Sets the FPS Artemis tries to render at, higher FPS means more CPU-usage but smoother animations. <LineBreak/>
|
||||
The options past 45 FPS are mostly useless unless you are using a custom device.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
@@ -386,7 +417,9 @@
|
||||
|
||||
|
||||
<!-- Tools -->
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Tools</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">
|
||||
Tools
|
||||
</TextBlock>
|
||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||
<StackPanel Margin="15">
|
||||
<Grid>
|
||||
@@ -399,15 +432,15 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Setup wizard</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
<Run Text="Setup wizard" />
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}">
|
||||
Opens the startup wizard usually shown when Artemis first starts.
|
||||
<Run Text="Opens the startup wizard usually shown when Artemis first starts." />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowSetupWizard}" Width="150">
|
||||
SHOW WIZARD
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowSetupWizard}" Width="150" Content="SHOW WIZARD" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
@@ -422,15 +455,15 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Debugger</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Debugger
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}">
|
||||
Use the debugger to see the raw image Artemis is rendering on the surface.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowDebugger}" Width="150">
|
||||
SHOW DEBUGGER
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowDebugger}" Width="150" Content="SHOW DEBUGGER" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
|
||||
@@ -445,15 +478,15 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Application files</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">
|
||||
Application files
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}">
|
||||
Opens the directory where application files like plugins and settings are stored.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowDataFolder}" Width="150">
|
||||
SHOW APP FILES
|
||||
</Button>
|
||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Command="{s:Action ShowDataFolder}" Width="150" Content="SHOW APP FILES" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -30,8 +30,6 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
private readonly IUpdateService _updateService;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private bool _canOfferUpdatesIfFound = true;
|
||||
private List<Tuple<string, double>> _renderScales;
|
||||
private List<Tuple<string, int>> _targetFrameRates;
|
||||
|
||||
public GeneralSettingsTabViewModel(
|
||||
IKernel kernel,
|
||||
@@ -41,9 +39,8 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
ISettingsService settingsService,
|
||||
IUpdateService updateService,
|
||||
IPluginManagementService pluginManagementService,
|
||||
IMessageService messageService,
|
||||
IRegistrationService registrationService,
|
||||
ICoreService coreService
|
||||
IMessageService messageService
|
||||
)
|
||||
{
|
||||
DisplayName = "GENERAL";
|
||||
@@ -54,38 +51,34 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
_debugService = debugService;
|
||||
_settingsService = settingsService;
|
||||
_updateService = updateService;
|
||||
_messageService = messageService;
|
||||
_registrationService = registrationService;
|
||||
_messageService = messageService;
|
||||
|
||||
LogLevels = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(LogEventLevel)));
|
||||
ColorSchemes = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(ApplicationColorScheme)));
|
||||
RenderScales = new List<Tuple<string, double>>
|
||||
RenderScales = new BindableCollection<Tuple<string, double>>
|
||||
{
|
||||
new("25%", 0.25),
|
||||
new("50%", 0.5),
|
||||
new("100%", 1),
|
||||
new("100%", 1)
|
||||
};
|
||||
TargetFrameRates = new BindableCollection<Tuple<string, int>>
|
||||
{
|
||||
new("10 FPS", 10),
|
||||
new("20 FPS", 20),
|
||||
new("30 FPS", 30),
|
||||
new("45 FPS", 45),
|
||||
new("60 FPS (lol)", 60),
|
||||
new("144 FPS (omegalol)", 144)
|
||||
};
|
||||
|
||||
TargetFrameRates = new List<Tuple<string, int>>();
|
||||
for (int i = 10; i <= 30; i += 5)
|
||||
TargetFrameRates.Add(new Tuple<string, int>(i + " FPS", i));
|
||||
if (coreService.StartupArguments.Contains("--pcmr"))
|
||||
{
|
||||
TargetFrameRates.Add(new Tuple<string, int>("60 FPS (lol)", 60));
|
||||
TargetFrameRates.Add(new Tuple<string, int>("144 FPS (omegalol)", 144));
|
||||
}
|
||||
|
||||
List<LayerBrushProvider> layerBrushProviders = pluginManagementService.GetFeaturesOfType<LayerBrushProvider>();
|
||||
|
||||
LayerBrushDescriptors = new BindableCollection<LayerBrushDescriptor>(layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors));
|
||||
_defaultLayerBrushDescriptor = _settingsService.GetSetting("ProfileEditor.DefaultLayerBrushDescriptor", new LayerBrushReference
|
||||
{
|
||||
LayerBrushProviderId = "Artemis.Plugins.LayerBrushes.Color.ColorBrushProvider-92a9d6ba",
|
||||
BrushType = "SolidBrush"
|
||||
});
|
||||
|
||||
WebServerPortSetting = _settingsService.GetSetting("WebServer.Port", 9696);
|
||||
WebServerPortSetting.AutoSave = true;
|
||||
}
|
||||
|
||||
public BindableCollection<LayerBrushDescriptor> LayerBrushDescriptors { get; }
|
||||
@@ -93,148 +86,87 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
public LayerBrushDescriptor SelectedLayerBrushDescriptor
|
||||
{
|
||||
get => LayerBrushDescriptors.FirstOrDefault(d => d.MatchesLayerBrushReference(_defaultLayerBrushDescriptor.Value));
|
||||
set
|
||||
{
|
||||
_defaultLayerBrushDescriptor.Value = new LayerBrushReference(value);
|
||||
_defaultLayerBrushDescriptor.Save();
|
||||
}
|
||||
set => _defaultLayerBrushDescriptor.Value = new LayerBrushReference(value);
|
||||
}
|
||||
|
||||
public BindableCollection<ValueDescription> LogLevels { get; }
|
||||
public BindableCollection<ValueDescription> ColorSchemes { get; }
|
||||
|
||||
public List<Tuple<string, int>> TargetFrameRates
|
||||
{
|
||||
get => _targetFrameRates;
|
||||
set => SetAndNotify(ref _targetFrameRates, value);
|
||||
}
|
||||
|
||||
public List<Tuple<string, double>> RenderScales
|
||||
{
|
||||
get => _renderScales;
|
||||
set => SetAndNotify(ref _renderScales, value);
|
||||
}
|
||||
|
||||
public bool StartWithWindows
|
||||
{
|
||||
get => _settingsService.GetSetting("UI.AutoRun", false).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("UI.AutoRun", false).Value = value;
|
||||
_settingsService.GetSetting("UI.AutoRun", false).Save();
|
||||
NotifyOfPropertyChange(nameof(StartWithWindows));
|
||||
Task.Run(() => ApplyAutorun(false));
|
||||
}
|
||||
}
|
||||
|
||||
public int AutoRunDelay
|
||||
{
|
||||
get => _settingsService.GetSetting("UI.AutoRunDelay", 15).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("UI.AutoRunDelay", 15).Value = value;
|
||||
_settingsService.GetSetting("UI.AutoRunDelay", 15).Save();
|
||||
NotifyOfPropertyChange(nameof(AutoRunDelay));
|
||||
Task.Run(() => ApplyAutorun(true));
|
||||
}
|
||||
}
|
||||
|
||||
public bool StartMinimized
|
||||
{
|
||||
get => !_settingsService.GetSetting("UI.ShowOnStartup", true).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("UI.ShowOnStartup", true).Value = !value;
|
||||
_settingsService.GetSetting("UI.ShowOnStartup", true).Save();
|
||||
NotifyOfPropertyChange(nameof(StartMinimized));
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckForUpdates
|
||||
{
|
||||
get => _settingsService.GetSetting("UI.CheckForUpdates", true).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("UI.CheckForUpdates", true).Value = value;
|
||||
_settingsService.GetSetting("UI.CheckForUpdates", true).Save();
|
||||
NotifyOfPropertyChange(nameof(CheckForUpdates));
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowDataModelValues
|
||||
{
|
||||
get => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false).Value = value;
|
||||
_settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false).Save();
|
||||
}
|
||||
}
|
||||
public BindableCollection<Tuple<string, double>> RenderScales { get; }
|
||||
public BindableCollection<Tuple<string, int>> TargetFrameRates { get; }
|
||||
|
||||
public Tuple<string, double> SelectedRenderScale
|
||||
{
|
||||
get => RenderScales.FirstOrDefault(s => Math.Abs(s.Item2 - RenderScale) < 0.01);
|
||||
set => RenderScale = value.Item2;
|
||||
get => RenderScales.FirstOrDefault(s => Math.Abs(s.Item2 - CoreRenderScale.Value) < 0.01);
|
||||
set => CoreRenderScale.Value = value.Item2;
|
||||
}
|
||||
|
||||
public Tuple<string, int> SelectedTargetFrameRate
|
||||
{
|
||||
get => TargetFrameRates.FirstOrDefault(t => Math.Abs(t.Item2 - TargetFrameRate) < 0.01);
|
||||
set => TargetFrameRate = value.Item2;
|
||||
get => TargetFrameRates.FirstOrDefault(s => s.Item2 == CoreTargetFrameRate.Value);
|
||||
set => CoreTargetFrameRate.Value = value.Item2;
|
||||
}
|
||||
|
||||
public LogEventLevel SelectedLogLevel
|
||||
public PluginSetting<bool> UIAutoRun => _settingsService.GetSetting("UI.AutoRun", false);
|
||||
public PluginSetting<int> UIAutoRunDelay => _settingsService.GetSetting("UI.AutoRunDelay", 15);
|
||||
public PluginSetting<bool> UIShowOnStartup => _settingsService.GetSetting("UI.ShowOnStartup", true);
|
||||
public PluginSetting<bool> UICheckForUpdates => _settingsService.GetSetting("UI.CheckForUpdates", true);
|
||||
public PluginSetting<ApplicationColorScheme> UIColorScheme => _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic);
|
||||
public PluginSetting<bool> ProfileEditorShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
|
||||
public PluginSetting<LogEventLevel> CoreLoggingLevel => _settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information);
|
||||
public PluginSetting<string> CorePreferredGraphicsContext => _settingsService.GetSetting("Core.PreferredGraphicsContext", "Vulkan");
|
||||
public PluginSetting<double> CoreRenderScale => _settingsService.GetSetting("Core.RenderScale", 0.25);
|
||||
public PluginSetting<int> CoreTargetFrameRate => _settingsService.GetSetting("Core.TargetFrameRate", 30);
|
||||
public PluginSetting<int> WebServerPort => _settingsService.GetSetting("WebServer.Port", 9696);
|
||||
|
||||
private void UIAutoRunOnSettingChanged(object sender, EventArgs e)
|
||||
{
|
||||
get => _settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information).Value;
|
||||
set
|
||||
Task.Run(() => ApplyAutorun(false));
|
||||
}
|
||||
|
||||
private void UIAutoRunDelayOnSettingChanged(object sender, EventArgs e)
|
||||
{
|
||||
Task.Run(() => ApplyAutorun(true));
|
||||
}
|
||||
|
||||
private void CorePreferredGraphicsContextOnSettingChanged(object sender, EventArgs e)
|
||||
{
|
||||
_registrationService.ApplyPreferredGraphicsContext();
|
||||
}
|
||||
|
||||
|
||||
private void ApplyAutorun(bool recreate)
|
||||
{
|
||||
if (!UIAutoRun.Value)
|
||||
UIShowOnStartup.Value = true;
|
||||
|
||||
// Remove the old auto-run method of placing a shortcut in shell:startup
|
||||
string autoRunFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Artemis.lnk");
|
||||
if (File.Exists(autoRunFile))
|
||||
File.Delete(autoRunFile);
|
||||
|
||||
if (Constants.BuildInfo.IsLocalBuild)
|
||||
return;
|
||||
|
||||
// Create or remove the task if necessary
|
||||
try
|
||||
{
|
||||
_settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information).Value = value;
|
||||
_settingsService.GetSetting("Core.LoggingLevel", LogEventLevel.Information).Save();
|
||||
bool taskCreated = false;
|
||||
if (!recreate)
|
||||
taskCreated = SettingsUtilities.IsAutoRunTaskCreated();
|
||||
|
||||
if (UIAutoRun.Value && !taskCreated)
|
||||
SettingsUtilities.CreateAutoRunTask(TimeSpan.FromSeconds(UIAutoRunDelay.Value));
|
||||
else if (!UIAutoRun.Value && taskCreated)
|
||||
SettingsUtilities.RemoveAutoRunTask();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Execute.PostToUIThread(() => _dialogService.ShowExceptionDialog("An exception occured while trying to apply the auto run setting", e));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public ApplicationColorScheme SelectedColorScheme
|
||||
{
|
||||
get => _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Value = value;
|
||||
_settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Save();
|
||||
}
|
||||
}
|
||||
|
||||
public string PreferredGraphicsContext
|
||||
{
|
||||
get => _settingsService.GetSetting("Core.PreferredGraphicsContext", "Vulkan").Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("Core.PreferredGraphicsContext", "Vulkan").Value = value;
|
||||
_settingsService.GetSetting("Core.PreferredGraphicsContext", "Vulkan").Save();
|
||||
_registrationService.ApplyPreferredGraphicsContext();
|
||||
}
|
||||
}
|
||||
|
||||
public double RenderScale
|
||||
{
|
||||
get => _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("Core.RenderScale", 0.25).Value = value;
|
||||
_settingsService.GetSetting("Core.RenderScale", 0.25).Save();
|
||||
}
|
||||
}
|
||||
|
||||
public int TargetFrameRate
|
||||
{
|
||||
get => _settingsService.GetSetting("Core.TargetFrameRate", 25).Value;
|
||||
set
|
||||
{
|
||||
_settingsService.GetSetting("Core.TargetFrameRate", 25).Value = value;
|
||||
_settingsService.GetSetting("Core.TargetFrameRate", 25).Save();
|
||||
}
|
||||
}
|
||||
|
||||
public PluginSetting<int> WebServerPortSetting { get; }
|
||||
#region View methods
|
||||
|
||||
public bool CanOfferUpdatesIfFound
|
||||
{
|
||||
@@ -298,44 +230,32 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides of Screen
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
Task.Run(() => ApplyAutorun(false));
|
||||
|
||||
UIAutoRun.SettingChanged += UIAutoRunOnSettingChanged;
|
||||
UIAutoRunDelay.SettingChanged += UIAutoRunDelayOnSettingChanged;
|
||||
CorePreferredGraphicsContext.SettingChanged += CorePreferredGraphicsContextOnSettingChanged;
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
|
||||
private void ApplyAutorun(bool recreate)
|
||||
protected override void OnClose()
|
||||
{
|
||||
if (!StartWithWindows)
|
||||
StartMinimized = false;
|
||||
UIAutoRun.SettingChanged -= UIAutoRunOnSettingChanged;
|
||||
UIAutoRunDelay.SettingChanged -= UIAutoRunDelayOnSettingChanged;
|
||||
CorePreferredGraphicsContext.SettingChanged -= CorePreferredGraphicsContextOnSettingChanged;
|
||||
|
||||
// Remove the old auto-run method of placing a shortcut in shell:startup
|
||||
string autoRunFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Artemis.lnk");
|
||||
if (File.Exists(autoRunFile))
|
||||
File.Delete(autoRunFile);
|
||||
|
||||
if (Constants.BuildInfo.IsLocalBuild)
|
||||
return;
|
||||
|
||||
// Create or remove the task if necessary
|
||||
try
|
||||
{
|
||||
bool taskCreated = false;
|
||||
if (!recreate) taskCreated = SettingsUtilities.IsAutoRunTaskCreated();
|
||||
|
||||
if (StartWithWindows && !taskCreated)
|
||||
SettingsUtilities.CreateAutoRunTask(TimeSpan.FromSeconds(AutoRunDelay));
|
||||
else if (!StartWithWindows && taskCreated)
|
||||
SettingsUtilities.RemoveAutoRunTask();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Execute.PostToUIThread(() => _dialogService.ShowExceptionDialog("An exception occured while trying to apply the auto run setting", e));
|
||||
throw;
|
||||
}
|
||||
_settingsService.SaveAllSettings();
|
||||
base.OnClose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum ApplicationColorScheme
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user