Skip to content

Commit eba9f46

Browse files
committed
Update namings
1 parent 06aedea commit eba9f46

File tree

3 files changed

+54
-47
lines changed

3 files changed

+54
-47
lines changed

src/Files.App/ViewModels/Settings/ActionsViewModel.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public bool IsAlreadyUsedTeachingTipOpened
3131
set => SetProperty(ref _IsAlreadyUsedTeachingTipOpened, value);
3232
}
3333

34-
private bool _ShowAddNewShortcutGrid;
35-
public bool ShowAddNewShortcutGrid
34+
private bool _ShowAddNewHotKeySection;
35+
public bool ShowAddNewHotKeySection
3636
{
37-
get => _ShowAddNewShortcutGrid;
38-
set => SetProperty(ref _ShowAddNewShortcutGrid, value);
37+
get => _ShowAddNewHotKeySection;
38+
set => SetProperty(ref _ShowAddNewHotKeySection, value);
3939
}
4040

4141
private ModifiableCommandHotKeyItem? _SelectedNewShortcutItem;
@@ -48,22 +48,22 @@ public ModifiableCommandHotKeyItem? SelectedNewShortcutItem
4848
// Commands
4949

5050
public ICommand LoadCommandsCommand { get; set; }
51-
public ICommand ShowResetAllConfirmationCommand { get; set; }
52-
public ICommand ShowAddNewShortcutGridCommand { get; set; }
53-
public ICommand HideAddNewShortcutGridCommand { get; set; }
54-
public ICommand AddNewShortcutCommand { get; set; }
55-
public ICommand ResetAllCommand { get; set; }
51+
public ICommand ShowAddNewHotKeySectionCommand { get; set; }
52+
public ICommand HideAddNewHotKeySectionCommand { get; set; }
53+
public ICommand AddNewHotKeyCommand { get; set; }
54+
public ICommand ShowRestoreDefaultsConfirmationCommand { get; set; }
55+
public ICommand RestoreDefaultsCommand { get; set; }
5656

5757
// Constructor
5858

5959
public ActionsViewModel()
6060
{
6161
LoadCommandsCommand = new AsyncRelayCommand(ExecuteLoadCommandsCommand);
62-
ShowResetAllConfirmationCommand = new RelayCommand(ExecuteShowResetAllConfirmationCommand);
63-
ShowAddNewShortcutGridCommand = new RelayCommand(ExecuteShowAddNewShortcutGridCommand);
64-
HideAddNewShortcutGridCommand = new RelayCommand(ExecuteHideAddNewShortcutGridCommand);
65-
AddNewShortcutCommand = new RelayCommand(ExecuteAddNewShortcutCommand);
66-
ResetAllCommand = new RelayCommand(ExecuteResetAllCommand);
62+
ShowAddNewHotKeySectionCommand = new RelayCommand(ExecuteShowAddNewHotKeySectionCommand);
63+
HideAddNewHotKeySectionCommand = new RelayCommand(ExecuteHideAddNewHotKeySectionCommand);
64+
AddNewHotKeyCommand = new RelayCommand(ExecuteAddNewHotKeyCommand);
65+
ShowRestoreDefaultsConfirmationCommand = new RelayCommand(ExecuteShowRestoreDefaultsConfirmationCommand);
66+
RestoreDefaultsCommand = new RelayCommand(ExecuteRestoreDefaultsCommand);
6767
}
6868

6969
// Command methods
@@ -110,26 +110,21 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
110110
});
111111
}
112112

113-
private void ExecuteShowResetAllConfirmationCommand()
113+
private void ExecuteShowAddNewHotKeySectionCommand()
114114
{
115-
IsResetAllConfirmationTeachingTipOpened = true;
116-
}
117-
118-
private void ExecuteShowAddNewShortcutGridCommand()
119-
{
120-
ShowAddNewShortcutGrid = true;
115+
ShowAddNewHotKeySection = true;
121116

122-
// Reset edit mode for each item
117+
// Reset edit mode of every item
123118
foreach (var hotkey in ValidKeyboardShortcuts)
124119
{
125120
hotkey.IsEditMode = false;
126121
hotkey.HotKeyText = hotkey.HotKey.LocalizedLabel;
127122
}
128123
}
129124

130-
private void ExecuteHideAddNewShortcutGridCommand()
125+
private void ExecuteHideAddNewHotKeySectionCommand()
131126
{
132-
ShowAddNewShortcutGrid = false;
127+
ShowAddNewHotKeySection = false;
133128

134129
if (SelectedNewShortcutItem is null)
135130
return;
@@ -138,7 +133,7 @@ private void ExecuteHideAddNewShortcutGridCommand()
138133
SelectedNewShortcutItem = null;
139134
}
140135

