From 8820632e22062df6857816c3fbeb9ce97c40498f Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 27 Feb 2024 23:33:25 +0900 Subject: [PATCH 01/14] Initial commit --- .../EnumValueToEnumNameConverter.cs | 32 +++++++++++++++++++ .../UserControls/InnerNavigationToolbar.xaml | 18 ++++++++--- 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 src/Files.App/Converters/EnumValueToEnumNameConverter.cs diff --git a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs new file mode 100644 index 000000000000..a352660e4bd0 --- /dev/null +++ b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2023 Files Community +// Licensed under the MIT License. See the LICENSE. + +using Microsoft.UI.Xaml.Data; + +namespace Files.App.Converters +{ + internal sealed class EnumValueToEnumNameConverter : IValueConverter + { + public string EnumTypeName { get; set; } = string.Empty; + + public object Convert(object value, Type targetType, object parameter, string language) + { + var stringValue = value.ToString() ?? string.Empty; + + return EnumTypeName switch + { + "DetailsViewSizeKind" => Enum.Parse(stringValue).ToString(), + "ListViewSizeKind" => Enum.Parse(stringValue).ToString(), + "TilesViewSizeKind" => Enum.Parse(stringValue).ToString(), + "GridViewSizeKind" => Enum.Parse(stringValue).ToString(), + "ColumnsViewSizeKind" => Enum.Parse(stringValue).ToString(), + _ => string.Empty, + }; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml b/src/Files.App/UserControls/InnerNavigationToolbar.xaml index 2baa3c2b551a..61c0e5d245f6 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml @@ -26,6 +26,11 @@ + + + + + + @@ -844,10 +851,11 @@ @@ -927,10 +935,11 @@ @@ -1000,10 +1009,11 @@ From 1f21af3412268d4860b31dd03bdc0ac68407f417 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:06:47 +0900 Subject: [PATCH 02/14] Added comments & description --- .../Data/Enums/ColumnsViewSizeKind.cs | 27 ++++++++ .../Data/Enums/DetailsViewSizeKind.cs | 27 ++++++++ src/Files.Core/Data/Enums/GridViewSizeKind.cs | 62 +++++++++++++++++++ src/Files.Core/Data/Enums/ListViewSizeKind.cs | 27 ++++++++ .../Data/Enums/TilesViewSizeKind.cs | 7 +++ 5 files changed, 150 insertions(+) diff --git a/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs b/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs index 2952cbf672f9..0966cd1bb881 100644 --- a/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs @@ -3,12 +3,39 @@ namespace Files.Core.Data.Enums { + /// + /// Defines constant that specifies the icon/height size in Columns layout. + /// public enum ColumnsViewSizeKind { + /// + /// The icon/heigh is compact. + /// + [Description("Compact")] Compact = 1, + + /// + /// The icon/heigh is small. + /// + [Description("Small")] Small = 2, + + /// + /// The icon/heigh is medium. + /// + [Description("Medium")] Medium = 3, + + /// + /// The icon/heigh is large. + /// + [Description("Large")] Large = 4, + + /// + /// The icon/heigh is extra large. + /// + [Description("ExtraLarge")] ExtraLarge = 5, } } diff --git a/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs b/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs index b04a57e2ac2b..fb6aef2007aa 100644 --- a/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs @@ -3,12 +3,39 @@ namespace Files.Core.Data.Enums { + /// + /// Defines constant that specifies the icon/height size in Details layout. + /// public enum DetailsViewSizeKind { + /// + /// The icon/heigh is compact. + /// + [Description("Compact")] Compact = 1, + + /// + /// The icon/heigh is small. + /// + [Description("Small")] Small = 2, + + /// + /// The icon/heigh is medium. + /// + [Description("Medium")] Medium = 3, + + /// + /// The icon/heigh is large. + /// + [Description("Large")] Large = 4, + + /// + /// The icon/heigh is extra large. + /// + [Description("ExtraLarge")] ExtraLarge = 5, } } diff --git a/src/Files.Core/Data/Enums/GridViewSizeKind.cs b/src/Files.Core/Data/Enums/GridViewSizeKind.cs index 3fe606cff706..051fd5b28caa 100644 --- a/src/Files.Core/Data/Enums/GridViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/GridViewSizeKind.cs @@ -3,19 +3,81 @@ namespace Files.Core.Data.Enums { + /// + /// Defines constant that specifies the icon/height size in Grid layout. + /// public enum GridViewSizeKind { + /// + /// The icon/heigh is small. + /// + [Description("Small")] Small = 1, + + /// + /// The icon/heigh is medium. + /// + [Description("Medium")] Medium = 2, + + /// + /// The icon/heigh is medium+. + /// + [Description("Medium+")] Three = 3, + + /// + /// The icon/heigh is medium++. + /// + [Description("Medium++")] Four = 4, + + /// + /// The icon/heigh is medium+++. + /// + [Description("Medium+++")] Five = 5, + + /// + /// The icon/heigh is medium++++. + /// + [Description("Medium++++")] Six = 6, + + /// + /// The icon/heigh is medium+++++. + /// + [Description("Medium+++++")] Seven = 7, + + /// + /// The icon/heigh is large. + /// + [Description("Large")] Large = 8, + + /// + /// The icon/heigh is large+. + /// + [Description("Large+")] Nine = 9, + + /// + /// The icon/heigh is large++. + /// + [Description("Large++")] Ten = 10, + + /// + /// The icon/heigh is large+++. + /// + [Description("Large+++")] Eleven = 11, + + /// + /// The icon/heigh is extra large. + /// + [Description("ExtraLarge")] ExtraLarge = 12, } } diff --git a/src/Files.Core/Data/Enums/ListViewSizeKind.cs b/src/Files.Core/Data/Enums/ListViewSizeKind.cs index a7315b8629d4..e080e5162865 100644 --- a/src/Files.Core/Data/Enums/ListViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/ListViewSizeKind.cs @@ -3,12 +3,39 @@ namespace Files.Core.Data.Enums { + /// + /// Defines constant that specifies the icon/height size in List layout. + /// public enum ListViewSizeKind { + /// + /// The icon/heigh is compact. + /// + [Description("Compact")] Compact = 1, + + /// + /// The icon/heigh is small. + /// + [Description("Small")] Small = 2, + + /// + /// The icon/heigh is medium. + /// + [Description("Medium")] Medium = 3, + + /// + /// The icon/heigh is large. + /// + [Description("Large")] Large = 4, + + /// + /// The icon/heigh is extra large. + /// + [Description("ExtraLarge")] ExtraLarge = 5, } } diff --git a/src/Files.Core/Data/Enums/TilesViewSizeKind.cs b/src/Files.Core/Data/Enums/TilesViewSizeKind.cs index e7a45d4c1f12..19e3c108a0c7 100644 --- a/src/Files.Core/Data/Enums/TilesViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/TilesViewSizeKind.cs @@ -3,8 +3,15 @@ namespace Files.Core.Data.Enums { + /// + /// Defines constant that specifies the icon/height size in Tiles layout. + /// public enum TilesViewSizeKind { + /// + /// The icon/heigh is small. + /// + [Description("Small")] Small = 1, } } From b16f9d43bc9e6bc17c670313c5ab9f1fce29c468 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:09:10 +0900 Subject: [PATCH 03/14] Reflect --- .../Converters/EnumValueToEnumNameConverter.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs index a352660e4bd0..bec493ff4f88 100644 --- a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs +++ b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs @@ -15,11 +15,11 @@ public object Convert(object value, Type targetType, object parameter, string la return EnumTypeName switch { - "DetailsViewSizeKind" => Enum.Parse(stringValue).ToString(), - "ListViewSizeKind" => Enum.Parse(stringValue).ToString(), - "TilesViewSizeKind" => Enum.Parse(stringValue).ToString(), - "GridViewSizeKind" => Enum.Parse(stringValue).ToString(), - "ColumnsViewSizeKind" => Enum.Parse(stringValue).ToString(), + "DetailsViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), + "ListViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), + "TilesViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), + "GridViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), + "ColumnsViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), _ => string.Empty, }; } From bc9d1202f8fff488bb76911fddde334d38156a26 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:09:42 +0900 Subject: [PATCH 04/14] Commentted out --- .../Converters/EnumValueToEnumNameConverter.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs index bec493ff4f88..e796cff94244 100644 --- a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs +++ b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs @@ -15,11 +15,11 @@ public object Convert(object value, Type targetType, object parameter, string la return EnumTypeName switch { - "DetailsViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), - "ListViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), - "TilesViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), - "GridViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), - "ColumnsViewSizeKind" => Enum.Parse(stringValue).GetDescription().GetLocalizedResource(), + "DetailsViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, + "ListViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, + "TilesViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, + "GridViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, + "ColumnsViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, _ => string.Empty, }; } From 51eb33a861e9ab055f89d03c48bc39bcc6702eba Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:15:08 -0500 Subject: [PATCH 05/14] Added strings --- src/Files.App/Strings/en-US/Resources.resw | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index 8b87216359fe..e58eeb495ef3 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -3673,4 +3673,56 @@ Additional sizes are not yet available for the Tiles View. + + Compact + Used in EnumValueToEnumNameConverter.cs + + + Small + Used in EnumValueToEnumNameConverter.cs + + + Medium + Used in EnumValueToEnumNameConverter.cs + + + Medium+ + Used in EnumValueToEnumNameConverter.cs + + + Medium++ + Used in EnumValueToEnumNameConverter.cs + + + Medium+++ + Used in EnumValueToEnumNameConverter.cs + + + Medium++++ + Used in EnumValueToEnumNameConverter.cs + + + Medium+++++ + Used in EnumValueToEnumNameConverter.cs + + + Large + Used in EnumValueToEnumNameConverter.cs + + + Large+ + Used in EnumValueToEnumNameConverter.cs + + + Large++ + Used in EnumValueToEnumNameConverter.cs + + + Large+++ + Used in EnumValueToEnumNameConverter.cs + + + Extra large + Used in EnumValueToEnumNameConverter.cs + \ No newline at end of file From 46f44c1a1af44d798c1c61f0c7284657538e9520 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:18:03 -0500 Subject: [PATCH 06/14] Update Resources.resw --- src/Files.App/Strings/en-US/Resources.resw | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index e58eeb495ef3..e2249f3d8b54 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -3675,54 +3675,54 @@ Compact - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Small - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Medium - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Medium+ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Medium++ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Medium+++ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Medium++++ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Medium+++++ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Large - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Large+ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Large++ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Large+++ - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes Extra large - Used in EnumValueToEnumNameConverter.cs + Used to describe layout sizes \ No newline at end of file From f7d5cfc911b1f7e912952c3e5e2f7e96229c1280 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:20:10 +0900 Subject: [PATCH 07/14] Revert --- src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs | 5 ----- src/Files.Core/Data/Enums/DetailsViewSizeKind.cs | 5 ----- src/Files.Core/Data/Enums/GridViewSizeKind.cs | 12 ------------ src/Files.Core/Data/Enums/ListViewSizeKind.cs | 5 ----- src/Files.Core/Data/Enums/TilesViewSizeKind.cs | 1 - 5 files changed, 28 deletions(-) diff --git a/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs b/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs index 0966cd1bb881..df0bc0e64045 100644 --- a/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs @@ -11,31 +11,26 @@ public enum ColumnsViewSizeKind /// /// The icon/heigh is compact. /// - [Description("Compact")] Compact = 1, /// /// The icon/heigh is small. /// - [Description("Small")] Small = 2, /// /// The icon/heigh is medium. /// - [Description("Medium")] Medium = 3, /// /// The icon/heigh is large. /// - [Description("Large")] Large = 4, /// /// The icon/heigh is extra large. /// - [Description("ExtraLarge")] ExtraLarge = 5, } } diff --git a/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs b/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs index fb6aef2007aa..c9c3ae147082 100644 --- a/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs @@ -11,31 +11,26 @@ public enum DetailsViewSizeKind /// /// The icon/heigh is compact. /// - [Description("Compact")] Compact = 1, /// /// The icon/heigh is small. /// - [Description("Small")] Small = 2, /// /// The icon/heigh is medium. /// - [Description("Medium")] Medium = 3, /// /// The icon/heigh is large. /// - [Description("Large")] Large = 4, /// /// The icon/heigh is extra large. /// - [Description("ExtraLarge")] ExtraLarge = 5, } } diff --git a/src/Files.Core/Data/Enums/GridViewSizeKind.cs b/src/Files.Core/Data/Enums/GridViewSizeKind.cs index 051fd5b28caa..1dd2a78b5ec2 100644 --- a/src/Files.Core/Data/Enums/GridViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/GridViewSizeKind.cs @@ -11,73 +11,61 @@ public enum GridViewSizeKind /// /// The icon/heigh is small. /// - [Description("Small")] Small = 1, /// /// The icon/heigh is medium. /// - [Description("Medium")] Medium = 2, /// /// The icon/heigh is medium+. /// - [Description("Medium+")] Three = 3, /// /// The icon/heigh is medium++. /// - [Description("Medium++")] Four = 4, /// /// The icon/heigh is medium+++. /// - [Description("Medium+++")] Five = 5, /// /// The icon/heigh is medium++++. /// - [Description("Medium++++")] Six = 6, /// /// The icon/heigh is medium+++++. /// - [Description("Medium+++++")] Seven = 7, /// /// The icon/heigh is large. /// - [Description("Large")] Large = 8, /// /// The icon/heigh is large+. /// - [Description("Large+")] Nine = 9, /// /// The icon/heigh is large++. /// - [Description("Large++")] Ten = 10, /// /// The icon/heigh is large+++. /// - [Description("Large+++")] Eleven = 11, /// /// The icon/heigh is extra large. /// - [Description("ExtraLarge")] ExtraLarge = 12, } } diff --git a/src/Files.Core/Data/Enums/ListViewSizeKind.cs b/src/Files.Core/Data/Enums/ListViewSizeKind.cs index e080e5162865..922e1c647ad2 100644 --- a/src/Files.Core/Data/Enums/ListViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/ListViewSizeKind.cs @@ -11,31 +11,26 @@ public enum ListViewSizeKind /// /// The icon/heigh is compact. /// - [Description("Compact")] Compact = 1, /// /// The icon/heigh is small. /// - [Description("Small")] Small = 2, /// /// The icon/heigh is medium. /// - [Description("Medium")] Medium = 3, /// /// The icon/heigh is large. /// - [Description("Large")] Large = 4, /// /// The icon/heigh is extra large. /// - [Description("ExtraLarge")] ExtraLarge = 5, } } diff --git a/src/Files.Core/Data/Enums/TilesViewSizeKind.cs b/src/Files.Core/Data/Enums/TilesViewSizeKind.cs index 19e3c108a0c7..da1101f2973a 100644 --- a/src/Files.Core/Data/Enums/TilesViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/TilesViewSizeKind.cs @@ -11,7 +11,6 @@ public enum TilesViewSizeKind /// /// The icon/heigh is small. /// - [Description("Small")] Small = 1, } } From b675aa041ff964a3eb498018af8d93aabba91ab8 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:21:48 +0900 Subject: [PATCH 08/14] Added template for the factory --- .../Data/Factories/LayoutIconSizeKindNameFactory.cs | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs diff --git a/src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs b/src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs new file mode 100644 index 000000000000..bdf397caadaa --- /dev/null +++ b/src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2023 Files Community +// Licensed under the MIT License. See the LICENSE. + +namespace Files.App.Data.Factories +{ + internal sealed class LayoutIconSizeKindNameFactory + { + } +} From 7af12ff749009dce8d854655fa718cf792004f1b Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:22:42 +0900 Subject: [PATCH 09/14] Removed unneeded property set --- src/Files.App/UserControls/InnerNavigationToolbar.xaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml b/src/Files.App/UserControls/InnerNavigationToolbar.xaml index 61c0e5d245f6..78f9162e4daf 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml @@ -784,7 +784,6 @@ Date: Tue, 27 Feb 2024 11:38:13 -0500 Subject: [PATCH 10/14] Add space --- src/Files.App/Strings/en-US/Resources.resw | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index e2249f3d8b54..570f4620e89e 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -3686,23 +3686,23 @@ Used to describe layout sizes - Medium+ + Medium + Used to describe layout sizes - Medium++ + Medium ++ Used to describe layout sizes - Medium+++ + Medium +++ Used to describe layout sizes - Medium++++ + Medium ++++ Used to describe layout sizes - Medium+++++ + Medium +++++ Used to describe layout sizes @@ -3710,15 +3710,15 @@ Used to describe layout sizes - Large+ + Large + Used to describe layout sizes - Large++ + Large ++ Used to describe layout sizes - Large+++ + Large +++ Used to describe layout sizes From 3794f509da47e11f410120e7128d77d45b52ae34 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:49:43 +0900 Subject: [PATCH 11/14] Populate --- .../EnumValueToEnumNameConverter.cs | 15 ++- .../LayoutIconSizeKindNameFactory.cs | 9 -- .../LocalizedEnumDescriptionFactory.cs | 92 +++++++++++++++++++ 3 files changed, 102 insertions(+), 14 deletions(-) delete mode 100644 src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs create mode 100644 src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs diff --git a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs index e796cff94244..13e8fb477b3b 100644 --- a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs +++ b/src/Files.App/Converters/EnumValueToEnumNameConverter.cs @@ -15,11 +15,16 @@ public object Convert(object value, Type targetType, object parameter, string la return EnumTypeName switch { - "DetailsViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, - "ListViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, - "TilesViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, - "GridViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, - "ColumnsViewSizeKind" => Enum.Parse(stringValue).GetDescription()/*.GetLocalizedResource()*/, + "DetailsViewSizeKind" + => LocalizedEnumDescriptionFactory.Get(Enum.Parse(stringValue)), + "ListViewSizeKind" + => LocalizedEnumDescriptionFactory.Get(Enum.Parse(stringValue)), + "TilesViewSizeKind" + => LocalizedEnumDescriptionFactory.Get(Enum.Parse(stringValue)), + "GridViewSizeKind" + => LocalizedEnumDescriptionFactory.Get(Enum.Parse(stringValue)), + "ColumnsViewSizeKind" + => LocalizedEnumDescriptionFactory.Get(Enum.Parse(stringValue)), _ => string.Empty, }; } diff --git a/src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs b/src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs deleted file mode 100644 index bdf397caadaa..000000000000 --- a/src/Files.App/Data/Factories/LayoutIconSizeKindNameFactory.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2023 Files Community -// Licensed under the MIT License. See the LICENSE. - -namespace Files.App.Data.Factories -{ - internal sealed class LayoutIconSizeKindNameFactory - { - } -} diff --git a/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs b/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs new file mode 100644 index 000000000000..d9c72ec03b36 --- /dev/null +++ b/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs @@ -0,0 +1,92 @@ +// Copyright (c) 2023 Files Community +// Licensed under the MIT License. See the LICENSE. + +namespace Files.App.Data.Factories +{ + internal static class LocalizedEnumDescriptionFactory + { + private static Dictionary DetailsViewSizeKinds { get; } = []; + private static Dictionary ListViewSizeKinds { get; } = []; + private static Dictionary TilesViewSizeKinds { get; } = []; + private static Dictionary GridViewSizeKinds { get; } = []; + private static Dictionary ColumnsViewSizeKinds { get; } = []; + + public static string Get(DetailsViewSizeKind value) + { + if (DetailsViewSizeKinds.Count == 0) + { + DetailsViewSizeKinds.Add(DetailsViewSizeKind.Compact, "Compact".GetLocalizedResource()); + DetailsViewSizeKinds.Add(DetailsViewSizeKind.Small, "Small".GetLocalizedResource()); + DetailsViewSizeKinds.Add(DetailsViewSizeKind.Medium, "Medium".GetLocalizedResource()); + DetailsViewSizeKinds.Add(DetailsViewSizeKind.Large, "Large".GetLocalizedResource()); + DetailsViewSizeKinds.Add(DetailsViewSizeKind.ExtraLarge, "ExtraLarge".GetLocalizedResource()); + } + + var stringValue = DetailsViewSizeKinds.GetValueOrDefault(value)!; + return stringValue; + } + + public static string Get(ListViewSizeKind value) + { + if (ListViewSizeKinds.Count == 0) + { + ListViewSizeKinds.Add(ListViewSizeKind.Compact, "Compact".GetLocalizedResource()); + ListViewSizeKinds.Add(ListViewSizeKind.Small, "Small".GetLocalizedResource()); + ListViewSizeKinds.Add(ListViewSizeKind.Medium, "Medium".GetLocalizedResource()); + ListViewSizeKinds.Add(ListViewSizeKind.Large, "Large".GetLocalizedResource()); + ListViewSizeKinds.Add(ListViewSizeKind.ExtraLarge, "ExtraLarge".GetLocalizedResource()); + } + + var stringValue = ListViewSizeKinds.GetValueOrDefault(value)!; + return stringValue; + } + + public static string Get(TilesViewSizeKind value) + { + if (TilesViewSizeKinds.Count == 0) + { + TilesViewSizeKinds.Add(TilesViewSizeKind.Small, "Small".GetLocalizedResource()); + } + + var stringValue = TilesViewSizeKinds.GetValueOrDefault(value)!; + return stringValue; + } + + public static string Get(GridViewSizeKind value) + { + if (GridViewSizeKinds.Count == 0) + { + GridViewSizeKinds.Add(GridViewSizeKind.Small, "Small".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Medium, "Medium".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Three, "Three".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Four, "Four".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Five, "Five".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Six, "Six".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Seven, "Seven".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Large, "Large".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Nine, "Nine".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Ten, "Ten".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Eleven, "Eleven".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.ExtraLarge, "ExtraLarge".GetLocalizedResource()); + } + + var stringValue = GridViewSizeKinds.GetValueOrDefault(value)!; + return stringValue; + } + + public static string Get(ColumnsViewSizeKind value) + { + if (ColumnsViewSizeKinds.Count == 0) + { + ColumnsViewSizeKinds.Add(ColumnsViewSizeKind.Compact, "Compact".GetLocalizedResource()); + ColumnsViewSizeKinds.Add(ColumnsViewSizeKind.Small, "Small".GetLocalizedResource()); + ColumnsViewSizeKinds.Add(ColumnsViewSizeKind.Medium, "Medium".GetLocalizedResource()); + ColumnsViewSizeKinds.Add(ColumnsViewSizeKind.Large, "Large".GetLocalizedResource()); + ColumnsViewSizeKinds.Add(ColumnsViewSizeKind.ExtraLarge, "ExtraLarge".GetLocalizedResource()); + } + + var stringValue = ColumnsViewSizeKinds.GetValueOrDefault(value)!; + return stringValue; + } + } +} From fa3b31dff7d2d8d210c91989ba5fd44ddbdf66dc Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:52:35 +0900 Subject: [PATCH 12/14] Update --- ...nverter.cs => EnumToHumanizedConverter.cs} | 2 +- .../LocalizedEnumDescriptionFactory.cs | 19 +++++++++++-------- .../UserControls/InnerNavigationToolbar.xaml | 18 +++++++++--------- 3 files changed, 21 insertions(+), 18 deletions(-) rename src/Files.App/Converters/{EnumValueToEnumNameConverter.cs => EnumToHumanizedConverter.cs} (94%) diff --git a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs b/src/Files.App/Converters/EnumToHumanizedConverter.cs similarity index 94% rename from src/Files.App/Converters/EnumValueToEnumNameConverter.cs rename to src/Files.App/Converters/EnumToHumanizedConverter.cs index 13e8fb477b3b..e7376a37f35e 100644 --- a/src/Files.App/Converters/EnumValueToEnumNameConverter.cs +++ b/src/Files.App/Converters/EnumToHumanizedConverter.cs @@ -5,7 +5,7 @@ namespace Files.App.Converters { - internal sealed class EnumValueToEnumNameConverter : IValueConverter + internal sealed class EnumToHumanizedConverter : IValueConverter { public string EnumTypeName { get; set; } = string.Empty; diff --git a/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs b/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs index d9c72ec03b36..e690d004f246 100644 --- a/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs +++ b/src/Files.App/Data/Factories/LocalizedEnumDescriptionFactory.cs @@ -3,6 +3,9 @@ namespace Files.App.Data.Factories { + /// + /// Generates localization description for an enum value. + /// internal static class LocalizedEnumDescriptionFactory { private static Dictionary DetailsViewSizeKinds { get; } = []; @@ -58,15 +61,15 @@ public static string Get(GridViewSizeKind value) { GridViewSizeKinds.Add(GridViewSizeKind.Small, "Small".GetLocalizedResource()); GridViewSizeKinds.Add(GridViewSizeKind.Medium, "Medium".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Three, "Three".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Four, "Four".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Five, "Five".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Six, "Six".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Seven, "Seven".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Three, "Medium+".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Four, "Medium++".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Five, "Medium+++".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Six, "Medium++++".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Seven, "Medium+++++".GetLocalizedResource()); GridViewSizeKinds.Add(GridViewSizeKind.Large, "Large".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Nine, "Nine".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Ten, "Ten".GetLocalizedResource()); - GridViewSizeKinds.Add(GridViewSizeKind.Eleven, "Eleven".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Nine, "Large+".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Ten, "Large++".GetLocalizedResource()); + GridViewSizeKinds.Add(GridViewSizeKind.Eleven, "Large+++".GetLocalizedResource()); GridViewSizeKinds.Add(GridViewSizeKind.ExtraLarge, "ExtraLarge".GetLocalizedResource()); } diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml b/src/Files.App/UserControls/InnerNavigationToolbar.xaml index 78f9162e4daf..45a7c8cc64c5 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml @@ -26,11 +26,11 @@ - - - - - + + + + + @@ -853,7 +853,7 @@ Maximum="5" Minimum="1" SnapsTo="Ticks" - ThumbToolTipValueConverter="{StaticResource EnumListViewSizeKindToEnumNameConverter}" + ThumbToolTipValueConverter="{StaticResource EnumListViewSizeKindToHumanizedConverter}" TickFrequency="1" TickPlacement="BottomRight" Value="{x:Bind UserSettingsService.LayoutSettingsService.ListViewSize, Mode=TwoWay, Converter={StaticResource GenericEnumConverter}, ConverterParameter='1-1,2-2,3-3,4-4,5-5'}" /> @@ -936,7 +936,7 @@ Maximum="12" Minimum="1" SnapsTo="Ticks" - ThumbToolTipValueConverter="{StaticResource EnumGridViewSizeKindToEnumNameConverter}" + ThumbToolTipValueConverter="{StaticResource EnumGridViewSizeKindToHumanizedConverter}" TickFrequency="1" TickPlacement="BottomRight" Value="{x:Bind UserSettingsService.LayoutSettingsService.GridViewSize, Mode=TwoWay, Converter={StaticResource GenericEnumConverter}, ConverterParameter='1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10,11-11,12-12'}" /> @@ -1009,7 +1009,7 @@ Maximum="5" Minimum="1" SnapsTo="Ticks" - ThumbToolTipValueConverter="{StaticResource EnumColumnsViewSizeKindToEnumNameConverter}" + ThumbToolTipValueConverter="{StaticResource EnumColumnsViewSizeKindToHumanizedConverter}" TickFrequency="1" TickPlacement="BottomRight" Value="{x:Bind UserSettingsService.LayoutSettingsService.ColumnsViewSize, Mode=TwoWay, Converter={StaticResource GenericEnumConverter}, ConverterParameter='1-1,2-2,3-3,4-4,5-5'}" /> From 754afd0fe92d517880ffe6df9112dbecca8bdb4f Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 28 Feb 2024 02:01:42 +0900 Subject: [PATCH 13/14] Rename --- .../UserControls/InnerNavigationToolbar.xaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml b/src/Files.App/UserControls/InnerNavigationToolbar.xaml index 45a7c8cc64c5..cba20bf34679 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml @@ -26,11 +26,11 @@ - - - - - + + + + + @@ -853,7 +853,7 @@ Maximum="5" Minimum="1" SnapsTo="Ticks" - ThumbToolTipValueConverter="{StaticResource EnumListViewSizeKindToHumanizedConverter}" + ThumbToolTipValueConverter="{StaticResource ListViewSizeKindEnumToHumanizedConverter}" TickFrequency="1" TickPlacement="BottomRight" Value="{x:Bind UserSettingsService.LayoutSettingsService.ListViewSize, Mode=TwoWay, Converter={StaticResource GenericEnumConverter}, ConverterParameter='1-1,2-2,3-3,4-4,5-5'}" /> @@ -936,7 +936,7 @@ Maximum="12" Minimum="1" SnapsTo="Ticks" - ThumbToolTipValueConverter="{StaticResource EnumGridViewSizeKindToHumanizedConverter}" + ThumbToolTipValueConverter="{StaticResource GridViewSizeKindEnumToHumanizedConverter}" TickFrequency="1" TickPlacement="BottomRight" Value="{x:Bind UserSettingsService.LayoutSettingsService.GridViewSize, Mode=TwoWay, Converter={StaticResource GenericEnumConverter}, ConverterParameter='1-1,2-2,3-3,4-4,5-5,6-6,7-7,8-8,9-9,10-10,11-11,12-12'}" /> @@ -1009,7 +1009,7 @@ Maximum="5" Minimum="1" SnapsTo="Ticks" - ThumbToolTipValueConverter="{StaticResource EnumColumnsViewSizeKindToHumanizedConverter}" + ThumbToolTipValueConverter="{StaticResource ColumnsViewSizeKindEnumToHumanizedConverter}" TickFrequency="1" TickPlacement="BottomRight" Value="{x:Bind UserSettingsService.LayoutSettingsService.ColumnsViewSize, Mode=TwoWay, Converter={StaticResource GenericEnumConverter}, ConverterParameter='1-1,2-2,3-3,4-4,5-5'}" /> From 0520b9ba31f1f002bf2f3037ef67320a620f4824 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Tue, 27 Feb 2024 12:18:18 -0500 Subject: [PATCH 14/14] Fix comments --- .../Data/Enums/ColumnsViewSizeKind.cs | 12 ++++----- .../Data/Enums/DetailsViewSizeKind.cs | 12 ++++----- src/Files.Core/Data/Enums/GridViewSizeKind.cs | 26 +++++++++---------- src/Files.Core/Data/Enums/ListViewSizeKind.cs | 12 ++++----- .../Data/Enums/TilesViewSizeKind.cs | 4 +-- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs b/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs index df0bc0e64045..660023388346 100644 --- a/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/ColumnsViewSizeKind.cs @@ -4,32 +4,32 @@ namespace Files.Core.Data.Enums { /// - /// Defines constant that specifies the icon/height size in Columns layout. + /// Defines constants that specify the size in the Columns View layout. /// public enum ColumnsViewSizeKind { /// - /// The icon/heigh is compact. + /// The size is compact. /// Compact = 1, /// - /// The icon/heigh is small. + /// The size is small. /// Small = 2, /// - /// The icon/heigh is medium. + /// The size is medium. /// Medium = 3, /// - /// The icon/heigh is large. + /// The size is large. /// Large = 4, /// - /// The icon/heigh is extra large. + /// The size is extra large. /// ExtraLarge = 5, } diff --git a/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs b/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs index c9c3ae147082..77af2c26d72c 100644 --- a/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/DetailsViewSizeKind.cs @@ -4,32 +4,32 @@ namespace Files.Core.Data.Enums { /// - /// Defines constant that specifies the icon/height size in Details layout. + /// Defines constants that specify the size in the Details View layout. /// public enum DetailsViewSizeKind { /// - /// The icon/heigh is compact. + /// The size is compact. /// Compact = 1, /// - /// The icon/heigh is small. + /// The size is small. /// Small = 2, /// - /// The icon/heigh is medium. + /// The size is medium. /// Medium = 3, /// - /// The icon/heigh is large. + /// The size is large. /// Large = 4, /// - /// The icon/heigh is extra large. + /// The size is extra large. /// ExtraLarge = 5, } diff --git a/src/Files.Core/Data/Enums/GridViewSizeKind.cs b/src/Files.Core/Data/Enums/GridViewSizeKind.cs index 1dd2a78b5ec2..2c202d347dce 100644 --- a/src/Files.Core/Data/Enums/GridViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/GridViewSizeKind.cs @@ -4,67 +4,67 @@ namespace Files.Core.Data.Enums { /// - /// Defines constant that specifies the icon/height size in Grid layout. + /// Defines constants that specify the size in the Grid View layout. /// public enum GridViewSizeKind { /// - /// The icon/heigh is small. + /// The size is small. /// Small = 1, /// - /// The icon/heigh is medium. + /// The size is medium. /// Medium = 2, /// - /// The icon/heigh is medium+. + /// The size is medium+. /// Three = 3, /// - /// The icon/heigh is medium++. + /// The size is medium++. /// Four = 4, /// - /// The icon/heigh is medium+++. + /// The size is medium+++. /// Five = 5, /// - /// The icon/heigh is medium++++. + /// The size is medium++++. /// Six = 6, /// - /// The icon/heigh is medium+++++. + /// The size is medium+++++. /// Seven = 7, /// - /// The icon/heigh is large. + /// The size is large. /// Large = 8, /// - /// The icon/heigh is large+. + /// The size is large+. /// Nine = 9, /// - /// The icon/heigh is large++. + /// The size is large++. /// Ten = 10, /// - /// The icon/heigh is large+++. + /// The size is large+++. /// Eleven = 11, /// - /// The icon/heigh is extra large. + /// The size is extra large. /// ExtraLarge = 12, } diff --git a/src/Files.Core/Data/Enums/ListViewSizeKind.cs b/src/Files.Core/Data/Enums/ListViewSizeKind.cs index 922e1c647ad2..deb467bf40ec 100644 --- a/src/Files.Core/Data/Enums/ListViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/ListViewSizeKind.cs @@ -4,32 +4,32 @@ namespace Files.Core.Data.Enums { /// - /// Defines constant that specifies the icon/height size in List layout. + /// Defines constants that specify the size in the List View layout. /// public enum ListViewSizeKind { /// - /// The icon/heigh is compact. + /// The size is compact. /// Compact = 1, /// - /// The icon/heigh is small. + /// The size is small. /// Small = 2, /// - /// The icon/heigh is medium. + /// The size is medium. /// Medium = 3, /// - /// The icon/heigh is large. + /// The size is large. /// Large = 4, /// - /// The icon/heigh is extra large. + /// The size is extra large. /// ExtraLarge = 5, } diff --git a/src/Files.Core/Data/Enums/TilesViewSizeKind.cs b/src/Files.Core/Data/Enums/TilesViewSizeKind.cs index da1101f2973a..7b791c66503d 100644 --- a/src/Files.Core/Data/Enums/TilesViewSizeKind.cs +++ b/src/Files.Core/Data/Enums/TilesViewSizeKind.cs @@ -4,12 +4,12 @@ namespace Files.Core.Data.Enums { /// - /// Defines constant that specifies the icon/height size in Tiles layout. + /// Defines constants that specify the size in the Tiles View layout. /// public enum TilesViewSizeKind { /// - /// The icon/heigh is small. + /// The size is small. /// Small = 1, }