Skip to content

Commit 2d43684

Browse files
committed
Initial commit.
1 parent ec458c2 commit 2d43684

File tree

2 files changed

+92
-62
lines changed

2 files changed

+92
-62
lines changed

Rubberduck.Core/UI/Settings/InspectionSettings.xaml

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xmlns:controls="clr-namespace:Rubberduck.UI.Controls"
1111
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
1212
mc:Ignorable="d"
13-
d:DesignWidth="500"
13+
d:DesignWidth="700"
1414
d:DataContext="{d:DesignInstance {x:Type settings:InspectionSettingsViewModel}, IsDesignTimeCreatable=False}">
1515
<UserControl.Resources>
1616
<converters:CodeInspectionSeverityEnumToTextConverter x:Key="CodeInspectionSeverityEnumToText" />
@@ -19,7 +19,7 @@
1919

2020
<BitmapImage x:Key="AddImage" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/plus-circle.png" />
2121
<BitmapImage x:Key="DeleteImage" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/cross-script.png" />
22-
22+
2323
<LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" EndPoint="0,1" StartPoint="0,0">
2424
<GradientStop Color="#FFD9F4FF" Offset="0"/>
2525
<GradientStop Color="#FF9BDDFB" Offset="1"/>
@@ -30,7 +30,7 @@
3030
</LinearGradientBrush>
3131
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
3232
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
33-
33+
3434
<ObjectDataProvider x:Key="Severities"
3535
MethodName="GetValues"
3636
ObjectType="{x:Type core:Enum}">
@@ -255,30 +255,51 @@
255255
</DataTrigger>
256256
</Style.Triggers>
257257
</Style>
258+
<Style x:Key="HeaderBackground" TargetType="Label">
259+
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
260+
<Setter Property="Background" Value="DarkGray"/>
261+
</Style>
262+
<Style x:Key="HeaderText" TargetType="Label">
263+
<Setter Property="Foreground" Value="White"/>
264+
<Setter Property="FontWeight" Value="SemiBold"/>
265+
</Style>
266+
<Style x:Key="BorderHeader" TargetType="Border">
267+
<Setter Property="Background" Value="DarkGray"/>
268+
<Setter Property="CornerRadius" Value="5"/>
269+
</Style>
258270
</UserControl.Resources>
259271
<Grid>
260272
<ScrollViewer>
261273
<StackPanel Margin="5,5,5,0" ScrollViewer.VerticalScrollBarVisibility="Auto">
262-
<Label Background="DarkGray"
263-
HorizontalContentAlignment="Stretch"
274+
<Border Style="{StaticResource BorderHeader}"
264275
Margin="0,5,0,5">
265-
<Label.Style>
266-
<Style>
267-
<Style.Resources>
268-
<Style TargetType="{x:Type Border}">
269-
<Setter Property="CornerRadius" Value="5"/>
270-
</Style>
271-
</Style.Resources>
272-
</Style>
273-
</Label.Style>
274-
<DockPanel Background="DarkGray" FlowDirection="LeftToRight">
276+
<DockPanel FlowDirection="LeftToRight">
275277
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
276-
<Label Foreground="White"
277-
FontWeight="SemiBold"
278+
<Label Style="{StaticResource HeaderText}"
278279
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_InspectionSeveritySettingsLabel}">
279280
</Label>
281+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
282+
<Label Content="-"/>
283+
<Label Style="{StaticResource HeaderText}"
284+
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=InspectionSettings_FilterDescription}" />
285+
<TextBox MinWidth="125"
286+
Text="{Binding InspectionSettingsDescriptionFilter, UpdateSourceTrigger=PropertyChanged}"
287+
HorizontalAlignment="Stretch" />
288+
<Border Width="10" />
289+
<Label Style="{StaticResource HeaderText}"
290+
Content="Severity:" />
291+
<CheckBox IsChecked="{Binding AreInspectionsFilteredBySeverity, UpdateSourceTrigger=PropertyChanged}" />
292+
<StackPanel Orientation="Horizontal">
293+
<ComboBox Width="100"
294+
IsEnabled="{Binding AreInspectionsFilteredBySeverity}"
295+
ItemsSource="{Binding InspectionSettingsSeverityFilter}">
296+
<!--, UpdateSourceTrigger=PropertyChanged-->
297+
</ComboBox>
298+
</StackPanel>
299+
</StackPanel>
280300
</StackPanel>
281-
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" HorizontalAlignment="Left">
301+
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" HorizontalAlignment="Left"
302+
Margin="10,0,0,0">
282303
<controls:LinkButton
283304
Margin="2"
284305
Command="{Binding ImportButtonCommand}"
@@ -288,16 +309,8 @@
288309
Command="{Binding ExportButtonCommand}"
289310
Content="{Resx ResxName=Rubberduck.Resources.Settings.SettingsUI, Key=ExportPageSettingsButton}"/>
290311
</StackPanel>
291-
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" HorizontalAlignment="Stretch">
292-
<Label Foreground="White"
293-
FontWeight="SemiBold"
294-
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=InspectionSettings_FilterDescription}" />
295-
<TextBox MinWidth="125"
296-
Text="{Binding InspectionSettingsFilter, UpdateSourceTrigger=PropertyChanged}"
297-
HorizontalAlignment="Stretch" />
298-
</StackPanel>
299312
</DockPanel>
300-
</Label>
313+
</Border>
301314
<Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="2">
302315
<controls:GroupingGrid ItemsSource="{Binding InspectionSettings}"
303316
AutoGenerateColumns="False"
@@ -344,41 +357,25 @@
344357
</controls:GroupingGrid.Columns>
345358
</controls:GroupingGrid>
346359
</Border>
347-
<Label Background="DarkGray"
348-
Foreground="White"
349-
FontWeight="SemiBold"
350-
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_Misc}"
351-
Margin="0,15,0,5">
352-
<Label.Style>
353-
<Style>
354-
<Style.Resources>
355-
<Style TargetType="{x:Type Border}">
356-
<Setter Property="CornerRadius" Value="5"/>
357-
</Style>
358-
</Style.Resources>
359-
</Style>
360-
</Label.Style>
361-
</Label>
360+
361+
<Border Style="{StaticResource BorderHeader}"
362+
Margin="0,15,0,5">
363+
<Label Style="{StaticResource HeaderText}"
364+
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_Misc}">
365+
</Label>
366+
</Border>
367+
362368
<StackPanel>
363369
<CheckBox IsChecked="{Binding RunInspectionsOnSuccessfulParse}"
364370
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_Misc_RunInspectionsOnSuccessfulParse}" />
365371
</StackPanel>
366372

