Remove 'Reset Profile'

This commit is contained in:
Carlos Zamora
2026-06-16 14:06:35 -07:00
parent 577bf32d4d
commit 2c8a634ffa
7 changed files with 35 additions and 117 deletions

View File

@@ -811,32 +811,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
DeleteProfileRequested.raise(*this, *deleteProfileArgs);
}
void ProfileViewModel::ResetSettings()
{
// Clear every projected profile setting. Each Clear##name() notifies the bound
// properties and cascades to derived previews via our PropertyChanged handler.
#define PROFILE_VIEW_MODEL_CLEAR_SETTING(target, name) Clear##name();
PROFILE_VIEW_MODEL_PROJECTED_SETTINGS(PROFILE_VIEW_MODEL_CLEAR_SETTING)
#undef PROFILE_VIEW_MODEL_CLEAR_SETTING
_lastStartingDirectoryPath.clear();
// Not exposed to SUI
_profile.ClearEnvironmentVariables();
_profile.ClearAllowKeypadMode();
// Clear complex child objects
_profile.DefaultAppearance().ClearAllSettings();
_profile.FontInfo().ClearAllSettings();
if (HasUnfocusedAppearance())
{
DeleteUnfocusedAppearance();
}
_RefreshDefaultAppearanceViewModel();
_NotifyChanges(L"DefaultAppearance", L"TabThemeColorPreview", L"TabColorPreview");
}
void ProfileViewModel::SetupAppearances(Windows::Foundation::Collections::IObservableVector<Editor::ColorSchemeViewModel> schemesList)
{
DefaultAppearance().SchemesList(schemesList);

View File

@@ -39,7 +39,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void DeleteProfile();
void SetupAppearances(Windows::Foundation::Collections::IObservableVector<Editor::ColorSchemeViewModel> schemesList);
void ResetSettings();
// bell style bits
hstring BellStylePreview() const;
@@ -114,50 +113,41 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_profile, Guid);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_profile, ConnectionType);
// The clearable settings this view model projects from the underlying profile model.
// This is the single source of truth for both the declarations below and the
// ClearX() calls in ResetSettings()
#define PROFILE_VIEW_MODEL_PROJECTED_SETTINGS(X) \
X(_profile, Name) \
X(_profile, Source) \
X(_profile, Hidden) \
X(_profile, Icon) \
X(_profile, CloseOnExit) \
X(_profile, TabTitle) \
X(_profile, TabColor) \
X(_profile, SuppressApplicationTitle) \
X(_profile, ScrollState) \
X(_profile, Padding) \
X(_profile, Commandline) \
X(_profile, StartingDirectory) \
X(_profile, AntialiasingMode) \
X(_profile.DefaultAppearance(), Opacity) \
X(_profile.DefaultAppearance(), UseAcrylic) \
X(_profile, HistorySize) \
X(_profile, SnapOnInput) \
X(_profile, AltGrAliasing) \
X(_profile, BellStyle) \
X(_profile, BellSound) \
X(_profile, Elevate) \
X(_profile, ReloadEnvironmentVariables) \
X(_profile, RightClickContextMenu) \
X(_profile, ShowMarks) \
X(_profile, AutoMarkPrompts) \
X(_profile, RepositionCursorWithMouse) \
X(_profile, ForceVTInput) \
X(_profile, AllowKittyKeyboardMode) \
X(_profile, AllowVtChecksumReport) \
X(_profile, AllowVtClipboardWrite) \
X(_profile, AllowOscNotifications) \
X(_profile, AnswerbackMessage) \
X(_profile, RainbowSuggestions) \
X(_profile, PathTranslationStyle) \
X(_profile, DragDropDelimiter)
#define PROFILE_VIEW_MODEL_DECLARE_SETTING(target, name) OBSERVABLE_PROJECTED_SETTING(target, name);
PROFILE_VIEW_MODEL_PROJECTED_SETTINGS(PROFILE_VIEW_MODEL_DECLARE_SETTING)
#undef PROFILE_VIEW_MODEL_DECLARE_SETTING
OBSERVABLE_PROJECTED_SETTING(_profile, Name);
OBSERVABLE_PROJECTED_SETTING(_profile, Source);
OBSERVABLE_PROJECTED_SETTING(_profile, Hidden);
OBSERVABLE_PROJECTED_SETTING(_profile, Icon);
OBSERVABLE_PROJECTED_SETTING(_profile, CloseOnExit);
OBSERVABLE_PROJECTED_SETTING(_profile, TabTitle);
OBSERVABLE_PROJECTED_SETTING(_profile, TabColor);
OBSERVABLE_PROJECTED_SETTING(_profile, SuppressApplicationTitle);
OBSERVABLE_PROJECTED_SETTING(_profile, ScrollState);
OBSERVABLE_PROJECTED_SETTING(_profile, Padding);
OBSERVABLE_PROJECTED_SETTING(_profile, Commandline);
OBSERVABLE_PROJECTED_SETTING(_profile, StartingDirectory);
OBSERVABLE_PROJECTED_SETTING(_profile, AntialiasingMode);
OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), Opacity);
OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), UseAcrylic);
OBSERVABLE_PROJECTED_SETTING(_profile, HistorySize);
OBSERVABLE_PROJECTED_SETTING(_profile, SnapOnInput);
OBSERVABLE_PROJECTED_SETTING(_profile, AltGrAliasing);
OBSERVABLE_PROJECTED_SETTING(_profile, BellStyle);
OBSERVABLE_PROJECTED_SETTING(_profile, BellSound);
OBSERVABLE_PROJECTED_SETTING(_profile, Elevate);
OBSERVABLE_PROJECTED_SETTING(_profile, ReloadEnvironmentVariables);
OBSERVABLE_PROJECTED_SETTING(_profile, RightClickContextMenu);
OBSERVABLE_PROJECTED_SETTING(_profile, ShowMarks);
OBSERVABLE_PROJECTED_SETTING(_profile, AutoMarkPrompts);
OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse);
OBSERVABLE_PROJECTED_SETTING(_profile, ForceVTInput);
OBSERVABLE_PROJECTED_SETTING(_profile, AllowKittyKeyboardMode);
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport);
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtClipboardWrite);
OBSERVABLE_PROJECTED_SETTING(_profile, AllowOscNotifications);
OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage);
OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions);
OBSERVABLE_PROJECTED_SETTING(_profile, PathTranslationStyle);
OBSERVABLE_PROJECTED_SETTING(_profile, DragDropDelimiter);
WINRT_PROPERTY(bool, IsBaseLayer, false);
WINRT_PROPERTY(bool, FocusDeleteButton, false);

