Skip to content
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

Apply Enum Mappings to most enum settings #8090

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Oct 29, 2020

Summary of the Pull Request

Builds off of #8086 to introduce enum mappings for most of the remaining enum settings. This excludes the following two settings:

  • FontWeight: we accept a number and an enum. So we'll probably need some special logic for this one (Kayla's working on this one)
  • BackgroundImageAlignment: this is one setting stored as two enums. We'll need some special logic here too.

This also removes "Globals" files, a relic from the hackathon. We decided to split this up into all the other pages, and forgot to remove this at some point.

References

#1564 - Settings UI Epic

Validation Steps Performed

These become validated when we load the page with setting on it. Since there's a known issue right now that we can't load every available page (yet), I've only been able to validate that this works on the loadable pages.

If a setting was added, but we didn't update the resw properly, we get an error at runtime. So this helps a ton with debugging!

Comment on lines +81 to +114
auto entry = winrt::make<EnumEntry>(enumName, winrt::box_value<TextAntialiasingMode>(value));
_AntialiasingModes.Append(entry);

// Initialize the selected item to be our current setting
if (value == Profile().AntialiasingMode())
{
AntialiasingModeButtons().SelectedItem(entry);
}
}

auto closeOnExitModesMap = EnumMappings::CloseOnExit();
for (auto [key, value] : closeOnExitModesMap)
{
auto enumName = LocalizedNameForEnumName(L"Profile_CloseOnExit", key, L"Content");
auto entry = winrt::make<EnumEntry>(enumName, winrt::box_value<CloseOnExitMode>(value));
_CloseOnExitModes.Append(entry);

// Initialize the selected item to be our current setting
if (value == Profile().CloseOnExit())
{
CloseOnExitModeButtons().SelectedItem(entry);
}
}

auto bellStyleMap = EnumMappings::BellStyle();
for (auto [key, value] : bellStyleMap)
{
auto enumName = LocalizedNameForEnumName(L"Profile_BellStyle", key, L"Content");
auto entry = winrt::make<EnumEntry>(enumName, winrt::box_value<BellStyle>(value));
_BellStyles.Append(entry);

// Initialize the selected item to be our current setting
if (value == Profile().BellStyle())
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean, this seems insane.

@@ -251,7 +251,8 @@
<value>Launch size</value>
</data>
<data name="Globals_LaunchSize.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Defines whether the terminal will launch in a window, maximized, or full screen.</value>
<value>Defines whether the terminal will launch as maximized, full screen, or in a window. Setting this to "Focus" is equivalent to launching the terminal in the "Default" mode, but with the focus mode enabled. Similar, setting this to "MaximizedFocus" will result in launching the terminal in a maximized window with the focus mode enabled.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THE LOC FREEZE WAS THREE WEEKS AGO COME ON LOL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, the wording is wrong. Maximized Focus should be two words.

I don't think we're doing it right if we just copy the entire json schema field description into a freakin' tooltip, but it's what we've got today.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. #7873 went in and I had no clue. I'll pull all the resw changes into a separate PR to get enough time for localization.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved all the localization stuff over to #8116. Removing this stuff from this PR.

@carlos-zamora
Copy link
Member Author

I'm actually going to close this PR.

@DHowett DHowett deleted the dev/cazamor/sui/enum-mapping branch February 5, 2021 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants