Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBeekman committed May 3, 2024
2 parents 058513f + 10ad1d6 commit d9a3a23
Show file tree
Hide file tree
Showing 39 changed files with 600 additions and 155 deletions.
26 changes: 0 additions & 26 deletions src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,31 +385,5 @@ public void Save()
Entity.Type = pathType.FullName;
}

#region Equality members

/// <inheritdoc cref="Equals(object)" />
/// >
protected bool Equals(DataModelPath other)
{
return ReferenceEquals(Target, other.Target) && Path == other.Path;
}

/// <inheritdoc />
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((DataModelPath) obj);
}

/// <inheritdoc />
public override int GetHashCode()
{
return HashCode.Combine(Target, Path);
}

#endregion

#endregion
}
16 changes: 12 additions & 4 deletions src/Artemis.Core/Models/Surface/Layout/ArtemisLedLayout.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using RGB.NET.Layout;
Expand All @@ -15,7 +16,7 @@ internal ArtemisLedLayout(ArtemisLayout deviceLayout, ILedLayout led)
DeviceLayout = deviceLayout;
RgbLayout = led;
LayoutCustomLedData = (LayoutCustomLedData?) led.CustomData ?? new LayoutCustomLedData();

// Default to the first logical layout for images
LayoutCustomLedDataLogicalLayout? defaultLogicalLayout = LayoutCustomLedData.LogicalLayouts?.FirstOrDefault();
if (defaultLogicalLayout != null)
Expand Down Expand Up @@ -46,7 +47,14 @@ internal ArtemisLedLayout(ArtemisLayout deviceLayout, ILedLayout led)
/// Gets the custom layout data embedded in the RGB.NET layout
/// </summary>
public LayoutCustomLedData LayoutCustomLedData { get; }


/// <summary>
/// Gets the logical layout names available for this LED
/// </summary>
public IEnumerable<string> GetLogicalLayoutNames()
{
return LayoutCustomLedData.LogicalLayouts?.Where(l => l.Name != null).Select(l => l.Name!) ?? [];
}

internal void ApplyCustomLedData(ArtemisDevice artemisDevice)
{
Expand All @@ -61,11 +69,11 @@ internal void ApplyCustomLedData(ArtemisDevice artemisDevice)

ApplyLogicalLayout(logicalLayout);
}

