8da6737d64
This commit switches the GUIDs for default profiles from being randomly generated to being version 5 UUIDs. More info in #870. ## PR Checklist * [x] Closes #870 * [x] CLA signed * [x] Tests added/passed * [x] Requires documentation to be updated (#883) * [x] I've discussed this with core contributors already. ## Detailed Description of the Pull Request / Additional comments This commit has a number of changes that seem ancillary, but they're general goodness. Let me explain: * I've added a whole new Types test library with only two tests in * Since UUIDv5 generation requires SHA1, we needed to take a dependency on bcrypt * I honestly don't think we should have to link bcrypt in conhost, but LTO should take care of that * I considered adding a new Terminal-specific Utils/Types library, but that seemed like a waste * The best way to link bcrypt turned out to be in line with a discussion @miniksa and I had, where we decided we both love APISets and think that the console should link against them exclusively... so I've added `onecore_apiset.lib` to the front of the link line, where it will deflect the linker away from most of the other libs automagically. ``` StartGroup: UuidTests::TestV5UuidU8String Verify: AreEqual(uuidExpected, uuidActual) EndGroup: UuidTests::TestV5UuidU8String [Passed] StartGroup: UuidTests::TestV5UuidU16String Verify: AreEqual(uuidExpected, uuidActual) EndGroup: UuidTests::TestV5UuidU16String [Passed] ```
92 lines
2.8 KiB
C++
92 lines
2.8 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- Profile.hpp
|
|
|
|
Abstract:
|
|
- A profile acts as a single set of terminal settings. Many tabs or panes could
|
|
exist side-by-side with different profiles simultaneously.
|
|
|
|
Author(s):
|
|
- Mike Griese - March 2019
|
|
|
|
--*/
|
|
#pragma once
|
|
#include "ColorScheme.h"
|
|
|
|
namespace TerminalApp
|
|
{
|
|
class Profile;
|
|
};
|
|
|
|
class TerminalApp::Profile final
|
|
{
|
|
|
|
public:
|
|
Profile(const winrt::guid& guid);
|
|
Profile();
|
|
|
|
~Profile();
|
|
|
|
winrt::Microsoft::Terminal::Settings::TerminalSettings CreateTerminalSettings(const std::vector<::TerminalApp::ColorScheme>& schemes) const;
|
|
|
|
winrt::Windows::Data::Json::JsonObject ToJson() const;
|
|
static Profile FromJson(winrt::Windows::Data::Json::JsonObject json);
|
|
|
|
GUID GetGuid() const noexcept;
|
|
std::wstring_view GetName() const noexcept;
|
|
|
|
void SetFontFace(std::wstring fontFace) noexcept;
|
|
void SetColorScheme(std::optional<std::wstring> schemeName) noexcept;
|
|
void SetAcrylicOpacity(double opacity) noexcept;
|
|
void SetCommandline(std::wstring cmdline) noexcept;
|
|
void SetStartingDirectory(std::wstring startingDirectory) noexcept;
|
|
void SetName(std::wstring name) noexcept;
|
|
void SetUseAcrylic(bool useAcrylic) noexcept;
|
|
void SetDefaultForeground(COLORREF defaultForeground) noexcept;
|
|
void SetDefaultBackground(COLORREF defaultBackground) noexcept;
|
|
|
|
bool HasIcon() const noexcept;
|
|
std::wstring_view GetIconPath() const noexcept;
|
|
|
|
bool GetCloseOnExit() const noexcept;
|
|
|
|
private:
|
|
|
|
static std::wstring EvaluateStartingDirectory(const std::wstring& directory);
|
|
|
|
static winrt::Microsoft::Terminal::Settings::ScrollbarState ParseScrollbarState(const std::wstring& scrollbarState);
|
|
static winrt::Microsoft::Terminal::Settings::CursorStyle _ParseCursorShape(const std::wstring& cursorShapeString);
|
|
static std::wstring _SerializeCursorStyle(const winrt::Microsoft::Terminal::Settings::CursorStyle cursorShape);
|
|
|
|
GUID _guid;
|
|
std::wstring _name;
|
|
|
|
// If this is set, then our colors should come from the associated color scheme
|
|
std::optional<std::wstring> _schemeName;
|
|
|
|
std::optional<uint32_t> _defaultForeground;
|
|
std::optional<uint32_t> _defaultBackground;
|
|
std::array<uint32_t, COLOR_TABLE_SIZE> _colorTable;
|
|
int32_t _historySize;
|
|
bool _snapOnInput;
|
|
uint32_t _cursorColor;
|
|
uint32_t _cursorHeight;
|
|
winrt::Microsoft::Terminal::Settings::CursorStyle _cursorShape;
|
|
|
|
std::wstring _commandline;
|
|
std::wstring _fontFace;
|
|
std::optional<std::wstring> _startingDirectory;
|
|
int32_t _fontSize;
|
|
double _acrylicTransparency;
|
|
bool _useAcrylic;
|
|
|
|
std::optional<std::wstring> _scrollbarState;
|
|
bool _closeOnExit;
|
|
std::wstring _padding;
|
|
|
|
std::optional<std::wstring> _icon;
|
|
};
|