Implement CascadiaSettings::Copy() (#7877)

## Summary of the Pull Request
This implements the `Copy` function for `CascadiaSettings`. Copy performs a deep copy of a `CascadiaSettings` object. This is needed for data binding in the Terminal Settings Editor.

The `Copy` function was basically implemented in every settings model object. This was mostly just repetitive work.

## References
#7667 - TSM
#1564 - Settings UI

## PR Checklist
* [X] Tests added/passed
This commit is contained in:
Carlos Zamora 2020-10-16 15:14:11 -07:00 committed by GitHub
parent df7c3ccc3b
commit 90452664ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 374 additions and 6 deletions

View file

@ -80,6 +80,8 @@ namespace SettingsModelLocalTests
TEST_METHOD(TestUnbindNestedCommand);
TEST_METHOD(TestRebindNestedCommand);
TEST_METHOD(TestCopy);
TEST_CLASS_SETUP(ClassSetup)
{
InitializeJsonReader();
@ -2370,4 +2372,92 @@ namespace SettingsModelLocalTests
}
}
void DeserializationTests::TestCopy()
{
const std::string settingsJson{ R"(
{
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols": 50,
"profiles":
[
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Custom Profile",
"fontFace": "Cascadia Code"
}
],
"schemes":
[
{
"name": "Campbell, but for a test",
"foreground": "#CCCCCC",
"background": "#0C0C0C",
"cursorColor": "#FFFFFF",
"black": "#0C0C0C",
"red": "#C50F1F",
"green": "#13A10E",
"yellow": "#C19C00",
"blue": "#0037DA",
"purple": "#881798",
"cyan": "#3A96DD",
"white": "#CCCCCC",
"brightBlack": "#767676",
"brightRed": "#E74856",
"brightGreen": "#16C60C",
"brightYellow": "#F9F1A5",
"brightBlue": "#3B78FF",
"brightPurple": "#B4009E",
"brightCyan": "#61D6D6",
"brightWhite": "#F2F2F2"
}
],
"actions":
[
{ "command": "openSettings", "keys": "ctrl+," },
{ "command": { "action": "openSettings", "target": "defaultsFile" }, "keys": "ctrl+alt+," },
{
"name": { "key": "SetColorSchemeParentCommandName" },
"commands": [
{
"iterateOn": "schemes",
"name": "${scheme.name}",
"command": { "action": "setColorScheme", "colorScheme": "${scheme.name}" }
}
]
}
]
})" };
VerifyParseSucceeded(settingsJson);
auto settings{ winrt::make_self<implementation::CascadiaSettings>() };
settings->_ParseJsonString(settingsJson, false);
settings->LayerJson(settings->_userSettings);
settings->_ValidateSettings();
const auto copy{ settings->Copy() };
const auto copyImpl{ winrt::get_self<implementation::CascadiaSettings>(copy) };
// test globals
VERIFY_ARE_EQUAL(settings->_globals->DefaultProfile(), copyImpl->_globals->DefaultProfile());
// test profiles
VERIFY_ARE_EQUAL(settings->_profiles.Size(), copyImpl->_profiles.Size());
VERIFY_ARE_EQUAL(settings->_profiles.GetAt(0).Name(), copyImpl->_profiles.GetAt(0).Name());
// test schemes
const auto schemeName{ L"Campbell, but for a test" };
VERIFY_ARE_EQUAL(settings->_globals->_colorSchemes.Size(), copyImpl->_globals->_colorSchemes.Size());
VERIFY_ARE_EQUAL(settings->_globals->_colorSchemes.HasKey(schemeName), copyImpl->_globals->_colorSchemes.HasKey(schemeName));
// test actions
VERIFY_ARE_EQUAL(settings->_globals->_keymap->_keyShortcuts.size(), copyImpl->_globals->_keymap->_keyShortcuts.size());
VERIFY_ARE_EQUAL(settings->_globals->_commands.Size(), copyImpl->_globals->_commands.Size());
// Test that changing the copy should not change the original
VERIFY_ARE_EQUAL(settings->_globals->WordDelimiters(), copyImpl->_globals->WordDelimiters());
copyImpl->_globals->WordDelimiters(L"changed value");
VERIFY_ARE_NOT_EQUAL(settings->_globals->WordDelimiters(), copyImpl->_globals->WordDelimiters());
}
}

View file

