eb0fb3e822
This PR adds improved override message generation for inheritance in SUI. The settings model now has an `OriginTag` to be able to denote where a `Profile` came from. This tag is used in the `SettingContainer` to generate a more specific override message. ## References #6800 - SUI Epic #8919 - SUI Inheritance PR #8804 - SUI Inheritance (old issue) ## Detailed Description of the Pull Request / Additional comments - **Terminal Settings Model** - Introduced `PROJECTED_SETTING` as a macro to more easily declare the functions for each setting - Introduced `<setting>OverrideSource` which finds the `Profile` that has \<setting\> defined - Introduced `OriginTag Profile::Origin {Custom, InBox, Generated}` to trace where a profile came from - `DefaultProfileUtils` creates profiles for profile generators. So that now sets the `Origin` tag to `Generated` - `CascadiaSettings::LoadDefaults()` tags all profiles created as `InBox`. - The view model had to ingest the API change to be able to interact with `<setting>OverrideSource` - **Override Message Generation** - The reset button now has a more specific tooltip - The reset button now only appears if base layer is being overridden - We use the settings model changes to determine the message to display for the target ## Validation Steps Performed Tested the following cases: - overrides nothing (inherited setting) - overrides value inherited from... - base layer - a profile generator - in-box profile - global settings should not have this feature
112 lines
5.3 KiB
C++
112 lines
5.3 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- GlobalAppSettings.h
|
|
|
|
Abstract:
|
|
- This class encapsulates all of the settings that are global to the app, and
|
|
not a part of any particular profile.
|
|
|
|
Author(s):
|
|
- Mike Griese - March 2019
|
|
|
|
--*/
|
|
#pragma once
|
|
|
|
#include "GlobalAppSettings.g.h"
|
|
#include "IInheritable.h"
|
|
|
|
#include "KeyMapping.h"
|
|
#include "Command.h"
|
|
#include "ColorScheme.h"
|
|
|
|
// fwdecl unittest classes
|
|
namespace SettingsModelLocalTests
|
|
{
|
|
class DeserializationTests;
|
|
class ColorSchemeTests;
|
|
};
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|
{
|
|
struct GlobalAppSettings : GlobalAppSettingsT<GlobalAppSettings>, IInheritable<GlobalAppSettings>
|
|
{
|
|
public:
|
|
GlobalAppSettings();
|
|
void _FinalizeInheritance() override;
|
|
com_ptr<GlobalAppSettings> Copy() const;
|
|
|
|
Windows::Foundation::Collections::IMapView<hstring, Model::ColorScheme> ColorSchemes() noexcept;
|
|
void AddColorScheme(const Model::ColorScheme& scheme);
|
|
void RemoveColorScheme(hstring schemeName);
|
|
|
|
Model::KeyMapping KeyMap() const noexcept;
|
|
|
|
static com_ptr<GlobalAppSettings> FromJson(const Json::Value& json);
|
|
void LayerJson(const Json::Value& json);
|
|
|
|
Json::Value ToJson() const;
|
|
|
|
std::vector<SettingsLoadWarnings> KeybindingsWarnings() const;
|
|
|
|
Windows::Foundation::Collections::IMapView<hstring, Model::Command> Commands() noexcept;
|
|
|
|
// These are implemented manually to handle the string/GUID exchange
|
|
// by higher layers in the app.
|
|
void DefaultProfile(const guid& defaultProfile) noexcept;
|
|
guid DefaultProfile() const;
|
|
bool HasUnparsedDefaultProfile() const;
|
|
winrt::hstring UnparsedDefaultProfile() const;
|
|
void UnparsedDefaultProfile(const hstring& value);
|
|
void ClearUnparsedDefaultProfile();
|
|
|
|
GETSET_SETTING(Model::GlobalAppSettings, int32_t, InitialRows, DEFAULT_ROWS);
|
|
GETSET_SETTING(Model::GlobalAppSettings, int32_t, InitialCols, DEFAULT_COLS);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, AlwaysShowTabs, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, ShowTitleInTitlebar, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, ConfirmCloseAllTabs, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, winrt::Windows::UI::Xaml::ElementTheme, Theme, winrt::Windows::UI::Xaml::ElementTheme::Default);
|
|
GETSET_SETTING(Model::GlobalAppSettings, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::Equal);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, ShowTabsInTitlebar, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, CopyOnSelect, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, winrt::Microsoft::Terminal::TerminalControl::CopyFormat, CopyFormatting, 0);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, WarnAboutLargePaste, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, WarnAboutMultiLinePaste, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, Model::LaunchPosition, InitialPosition, nullptr, nullptr);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, CenterOnLaunch, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, Model::LaunchMode, LaunchMode, LaunchMode::DefaultMode);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, SnapToGridOnResize, true);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, ForceFullRepaintRendering, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, SoftwareRendering, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, ForceVTInput, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, DebugFeaturesEnabled, _getDefaultDebugFeaturesValue());
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, StartOnUserLogin, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, AlwaysOnTop, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, Model::TabSwitcherMode, TabSwitcherMode, Model::TabSwitcherMode::InOrder);
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, DisableAnimations, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, hstring, StartupActions, L"");
|
|
GETSET_SETTING(Model::GlobalAppSettings, bool, FocusFollowMouse, false);
|
|
GETSET_SETTING(Model::GlobalAppSettings, Model::WindowingMode, WindowingBehavior, Model::WindowingMode::UseNew);
|
|
|
|
private:
|
|
guid _defaultProfile;
|
|
std::optional<hstring> _UnparsedDefaultProfile{ std::nullopt };
|
|
bool _validDefaultProfile;
|
|
|
|
com_ptr<KeyMapping> _keymap;
|
|
std::vector<SettingsLoadWarnings> _keybindingsWarnings;
|
|
|
|
Windows::Foundation::Collections::IMap<hstring, Model::ColorScheme> _colorSchemes;
|
|
Windows::Foundation::Collections::IMap<hstring, Model::Command> _commands;
|
|
|
|
std::optional<hstring> _getUnparsedDefaultProfileImpl() const;
|
|
static bool _getDefaultDebugFeaturesValue();
|
|
|
|
friend class SettingsModelLocalTests::DeserializationTests;
|
|
friend class SettingsModelLocalTests::ColorSchemeTests;
|
|
};
|
|
}
|