terminal/src/cascadia/TerminalSettingsEditor
Leonard Hecker 168d28b036
Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184)
This commit reduces the code surface that interacts with raw JSON data,
reducing code complexity and improving maintainability.
Files that needed to be changed drastically were additionally
cleaned up to remove any code cruft that has accrued over time.

In order to facility this the following changes were made:
* Move JSON handling from `CascadiaSettings` into `SettingsLoader`
  This allows us to use STL containers for data model instances.
  For instance profiles are now added to a hashmap for O(1) lookup.
* JSON parsing within `SettingsLoader` doesn't differentiate between user,
  inbox and fragment JSON data, reducing code complexity and size.
  It also centralizes common concerns, like profile deduplication and
  ensuring that all profiles are assigned a GUID.
* Direct JSON modification, like the insertion of dynamic profiles into
  settings.json were removed. This vastly reduces code complexity,
  but unfortunately removes support for comments in JSON on first start.
* `ColorScheme`s cannot be layered. As such its `LayerJson` API was replaced
  with `FromJson`, allowing us to remove JSON-based color scheme validation.
* `Profile`s used to test their wish to layer using `ShouldBeLayered`, which
  was replaced with a GUID-based hashmap lookup on previously parsed profiles.

Further changes were made as improvements upon the previous changes:
* Compact the JSON files embedded binary, saving 28kB
* Prevent double-initialization of the color table in `ColorScheme`
* Making `til::color` getters `constexpr`, allow better optimizations

The result is a reduction of:
* 48kB binary size for the Settings.Model.dll
* 5-10% startup duration
* 26% code for the `CascadiaSettings` class
* 1% overall code in this project

Furthermore this results in the following breaking changes:
* The long deprecated "globals" settings object will not be detected and no
  warning will be created during load.
* The initial creation of a new settings.json will not produce helpful comments.

Both cases are caused by the removal of manual JSON handling and the
move to representing the settings file with model objects instead

## PR Checklist
* [x] Closes #5276
* [x] Closes #7421
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

* Out-of-box-experience is identical to before ✔️
  (Except for the settings.json file lacking comments.)
* Existing user settings load correctly ✔️
* New WSL instances are added to user settings ✔️
* New fragments are added to user settings ✔️
* All profiles are assigned GUIDs ✔️
2021-09-22 16:27:31 +00:00
..
Resources/en-US Enable Vintage Opacity (#11180) 2021-09-20 17:08:13 +00:00
Actions.cpp Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
Actions.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Actions.idl Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
Actions.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
AddProfile.cpp Create a new page for "Add new profile" in the SUI (#9352) 2021-05-05 04:15:25 +00:00
AddProfile.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
AddProfile.idl Create a new page for "Add new profile" in the SUI (#9352) 2021-05-05 04:15:25 +00:00
AddProfile.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Appearances.cpp Add an ENUM setting for disabling rendering "intense" text as bold (#10759) 2021-08-16 13:45:56 +00:00
Appearances.h Add an ENUM setting for disabling rendering "intense" text as bold (#10759) 2021-08-16 13:45:56 +00:00
Appearances.idl Add an ENUM setting for disabling rendering "intense" text as bold (#10759) 2021-08-16 13:45:56 +00:00
Appearances.xaml Disable autocorrect for command, path and find text inputs (#11137) 2021-09-07 10:53:53 -07:00
ColorSchemes.cpp Terminal color picker tweaks (#10219) 2021-06-10 15:49:52 +00:00
ColorSchemes.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
ColorSchemes.idl Redesign color schemes page (#9196) 2021-02-19 18:20:04 +00:00
ColorSchemes.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
CommonResources.xaml Polish code for actions page (#10173) 2021-06-03 22:49:44 +00:00
Converters.cpp [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
Converters.h [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
Converters.idl [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
EnumEntry.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
EnumEntry.idl Enable text search on combo boxes (#9206) 2021-02-19 18:11:07 +00:00
GlobalAppearance.cpp Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
GlobalAppearance.h Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
GlobalAppearance.idl Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
GlobalAppearance.xaml Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
Interaction.cpp Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
Interaction.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Interaction.idl Add missing settings to the settings UI (#8774) 2021-01-14 23:57:59 +00:00
Interaction.xaml Disable autocorrect for command, path and find text inputs (#11137) 2021-09-07 10:53:53 -07:00
KeyChordListener.cpp Introduce vk() and sc() key chord specifiers (#10666) 2021-07-20 22:34:51 +00:00
KeyChordListener.h Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
KeyChordListener.idl Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
KeyChordListener.xaml Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
Launch.cpp Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
Launch.h Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
Launch.idl Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
Launch.xaml Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
MainPage.cpp Allow generated profiles to be deleted (#11007) 2021-08-23 22:00:08 +00:00
MainPage.h Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
MainPage.idl Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
MainPage.xaml Enable Vintage Opacity (#11180) 2021-09-20 17:08:13 +00:00
Microsoft.Terminal.Settings.Editor.def Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
Microsoft.Terminal.Settings.Editor.vcxproj Update to MUX 2.7 (#11240) 2021-09-20 22:08:55 +00:00
Microsoft.Terminal.Settings.Editor.vcxproj.filters [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
packages.config Update to MUX 2.7 (#11240) 2021-09-20 22:08:55 +00:00
pch.cpp Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
pch.h Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
PercentageSignConverter.cpp Add percentage sign to opacity slider values (#10369) 2021-06-09 22:45:06 +00:00
PercentageSignConverter.h Add percentage sign to opacity slider values (#10369) 2021-06-09 22:45:06 +00:00
PreviewConnection.cpp Switch Connections to use ValueSets to initialize them (#10184) 2021-07-20 15:02:17 +00:00
PreviewConnection.h Switch Connections to use ValueSets to initialize them (#10184) 2021-07-20 15:02:17 +00:00
Profiles.cpp Allow generated profiles to be deleted (#11007) 2021-08-23 22:00:08 +00:00
Profiles.h Enable Vintage Opacity (#11180) 2021-09-20 17:08:13 +00:00
Profiles.idl Enable Vintage Opacity (#11180) 2021-09-20 17:08:13 +00:00
Profiles.xaml Enable Vintage Opacity (#11180) 2021-09-20 17:08:13 +00:00
ReadOnlyActions.cpp Introduce feature flag for editable actions page (#10581) 2021-07-08 20:55:31 +00:00
ReadOnlyActions.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
ReadOnlyActions.idl Introduce feature flag for editable actions page (#10581) 2021-07-08 20:55:31 +00:00
ReadOnlyActions.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Rendering.cpp Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
Rendering.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Rendering.idl Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
Rendering.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
SettingContainer.cpp Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
SettingContainer.h Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
SettingContainer.idl Introduce setting override tracking and update SettingContainer (#9079) 2021-02-19 23:50:52 +00:00
SettingContainerStyle.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
Utils.cpp Add an Appearances xaml object and AppearanceViewModel to TSE (#10066) 2021-07-09 15:43:58 -05:00
Utils.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
ViewModelHelpers.h Enable /Zc:preprocessor (#10593) 2021-07-13 23:00:11 +00:00
ViewModelHelpers.idl.h Introduce setting override tracking and update SettingContainer (#9079) 2021-02-19 23:50:52 +00:00