@ -240,6 +240,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
}
com_ptr<ActionAndArgs> ActionAndArgs::Copy() const
{
auto copy{ winrt::make_self<ActionAndArgs>() };
copy->_Action = _Action;
copy->_Args = _Args.Copy();
return copy;
}
winrt::hstring ActionAndArgs::GenerateName() const
{
// Use a magic static to initialize this map, because we won't be able

View file

@ -19,6 +19,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
ActionAndArgs(ShortcutAction action, IActionArgs args) :
_Action{ action },
_Args{ args } {};
com_ptr<ActionAndArgs> Copy() const;
hstring GenerateName() const;

View file

@ -89,6 +89,16 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, ProfileKey, args->_Profile);
return *args;
}
Model::NewTerminalArgs Copy() const
{
auto copy{ winrt::make_self<NewTerminalArgs>() };
copy->_Commandline = _Commandline;
copy->_StartingDirectory = _StartingDirectory;
copy->_TabTitle = _TabTitle;
copy->_ProfileIndex = _ProfileIndex;
copy->_Profile = _Profile;
return *copy;
}
};
struct CopyTextArgs : public CopyTextArgsT<CopyTextArgs>
@ -121,6 +131,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, CopyFormattingKey, args->_CopyFormatting);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<CopyTextArgs>() };
copy->_SingleLine = _SingleLine;
copy->_CopyFormatting = _CopyFormatting;
return *copy;
}
};
struct NewTabArgs : public NewTabArgsT<NewTabArgs>
@ -149,6 +167,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
args->_TerminalArgs = NewTerminalArgs::FromJson(json);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<NewTabArgs>() };
copy->_TerminalArgs = _TerminalArgs.Copy();
return *copy;
}
};
struct SwitchToTabArgs : public SwitchToTabArgsT<SwitchToTabArgs>
@ -179,6 +203,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, TabIndexKey, args->_TabIndex);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<SwitchToTabArgs>() };
copy->_TabIndex = _TabIndex;
return *copy;
}
};
struct ResizePaneArgs : public ResizePaneArgsT<ResizePaneArgs>
@ -214,6 +244,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return { *args, {} };
}
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<ResizePaneArgs>() };
copy->_Direction = _Direction;
return *copy;
}
};
struct MoveFocusArgs : public MoveFocusArgsT<MoveFocusArgs>
@ -249,6 +285,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return { *args, {} };
}
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<MoveFocusArgs>() };
copy->_Direction = _Direction;
return *copy;
}
};
struct AdjustFontSizeArgs : public AdjustFontSizeArgsT<AdjustFontSizeArgs>
@ -277,6 +319,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, AdjustFontSizeDelta, args->_Delta);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<AdjustFontSizeArgs>() };
copy->_Delta = _Delta;
return *copy;
}
};
struct SendInputArgs : public SendInputArgsT<SendInputArgs>
@ -308,6 +356,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<SendInputArgs>() };
copy->_Input = _Input;
return *copy;
}
};
struct SplitPaneArgs : public SplitPaneArgsT<SplitPaneArgs>
@ -347,6 +401,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, SplitModeKey, args->_SplitMode);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<SplitPaneArgs>() };
copy->_SplitStyle = _SplitStyle;
copy->_TerminalArgs = _TerminalArgs.Copy();
copy->_SplitMode = _SplitMode;
return *copy;
}
};
struct OpenSettingsArgs : public OpenSettingsArgsT<OpenSettingsArgs>
@ -375,6 +437,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, TargetKey, args->_Target);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<OpenSettingsArgs>() };
copy->_Target = _Target;
return *copy;
}
};
struct SetColorSchemeArgs : public SetColorSchemeArgsT<SetColorSchemeArgs>
@ -407,6 +475,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<SetColorSchemeArgs>() };
copy->_SchemeName = _SchemeName;
return *copy;
}
};
struct SetTabColorArgs : public SetTabColorArgsT<SetTabColorArgs>
@ -438,6 +512,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<SetTabColorArgs>() };
copy->_TabColor = _TabColor;
return *copy;
}
};
struct RenameTabArgs : public RenameTabArgsT<RenameTabArgs>
@ -466,6 +546,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, TitleKey, args->_Title);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<RenameTabArgs>() };
copy->_Title = _Title;
return *copy;
}
};
struct ExecuteCommandlineArgs : public ExecuteCommandlineArgsT<ExecuteCommandlineArgs>
@ -500,6 +586,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<ExecuteCommandlineArgs>() };
copy->_Commandline = _Commandline;
return *copy;
}
};
struct CloseOtherTabsArgs : public CloseOtherTabsArgsT<CloseOtherTabsArgs>
@ -530,6 +622,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, IndexKey, args->_Index);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<CloseOtherTabsArgs>() };
copy->_Index = _Index;
return *copy;
}
};
struct CloseTabsAfterArgs : public CloseTabsAfterArgsT<CloseTabsAfterArgs>
@ -560,6 +658,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
JsonUtils::GetValueForKey(json, IndexKey, args->_Index);
return { *args, {} };
}
IActionArgs Copy() const
{
auto copy{ winrt::make_self<CloseTabsAfterArgs>() };
copy->_Index = _Index;
return *copy;
}
};
}