367-
<Label Background="DarkGray"
368-
Foreground="White"
369-
FontWeight="SemiBold"
370-
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_WhitelistedIdentifiersLabel}"
371-
Margin="0,15,0,5">
372-
<Label.Style>
373-
<Style>
374-
<Style.Resources>
375-
<Style TargetType="{x:Type Border}">
376-
<Setter Property="CornerRadius" Value="5"/>
377-
</Style>
378-
</Style.Resources>
379-
</Style>
380-
</Label.Style>
381-
</Label>
373+
<Border Style="{StaticResource BorderHeader}"
374+
Margin="0,15,0,5">
375+
<Label Style="{StaticResource HeaderText}"
376+
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_WhitelistedIdentifiersLabel}" />
377+
</Border>
378+
382379
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeInspectionSettings_WhitelistedIdentifiersDescription}" />
383380
<ToolBarTray IsLocked="True"
384381
Background="Transparent">

Rubberduck.Core/UI/Settings/InspectionSettingsViewModel.cs

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public void UpdateCollection(CodeInspectionSeverity severity)
4343
InspectionSettings.CommitEdit();
4444
}
4545

46-
private string _inspectionSettingsFilter;
47-
public string InspectionSettingsFilter
46+
private string _inspectionSettingsDescriptionFilter;
47+
public string InspectionSettingsDescriptionFilter
4848
{
49-
get => _inspectionSettingsFilter;
49+
get => _inspectionSettingsDescriptionFilter;
5050
set
5151
{
52-
if (_inspectionSettingsFilter != value)
52+
if (_inspectionSettingsDescriptionFilter != value)
5353
{
54-
_inspectionSettingsFilter = value;
54+
_inspectionSettingsDescriptionFilter = value;
5555
OnPropertyChanged(nameof(InspectionSettings));
5656

5757
if (string.IsNullOrEmpty(value))
@@ -68,6 +68,39 @@ public string InspectionSettingsFilter
6868
}
6969
}
7070

71+
private bool _areInspectionsFilteredBySeverity;
72+
public bool AreInspectionsFilteredBySeverity
73+
{
74+
get => _areInspectionsFilteredBySeverity;
75+
set
76+
{
77+
if (_areInspectionsFilteredBySeverity != value)
78+
{
79+
_areInspectionsFilteredBySeverity = value;
80+
OnPropertyChanged();
81+
}
82+
}
83+
}
84+
85+
private CodeInspectionSeverity _appliedSeverityFilter;
86+
private List<CodeInspectionSeverity> _inspectionSettingsSeverityFilters = new List<CodeInspectionSeverity> { CodeInspectionSeverity.DoNotShow, CodeInspectionSeverity.Error, CodeInspectionSeverity.Warning, CodeInspectionSeverity.Suggestion, CodeInspectionSeverity.Hint };
87+
public List<CodeInspectionSeverity> InspectionSettingsSeverityFilters
88+
{
89+
get => _inspectionSettingsSeverityFilters;
90+
set
91+
{
92+
93+
if (_inspectionSettingsSeverityFilters.Contains(value))
94+
{
95+
_inspectionSettingsSeverityFilters = value;
96+
97+
AreInspectionsFilteredBySeverity = true;
98+
99+
OnPropertyChanged(nameof(InspectionSettings));
100+
}
101+
}
102+
}
103+
71104
private ListCollectionView _inspectionSettings;
72105
public ListCollectionView InspectionSettings
73106
{

0 commit comments

Comments
 (0)