private void ApplyLogicalLayout(LayoutCustomLedDataLogicalLayout logicalLayout)
{
string? layoutDirectory = Path.GetDirectoryName(DeviceLayout.FilePath);

LogicalName = logicalLayout.Name;
if (layoutDirectory != null && logicalLayout.Image != null)
Image = new Uri(Path.Combine(layoutDirectory, logicalLayout.Image!), UriKind.Absolute);
Expand Down
3 changes: 1 addition & 2 deletions src/Artemis.Core/Plugins/Profiling/Profiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ internal Profiler(Plugin plugin, string name)
/// Gets the name of this profiler
/// </summary>
public string Name { get; }



/// <summary>
/// Gets a dictionary containing measurements by their identifiers
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Artemis.UI/Artemis.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Skia.Lottie" />
<PackageReference Include="AvaloniaEdit.TextMate" />
<PackageReference Include="FluentAvalonia.ProgressRing" />
<PackageReference Include="Markdown.Avalonia.Tight" />
<PackageReference Include="Octopus.Octodiff" />
<PackageReference Include="PropertyChanged.SourceGenerator">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public PlaybackViewModel(IProfileEditorService profileEditorService, ISettingsSe
_keyBindingsEnabled = Shared.UI.CurrentKeyBindingsEnabled.ToProperty(this, vm => vm.KeyBindingsEnabled).DisposeWith(d);
// Update timer
Timer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000));
Timer updateTimer = new(TimeSpan.FromMilliseconds(16));
updateTimer.Elapsed += (_, _) => Update();
updateTimer.DisposeWith(d);
_profileEditorService.Playing.Subscribe(_ => _lastUpdate = DateTime.Now).DisposeWith(d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DataBindingViewModel(IProfileEditorService profileEditorService, INodeVmF
.DisposeWith(d);
_profileEditorService.Playing.CombineLatest(_profileEditorService.SuspendedEditing).Subscribe(tuple => _playing = tuple.First || tuple.Second).DisposeWith(d);
Timer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000));
Timer updateTimer = new(TimeSpan.FromMilliseconds(25));
Timer saveTimer = new(TimeSpan.FromMinutes(2));
updateTimer.Elapsed += (_, _) => Update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ private void ApplyCurrentStep(int step)
else if (step == 2)
Frame.NavigateToType(typeof(DevicesStep), null, new FrameNavigationOptions());
else if (step == 3)
Frame.NavigateToType(typeof(LayoutStep), null, new FrameNavigationOptions());
Frame.NavigateToType(typeof(LayoutsStep), null, new FrameNavigationOptions());
else if (step == 4)
Frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions());
Frame.NavigateToType(typeof(SurfaceStep), null, new FrameNavigationOptions());
else if (step == 5)
Frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions());
else if (step == 6)
Frame.NavigateToType(typeof(FinishStep), null, new FrameNavigationOptions());
}
}
18 changes: 11 additions & 7 deletions src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Artemis.Core.Services;
using Artemis.UI.DryIoc.Factories;
using Artemis.UI.Screens.Plugins;
using Artemis.UI.Screens.Workshop.LayoutFinder;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Providers;
using Artemis.UI.Shared.Services;
Expand All @@ -35,7 +36,8 @@ public StartupWizardViewModel(IContainer container,
IPluginManagementService pluginManagementService,
IWindowService windowService,
IDeviceService deviceService,
ISettingsVmFactory settingsVmFactory)
ISettingsVmFactory settingsVmFactory,
LayoutFinderViewModel layoutFinderViewModel)
{
_settingsService = settingsService;
_windowService = windowService;
Expand All @@ -54,6 +56,7 @@ public StartupWizardViewModel(IContainer container,
.Where(p => p.Info.IsCompatible && p.Features.Any(f => f.AlwaysEnabled && f.FeatureType.IsAssignableTo(typeof(DeviceProvider))))
.OrderBy(p => p.Info.Name)
.Select(p => settingsVmFactory.PluginViewModel(p, ReactiveCommand.Create(() => new Unit()))));
LayoutFinderViewModel = layoutFinderViewModel;

CurrentStep = 1;
SetupButtons();
Expand Down Expand Up @@ -82,7 +85,8 @@ public StartupWizardViewModel(IContainer container,

public string Version { get; }
public ObservableCollection<PluginViewModel> DeviceProviders { get; }

public LayoutFinderViewModel LayoutFinderViewModel { get; }

public bool IsAutoRunSupported => _autoRunProvider != null;

public PluginSetting<bool> UIAutoRun => _settingsService.GetSetting("UI.AutoRun", false);
Expand All @@ -98,29 +102,29 @@ private void ExecuteGoBack()
CurrentStep--;

// Skip the settings step if none of it's contents are supported
if (CurrentStep == 4 && !IsAutoRunSupported)
if (CurrentStep == 5 && !IsAutoRunSupported)
CurrentStep--;

SetupButtons();
}

private void ExecuteContinue()
{
if (CurrentStep < 5)
if (CurrentStep < 6)
CurrentStep++;

// Skip the settings step if none of it's contents are supported
if (CurrentStep == 4 && !IsAutoRunSupported)
if (CurrentStep == 5 && !IsAutoRunSupported)
CurrentStep++;

SetupButtons();
}

private void SetupButtons()
{
ShowContinue = CurrentStep != 3 && CurrentStep < 5;
ShowContinue = CurrentStep != 4 && CurrentStep < 6;
ShowGoBack = CurrentStep > 1;
ShowFinish = CurrentStep == 5;
ShowFinish = CurrentStep == 6;
}

private void ExecuteSkipOrFinishWizard()
Expand Down
31 changes: 31 additions & 0 deletions src/Artemis.UI/Screens/StartupWizard/Steps/LayoutsStep.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:startupWizard="clr-namespace:Artemis.UI.Screens.StartupWizard"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.StartupWizard.Steps.LayoutsStep"
x:DataType="startupWizard:StartupWizardViewModel">
<Border Classes="card">
<Grid RowDefinitions="Auto,Auto,Auto">
<StackPanel Grid.Row="0">
<TextBlock TextWrapping="Wrap">
Device layouts provide Artemis with an image of your devices and exact LED positions. <LineBreak />
While not strictly necessary, this helps to create effects that are perfectly aligned with your hardware.
</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="0 10">
Below you can automatically search the Artemis Workshop for device layouts of your devices.
</TextBlock>
</StackPanel>

<Button Grid.Row="1"
Content="Auto-install layouts"
Command="{CompiledBinding LayoutFinderViewModel.SearchAll}"
ToolTip.Tip="Search layouts and if found install them automatically"
HorizontalAlignment="Right"/>
<ScrollViewer Grid.Row="2" Margin="0 15">
<ContentControl Content="{CompiledBinding LayoutFinderViewModel}"></ContentControl>
</ScrollViewer>
</Grid>
</Border>
</UserControl>
13 changes: 13 additions & 0 deletions src/Artemis.UI/Screens/StartupWizard/Steps/LayoutsStep.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace Artemis.UI.Screens.StartupWizard.Steps;

public partial class LayoutsStep : UserControl
{
public LayoutsStep()
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:startupWizard="clr-namespace:Artemis.UI.Screens.StartupWizard"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.StartupWizard.Steps.LayoutStep"
x:Class="Artemis.UI.Screens.StartupWizard.Steps.SurfaceStep"
x:DataType="startupWizard:StartupWizardViewModel">

<Grid RowDefinitions="Auto,*,Auto,Auto" ColumnDefinitions="*,*">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace Artemis.UI.Screens.StartupWizard.Steps;

public partial class LayoutStep : UserControl
public partial class SurfaceStep : UserControl
{
public LayoutStep()
public SurfaceStep()
{
InitializeComponent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public NodeScriptWindowViewModel(NodeScript nodeScript,
{
_keyBindingsEnabled = Shared.UI.CurrentKeyBindingsEnabled.ToProperty(this, vm => vm.KeyBindingsEnabled).DisposeWith(d);
Timer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000));
Timer updateTimer = new(TimeSpan.FromMilliseconds(25));
Timer saveTimer = new(TimeSpan.FromMinutes(2));
updateTimer.Elapsed += (_, _) => Update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@
</Ellipse>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{CompiledBinding Name}" Margin="0 4 0 0"></TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" Text="{CompiledBinding Email}"></TextBlock>

<controls:HyperlinkButton
IsVisible="{CompiledBinding AllowLogout}"
Grid.Column="1"
Grid.Row="2"
Margin="-8 4 0 0"
Grid.Row="3"
Margin="-8 0 0 0"
Padding="6 4"
Click="Signout_OnClick">
Sign out
Click="Manage_OnClick">
Manage account
</controls:HyperlinkButton>

<controls:HyperlinkButton
IsVisible="{CompiledBinding AllowLogout}"
Grid.Column="1"
Grid.Row="3"
Margin="-8 0 0 0"
Grid.Row="2"
Margin="-8 4 0 0"
Padding="6 4"
Click="Manage_OnClick">
Manage account
Click="Signout_OnClick">
Sign out
</controls:HyperlinkButton>
</Grid>
</Flyout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</Styles>
</UserControl.Styles>

<Grid ColumnDefinitions="300,*" RowDefinitions="Auto,*,Auto">
<StackPanel Grid.Column="0" Grid.RowSpan="3" Margin="0 0 10 0" VerticalAlignment="Top">
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,*,Auto">
<StackPanel Grid.Column="0" Grid.RowSpan="3" Margin="0 0 10 0" VerticalAlignment="Top" Width="300" IsVisible="{CompiledBinding ShowCategoryFilter}">
<Border Classes="card" VerticalAlignment="Stretch">
<StackPanel>
<TextBlock Theme="{StaticResource SubtitleTextBlockStyle}">Categories</TextBlock>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected EntryListViewModel(IWorkshopClient workshopClient,
this.WhenActivated(d =>
{
InputViewModel.WhenAnyValue(vm => vm.Search).Skip(1).Throttle(TimeSpan.FromMilliseconds(200)).Subscribe(_ => Reset()).DisposeWith(d);
InputViewModel.WhenAnyValue(vm => vm.SortBy).Skip(1).Throttle(TimeSpan.FromMilliseconds(200)).Subscribe(_ => Reset()).DisposeWith(d);
CategoriesViewModel.WhenAnyValue(vm => vm.CategoryFilters).Skip(1).Subscribe(_ => Reset()).DisposeWith(d);
});

Expand All @@ -71,6 +72,7 @@ protected EntryListViewModel(IWorkshopClient workshopClient,

public CategoriesViewModel CategoriesViewModel { get; }
public EntryListInputViewModel InputViewModel { get; }
public bool ShowCategoryFilter { get; set; } = true;
public EntryType? EntryType { get; set; }

public ReadOnlyObservableCollection<EntryListItemViewModel> Entries { get; }
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit d9a3a23

Please sign in to comment.