View File

@@ -41,7 +41,6 @@ namespace Microsoft.Terminal.Settings.Editor
event Windows.Foundation.TypedEventHandler<ProfileViewModel, DeleteProfileEventArgs> DeleteProfileRequested;
void SetupAppearances(Windows.Foundation.Collections.IObservableVector<ColorSchemeViewModel> schemesList);
void ResetSettings();
void SetAcrylicOpacityPercentageValue(Double value);

View File

@@ -87,11 +87,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_Profile.CurrentPage(ProfileSubPage::Advanced);
}
void Profiles_Base::ResetProfileConfirmation_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)
{
Profile().ResetSettings();
}
void Profiles_Base::DeleteConfirmation_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*e*/)
{
TraceLoggingWrite(

View File

@@ -22,7 +22,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Appearance_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void Terminal_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void Advanced_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void ResetProfileConfirmation_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
void DeleteConfirmation_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
til::property_changed_event PropertyChanged;

View File

@@ -151,25 +151,6 @@
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingsCard>
<!-- Reset Profile -->
<local:SettingsCard x:Name="ResetProfile"
x:Uid="Profile_ResetProfile"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(Profile.IsBaseLayer), Mode=OneWay}">
<Button x:Uid="Profile_ResetProfileButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Profile_ResetProfileConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Profile_ResetProfileConfirmationButton"
Click="ResetProfileConfirmation_Click" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingsCard>
<!-- Delete Profile -->
<local:SettingsCard x:Name="DeleteProfile"
x:Uid="Profile_DeleteProfile"

View File

@@ -1657,26 +1657,6 @@
<value>Are you sure you want to delete this profile?</value>
<comment>A confirmation message displayed when the user intends to delete a profile.</comment>
</data>
<data name="Profile_ResetProfile.Header" xml:space="preserve">
<value>Reset this profile to default settings</value>
<comment>Header for a settings card that resets the profile to inherited defaults.</comment>
</data>
<data name="Profile_ResetProfile.Description" xml:space="preserve">
<value>Clears all customizations and restores inherited defaults from the Defaults profile</value>
<comment>Description for the reset profile settings card.</comment>
</data>
<data name="Profile_ResetProfileButton.Content" xml:space="preserve">
<value>Reset</value>
<comment>Button label to reset a profile's settings.</comment>
</data>
<data name="Profile_ResetProfileConfirmationMessage.Text" xml:space="preserve">
<value>Are you sure you want to reset all settings for this profile? This cannot be undone.</value>
<comment>A confirmation message displayed when the user intends to reset a profile.</comment>
</data>
<data name="Profile_ResetProfileConfirmationButton.Content" xml:space="preserve">
<value>Reset profile</value>
<comment>Button label for positive confirmation of resetting a profile.</comment>
</data>
<data name="Profile_DeleteProfile.Header" xml:space="preserve">
<value>Delete this profile</value>
<comment>Header for a settings card that deletes the profile.</comment>