mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Profile editor - Added adapt menu option
Profile editor - Implement menu title casing Device properties - Display LED ID even if missing from enum
This commit is contained in:
parent
1e3121a4df
commit
ab754942d5
29
src/Artemis.UI/Converters/LedIdToStringConverter.cs
Normal file
29
src/Artemis.UI/Converters/LedIdToStringConverter.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.UI.Converters
|
||||
{
|
||||
[ValueConversion(typeof(LedId), typeof(string))]
|
||||
public class LedIdToStringConverter : IValueConverter
|
||||
{
|
||||
#region Implementation of IValueConverter
|
||||
|
||||
/// <inheritdoc />
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value?.ToString();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (Enum.TryParse(typeof(LedId), value?.ToString(), true, out object parsedLedId))
|
||||
return parsedLedId;
|
||||
return LedId.Unknown1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ using System.Windows.Data;
|
||||
|
||||
namespace Artemis.UI.Converters
|
||||
{
|
||||
[ValueConversion(typeof(Uri), typeof(string))]
|
||||
public class UriToFileNameConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
||||
@ -60,21 +60,24 @@
|
||||
s:View.ActionTarget="{Binding ProfileTreeViewModel}" />
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="View properties"
|
||||
<MenuItem Header="View Properties"
|
||||
Icon="{materialDesign:PackIcon Kind=Settings}"
|
||||
Command="{s:Action ViewProperties}"/>
|
||||
<MenuItem Header="Suspend profile"
|
||||
<MenuItem Header="Adapt Profile"
|
||||
Icon="{materialDesign:PackIcon Kind=Magic}"
|
||||
Command="{s:Action AdaptProfile}"/>
|
||||
<MenuItem Header="Suspend Profile"
|
||||
IsCheckable="True"
|
||||
IsChecked="{Binding ProfileConfiguration.IsSuspended}" />
|
||||
<Separator />
|
||||
<MenuItem Header="Export profile"
|
||||
<MenuItem Header="Export Profile"
|
||||
Icon="{materialDesign:PackIcon Kind=Export}"
|
||||
Command="{s:Action ExportProfile}" />
|
||||
<MenuItem Header="Duplicate profile"
|
||||
<MenuItem Header="Duplicate Profile"
|
||||
Icon="{materialDesign:PackIcon Kind=ContentDuplicate}"
|
||||
Command="{s:Action DuplicateProfile}" />
|
||||
<Separator />
|
||||
<MenuItem Header="Delete profile"
|
||||
<MenuItem Header="Delete Profile"
|
||||
Icon="{materialDesign:PackIcon Kind=Trash}"
|
||||
Command="{s:Action DeleteProfile}" />
|
||||
</MenuItem>
|
||||
@ -95,20 +98,20 @@
|
||||
InputGestureText="Ctrl+V" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Scripting" IsEnabled="False">
|
||||
<MenuItem Header="_Profile scripts"
|
||||
<MenuItem Header="_Profile Scripts"
|
||||
Icon="{materialDesign:PackIcon Kind=BookEdit}"
|
||||
Command="{s:Action OpenProfileScripts}"/>
|
||||
<MenuItem Header="_Layer scripts"
|
||||
<MenuItem Header="_Layer Scripts"
|
||||
Icon="{materialDesign:PackIcon Kind=Layers}"
|
||||
IsEnabled="{Binding HasSelectedElement}"
|
||||
Command="{s:Action OpenLayerScripts}"/>
|
||||
<MenuItem Header="_Property scripts"
|
||||
<MenuItem Header="_Property Scripts"
|
||||
Icon="{materialDesign:PackIcon Kind=FormTextbox}"
|
||||
IsEnabled="{Binding HasSelectedElement}"
|
||||
Command="{s:Action OpenLayerPropertyScripts}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
<MenuItem Header="Artemis wiki"
|
||||
<MenuItem Header="Artemis Wiki"
|
||||
Icon="{materialDesign:PackIcon Kind=BookEdit}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://wiki.artemis-rgb.com/" />
|
||||
@ -121,7 +124,7 @@
|
||||
Icon="{materialDesign:PackIcon Kind=Layers}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://wiki.artemis-rgb.com/guides/user/profiles/layers" />
|
||||
<MenuItem Header="Display conditions"
|
||||
<MenuItem Header="Display Conditions"
|
||||
Icon="{materialDesign:PackIcon Kind=NotEqual}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://wiki.artemis-rgb.com/guides/user/profiles/conditions" />
|
||||
@ -129,7 +132,7 @@
|
||||
Icon="{materialDesign:PackIcon Kind=Stopwatch}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://wiki.artemis-rgb.com/guides/user/profiles/timeline" />
|
||||
<MenuItem Header="Data bindings"
|
||||
<MenuItem Header="Data Bindings"
|
||||
Icon="{materialDesign:PackIcon Kind=VectorLink}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://wiki.artemis-rgb.com/guides/user/profiles/data-bindings" />
|
||||
@ -138,11 +141,11 @@
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://wiki.artemis-rgb.com/guides/user/profiles/scripting" />
|
||||
<Separator />
|
||||
<MenuItem Header="Report a bug"
|
||||
<MenuItem Header="Report a Bug"
|
||||
Icon="{materialDesign:PackIcon Kind=Github}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://github.com/Artemis-RGB/Artemis/issues" />
|
||||
<MenuItem Header="Get help on Discord"
|
||||
<MenuItem Header="Get Help on Discord"
|
||||
Icon="{materialDesign:PackIcon Kind=Discord}"
|
||||
Command="{s:Action OpenUrl}"
|
||||
CommandParameter="https://discord.gg/S3MVaC9" />
|
||||
@ -152,7 +155,7 @@
|
||||
<Button Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||
ToolTip="Open debugger"
|
||||
ToolTip="Open Debugger"
|
||||
Margin="10 -4 10 0"
|
||||
Width="34"
|
||||
Height="34"
|
||||
|
||||
@ -126,20 +126,6 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
set => SetAndNotify(ref _elementPropertiesWidth, value);
|
||||
}
|
||||
|
||||
public async Task AdaptActiveProfile()
|
||||
{
|
||||
if (_profileEditorService.SelectedProfileConfiguration?.Profile == null)
|
||||
return;
|
||||
|
||||
if (!await DialogService.ShowConfirmDialog(
|
||||
"Adapt profile",
|
||||
"Are you sure you want to adapt the profile to your current surface? Layer assignments may change."
|
||||
))
|
||||
return;
|
||||
|
||||
_profileService.AdaptProfile(_profileEditorService.SelectedProfileConfiguration.Profile);
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
// Expanded status is also undone because undoing works a bit crude, that's annoying
|
||||
@ -248,6 +234,20 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
{
|
||||
await _sidebarVmFactory.SidebarProfileConfigurationViewModel(_profileEditorService.SelectedProfileConfiguration).ViewProperties();
|
||||
}
|
||||
|
||||
public async Task AdaptProfile()
|
||||
{
|
||||
if (_profileEditorService.SelectedProfileConfiguration?.Profile == null)
|
||||
return;
|
||||
|
||||
if (!await DialogService.ShowConfirmDialog(
|
||||
"Adapt profile",
|
||||
"Are you sure you want to adapt the profile to your current surface? Layer assignments may change."
|
||||
))
|
||||
return;
|
||||
|
||||
_profileService.AdaptProfile(_profileEditorService.SelectedProfileConfiguration.Profile);
|
||||
}
|
||||
|
||||
public void DuplicateProfile()
|
||||
{
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
d:DataContext="{d:DesignInstance {x:Type tabs:DeviceLedsTabViewModel}}">
|
||||
<UserControl.Resources>
|
||||
<converters:UriToFileNameConverter x:Key="UriToFileNameConverter" />
|
||||
<converters:LedIdToStringConverter x:Key="LedIdToStringConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid ItemsSource="{Binding LedViewModels}"
|
||||
@ -31,7 +32,7 @@
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Id}" Header="LED ID" Width="Auto" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Id, Converter={StaticResource LedIdToStringConverter}, Mode=OneWay}" Header="LED ID" Width="Auto" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Color}" Header="Color (ARGB)" Width="Auto" CanUserSort="False" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding ArtemisLed.Layout.Image, Converter={StaticResource UriToFileNameConverter}, Mode=OneWay}" Header="Image file" CanUserSort="False" />
|
||||
<materialDesign:DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Shape}" Header="Shape" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user