Show the eu07.ini key on every settings row

This commit is contained in:
maj00r
2026-09-04 21:21:14 +02:00
parent 964884bd56
commit e969137824
6 changed files with 284 additions and 78 deletions

View File

@@ -5,7 +5,8 @@ namespace StarterNG.Controls;
/// <summary>
/// One line of the settings panel: label on the left, the control itself in the
/// middle, a value read-out on the right and an optional description underneath.
/// middle, a value read-out on the right, and underneath the eu07.ini key this
/// row writes plus an optional description.
/// Replaces the hand-rolled StackPanel/DockPanel pattern that used to be repeated
/// for every setting.
/// </summary>
@@ -17,6 +18,15 @@ public class SettingRow : ContentControl
public static readonly StyledProperty<string?> DescriptionProperty =
AvaloniaProperty.Register<SettingRow, string?>(nameof(Description));
/// <summary>
/// The eu07.ini key this row reads and writes, shown verbatim so a user can
/// match what they see here against the file, the wiki or a forum post. Rows
/// that are starter-only preferences carry their "starter.*" key just the
/// same; rows that write no key at all leave this empty.
/// </summary>
public static readonly StyledProperty<string?> ConfigKeyProperty =
AvaloniaProperty.Register<SettingRow, string?>(nameof(ConfigKey));
public static readonly StyledProperty<string?> ValueTextProperty =
AvaloniaProperty.Register<SettingRow, string?>(nameof(ValueText));
@@ -32,6 +42,12 @@ public class SettingRow : ContentControl
set => SetValue(DescriptionProperty, value);
}
public string? ConfigKey
{
get => GetValue(ConfigKeyProperty);
set => SetValue(ConfigKeyProperty, value);
}
public string? ValueText
{
get => GetValue(ValueTextProperty);
@@ -49,6 +65,7 @@ public class SettingRow : ContentControl
if (change.Property == LabelProperty ||
change.Property == DescriptionProperty ||
change.Property == ConfigKeyProperty ||
change.Property == ValueTextProperty ||
change.Property == ContentProperty)
UpdatePseudoClasses();
@@ -62,6 +79,7 @@ public class SettingRow : ContentControl
{
PseudoClasses.Set(":no-label", string.IsNullOrEmpty(Label));
PseudoClasses.Set(":no-description", string.IsNullOrEmpty(Description));
PseudoClasses.Set(":no-key", string.IsNullOrEmpty(ConfigKey));
PseudoClasses.Set(":no-value", string.IsNullOrEmpty(ValueText));
// A read-only row is a label and a reading with no widget between them. The
// reading then takes the middle column too, so a long path ellipsises instead