Skip to content

Moved the sidebar settings to the appearance settings page #6688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 3, 2021
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
4 changes: 1 addition & 3 deletions Files/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ private IServiceProvider ConfigureServices()
// Base IUserSettingsService as parent settings store (to get ISettingsSharingContext from)
.AddSingleton<IUserSettingsService, UserSettingsService>()
// Children settings (from IUserSettingsService)
.AddSingleton<IFilesAndFoldersSettingsService, FilesAndFoldersSettingsService>((sp) => new FilesAndFoldersSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IStartupSettingsService, StartupSettingsService>((sp) => new StartupSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IMultitaskingSettingsService, MultitaskingSettingsService>((sp) => new MultitaskingSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IWidgetsSettingsService, WidgetsSettingsService>((sp) => new WidgetsSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<ISidebarSettingsService, SidebarSettingsService>((sp) => new SidebarSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IPreferencesSettingsService, PreferencesSettingsService>((sp) => new PreferencesSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IAppearanceSettingsService, AppearanceSettingsService>((sp) => new AppearanceSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IPreferencesSettingsService, PreferencesSettingsService>((sp) => new PreferencesSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<IPreviewPaneSettingsService, PreviewPaneSettingsService>((sp) => new PreviewPaneSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
.AddSingleton<ILayoutSettingsService, LayoutSettingsService>((sp) => new LayoutSettingsService(sp.GetService<IUserSettingsService>().GetSharingContext()))
// Settings not related to IUserSettingsService:
Expand Down
2 changes: 1 addition & 1 deletion Files/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ private async Task LoadMenuItemsAsync()
secondaryElements.OfType<FrameworkElement>().ForEach(i => i.MinWidth = Constants.UI.ContextMenuItemsMaxWidth); // Set menu min width
secondaryElements.ForEach(i => ItemContextMenuFlyout.SecondaryCommands.Add(i));

if (UserSettingsService.FilesAndFoldersSettingsService.AreFileTagsEnabled && !InstanceViewModel.IsPageTypeSearchResults && !InstanceViewModel.IsPageTypeRecycleBin && !InstanceViewModel.IsPageTypeFtp && !InstanceViewModel.IsPageTypeZipFolder)
if (UserSettingsService.PreferencesSettingsService.AreFileTagsEnabled && !InstanceViewModel.IsPageTypeSearchResults && !InstanceViewModel.IsPageTypeRecycleBin && !InstanceViewModel.IsPageTypeFtp && !InstanceViewModel.IsPageTypeZipFolder)
{
AddFileTagsItemToMenu(ItemContextMenuFlyout);
}
Expand Down
8 changes: 4 additions & 4 deletions Files/DataModels/SidebarPinnedModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void RemoveFavoritesSideBarSection()
try
{
var item = (from n in SidebarControl.SideBarItems where n.Text.Equals("SidebarFavorites".GetLocalized()) select n).FirstOrDefault();
if (!UserSettingsService.SidebarSettingsService.ShowFavoritesSection && item != null)
if (!UserSettingsService.AppearanceSettingsService.ShowFavoritesSection && item != null)
{
SidebarControl.SideBarItems.Remove(item);
}
Expand All @@ -73,7 +73,7 @@ private void RemoveFavoritesSideBarSection()

public async void UpdateFavoritesSectionVisibility()
{
if (UserSettingsService.SidebarSettingsService.ShowFavoritesSection)
if (UserSettingsService.AppearanceSettingsService.ShowFavoritesSection)
{
await AddAllItemsToSidebar();
}
Expand Down Expand Up @@ -314,7 +314,7 @@ private void AddItemToSidebarAsync(LocationItem section)
/// </summary>
public async Task AddAllItemsToSidebar()
{
if (!UserSettingsService.SidebarSettingsService.ShowFavoritesSection)
if (!UserSettingsService.AppearanceSettingsService.ShowFavoritesSection)
{
return;
}
Expand Down Expand Up @@ -366,7 +366,7 @@ public async Task AddAllItemsToSidebar()
await AddItemToSidebarAsync(path);
}

await ShowHideRecycleBinItemAsync(UserSettingsService.SidebarSettingsService.PinRecycleBinToSidebar);
await ShowHideRecycleBinItemAsync(UserSettingsService.AppearanceSettingsService.PinRecycleBinToSidebar);
}

/// <summary>
Expand Down
65 changes: 18 additions & 47 deletions Files/Dialogs/SettingsDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
mc:Ignorable="d">
<ContentDialog.Resources>
<ResourceDictionary>
<x:Double x:Key="ContentDialogMaxWidth">1300</x:Double>
<x:Double x:Key="ContentDialogMaxWidth">800</x:Double>
<Thickness x:Key="ContentDialogPadding">0</Thickness>
<SolidColorBrush x:Key="ContentDialogTopOverlay" Color="Transparent" />
<ResourceDictionary.ThemeDictionaries>
Expand All @@ -36,26 +36,18 @@
<Grid
x:Name="ContainerGrid"
Width="Auto"
Height="600"
MaxHeight="600"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{ThemeResource SolidBackgroundFillColorTertiary}">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="Column0" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<muxc:NavigationView
x:Name="SettingsPane"
Grid.Column="0"
Width="200"
Margin="12,12,0,12"
IsBackButtonVisible="Collapsed"
IsBackEnabled="False"
IsPaneOpen="True"
IsPaneToggleButtonVisible="False"
IsSettingsVisible="False"
IsTitleBarAutoPaddingEnabled="False"
OpenPaneLength="200"
PaneDisplayMode="Left"
PaneDisplayMode="Top"
SelectionChanged="SettingsPane_SelectionChanged">

<muxc:NavigationView.MenuItems>
Expand Down Expand Up @@ -86,38 +78,20 @@
<FontIcon FontFamily="{StaticResource CustomGlyph}" Glyph="&#xF116;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem
x:Uid="SettingsNavSidebar"
AccessKey="S"
Content="Sidebar"
Tag="3">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE145;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem
x:Uid="SettingsNavMultitasking"
AccessKey="M"
Content="Multitasking"
Tag="4">
Tag="3">
<muxc:NavigationViewItem.Icon>
<FontIcon FontSize="16" Glyph="&#xEE40;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem
x:Uid="SettingsNavFilesAndFolders"
AccessKey="F"
Content="Files &amp; Folders"
Tag="5">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE8B7;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem
x:Uid="SettingsNavExperimental"
AccessKey="E"
Content="Experimental"
Tag="6">
Tag="4">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xF1AD;" />
</muxc:NavigationViewItem.Icon>
Expand All @@ -128,27 +102,24 @@
<muxc:NavigationViewItem
AccessKey="B"
Content="{helpers:ResourceString Name=About}"
Tag="7">
Tag="5">
<muxc:NavigationViewItem.Icon>
<FontIcon FontSize="16" Glyph="&#xE946;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
</muxc:NavigationView.FooterMenuItems>
</muxc:NavigationView>

<ScrollViewer
Grid.Column="1"
Margin="12,0,0,0"
Padding="4,12,8,0"
Background="{ThemeResource SolidBackgroundFillColorBase}"
HorizontalScrollMode="Disabled"
VerticalScrollBarVisibility="Auto"
VerticalScrollMode="Enabled">
<Frame
x:Name="SettingsContentFrame"
Width="460"
Height="Auto" />
</ScrollViewer>
<ScrollViewer
x:Name="SettingsScrollViewer"
VerticalAlignment="Stretch"
VerticalScrollBarVisibility="Visible"
VerticalScrollMode="Enabled">
<Frame
x:Name="SettingsContentFrame"
Padding="12"
Background="{ThemeResource SolidBackgroundFillColorBase}" />
</ScrollViewer>
</muxc:NavigationView>

<Button
x:Name="ButtonClose"
Expand Down
25 changes: 5 additions & 20 deletions Files/Dialogs/SettingsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,13 @@ private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)

private void UpdateDialogLayout()
{
if (Window.Current.Bounds.Width <= 700)
{
SettingsPane.PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.LeftCompact;
SettingsContentFrame.Width = 410;
Column0.Width = new GridLength(60);
}
else
{
SettingsPane.PaneDisplayMode = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Left;
SettingsContentFrame.Width = 460;
Column0.Width = new GridLength(0, GridUnitType.Auto);
}

if (Window.Current.Bounds.Height <= 600)
{
ContainerGrid.Height = Window.Current.Bounds.Height;
SettingsScrollViewer.Height = Window.Current.Bounds.Height - 40;
}
else
{
ContainerGrid.Height = 600;
SettingsScrollViewer.Height = 560;
}
}

Expand All @@ -62,11 +49,9 @@ private void SettingsPane_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigation
0 => SettingsContentFrame.Navigate(typeof(Appearance)),
1 => SettingsContentFrame.Navigate(typeof(OnStartup)),
2 => SettingsContentFrame.Navigate(typeof(Preferences)),
3 => SettingsContentFrame.Navigate(typeof(Sidebar)),
4 => SettingsContentFrame.Navigate(typeof(Multitasking)),
5 => SettingsContentFrame.Navigate(typeof(FilesAndFolders)),
6 => SettingsContentFrame.Navigate(typeof(Experimental)),
7 => SettingsContentFrame.Navigate(typeof(About)),
3 => SettingsContentFrame.Navigate(typeof(Multitasking)),
4 => SettingsContentFrame.Navigate(typeof(Experimental)),
5 => SettingsContentFrame.Navigate(typeof(About)),
_ => SettingsContentFrame.Navigate(typeof(Appearance))
};
}
Expand Down
20 changes: 0 additions & 20 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -246,25 +246,21 @@
<Compile Include="Models\JsonSettings\ISettingsSerializer.cs" />
<Compile Include="Services\IAppearanceSettingsService.cs" />
<Compile Include="Services\IBundlesSettingsService.cs" />
<Compile Include="Services\IFilesAndFoldersSettingsService.cs" />
<Compile Include="Services\IFileTagsSettingsService.cs" />
<Compile Include="Services\ILayoutSettingsService.cs" />
<Compile Include="Services\Implementation\AppearanceSettingsService.cs" />
<Compile Include="Services\Implementation\BundlesSettingsService.cs" />
<Compile Include="Services\Implementation\FilesAndFoldersSettingsService.cs" />
<Compile Include="Services\Implementation\FileTagsSettingsService.cs" />
<Compile Include="Services\Implementation\LayoutSettingsService.cs" />
<Compile Include="Services\Implementation\MultitaskingSettingsService.cs" />
<Compile Include="Services\Implementation\PreferencesSettingsService.cs" />
<Compile Include="Services\Implementation\PreviewPaneSettingsService.cs" />
<Compile Include="Services\Implementation\SidebarSettingsService.cs" />
<Compile Include="Services\Implementation\StartupSettingsService.cs" />
<Compile Include="Services\Implementation\UserSettingsService.cs" />
<Compile Include="Services\Implementation\WidgetsSettingsService.cs" />
<Compile Include="Services\IMultitaskingSettingsService.cs" />
<Compile Include="Services\IPreferencesSettingsService.cs" />
<Compile Include="Services\IPreviewPaneSettingsService.cs" />
<Compile Include="Services\ISidebarSettingsService.cs" />
<Compile Include="Services\IStartupSettingsService.cs" />
<Compile Include="Services\IUserSettingsService.cs" />
<Compile Include="Services\IWidgetsSettingsService.cs" />
Expand Down Expand Up @@ -373,7 +369,6 @@
<Compile Include="ViewModels\Previews\ArchivePreviewViewModel.cs" />
<Compile Include="ViewModels\Previews\CodePreviewViewModel.cs" />
<Compile Include="ViewModels\Properties\SecurityProperties.cs" />
<Compile Include="ViewModels\SettingsViewModels\SidebarViewModel.cs" />
<Compile Include="ViewModels\SearchBoxViewModel.cs" />
<Compile Include="ViewModels\SidebarViewModel.cs" />
<Compile Include="Models\JsonSettings\BaseJsonSettingsModel.cs" />
Expand Down Expand Up @@ -535,7 +530,6 @@
<Compile Include="ViewModels\SettingsViewModels\AboutViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\AppearanceViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\ExperimentalViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\FilesAndFoldersViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\MultitaskingViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\OnStartupViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModels\PreferencesViewModel.cs" />
Expand Down Expand Up @@ -612,9 +606,6 @@
<Compile Include="Views\SettingsPages\OnStartup.xaml.cs">
<DependentUpon>OnStartup.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\FilesAndFolders.xaml.cs">
<DependentUpon>FilesAndFolders.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\Appearance.xaml.cs">
<DependentUpon>Appearance.xaml</DependentUpon>
</Compile>
Expand All @@ -624,9 +615,6 @@
<Compile Include="Views\SettingsPages\Multitasking.xaml.cs">
<DependentUpon>Multitasking.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\Sidebar.xaml.cs">
<DependentUpon>Sidebar.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\Preferences.xaml.cs">
<DependentUpon>Preferences.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -1406,10 +1394,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsPages\FilesAndFolders.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsPages\Appearance.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -1422,10 +1406,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsPages\Sidebar.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsPages\Preferences.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
8 changes: 4 additions & 4 deletions Files/Filesystem/CloudDrivesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public IReadOnlyList<DriveItem> Drives

public async Task EnumerateDrivesAsync()
{
if (!UserSettingsService.SidebarSettingsService.ShowCloudDrivesSection)
if (!UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection)
{
return;
}
Expand Down Expand Up @@ -105,7 +105,7 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
try
{
var section = SidebarControl.SideBarItems.FirstOrDefault(x => x.Text == "SidebarCloudDrives".GetLocalized()) as LocationItem;
if (UserSettingsService.SidebarSettingsService.ShowCloudDrivesSection && section == null && Drives.Any())
if (UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection && section == null && Drives.Any())
{
section = new LocationItem()
{
Expand Down Expand Up @@ -146,7 +146,7 @@ private void RemoveCloudDrivesSideBarSection()
try
{
var item = (from n in SidebarControl.SideBarItems where n.Text.Equals("SidebarCloudDrives".GetLocalized()) select n).FirstOrDefault();
if (!UserSettingsService.SidebarSettingsService.ShowCloudDrivesSection && item != null)
if (!UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection && item != null)
{
SidebarControl.SideBarItems.Remove(item);
}
Expand All @@ -157,7 +157,7 @@ private void RemoveCloudDrivesSideBarSection()

public async void UpdateCloudDrivesSectionVisibility()
{
if (UserSettingsService.SidebarSettingsService.ShowCloudDrivesSection)
if (UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection)
{
await EnumerateDrivesAsync();
}
Expand Down
6 changes: 3 additions & 3 deletions Files/Filesystem/Drives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
try
{
var section = SidebarControl.SideBarItems.FirstOrDefault(x => x.Text == "SidebarDrives".GetLocalized()) as LocationItem;
if (UserSettingsService.SidebarSettingsService.ShowDrivesSection && section == null)
if (UserSettingsService.AppearanceSettingsService.ShowDrivesSection && section == null)
{
section = new LocationItem()
{
Expand Down Expand Up @@ -317,7 +317,7 @@ private void RemoveDrivesSideBarSection()
try
{
var item = (from n in SidebarControl.SideBarItems where n.Text.Equals("SidebarDrives".GetLocalized()) select n).FirstOrDefault();
if (!UserSettingsService.SidebarSettingsService.ShowDrivesSection && item != null)
if (!UserSettingsService.AppearanceSettingsService.ShowDrivesSection && item != null)
{
SidebarControl.SideBarItems.Remove(item);
}
Expand All @@ -328,7 +328,7 @@ private void RemoveDrivesSideBarSection()

public async void UpdateDrivesSectionVisibility()
{
if (UserSettingsService.SidebarSettingsService.ShowDrivesSection)
if (UserSettingsService.AppearanceSettingsService.ShowDrivesSection)
{
await EnumerateDrivesAsync();
}
Expand Down
Loading