141-
private void ExecuteAddNewShortcutCommand()
136+
private void ExecuteAddNewHotKeyCommand()
142137
{
143138
if (SelectedNewShortcutItem is null)
144139
return;
@@ -202,8 +197,8 @@ GeneralSettingsService.Actions is not null
202197
PreviousHotKey = HotKey.Parse(SelectedNewShortcutItem.PreviousHotKey.RawLabel),
203198
};
204199

205-
// Hide the grid
206-
ShowAddNewShortcutGrid = false;
200+
// Hide the section
201+
ShowAddNewHotKeySection = false;
207202

208203
// Remove from excluded list and set null
209204
SelectedNewShortcutItem.HotKeyText = "";
@@ -213,7 +208,12 @@ GeneralSettingsService.Actions is not null
213208
ValidKeyboardShortcuts.Insert(0, selectedNewItem);
214209
}
215210

216-
private void ExecuteResetAllCommand()
211+
private void ExecuteShowRestoreDefaultsConfirmationCommand()
212+
{
213+
IsResetAllConfirmationTeachingTipOpened = true;
214+
}
215+
216+
private void ExecuteRestoreDefaultsCommand()
217217
{
218218
GeneralSettingsService.Actions = null;
219219
IsResetAllConfirmationTeachingTipOpened = false;

src/Files.App/Views/Settings/ActionsPage.xaml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,36 @@
8282
<ColumnDefinition Width="Auto" />
8383
</Grid.ColumnDefinitions>
8484

85+
<!-- Subtitle Text -->
8586
<TextBlock
8687
Margin="0,8,0,4"
8788
FontSize="16"
8889
FontWeight="Medium"
8990
Text="{helpers:ResourceString Name=Commands}" />
9091

91-
<!-- Add New Button -->
92+
<!-- Show Add New Section Button -->
9293
<Button
9394
x:Name="ShowAddNewGridButton"
9495
Grid.Column="1"
95-
Command="{x:Bind ViewModel.ShowAddNewShortcutGridCommand, Mode=OneWay}"
96+
Command="{x:Bind ViewModel.ShowAddNewHotKeySectionCommand, Mode=OneWay}"
9697
Content="{helpers:ResourceString Name=AddCommand}"
9798
IsEnabled="{x:Bind ViewModel.SelectedNewShortcutItem, Converter={StaticResource NullToNegateBooleanConverter}, Mode=OneWay}" />
9899

99-
<!-- Reset All Button -->
100+
<!-- Restore Defaults Button -->
100101
<Button
101-
x:Name="ResetAllButton"
102+
x:Name="RestoreDefaultsButton"
102103
Grid.Column="2"
103-
Command="{x:Bind ViewModel.ShowResetAllConfirmationCommand, Mode=OneWay}"
104+
Command="{x:Bind ViewModel.ShowRestoreDefaultsConfirmationCommand, Mode=OneWay}"
104105
Content="{helpers:ResourceString Name=RestoreDefaults}" />
105106
</Grid>
106107

107108
<!-- Add New -->
108109
<Grid
109-
x:Name="CreateNewSectionGrid"
110+
x:Name="CreateNewHotKeySection"
110111
Height="60"
111112
Margin="0,4,0,0"
112113
Padding="16,12"
113-
x:Load="{x:Bind ViewModel.ShowAddNewShortcutGrid, Mode=OneWay}"
114+
x:Load="{x:Bind ViewModel.ShowAddNewHotKeySection, Mode=OneWay}"
114115
Background="{ThemeResource ExpanderHeaderBackground}"
115116
BorderBrush="{ThemeResource ExpanderHeaderBorderBrush}"
116117
BorderThickness="1"
@@ -123,8 +124,9 @@
123124
<ColumnDefinition Width="32" />
124125
</Grid.ColumnDefinitions>
125126

127+
<!-- New Command Selector -->
126128
<ComboBox
127-
x:Name="NewShortcutItemPickerComboBox"
129+
x:Name="NewHotKeyItemPickerComboBox"
128130
Padding="0"
129131
ItemsSource="{x:Bind ViewModel.AllKeyboardShortcuts, Mode=OneWay}"
130132
PlaceholderText="{helpers:ResourceString Name=ChooseAnAction}"
@@ -170,41 +172,43 @@
170172

171173
<!-- Add Button -->
172174
<Button
173-
x:Name="AddNewButton"
175+
x:Name="AddButton"
174176
Grid.Column="2"
175177
Width="32"
176178
Height="32"
177179
Padding="0"
178180
AutomationProperties.Name="{helpers:ResourceString Name=Add}"
179-
Command="{x:Bind ViewModel.AddNewShortcutCommand, Mode=OneWay}"
181+
Command="{x:Bind ViewModel.AddNewHotKeyCommand, Mode=OneWay}"
180182
IsEnabled="{x:Bind ViewModel.SelectedNewShortcutItem, Converter={StaticResource NullToBooleanConverter}, Mode=OneWay}"
181183
Style="{StaticResource AccentButtonStyle}"
182184
ToolTipService.ToolTip="{helpers:ResourceString Name=Add}">
183185
<FontIcon FontSize="14" Glyph="&#xE73E;" />
184186
</Button>
185187

186-
<!-- Delete Button -->
188+
<!-- Cancel Button -->
187189
<Button
188-
x:Name="DeleteButton"
190+
x:Name="CancelButton"
189191
Grid.Column="3"
190192
Width="32"
191193
Height="32"
192194
Padding="0"
193195
AutomationProperties.Name="{helpers:ResourceString Name=Cancel}"
194-
Command="{x:Bind ViewModel.HideAddNewShortcutGridCommand, Mode=OneWay}"
196+
Command="{x:Bind ViewModel.HideAddNewHotKeySectionCommand, Mode=OneWay}"
195197
ToolTipService.ToolTip="{helpers:ResourceString Name=Cancel}">
196198
<FontIcon FontSize="14" Glyph="&#xE711;" />
197199
</Button>
198200

199201
</Grid>
200202

203+
<!-- (Divider) -->
201204
<Border
202-
x:Name="CreateNewSectionGridDividerBorder"
205+
x:Name="NewHotKeySectionDividerBorder"
203206
Height="1"
204207
Margin="0,4"
205-
x:Load="{x:Bind ViewModel.ShowAddNewShortcutGrid, Mode=OneWay}"
208+
x:Load="{x:Bind ViewModel.ShowAddNewHotKeySection, Mode=OneWay}"
206209
Background="{ThemeResource DividerStrokeColorDefaultBrush}" />
207210

211+
<!-- List Of Available HotKeys -->
208212
<ListView
209213
x:Name="ValidKeyboardShortcutsListView"
210214
ItemsSource="{x:Bind ViewModel.ValidKeyboardShortcuts, Mode=OneWay}"
@@ -369,20 +373,23 @@
369373
</ListView.ItemContainerStyle>
370374

371375
</ListView>
376+
372377
</StackPanel>
373378

379+
<!-- Restore Defaults Confirmation TeachingTip -->
374380
<TeachingTip
375-
x:Name="ResetAllConfirmationTeachingTip"
376-
ActionButtonCommand="{x:Bind ViewModel.ResetAllCommand, Mode=OneWay}"
381+
x:Name="RestoreDefaultsConfirmationTeachingTip"
382+
ActionButtonCommand="{x:Bind ViewModel.RestoreDefaultsCommand, Mode=OneWay}"
377383
ActionButtonContent="{helpers:ResourceString Name=Yes}"
378384
ActionButtonStyle="{ThemeResource AccentButtonStyle}"
379385
CloseButtonContent="{helpers:ResourceString Name=No}"
380386
IsLightDismissEnabled="True"
381387
IsOpen="{x:Bind ViewModel.IsResetAllConfirmationTeachingTipOpened, Mode=TwoWay}"
382388
PreferredPlacement="BottomLeft"
383389
Subtitle="{helpers:ResourceString Name=RestoreDefaultKeybindingsConfirmation}"
384-
Target="{x:Bind ResetAllButton}" />
390+
Target="{x:Bind RestoreDefaultsButton}" />
385391

392+
<!-- Already Used TeachingTip -->
386393
<TeachingTip
387394
x:Name="AlreadyUsedTeachingTip"
388395
CloseButtonContent="OK"

src/Files.App/Views/Settings/ActionsPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private void EditButton_Click(object sender, RoutedEventArgs e)
5454
if (sender is Button button && button.DataContext is ModifiableCommandHotKeyItem item)
5555
{
5656
// Hide the add command grid
57-
ViewModel.ShowAddNewShortcutGrid = false;
57+
ViewModel.ShowAddNewHotKeySection = false;
5858

5959
// Reset the selected item's info
6060
if (ViewModel.SelectedNewShortcutItem is not null)

0 commit comments

Comments
 (0)