1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Plugins tab - Added missing button

Profile editor - Color tweaks
Layer adaption hints - Color tweaks
Layer adaption hints - Save on close
Layer properties - Fix loading of keyframes
This commit is contained in:
Robert 2022-07-25 22:39:29 +02:00
parent a2ce3b9d9c
commit eccad3042a
6 changed files with 67 additions and 66 deletions

View File

@ -550,7 +550,11 @@ namespace Artemis.Core
try try
{ {
foreach (KeyframeEntity keyframeEntity in Entity.KeyframeEntities.Where(k => k.Position <= ProfileElement.Timeline.Length)) foreach (KeyframeEntity keyframeEntity in Entity.KeyframeEntities.Where(k => k.Position <= ProfileElement.Timeline.Length))
CreateKeyframeFromEntity(keyframeEntity); {
LayerPropertyKeyframe<T>? keyframe = CreateKeyframeFromEntity(keyframeEntity) as LayerPropertyKeyframe<T>;
if (keyframe != null)
AddKeyframe(keyframe);
}
} }
catch (JsonException) catch (JsonException)
{ {

View File

@ -4,7 +4,6 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Media.Immutable; using Avalonia.Media.Immutable;
using FluentAvalonia.Styling;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media; using FluentAvalonia.UI.Media;
using ReactiveUI; using ReactiveUI;
@ -56,19 +55,16 @@ namespace Artemis.UI.Shared
{ {
base.OnOpened(e); base.OnOpened(e);
// Enable Mica on Windows 11 if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || !IsWindows11)
FluentAvaloniaTheme? thm = AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>(); return;
if (thm != null && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ // Enable Mica on Windows 11, based on the FluentAvalonia sample application
// TODO: add Windows version to CoreWindow
if (IsWindows11 && thm.RequestedTheme != FluentAvaloniaTheme.HighContrastModeString)
{
TransparencyBackgroundFallback = Brushes.Transparent; TransparencyBackgroundFallback = Brushes.Transparent;
TransparencyLevelHint = WindowTransparencyLevel.Mica; TransparencyLevelHint = WindowTransparencyLevel.Mica;
TryEnableMicaEffect(thm); Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value : new Color2(32, 32, 32);
} color = color.LightenPercent(-0.8f);
} Background = new ImmutableSolidColorBrush(color, 0.78);
} }
private void OnDataContextChanged(object? value) private void OnDataContextChanged(object? value)
@ -85,29 +81,5 @@ namespace Artemis.UI.Shared
ClearValue(DataContextProperty); ClearValue(DataContextProperty);
else if (DataContext != value) DataContext = value; else if (DataContext != value) DataContext = value;
} }
private void TryEnableMicaEffect(FluentAvaloniaTheme thm)
{
// The background colors for the Mica brush are still based around SolidBackgroundFillColorBase resource
// BUT since we can't control the actual Mica brush color, we have to use the window background to create
// the same effect. However, we can't use SolidBackgroundFillColorBase directly since its opaque, and if
// we set the opacity the color become lighter than we want. So we take the normal color, darken it and
// apply the opacity until we get the roughly the correct color
// NOTE that the effect still doesn't look right, but it suffices. Ideally we need access to the Mica
// CompositionBrush to properly change the color but I don't know if we can do that or not
if (thm.RequestedTheme == FluentAvaloniaTheme.DarkModeString)
{
Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value : new Color2(32, 32, 32);
color = color.LightenPercent(-0.8f);
Background = new ImmutableSolidColorBrush(color, 0.78);
}
else if (thm.RequestedTheme == FluentAvaloniaTheme.LightModeString)
{
// Similar effect here
Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value : new Color2(243, 243, 243);
color = color.LightenPercent(0.5f);
Background = new ImmutableSolidColorBrush(color, 0.9);
}
}
} }
} }

View File

