Add some trace logging concerning which schemes are in use (#6803)
## Summary of the Pull Request Let's try and figure out just how many people are actually using Solarized. I emailed @DHowett about this a week ago, but otherwise we don't really have any other tasks for this. ## PR Checklist * [x] I work here * [n/a] Requires documentation to be updated
This commit is contained in:
parent
d350a89324
commit
ceeaadc311
|
@ -718,3 +718,30 @@ std::string CascadiaSettings::_ApplyFirstRunChangesToSettingsTemplate(std::strin
|
|||
|
||||
return finalSettings;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Lookup the color scheme for a given profile. If the profile doesn't exist,
|
||||
// or the scheme name listed in the profile doesn't correspond to a scheme,
|
||||
// this will return `nullptr`.
|
||||
// Arguments:
|
||||
// - profileGuid: the GUID of the profile to find the scheme for.
|
||||
// Return Value:
|
||||
// - a non-owning pointer to the scheme.
|
||||
const ColorScheme* CascadiaSettings::GetColorSchemeForProfile(const GUID profileGuid) const
|
||||
{
|
||||
auto* profile = FindProfile(profileGuid);
|
||||
if (!profile)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
auto schemeName = profile->GetSchemeName().has_value() ? profile->GetSchemeName().value() : L"\0";
|
||||
auto scheme = _globals.GetColorSchemes().find(schemeName);
|
||||
if (scheme != _globals.GetColorSchemes().end())
|
||||
{
|
||||
return &scheme->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
static std::filesystem::path GetDefaultSettingsPath();
|
||||
|
||||
const Profile* FindProfile(GUID profileGuid) const noexcept;
|
||||
const ColorScheme* GetColorSchemeForProfile(const GUID profileGuid) const;
|
||||
|
||||
std::vector<TerminalApp::SettingsLoadWarnings>& GetWarnings();
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ void Profile::SetColorScheme(std::optional<std::wstring> schemeName) noexcept
|
|||
_schemeName = std::move(schemeName);
|
||||
}
|
||||
|
||||
std::optional<std::wstring>& Profile::GetSchemeName() noexcept
|
||||
const std::optional<std::wstring>& Profile::GetSchemeName() const noexcept
|
||||
{
|
||||
return _schemeName;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
void SetGuid(GUID guid) noexcept { _guid = guid; }
|
||||
void SetFontFace(std::wstring fontFace) noexcept;
|
||||
void SetColorScheme(std::optional<std::wstring> schemeName) noexcept;
|
||||
std::optional<std::wstring>& GetSchemeName() noexcept;
|
||||
const std::optional<std::wstring>& GetSchemeName() const noexcept;
|
||||
void SetTabTitle(std::wstring tabTitle) noexcept;
|
||||
void SetSuppressApplicationTitle(bool suppressApplicationTitle) noexcept;
|
||||
void SetAcrylicOpacity(double opacity) noexcept;
|
||||
|
|
|
@ -554,6 +554,13 @@ namespace winrt::TerminalApp::implementation
|
|||
const bool usedManualProfile = (newTerminalArgs != nullptr) &&
|
||||
(newTerminalArgs.ProfileIndex() != nullptr ||
|
||||
newTerminalArgs.Profile().empty());
|
||||
|
||||
// Lookup the name of the color scheme used by this profile.
|
||||
const auto* scheme = _settings->GetColorSchemeForProfile(profileGuid);
|
||||
// If they explicitly specified `null` as the scheme (indicating _no_ scheme), log
|
||||
// that as the empty string.
|
||||
const auto schemeName = scheme ? scheme->GetName() : L"\0";
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hTerminalAppProvider, // handle to TerminalApp tracelogging provider
|
||||
"TabInformation",
|
||||
|
@ -565,6 +572,7 @@ namespace winrt::TerminalApp::implementation
|
|||
TraceLoggingBool(settings.UseAcrylic(), "UseAcrylic", "The acrylic preference from the settings"),
|
||||
TraceLoggingFloat64(settings.TintOpacity(), "TintOpacity", "Opacity preference from the settings"),
|
||||
TraceLoggingWideString(settings.FontFace().c_str(), "FontFace", "Font face chosen in the settings"),
|
||||
TraceLoggingWideString(schemeName.data(), "SchemeName", "Color scheme set in the settings"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServicePerformance));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue