Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/GamerGuardian/UI/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down Expand Up @@ -246,6 +250,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down Expand Up @@ -316,6 +324,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down Expand Up @@ -412,6 +424,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down Expand Up @@ -516,6 +532,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical"
Expand Down Expand Up @@ -594,6 +614,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down Expand Up @@ -780,6 +804,10 @@
<TextBlock Text="{Binding DefaultText}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock Text="{Binding RecommendedText}"
Visibility="{Binding RecommendedTextVisibility}"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down Expand Up @@ -824,6 +852,9 @@
<TextBlock Text="Default: Balanced"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
FontSize="11"/>
<TextBlock x:Name="PowerPlanRecommendedText"
Foreground="{DynamicResource SystemFillColorSuccessBrush}"
FontSize="11" FontWeight="SemiBold" Margin="12,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
Expand Down
37 changes: 37 additions & 0 deletions src/GamerGuardian/UI/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,10 @@ private void LoadGlobals()
var active = SafeRunGuid(PowerPlanMonitor.GetActivePlan);
var activeName = active is not null && planNames.TryGetValue(active.Value, out var name) ? name : "unknown";
PowerPlanCurrentText.Text = $"Current: {activeName}";
var planRec = SettingDocsCatalog.Get("powerplan")?.Recommended;
PowerPlanRecommendedText.Text = string.IsNullOrWhiteSpace(planRec) ? string.Empty : $"Recommended: {planRec}";
PowerPlanRecommendedText.Visibility = string.IsNullOrEmpty(PowerPlanRecommendedText.Text)
? Visibility.Collapsed : Visibility.Visible;
PowerPlanMonitorCheck.IsChecked = g.PowerPlan.Monitor;
PowerPlanAutoApplyCheck.IsChecked = g.PowerPlan.AutoApply;

Expand Down Expand Up @@ -1666,6 +1670,23 @@ public sealed class GlobalToggleRow : INotifyPropertyChanged
public Visibility LearnMoreVisibility =>
string.IsNullOrEmpty(LearnMoreContent) ? Visibility.Collapsed : Visibility.Visible;

/// <summary>
/// GamerGuardian's recommended value for this setting, pulled from the
/// per-setting docs catalog. Shown alongside Current/Default so the user can
/// see the suggested target at a glance. Empty (and hidden) when the setting
/// has no documented recommendation.
/// </summary>
public string RecommendedText
{
get
{
var rec = SettingDocsCatalog.Get(SettingId)?.Recommended;
return string.IsNullOrWhiteSpace(rec) ? string.Empty : $"Recommended: {rec}";
}
}
public Visibility RecommendedTextVisibility =>
string.IsNullOrEmpty(RecommendedText) ? Visibility.Collapsed : Visibility.Visible;

public bool Monitor
{
get => _pref.Monitor;
Expand Down Expand Up @@ -1763,6 +1784,22 @@ public sealed class ServiceRow : INotifyPropertyChanged
public Visibility LearnMoreVisibility =>
string.IsNullOrEmpty(LearnMoreContent) ? Visibility.Collapsed : Visibility.Visible;

/// <summary>
/// GamerGuardian's recommended startup state for this service, pulled from the
/// per-setting docs catalog. Shown alongside Current/Default. Empty (and
/// hidden) when the service has no documented recommendation.
/// </summary>
public string RecommendedText
{
get
{
var rec = SettingDocsCatalog.Get(SettingId)?.Recommended;
return string.IsNullOrWhiteSpace(rec) ? string.Empty : $"Recommended: {rec}";
}
}
public Visibility RecommendedTextVisibility =>
string.IsNullOrEmpty(RecommendedText) ? Visibility.Collapsed : Visibility.Visible;

public bool Monitor
{
get => _pref.Monitor;
Expand Down
22 changes: 22 additions & 0 deletions tests/GamerGuardian.Tests/SettingDocsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,26 @@ public void VerifyCommandFor_DoSvc_QueriesPolicyValue()
// sc qc would query the Services hive; the policy verify shouldn't.
Assert.DoesNotContain("sc qc", cmd);
}

[Fact]
public void Catalog_EveryEntry_HasRecommendation()
{
// The Settings UI shows "Recommended: {x}" next to Current/Default for
// every documented setting (GlobalToggleRow / ServiceRow.RecommendedText).
// A blank Recommended would render an empty/hidden line, so guard against
// any catalog entry shipping without one.
foreach (var d in SettingDocsCatalog.All)
Assert.False(string.IsNullOrWhiteSpace(d.Recommended),
$"no Recommended for {d.SettingId}");
}

[Fact]
public void Catalog_Get_ResolvesRecommendation_ForToggleAndServiceIds()
{
// RecommendedText is built from SettingDocsCatalog.Get(SettingId).Recommended.
// Spot-check the id shapes the toggle/service rows actually pass.
Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("ai.copilot")?.Recommended));
Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("service:DiagTrack")?.Recommended));
Assert.False(string.IsNullOrWhiteSpace(SettingDocsCatalog.Get("powerplan")?.Recommended));
}
}