Skip to content
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

Replace feedback button with command palette button in dropdown #10297

Merged
2 commits merged into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,7 @@
<data name="WindowRestoreDownButtonToolTip" xml:space="preserve">
<value>Restore Down</value>
</data>
<data name="CommandPaletteMenuItem" xml:space="preserve">
miniksa marked this conversation as resolved.
Show resolved Hide resolved
<value>Command Palette</value>
carlos-zamora marked this conversation as resolved.
Show resolved Hide resolved
</data>
</root>
39 changes: 21 additions & 18 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ namespace winrt::TerminalApp::implementation
// attaches it to the button. Populates the flyout with one entry per
// Profile, displaying the profile's name. Clicking each flyout item will
// open a new tab with that profile.
// Below the profiles are the static menu items: settings, feedback
// Below the profiles are the static menu items: settings, command palette
void TerminalPage::_CreateNewTabFlyout()
{
auto newTabFlyout = WUX::Controls::MenuFlyout{};
Expand Down Expand Up @@ -703,17 +703,23 @@ namespace winrt::TerminalApp::implementation
_SetAcceleratorForMenuItem(settingsItem, settingsKeyChord);
}

// Create the feedback button.
auto feedbackFlyout = WUX::Controls::MenuFlyoutItem{};
feedbackFlyout.Text(RS_(L"FeedbackMenuItem"));
// Create the command palette button.
auto commandPaletteFlyout = WUX::Controls::MenuFlyoutItem{};
commandPaletteFlyout.Text(RS_(L"CommandPaletteMenuItem"));

WUX::Controls::FontIcon feedbackIcon{};
feedbackIcon.Glyph(L"\xE939");
feedbackIcon.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" });
feedbackFlyout.Icon(feedbackIcon);
WUX::Controls::FontIcon commandPaletteIcon{};
commandPaletteIcon.Glyph(L"\xE945");
commandPaletteIcon.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" });
commandPaletteFlyout.Icon(commandPaletteIcon);

feedbackFlyout.Click({ this, &TerminalPage::_FeedbackButtonOnClick });
newTabFlyout.Items().Append(feedbackFlyout);
commandPaletteFlyout.Click({ this, &TerminalPage::_CommandPaletteButtonOnClick });
newTabFlyout.Items().Append(commandPaletteFlyout);

const auto commandPaletteKeyChord{ actionMap.GetKeyBindingForAction(ShortcutAction::ToggleCommandPalette) };
if (commandPaletteKeyChord)
{
_SetAcceleratorForMenuItem(commandPaletteFlyout, commandPaletteKeyChord);
}
KnapSac marked this conversation as resolved.
Show resolved Hide resolved
}

// Create the about button.
Expand Down Expand Up @@ -884,15 +890,12 @@ namespace winrt::TerminalApp::implementation
}

// Method Description:
// - Called when the feedback button is clicked. Launches github in your
// default browser, navigated to the "issues" page of the Terminal repo.
void TerminalPage::_FeedbackButtonOnClick(const IInspectable&,
const RoutedEventArgs&)
// - Called when the command palette button is clicked. Opens the command palette.
void TerminalPage::_CommandPaletteButtonOnClick(const IInspectable&,
const RoutedEventArgs&)
{
const auto feedbackUriValue = RS_(L"FeedbackUriValue");
winrt::Windows::Foundation::Uri feedbackUri{ feedbackUriValue };

winrt::Windows::System::Launcher::LaunchUriAsync(feedbackUri);
CommandPalette().EnableCommandPaletteMode(CommandPaletteLaunchMode::Action);
CommandPalette().Visibility(Visibility::Visible);
}

// Method Description:
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace winrt::TerminalApp::implementation

bool _displayingCloseDialog{ false };
void _SettingsButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _FeedbackButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _CommandPaletteButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _AboutButtonOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _ThirdPartyNoticesOnClick(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);

Expand Down