diff --git a/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs b/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs index deeff25bc..8440e8016 100644 --- a/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs +++ b/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs @@ -385,31 +385,5 @@ public void Save() Entity.Type = pathType.FullName; } - #region Equality members - - /// - /// > - protected bool Equals(DataModelPath other) - { - return ReferenceEquals(Target, other.Target) && Path == other.Path; - } - - /// - 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); - } - - /// - public override int GetHashCode() - { - return HashCode.Combine(Target, Path); - } - - #endregion - #endregion } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Surface/Layout/ArtemisLedLayout.cs b/src/Artemis.Core/Models/Surface/Layout/ArtemisLedLayout.cs index 55e237b5d..ac8e3827b 100644 --- a/src/Artemis.Core/Models/Surface/Layout/ArtemisLedLayout.cs +++ b/src/Artemis.Core/Models/Surface/Layout/ArtemisLedLayout.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using RGB.NET.Layout; @@ -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) @@ -46,7 +47,14 @@ internal ArtemisLedLayout(ArtemisLayout deviceLayout, ILedLayout led) /// Gets the custom layout data embedded in the RGB.NET layout /// public LayoutCustomLedData LayoutCustomLedData { get; } - + + /// + /// Gets the logical layout names available for this LED + /// + public IEnumerable GetLogicalLayoutNames() + { + return LayoutCustomLedData.LogicalLayouts?.Where(l => l.Name != null).Select(l => l.Name!) ?? []; + } internal void ApplyCustomLedData(ArtemisDevice artemisDevice) { @@ -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); diff --git a/src/Artemis.Core/Plugins/Profiling/Profiler.cs b/src/Artemis.Core/Plugins/Profiling/Profiler.cs index e920ed3da..d8d184ef1 100644 --- a/src/Artemis.Core/Plugins/Profiling/Profiler.cs +++ b/src/Artemis.Core/Plugins/Profiling/Profiler.cs @@ -23,8 +23,7 @@ internal Profiler(Plugin plugin, string name) /// Gets the name of this profiler /// public string Name { get; } - - + /// /// Gets a dictionary containing measurements by their identifiers /// diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 1714435f1..9702f8043 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -21,6 +21,7 @@ + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs index 51aeecec0..71d7891a8 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs @@ -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); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs index 7435ac361..6e1da26b5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs @@ -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(); diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs index 094e16d39..71c72bb2e 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs @@ -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()); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs index 8ea9f3cbd..588338b35 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs @@ -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; @@ -35,7 +36,8 @@ public StartupWizardViewModel(IContainer container, IPluginManagementService pluginManagementService, IWindowService windowService, IDeviceService deviceService, - ISettingsVmFactory settingsVmFactory) + ISettingsVmFactory settingsVmFactory, + LayoutFinderViewModel layoutFinderViewModel) { _settingsService = settingsService; _windowService = windowService; @@ -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(); @@ -82,7 +85,8 @@ public StartupWizardViewModel(IContainer container, public string Version { get; } public ObservableCollection DeviceProviders { get; } - + public LayoutFinderViewModel LayoutFinderViewModel { get; } + public bool IsAutoRunSupported => _autoRunProvider != null; public PluginSetting UIAutoRun => _settingsService.GetSetting("UI.AutoRun", false); @@ -98,7 +102,7 @@ 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(); @@ -106,11 +110,11 @@ private void ExecuteGoBack() 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(); @@ -118,9 +122,9 @@ private void ExecuteContinue() 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() diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutsStep.axaml b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutsStep.axaml new file mode 100644 index 000000000..40810d841 --- /dev/null +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutsStep.axaml @@ -0,0 +1,31 @@ + + + + + + Device layouts provide Artemis with an image of your devices and exact LED positions. + While not strictly necessary, this helps to create effects that are perfectly aligned with your hardware. + + + Below you can automatically search the Artemis Workshop for device layouts of your devices. + + + +