-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Compatibility and Terminal page to the Settings UI (#17895)
## Summary of the Pull Request Adds a global Compatibility page to the settings UI. This page exposes several existing settings and introduces a few new settings: - compatibility.allowHeadless - compatibility.isolatedMode - compatibility.textMeasurement - debugFeatures This also adds a Terminal subpage for profiles in the settings UI. This page includes: - suppressApplicationTitle - compatibility.input.forceVT - compatibility.allowDECRQCRA - answerbackMessage Several smaller changes were accomplished as a part of this PR: - `experimental.input.forceVT` was renamed to `compatibility.input.forceVT` - introduced the `compatibility.allowDECRQCRA` setting - updated the schema for these new settings and `compatibility.allowHeadless` (which was missing) - add `Feature_DebugModeUI` feature flag to control if debug features should be shown in the SUI Verified accessible via Accessibility Insights A part of #10000 Closes #16672
- Loading branch information
1 parent
0b4d3d5
commit 18d86bc
Showing
43 changed files
with
572 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#include "pch.h" | ||
#include "Compatibility.h" | ||
#include "EnumEntry.h" | ||
#include "Compatibility.g.cpp" | ||
#include "CompatibilityViewModel.g.cpp" | ||
|
||
using namespace winrt::Windows::UI::Xaml::Navigation; | ||
using namespace winrt::Microsoft::Terminal::Settings::Model; | ||
|
||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | ||
{ | ||
CompatibilityViewModel::CompatibilityViewModel(Model::GlobalAppSettings globalSettings) : | ||
_GlobalSettings{ globalSettings } | ||
{ | ||
INITIALIZE_BINDABLE_ENUM_SETTING(TextMeasurement, TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, L"Globals_TextMeasurement_", L"Text"); | ||
} | ||
|
||
bool CompatibilityViewModel::DebugFeaturesAvailable() const noexcept | ||
{ | ||
return Feature_DebugModeUI::IsEnabled(); | ||
} | ||
|
||
Compatibility::Compatibility() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
void Compatibility::OnNavigatedTo(const NavigationEventArgs& e) | ||
{ | ||
_ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#pragma once | ||
|
||
#include "Compatibility.g.h" | ||
#include "CompatibilityViewModel.g.h" | ||
#include "ViewModelHelpers.h" | ||
#include "Utils.h" | ||
|
||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | ||
{ | ||
struct CompatibilityViewModel : CompatibilityViewModelT<CompatibilityViewModel>, ViewModelHelper<CompatibilityViewModel> | ||
{ | ||
public: | ||
CompatibilityViewModel(Model::GlobalAppSettings globalSettings); | ||
|
||
bool DebugFeaturesAvailable() const noexcept; | ||
|
||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead: | ||
using ViewModelHelper<CompatibilityViewModel>::PropertyChanged; | ||
|
||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AllowHeadless); | ||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, IsolatedMode); | ||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DebugFeaturesEnabled); | ||
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _GlobalSettings.TextMeasurement); | ||
|
||
private: | ||
Model::GlobalAppSettings _GlobalSettings; | ||
}; | ||
|
||
struct Compatibility : public HasScrollViewer<Compatibility>, CompatibilityT<Compatibility> | ||
{ | ||
Compatibility(); | ||
|
||
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e); | ||
|
||
til::property_changed_event PropertyChanged; | ||
WINRT_OBSERVABLE_PROPERTY(Editor::CompatibilityViewModel, ViewModel, PropertyChanged.raise, nullptr); | ||
}; | ||
} | ||
|
||
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation | ||
{ | ||
BASIC_FACTORY(Compatibility); | ||
BASIC_FACTORY(CompatibilityViewModel); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import "EnumEntry.idl"; | ||
|
||
#include "ViewModelHelpers.idl.h" | ||
|
||
namespace Microsoft.Terminal.Settings.Editor | ||
{ | ||
runtimeclass CompatibilityViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged | ||
{ | ||
CompatibilityViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings); | ||
|
||
Boolean DebugFeaturesAvailable { get; }; | ||
|
||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AllowHeadless); | ||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, IsolatedMode); | ||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DebugFeaturesEnabled); | ||
|
||
IInspectable CurrentTextMeasurement; | ||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TextMeasurementList { get; }; | ||
} | ||
|
||
[default_interface] runtimeclass Compatibility : Windows.UI.Xaml.Controls.Page | ||
{ | ||
Compatibility(); | ||
CompatibilityViewModel ViewModel { get; }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!-- | ||
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under | ||
the MIT License. See LICENSE in the project root for license information. | ||
--> | ||
<Page x:Class="Microsoft.Terminal.Settings.Editor.Compatibility" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:Microsoft.Terminal.Settings.Editor" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
mc:Ignorable="d"> | ||
|
||
<Page.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="CommonResources.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<DataTemplate x:Key="EnumComboBoxTemplate" | ||
x:DataType="local:EnumEntry"> | ||
<TextBlock Text="{x:Bind EnumName}" /> | ||
</DataTemplate> | ||
</ResourceDictionary> | ||
</Page.Resources> | ||
|
||
<StackPanel Style="{StaticResource SettingsStackStyle}"> | ||
<!-- Allow Headless --> | ||
<local:SettingContainer x:Uid="Globals_AllowHeadless"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}" | ||
Style="{StaticResource ToggleSwitchInExpanderStyle}" /> | ||
</local:SettingContainer> | ||
|
||
<!-- Isolated Mode --> | ||
<local:SettingContainer x:Uid="Globals_IsolatedMode"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.IsolatedMode, Mode=TwoWay}" | ||
Style="{StaticResource ToggleSwitchInExpanderStyle}" /> | ||
</local:SettingContainer> | ||
|
||
<!-- Text Measurement --> | ||
<local:SettingContainer x:Uid="Globals_TextMeasurement"> | ||
<ComboBox AutomationProperties.AccessibilityView="Content" | ||
ItemTemplate="{StaticResource EnumComboBoxTemplate}" | ||
ItemsSource="{x:Bind ViewModel.TextMeasurementList}" | ||
SelectedItem="{x:Bind ViewModel.CurrentTextMeasurement, Mode=TwoWay}" | ||
Style="{StaticResource ComboBoxSettingStyle}" /> | ||
</local:SettingContainer> | ||
|
||
<!-- Debug Features --> | ||
<local:SettingContainer x:Uid="Globals_DebugFeaturesEnabled" | ||
Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}" | ||
Style="{StaticResource ToggleSwitchInExpanderStyle}" /> | ||
</local:SettingContainer> | ||
</StackPanel> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.