more settings for labels

This commit is contained in:
Mike Griese
2025-11-18 11:06:01 -06:00
parent 5b255011c7
commit 46b8eea695
5 changed files with 77 additions and 7 deletions

View File

@@ -166,6 +166,13 @@ public enum DockPinSide
End,
}
public enum ShowLabelsOption
{
Default,
ShowLabels,
HideLabels,
}
// public class DockSettingsViewModel : ObservableObject
// {
// private readonly DockSettings _settingsModel;
@@ -188,6 +195,8 @@ public partial class DockBandSettingsViewModel : ObservableObject
{
// TODO! we should have a way of saying "pinned from {extension}" vs
// just a band that's from an extension
//
// TODO! add the number of items in the band
return $"{_adapter.ExtensionName}";
}
}
@@ -196,10 +205,37 @@ public partial class DockBandSettingsViewModel : ObservableObject
public IconInfoViewModel Icon => _adapter.IconViewModel;
public bool ShowLabels
public ShowLabelsOption ShowLabels
{
get => _dockSettingsModel.ShowLabels ?? true; // TODO! deal with the fact it might be null
set => _dockSettingsModel.ShowLabels = value; // TODO! save settings
get
{
if (_dockSettingsModel.ShowLabels == null)
{
return ShowLabelsOption.Default;
}
return _dockSettingsModel.ShowLabels.Value ? ShowLabelsOption.ShowLabels : ShowLabelsOption.HideLabels;
}
set
{
_dockSettingsModel.ShowLabels = value switch
{
ShowLabelsOption.Default => null,
ShowLabelsOption.ShowLabels => true,
ShowLabelsOption.HideLabels => false,
_ => null,
};
// TODO! save settings
}
}
// used to map to ComboBox selection
public int ShowLabelsIndex
{
get => (int)ShowLabels;
set => ShowLabels = (ShowLabelsOption)value;
}
[ObservableProperty]

View File

@@ -23,6 +23,8 @@ public class DockSettings
public List<DockBandSettings> StartBands { get; set; } = [];
public List<DockBandSettings> EndBands { get; set; } = [];
public bool ShowLabels { get; set; } = true;
}
public class DockBandSettings
@@ -30,6 +32,8 @@ public class DockBandSettings
public string Id { get; set; } = string.Empty;
public bool? ShowLabels { get; set; }
public bool ResolveShowLabels(bool defaultValue) => ShowLabels ?? defaultValue;
}
public enum DockSide

View File

@@ -168,6 +168,16 @@ public partial class SettingsViewModel : INotifyPropertyChanged
}
}
public bool Dock_ShowLabels
{
get => _settings.DockSettings.ShowLabels;
set
{
_settings.DockSettings.ShowLabels = value;
Save();
}
}
public bool EnableDock
{
get => _settings.EnableDock;

View File

@@ -88,6 +88,19 @@
</ComboBox>
</controls:SettingsCard>
<!-- Show Labels -->
<controls:SettingsCard Header="Show Labels">
<controls:SettingsCard.Description>
Choose whether to show labels for dock items by default.
</controls:SettingsCard.Description>
<ToggleSwitch
IsOn="{x:Bind ShowLabels, Mode=TwoWay}"
OffContent="Hide labels"
OnContent="Show Labels" />
</controls:SettingsCard>
<!-- Bands Section -->
<TextBlock x:Uid="DockBandsSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
@@ -133,10 +146,11 @@
</StackPanel>
</ComboBoxItem>
</ComboBox>
<ToggleSwitch
IsOn="{x:Bind ShowLabels, Mode=TwoWay}"
OffContent="Hide labels"
OnContent="Show Labels" />
<ComboBox MinWidth="120" SelectedIndex="{x:Bind ShowLabelsIndex, Mode=TwoWay}">
<ComboBoxItem Content="Default" />
<ComboBoxItem Content="Show Labels" />
<ComboBoxItem Content="Hide Labels" />
</ComboBox>
</StackPanel>
</controls:SettingsCard>
</DataTemplate>

View File

@@ -56,6 +56,12 @@ public sealed partial class DockSettingsPage : Page
set => viewModel.Dock_Backdrop = SelectedIndexToBackdrop(value);
}
public bool ShowLabels
{
get => viewModel.Dock_ShowLabels;
set => viewModel.Dock_ShowLabels = value;
}
// Conversion methods for ComboBox bindings
private static int DockSizeToSelectedIndex(DockSize size) => size switch
{