View file

@ -7,6 +7,7 @@ namespace Microsoft.Terminal.Settings.Model
{
Boolean Equals(IActionArgs other);
String GenerateName();
IActionArgs Copy();
};
interface IActionEventArgs
@ -48,6 +49,7 @@ namespace Microsoft.Terminal.Settings.Model
[default_interface] runtimeclass NewTerminalArgs {
NewTerminalArgs();
NewTerminalArgs(Int32 profileIndex);
NewTerminalArgs Copy();
String Commandline;
String StartingDirectory;

View file

@ -66,6 +66,29 @@ CascadiaSettings::CascadiaSettings(winrt::hstring json) :
_ValidateSettings();
}
winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings CascadiaSettings::Copy() const
{
// dynamic profile generators added by default
auto settings{ winrt::make_self<CascadiaSettings>() };
settings->_globals = _globals->Copy();
for (const auto profile : _profiles)
{
auto profImpl{ winrt::get_self<Profile>(profile) };
settings->_profiles.Append(*profImpl->Copy());
}
for (auto warning : _warnings)
{
settings->_warnings.Append(warning);
}
settings->_loadError = _loadError;
settings->_deserializationErrorMessage = _deserializationErrorMessage;
settings->_userSettingsString = _userSettingsString;
settings->_userSettings = _userSettings;
settings->_defaultSettings = _defaultSettings;
settings->_userDefaultProfileSettings = _userDefaultProfileSettings;
return *settings;
}
// Method Description:
// - Finds a profile that matches the given GUID. If there is no profile in this
// settings object that matches, returns nullptr.

View file

@ -60,15 +60,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
CascadiaSettings();
explicit CascadiaSettings(const bool addDynamicProfiles);
CascadiaSettings(hstring json);
Model::CascadiaSettings Copy() const;
static Model::CascadiaSettings LoadDefaults();
static Model::CascadiaSettings LoadAll();
static Model::CascadiaSettings LoadUniversal();
Model::GlobalAppSettings GlobalSettings() const;
Windows::Foundation::Collections::IObservableVector<Model::Profile> Profiles() const noexcept;
Model::KeyMapping KeyMap() const noexcept;
static com_ptr<CascadiaSettings> FromJson(const Json::Value& json);

View file

