## Summary of the Pull Request Introduce the `IconPathConverter` to `TerminalApp`. `Command` and `Profile` now both return the unexpanded icon path. `IconPathConverter` is responsible for expanding the icon path and retrieving the appropriate icon source. This also removes `Profile`'s expanded icon path and uses the `IconPathConverter` when necessary. This allows users to set profile icons to emoji as well. However, emoji do not appear in the jumplist. ## References Based on #7667 ## PR Checklist * [X] Closes #7784 * [x] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [x] Schema updated. ## Validation Steps Performed Deploy succeeded.
33 lines
1.3 KiB
C++
33 lines
1.3 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#include "pch.h"
|
|
#include "DefaultProfileUtils.h"
|
|
#include "../../types/inc/utils.hpp"
|
|
|
|
static constexpr std::wstring_view PACKAGED_PROFILE_ICON_PATH{ L"ms-appx:///ProfileIcons/" };
|
|
static constexpr std::wstring_view PACKAGED_PROFILE_ICON_EXTENSION{ L".png" };
|
|
|
|
// Method Description:
|
|
// - Helper function for creating a skeleton default profile with a pre-populated
|
|
// guid and name.
|
|
// Arguments:
|
|
// - name: the name of the new profile.
|
|
// Return Value:
|
|
// - A Profile, ready to be filled in
|
|
winrt::Microsoft::Terminal::Settings::Model::Profile CreateDefaultProfile(const std::wstring_view name)
|
|
{
|
|
const winrt::guid profileGuid{ Microsoft::Console::Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID,
|
|
gsl::as_bytes(gsl::make_span(name))) };
|
|
auto newProfile = winrt::make<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile>(profileGuid);
|
|
newProfile.Name(name);
|
|
|
|
std::wstring iconPath{ PACKAGED_PROFILE_ICON_PATH };
|
|
iconPath.append(Microsoft::Console::Utils::GuidToString(profileGuid));
|
|
iconPath.append(PACKAGED_PROFILE_ICON_EXTENSION);
|
|
|
|
newProfile.Icon(iconPath);
|
|
|
|
return newProfile;
|
|
}
|