@ -8,6 +8,7 @@
mc:Ignorable="d" mc:Ignorable="d"
x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.LayerHintsDialogView" x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.LayerHintsDialogView"
x:DataType="dialogs:LayerHintsDialogViewModel" x:DataType="dialogs:LayerHintsDialogViewModel"
WindowStartupLocation="CenterOwner"
Title="Artemis | Adaption hints" Title="Artemis | Adaption hints"
Width="750" Width="750"
Height="800"> Height="800">
@ -31,7 +32,9 @@
</TextBlock> </TextBlock>
</Grid> </Grid>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" Margin="0 15"> <Border Grid.Row="1" Classes="card" Margin="0 15">
<Panel>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" IsVisible="{CompiledBinding AdaptionHints.Count}">
<ItemsControl Items="{CompiledBinding AdaptionHints}" Classes="adaption-hints"> <ItemsControl Items="{CompiledBinding AdaptionHints}" Classes="adaption-hints">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
@ -48,6 +51,19 @@
</ItemsControl> </ItemsControl>
</ScrollViewer> </ScrollViewer>
<StackPanel IsVisible="{CompiledBinding !AdaptionHints.Count}" VerticalAlignment="Center" HorizontalAlignment="Center">
<avalonia:MaterialIcon Kind="AlertCircleOutline" HorizontalAlignment="Center" Width="48" Height="48" />
<TextBlock Classes="h4" TextAlignment="Center" TextWrapping="Wrap">
You haven't set up any adaption hints
</TextBlock>
<TextBlock Classes="subtitle" TextAlignment="Center" TextWrapping="Wrap">
Artemis will attempt to directly map the LEDs of this layer to different surfaces but results may vary.
</TextBlock>
</StackPanel>
</Panel>
</Border>
<Grid Grid.Row="2" ColumnDefinitions="*,Auto"> <Grid Grid.Row="2" ColumnDefinitions="*,Auto">
<Button Grid.Row="0" Grid.Column="0" Command="{Binding AutoDetermineHints}">Auto-determine hints</Button> <Button Grid.Row="0" Grid.Column="0" Command="{Binding AutoDetermineHints}">Auto-determine hints</Button>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Spacing="5"> <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Spacing="5">

View File

@ -260,6 +260,7 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase
return; return;
await _windowService.ShowDialogAsync<LayerHintsDialogViewModel, bool>(("layer", layer)); await _windowService.ShowDialogAsync<LayerHintsDialogViewModel, bool>(("layer", layer));
await ProfileEditorService.SaveProfileAsync();
} }
private async void UpdateCanPaste(bool isFlyoutOpen) private async void UpdateCanPaste(bool isFlyoutOpen)

View File

@ -82,10 +82,7 @@
</ItemsControl> </ItemsControl>
</Grid> </Grid>
</paz:ZoomBorder> </paz:ZoomBorder>
<Border CornerRadius="0 0 8 0" VerticalAlignment="Top" HorizontalAlignment="Left"> <Border CornerRadius="0 0 8 0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="{DynamicResource ControlFillColorDefaultBrush}">
<Border.Background>
<SolidColorBrush Color="{DynamicResource CardStrokeColorDefaultSolid}" Opacity="0.65" />
</Border.Background>
<StackPanel Orientation="Horizontal" Margin="8"> <StackPanel Orientation="Horizontal" Margin="8">
<shared:ProfileConfigurationIcon ConfigurationIcon="{CompiledBinding ProfileConfiguration.Icon}" <shared:ProfileConfigurationIcon ConfigurationIcon="{CompiledBinding ProfileConfiguration.Icon}"
Foreground="{DynamicResource ToolTipForeground}" Foreground="{DynamicResource ToolTipForeground}"

View File

@ -3,6 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settings="clr-namespace:Artemis.UI.Screens.Settings" xmlns:settings="clr-namespace:Artemis.UI.Screens.Settings"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Settings.PluginsTabView" x:Class="Artemis.UI.Screens.Settings.PluginsTabView"
x:DataType="settings:PluginsTabViewModel"> x:DataType="settings:PluginsTabViewModel">
@ -13,7 +14,17 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox Classes="clearButton" Text="{CompiledBinding SearchPluginInput}" Watermark="Search plugins" Margin="0 0 10 0" /> <TextBox Classes="clearButton" Text="{CompiledBinding SearchPluginInput}" Watermark="Search plugins" Margin="0 0 10 0" />
<Button Grid.Row="0" Grid.Column="1" Classes="accent" Command="{CompiledBinding ImportPlugin}" HorizontalAlignment="Right">Import plugin</Button>
<StackPanel Spacing="5" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<controls:HyperlinkButton Grid.Row="0"
Grid.Column="1"
VerticalAlignment="Top"
NavigateUri="https://wiki.artemis-rgb.com/en/guides/user/plugins">
Get more plugins
</controls:HyperlinkButton>
<Button Classes="accent" Command="{CompiledBinding ImportPlugin}">Import plugin</Button>
</StackPanel>
</Grid> </Grid>
<ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top"> <ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">