@ -9,6 +9,7 @@ namespace Microsoft.Terminal.Settings.Model
{
[default_interface] runtimeclass CascadiaSettings {
CascadiaSettings(String json);
CascadiaSettings Copy();
static CascadiaSettings LoadDefaults();
static CascadiaSettings LoadAll();

View file

@ -57,6 +57,18 @@ ColorScheme::ColorScheme(winrt::hstring name, Color defaultFg, Color defaultBg,
{
}
winrt::com_ptr<ColorScheme> ColorScheme::Copy() const
{
auto scheme{ winrt::make_self<ColorScheme>() };
scheme->_Name = _Name;
scheme->_Foreground = _Foreground;
scheme->_Background = _Background;
scheme->_SelectionBackground = _SelectionBackground;
scheme->_CursorColor = _CursorColor;
scheme->_table = _table;
return scheme;
}
// Method Description:
// - Create a new instance of this class from a serialized JsonObject.
// Arguments:

View file

@ -34,6 +34,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
public:
ColorScheme();
ColorScheme(hstring name, Windows::UI::Color defaultFg, Windows::UI::Color defaultBg, Windows::UI::Color cursorColor);
com_ptr<ColorScheme> Copy() const;
static com_ptr<ColorScheme> FromJson(const Json::Value& json);
bool ShouldBeLayered(const Json::Value& json) const;

View file

@ -38,12 +38,34 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_setAction(nullptr);
}
IMapView<winrt::hstring, Model::Command> Command::NestedCommands()
com_ptr<Command> Command::Copy() const
{
auto command{ winrt::make_self<Command>() };
command->_Name = _Name;
command->_Action = _Action;
command->_KeyChordText = _KeyChordText;
command->_Icon = _Icon;
command->_IterateOn = _IterateOn;
command->_originalJson = _originalJson;
if (HasNestedCommands())
{
command->_subcommands = winrt::single_threaded_map<winrt::hstring, Model::Command>();
for (auto kv : NestedCommands())
{
const auto subCmd{ winrt::get_self<Command>(kv.Value()) };
command->_subcommands.Insert(kv.Key(), *subCmd->Copy());
}
}
return command;
}
IMapView<winrt::hstring, Model::Command> Command::NestedCommands() const
{
return _subcommands ? _subcommands.GetView() : nullptr;
}
bool Command::HasNestedCommands()
bool Command::HasNestedCommands() const
{
return _subcommands ? _subcommands.Size() > 0 : false;
}

View file

@ -36,6 +36,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
struct Command : CommandT<Command>
{
Command();
com_ptr<Command> Copy() const;
static winrt::com_ptr<Command> FromJson(const Json::Value& json,
std::vector<SettingsLoadWarnings>& warnings);
@ -47,8 +48,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static std::vector<SettingsLoadWarnings> LayerJson(Windows::Foundation::Collections::IMap<winrt::hstring, Model::Command>& commands,
const Json::Value& json);
bool HasNestedCommands();
Windows::Foundation::Collections::IMapView<winrt::hstring, Model::Command> NestedCommands();
bool HasNestedCommands() const;
Windows::Foundation::Collections::IMapView<winrt::hstring, Model::Command> NestedCommands() const;
winrt::Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker propertyChangedRevoker;

View file

@ -63,6 +63,53 @@ GlobalAppSettings::GlobalAppSettings() :
_colorSchemes = winrt::single_threaded_map<winrt::hstring, Model::ColorScheme>();
}
winrt::com_ptr<GlobalAppSettings> GlobalAppSettings::Copy() const
{
auto globals{ winrt::make_self<GlobalAppSettings>() };
globals->_InitialRows = _InitialRows;
globals->_InitialCols = _InitialCols;
globals->_AlwaysShowTabs = _AlwaysShowTabs;
globals->_ShowTitleInTitlebar = _ShowTitleInTitlebar;
globals->_ConfirmCloseAllTabs = _ConfirmCloseAllTabs;
globals->_Theme = _Theme;
globals->_TabWidthMode = _TabWidthMode;
globals->_ShowTabsInTitlebar = _ShowTabsInTitlebar;
globals->_WordDelimiters = _WordDelimiters;
globals->_CopyOnSelect = _CopyOnSelect;
globals->_CopyFormatting = _CopyFormatting;
globals->_WarnAboutLargePaste = _WarnAboutLargePaste;
globals->_WarnAboutMultiLinePaste = _WarnAboutMultiLinePaste;
globals->_InitialPosition = _InitialPosition;
globals->_LaunchMode = _LaunchMode;
globals->_SnapToGridOnResize = _SnapToGridOnResize;
globals->_ForceFullRepaintRendering = _ForceFullRepaintRendering;
globals->_SoftwareRendering = _SoftwareRendering;
globals->_ForceVTInput = _ForceVTInput;
globals->_DebugFeaturesEnabled = _DebugFeaturesEnabled;
globals->_StartOnUserLogin = _StartOnUserLogin;
globals->_AlwaysOnTop = _AlwaysOnTop;
globals->_UseTabSwitcher = _UseTabSwitcher;
globals->_DisableAnimations = _DisableAnimations;
globals->_unparsedDefaultProfile = _unparsedDefaultProfile;
globals->_defaultProfile = _defaultProfile;
globals->_keymap = _keymap->Copy();
std::copy(_keybindingsWarnings.begin(), _keybindingsWarnings.end(), std::back_inserter(globals->_keybindingsWarnings));
for (auto kv : _colorSchemes)
{
const auto schemeImpl{ winrt::get_self<ColorScheme>(kv.Value()) };
globals->_colorSchemes.Insert(kv.Key(), *schemeImpl->Copy());
}
for (auto kv : _commands)
{
const auto commandImpl{ winrt::get_self<Command>(kv.Value()) };
globals->_commands.Insert(kv.Key(), *commandImpl->Copy());
}
return globals;
}
winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::ColorScheme> GlobalAppSettings::ColorSchemes() noexcept
{
return _colorSchemes.GetView();

View file

@ -34,6 +34,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
public:
GlobalAppSettings();
com_ptr<GlobalAppSettings> Copy() const;
Windows::Foundation::Collections::IMapView<hstring, Model::ColorScheme> ColorSchemes() noexcept;
void AddColorScheme(const Model::ColorScheme& scheme);

View file

@ -4,6 +4,7 @@
#include "pch.h"
#include "KeyMapping.h"
#include "KeyChordSerialization.h"
#include "ActionAndArgs.h"
#include "KeyMapping.g.cpp"
@ -12,6 +13,16 @@ using namespace winrt::Microsoft::Terminal::TerminalControl;
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
winrt::com_ptr<KeyMapping> KeyMapping::Copy() const
{
auto keymap{ winrt::make_self<KeyMapping>() };
std::for_each(_keyShortcuts.begin(), _keyShortcuts.end(), [keymap](auto& kv) {
const auto actionAndArgsImpl{ winrt::get_self<ActionAndArgs>(kv.second) };
keymap->_keyShortcuts[kv.first] = *actionAndArgsImpl->Copy();
});
return keymap;
}
Microsoft::Terminal::Settings::Model::ActionAndArgs KeyMapping::TryLookup(KeyChord const& chord) const
{
const auto result = _keyShortcuts.find(chord);

View file

@ -52,6 +52,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
struct KeyMapping : KeyMappingT<KeyMapping>
{
KeyMapping() = default;
com_ptr<KeyMapping> Copy() const;
Model::ActionAndArgs TryLookup(TerminalControl::KeyChord const& chord) const;
uint64_t Size() const;

View file

@ -70,6 +70,49 @@ Profile::Profile(guid guid) :
{
}
winrt::com_ptr<Profile> Profile::Copy() const
{
auto profile{ winrt::make_self<Profile>() };
profile->_Name = _Name;
profile->_Source = _Source;
profile->_Hidden = _Hidden;
profile->_Icon = _Icon;
profile->_CloseOnExit = _CloseOnExit;
profile->_TabTitle = _TabTitle;
profile->_TabColor = _TabColor;
profile->_SuppressApplicationTitle = _SuppressApplicationTitle;
profile->_UseAcrylic = _UseAcrylic;
profile->_AcrylicOpacity = _AcrylicOpacity;
profile->_ScrollState = _ScrollState;
profile->_FontFace = _FontFace;
profile->_FontSize = _FontSize;
profile->_FontWeight = _FontWeight;
profile->_Padding = _Padding;
profile->_Commandline = _Commandline;
profile->_StartingDirectory = _StartingDirectory;
profile->_BackgroundImagePath = _BackgroundImagePath;
profile->_BackgroundImageOpacity = _BackgroundImageOpacity;
profile->_BackgroundImageStretchMode = _BackgroundImageStretchMode;
profile->_AntialiasingMode = _AntialiasingMode;
profile->_RetroTerminalEffect = _RetroTerminalEffect;
profile->_ForceFullRepaintRendering = _ForceFullRepaintRendering;
profile->_SoftwareRendering = _SoftwareRendering;
profile->_ColorSchemeName = _ColorSchemeName;
profile->_Foreground = _Foreground;
profile->_Background = _Background;
profile->_SelectionBackground = _SelectionBackground;
profile->_CursorColor = _CursorColor;
profile->_HistorySize = _HistorySize;
profile->_SnapOnInput = _SnapOnInput;
profile->_AltGrAliasing = _AltGrAliasing;
profile->_CursorShape = _CursorShape;
profile->_CursorHeight = _CursorHeight;
profile->_Guid = _Guid;
profile->_ConnectionType = _ConnectionType;
profile->_BackgroundImageAlignment = _BackgroundImageAlignment;
return profile;
}
// Method Description:
// - Generates a Json::Value which is a "stub" of this profile. This stub will
// have enough information that it could be layered with this profile.

View file

@ -44,6 +44,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
public:
Profile();
Profile(guid guid);
com_ptr<Profile> Copy() const;
Json::Value GenerateStub() const;
static com_ptr<Profile> FromJson(const Json::Value& json);