Skip to content

Commit

Permalink
Replace feedback button with command palette button in dropdown (#10171)
Browse files Browse the repository at this point in the history
  • Loading branch information
KnapSac committed May 31, 2021
1 parent 89ca2ae commit 33dd336
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
10 changes: 3 additions & 7 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,9 @@
<data name="ReloadJsonParseErrorTitle" xml:space="preserve">
<value>Failed to reload settings</value>
</data>
<data name="FeedbackUriValue" xml:space="preserve">
<value>https://go.microsoft.com/fwlink/?linkid=2125419</value>
<comment>{Locked}This is a FWLink, so it will be localized with the fwlink tool</comment>
</data>
<data name="AboutMenuItem" xml:space="preserve">
<value>About</value>
</data>
<data name="FeedbackMenuItem" xml:space="preserve">
<value>Feedback</value>
</data>
<data name="SettingsMenuItem" xml:space="preserve">
<value>Settings</value>
</data>
Expand Down Expand Up @@ -634,4 +627,7 @@
<data name="WindowRestoreDownButtonToolTip" xml:space="preserve">
<value>Restore Down</value>
</data>
<data name="CommandPaletteMenuItem" xml:space="preserve">
<value>Command Palette</value>
</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);
}
}

// 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

0 comments on commit 33dd336

Please sign in to comment.