-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add New Tab Menu Customization to Settings UI #18015
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH nothing in this PR was a problem for me, although there are some nits. I'm mostly curious how it'll feel in practice (once it's in Canary). 🙂
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Played around with the branch, it's super cool! Mostly just nits but a couple blockers particularly around the repeated revoking/setting up of the same event handler
else | ||
{ | ||
// If we don't have a current folder, we're at the root of the NTM | ||
contentFrame().Navigate(xaml_typename<Editor::NewTabMenu>(), _newTabMenuPageVM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can the navigate call can be moved out of the if/else
block? It's the same call either way
// Reset the current folder entry and page BEFORE setting up the event handling | ||
_newTabMenuPageVM.CurrentFolder(nullptr); | ||
|
||
_SetupNTMEventHandling(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related to the other comment - we shouldn't need this call if we don't revoke the handler in _PreNavigateHelper
_PreNavigateHelper(); | ||
|
||
_SetupNTMEventHandling(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we're revoking the handler in _PreNavigateHelper
and then immediately setting it back up in _SetupNTMEventHandling
@@ -301,6 +317,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | |||
void MainPage::_PreNavigateHelper() | |||
{ | |||
_profileViewModelChangedRevoker.revoke(); | |||
_ntmViewModelChangedRevoker.revoke(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_newTabMenuPageVM
doesn't change, so why are we revoking our event handler for it and re-setting up the event handler? See the way we set up the event handling for _colorSchemesPageVM
- we should only need to set up all the event handling once and not repeatedly revoke it and set it up again
@@ -19,7 +19,8 @@ namespace Microsoft.Terminal.Settings.Editor | |||
Profile_Appearance, | |||
Profile_Terminal, | |||
Profile_Advanced, | |||
ColorSchemes_Edit | |||
ColorSchemes_Edit, | |||
NTM_Folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we call this NewTabMenu_Folder
so it's consistent with ColorSchemes_Edit
and more readable?
}); | ||
|
||
// Clear CurrentFolder to reset the view | ||
_CurrentFolder = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of clearing CurrentFolder
, can we first check whether the previous CurrentFolder
exists and then reset that as the current folder? Similar to the way the ColorSchemesPageVM resets the current scheme if that scheme still exists
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import "ProfileViewModel.idl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh
|
||
bool NewTabMenuViewModel::IsFolderView() const noexcept | ||
{ | ||
return CurrentView() != _rootEntries; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably more readable if this is return _CurrentFolder != nullptr
? Took me a bit to understand what this was used for haha
#include "ProfileEntry.h" | ||
#include "SeparatorEntry.h" | ||
#include "RemainingProfilesEntry.h" | ||
#include "MatchProfilesEntry.h" | ||
#include "ActionEntry.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these?
#include "FolderEntry.h" | ||
#include "ProfileEntry.h" | ||
#include "SeparatorEntry.h" | ||
#include "RemainingProfilesEntry.h" | ||
#include "MatchProfilesEntry.h" | ||
#include "ActionEntry.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, do we need these?
Feedback from Bug Bash (11/19)
|
Summary of the Pull Request
Adds customization for the New Tab Menu to the settings UI.
FolderEntry
FolderEntry
exposesEntries()
(used by the new tab menu to figure out what to actually render) andRawEntries()
(the actual JSON data deserialized into settings model objects). I went ahead and exposedRawEntries()
since we'll need to apply changes to it to then serialize.NewTabMenuViewModel
is the main view model that interacts with the page. It maintains the current view of items and applies changes to the settings model.NewTabMenuEntryViewModel
and all of the other_EntryViewModel
classes are wrappers for the settings model NTM entries.FolderTreeViewEntry
encapsulatesFolderEntryViewModel
. It allows us to construct aTreeView
of just folders.FontIconGlyph
to make this look nice!Verification
Follow-ups