Compare commits
1 commit
main
...
dev/migrie
Author | SHA1 | Date | |
---|---|---|---|
d486ccf244 |
|
@ -49,6 +49,7 @@ static const std::array<std::wstring_view, static_cast<uint32_t>(SettingsLoadWar
|
|||
USES_RESOURCE(L"InvalidSplitSize"),
|
||||
USES_RESOURCE(L"FailedToParseStartupActions"),
|
||||
USES_RESOURCE(L"FailedToParseSubCommands"),
|
||||
USES_RESOURCE(L"DidNotFindDynamicDefaultProfile"),
|
||||
};
|
||||
static const std::array<std::wstring_view, static_cast<uint32_t>(SettingsLoadErrors::ERRORS_SIZE)> settingsLoadErrorsLabels {
|
||||
USES_RESOURCE(L"NoProfilesText"),
|
||||
|
@ -488,6 +489,22 @@ namespace winrt::TerminalApp::implementation
|
|||
|
||||
warningsTextBlock.Inlines().Append(legacyGlobalsLink);
|
||||
}
|
||||
else if (warning == SettingsLoadWarnings::DidNotFindDynamicDefaultProfile)
|
||||
{
|
||||
// Add the URL here too
|
||||
const auto linkLabel = RS_(L"DynamicDefaultProfileHrefLabel");
|
||||
const auto uriValue = RS_(L"DynamicDefaultProfileHrefUrl");
|
||||
|
||||
winrt::Windows::UI::Xaml::Documents::Run legacyGlobalsLinkText;
|
||||
winrt::Windows::UI::Xaml::Documents::Hyperlink legacyGlobalsLink;
|
||||
winrt::Windows::Foundation::Uri linkUri{ uriValue };
|
||||
|
||||
legacyGlobalsLinkText.Text(linkLabel);
|
||||
legacyGlobalsLink.NavigateUri(linkUri);
|
||||
legacyGlobalsLink.Inlines().Append(legacyGlobalsLinkText);
|
||||
|
||||
warningsTextBlock.Inlines().Append(legacyGlobalsLink);
|
||||
}
|
||||
|
||||
warningsTextBlock.Inlines().Append(Documents::LineBreak{});
|
||||
}
|
||||
|
|
|
@ -232,6 +232,18 @@
|
|||
<data name="FailedToParseSubCommands" xml:space="preserve">
|
||||
<value>• Failed to parse all subcommands of nested command.</value>
|
||||
</data>
|
||||
<data name="DidNotFindDynamicDefaultProfile" xml:space="preserve">
|
||||
<value>• We detected your default profile is a dynamic profile that did not generate. The original source of this profile may no longer exist.
|
||||
</value>
|
||||
<comment>{Locked="•"} This glyph is a bullet, used in a bulleted list.</comment>
|
||||
</data>
|
||||
<data name="DynamicDefaultProfileHrefUrl" xml:space="preserve">
|
||||
<value>https://go.microsoft.com/fwlink/?linkid=2170601</value>
|
||||
<comment>{Locked}This is a FWLink, so it will be localized with the fwlink tool</comment>
|
||||
</data>
|
||||
<data name="DynamicDefaultProfileHrefLabel" xml:space="preserve">
|
||||
<value>For more info, see this web page.</value>
|
||||
</data>
|
||||
<data name="MissingRequiredParameter" xml:space="preserve">
|
||||
<value>• Found a keybinding that was missing a required parameter value. This keybinding will be ignored.</value>
|
||||
<comment>{Locked="•"} This glyph is a bullet, used in a bulleted list.</comment>
|
||||
|
|
|
@ -532,6 +532,7 @@ void CascadiaSettings::_ValidateDefaultProfileExists()
|
|||
|
||||
if (nullDefaultProfile || defaultProfileNotInProfiles)
|
||||
{
|
||||
// TODO! Don't add the warning if we already have a DidNotFindDynamicDefaultProfile warning.
|
||||
_warnings.Append(Microsoft::Terminal::Settings::Model::SettingsLoadWarnings::MissingDefaultProfile);
|
||||
// Use the first profile as the new default
|
||||
|
||||
|
|
|
@ -942,6 +942,31 @@ void CascadiaSettings::_LayerOrCreateProfile(const Json::Value& profileJson)
|
|||
profile->LayerJson(profileJson);
|
||||
_allProfiles.Append(*profile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO!
|
||||
const auto guid = Profile::GetGuidOrGenerateForJson(profileJson);
|
||||
try
|
||||
{
|
||||
// This might throw
|
||||
if (guid == _globals->DefaultProfile())
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::DidNotFindDynamicDefaultProfile);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// if it did, then the DefaultProfile isn't valid. It might be the name of the profile!
|
||||
if (GlobalSettings().HasUnparsedDefaultProfile())
|
||||
{
|
||||
const auto unparsedDefaultProfile{ GlobalSettings().UnparsedDefaultProfile() };
|
||||
if (Profile::GetNameForJson(profileJson) == unparsedDefaultProfile)
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::DidNotFindDynamicDefaultProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (profile && _userDefaultProfileSettings)
|
||||
|
|
|
@ -516,6 +516,11 @@ winrt::guid Profile::GetGuidOrGenerateForJson(const Json::Value& json) noexcept
|
|||
return Profile::_GenerateGuidForProfile(name, source);
|
||||
}
|
||||
|
||||
winrt::hstring Profile::GetNameForJson(const Json::Value& json) noexcept
|
||||
{
|
||||
return JsonUtils::GetValueForKey<hstring>(json, NameKey);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Create a new serialized JsonObject from an instance of this class
|
||||
// Arguments:
|
||||
|
|
|
@ -100,6 +100,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||
|
||||
hstring EvaluatedStartingDirectory() const;
|
||||
static guid GetGuidOrGenerateForJson(const Json::Value& json) noexcept;
|
||||
static hstring GetNameForJson(const Json::Value& json) noexcept;
|
||||
|
||||
Model::IAppearanceConfig DefaultAppearance();
|
||||
Model::FontConfig FontInfo();
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Microsoft.Terminal.Settings.Model
|
|||
InvalidSplitSize = 12,
|
||||
FailedToParseStartupActions = 13,
|
||||
FailedToParseSubCommands = 14,
|
||||
DidNotFindDynamicDefaultProfile = 15,
|
||||
WARNINGS_SIZE // IMPORTANT: This MUST be the last value in this enum. It's an unused placeholder.
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue