33470ad08e
Introduces the following UI controls to the ColorSchemes page: - "Add new" button - next to dropdown selector - adds a new color scheme named ("Color Scheme #" where # is the number of color schemes you have) - "Rename" Button - next to the selector - replaces the ComboBox with a TextBox and the accept/cancel buttons appear - "Delete" button - bottom of the page - opens flyout, when confirmed, deletes the current color scheme and selects another one This also adds a Delete button to the Profiles page. The Hide checkbox was moved above the Delete button. ## References #1564 - Settings UI #6800 - Settings UI Completion Epic ## Detailed Description of the Pull Request / Additional comments **Color Schemes:** - Deleting a color scheme selects another one from the list available - Rename replaces the combobox with a textbox to allow editing - The Add New button creates a new color scheme named "Color Scheme X" where X is the number of schemes defined - In-box color schemes cannot be deleted **Profile:** - Deleting a profile selects another one from the list available - the rename button does not exist (yet), because it needs a modification to the NavigationView's Header Template - The delete button is disabled for in-box profiles (CMD and Windows Powershell) and dynamic profiles ## Validation Steps Performed **Color Schemes - Add New** ✅ Creates a new color scheme named "Color Scheme X" (X being the number of color schemes) ✅ The new color scheme can be renamed/deleted/modified **Color Schemes - Rename** ✅ You cannot rename an in-box color scheme ✅ The rename button has a tooltip ✅ Clicking the rename button replaces the combobox with a textbox ✅ Accept --> changes name ✅ Cancel --> does not change the name ✅ accepting/cancelling the rename operation updates the combo box appropriately **Color Schemes - Delete** ✅ Clicking delete produces a flyout to confirm deletion ✅ Deleting a color scheme removes it from the list and select the one under it ✅ Deleting the last color scheme selects the last available color scheme after it's deleted ✅ In-box color schemes have the delete button disabled, and a disclaimer appears next to it **Profile- Delete** ✅ Base layer presents a disclaimer at the top, and hides the delete button ✅ Dynamic and in-box profiles disable the delete button and show the appropriate disclaimer next to the disabled button ✅ Clicking delete produces a flyout to confirm deletion ✅ Regular profiles have a delete button that is styled appropriately ✅ Clicking the delete profile button opens a content dialog. Confirmation deletes the profile and navigates to the profile indexed under it (deleting the last one redirects to the last one) ## Demo Refer to this post [here](https://github.com/microsoft/terminal/pull/8403#issuecomment-747545651. Confirmation flyout demo: https://github.com/microsoft/terminal/pull/8403#issuecomment-747657842
108 lines
4.3 KiB
C++
108 lines
4.3 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- GlobalAppSettings.h
|
|
|
|
Abstract:
|
|
- This class encapsulates all of the settings that are global to the app, and
|
|
not a part of any particular profile.
|
|
|
|
Author(s):
|
|
- Mike Griese - March 2019
|
|
|
|
--*/
|
|
#pragma once
|
|
|
|
#include "GlobalAppSettings.g.h"
|
|
#include "IInheritable.h"
|
|
|
|
#include "KeyMapping.h"
|
|
#include "Command.h"
|
|
#include "ColorScheme.h"
|
|
|
|
// fwdecl unittest classes
|
|
namespace SettingsModelLocalTests
|
|
{
|
|
class DeserializationTests;
|
|
class ColorSchemeTests;
|
|
};
|
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|
{
|
|
struct GlobalAppSettings : GlobalAppSettingsT<GlobalAppSettings>, IInheritable<GlobalAppSettings>
|
|
{
|
|
public:
|
|
GlobalAppSettings();
|
|
void _FinalizeInheritance() override;
|
|
com_ptr<GlobalAppSettings> Copy() const;
|
|
|
|
Windows::Foundation::Collections::IMapView<hstring, Model::ColorScheme> ColorSchemes() noexcept;
|
|
void AddColorScheme(const Model::ColorScheme& scheme);
|
|
void RemoveColorScheme(hstring schemeName);
|
|
|
|
Model::KeyMapping KeyMap() const noexcept;
|
|
|
|
static com_ptr<GlobalAppSettings> FromJson(const Json::Value& json);
|
|
void LayerJson(const Json::Value& json);
|
|
|
|
Json::Value ToJson() const;
|
|
|
|
std::vector<SettingsLoadWarnings> KeybindingsWarnings() const;
|
|
|
|
Windows::Foundation::Collections::IMapView<hstring, Model::Command> Commands() noexcept;
|
|
|
|
// These are implemented manually to handle the string/GUID exchange
|
|
// by higher layers in the app.
|
|
void DefaultProfile(const guid& defaultProfile) noexcept;
|
|
guid DefaultProfile() const;
|
|
bool HasUnparsedDefaultProfile() const;
|
|
winrt::hstring UnparsedDefaultProfile() const;
|
|
void UnparsedDefaultProfile(const hstring& value);
|
|
void ClearUnparsedDefaultProfile();
|
|
|
|
GETSET_SETTING(int32_t, InitialRows, DEFAULT_ROWS);
|
|
GETSET_SETTING(int32_t, InitialCols, DEFAULT_COLS);
|
|
GETSET_SETTING(bool, AlwaysShowTabs, true);
|
|
GETSET_SETTING(bool, ShowTitleInTitlebar, true);
|
|
GETSET_SETTING(bool, ConfirmCloseAllTabs, true);
|
|
GETSET_SETTING(winrt::Windows::UI::Xaml::ElementTheme, Theme, winrt::Windows::UI::Xaml::ElementTheme::Default);
|
|
GETSET_SETTING(winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::Equal);
|
|
GETSET_SETTING(bool, ShowTabsInTitlebar, true);
|
|
GETSET_SETTING(hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS);
|
|
GETSET_SETTING(bool, CopyOnSelect, false);
|
|
GETSET_SETTING(winrt::Microsoft::Terminal::TerminalControl::CopyFormat, CopyFormatting, 0);
|
|
GETSET_SETTING(bool, WarnAboutLargePaste, true);
|
|
GETSET_SETTING(bool, WarnAboutMultiLinePaste, true);
|
|
GETSET_SETTING(Model::LaunchPosition, InitialPosition, nullptr, nullptr);
|
|
GETSET_SETTING(Model::LaunchMode, LaunchMode, LaunchMode::DefaultMode);
|
|
GETSET_SETTING(bool, SnapToGridOnResize, true);
|
|
GETSET_SETTING(bool, ForceFullRepaintRendering, false);
|
|
GETSET_SETTING(bool, SoftwareRendering, false);
|
|
GETSET_SETTING(bool, ForceVTInput, false);
|
|
GETSET_SETTING(bool, DebugFeaturesEnabled, _getDefaultDebugFeaturesValue());
|
|
GETSET_SETTING(bool, StartOnUserLogin, false);
|
|
GETSET_SETTING(bool, AlwaysOnTop, false);
|
|
GETSET_SETTING(Model::TabSwitcherMode, TabSwitcherMode, Model::TabSwitcherMode::InOrder);
|
|
GETSET_SETTING(bool, DisableAnimations, false);
|
|
|
|
private:
|
|
guid _defaultProfile;
|
|
std::optional<hstring> _UnparsedDefaultProfile{ std::nullopt };
|
|
bool _validDefaultProfile;
|
|
|
|
com_ptr<KeyMapping> _keymap;
|
|
std::vector<SettingsLoadWarnings> _keybindingsWarnings;
|
|
|
|
Windows::Foundation::Collections::IMap<hstring, Model::ColorScheme> _colorSchemes;
|
|
Windows::Foundation::Collections::IMap<hstring, Model::Command> _commands;
|
|
|
|
std::optional<hstring> _getUnparsedDefaultProfileImpl() const;
|
|
static bool _getDefaultDebugFeaturesValue();
|
|
|
|
friend class SettingsModelLocalTests::DeserializationTests;
|
|
friend class SettingsModelLocalTests::ColorSchemeTests;
|
|
};
|
|
}
|