Hook up the list of actions to the command palette
This commit is contained in:
parent
846778b288
commit
c6dccdaf5c
|
@ -17,6 +17,7 @@ namespace winrt::TerminalApp::implementation
|
|||
InitializeComponent();
|
||||
|
||||
_filteredActions = winrt::single_threaded_observable_vector<winrt::TerminalApp::Action>();
|
||||
_allActions = winrt::single_threaded_vector<winrt::TerminalApp::Action>();
|
||||
|
||||
Action action1{};
|
||||
action1.Name(L"Foo");
|
||||
|
@ -34,4 +35,15 @@ namespace winrt::TerminalApp::implementation
|
|||
{
|
||||
return _filteredActions;
|
||||
}
|
||||
|
||||
void ActionList::SetActions(Windows::Foundation::Collections::IVector<TerminalApp::Action> const& actions)
|
||||
{
|
||||
_allActions = actions;
|
||||
|
||||
_filteredActions.Clear();
|
||||
for (auto action : _allActions)
|
||||
{
|
||||
_filteredActions.Append(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ namespace winrt::TerminalApp::implementation
|
|||
{
|
||||
ActionList();
|
||||
|
||||
// void OnNewTabButtonClick(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Controls::SplitButtonClickEventArgs const& args);
|
||||
|
||||
Windows::Foundation::Collections::IObservableVector<TerminalApp::Action> FilteredActions();
|
||||
void SetActions(Windows::Foundation::Collections::IVector<TerminalApp::Action> const& actions);
|
||||
|
||||
private:
|
||||
Windows::Foundation::Collections::IObservableVector<TerminalApp::Action> _filteredActions{ nullptr };
|
||||
Windows::Foundation::Collections::IVector<TerminalApp::Action> _allActions{ nullptr };
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,5 +10,7 @@ namespace TerminalApp
|
|||
ActionList();
|
||||
|
||||
Windows.Foundation.Collections.IObservableVector<Action> FilteredActions { get; };
|
||||
|
||||
void SetActions(Windows.Foundation.Collections.IVector<Action> actions);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,14 @@ namespace winrt::TerminalApp::implementation
|
|||
|
||||
_RegisterActionCallbacks();
|
||||
|
||||
// TODO: Update the command palette when settings reload
|
||||
auto actionsCollection = winrt::single_threaded_vector<winrt::TerminalApp::Action>();
|
||||
for (auto& action : _settings->GlobalSettings().GetActions())
|
||||
{
|
||||
actionsCollection.Append(action);
|
||||
}
|
||||
_commandPalette.SetActions(actionsCollection);
|
||||
|
||||
// Event Bindings (Early)
|
||||
_newTabButton.Click([this](auto&&, auto&&) {
|
||||
this->_OpenNewTab(std::nullopt);
|
||||
|
|
|
@ -59,6 +59,11 @@ std::vector<ColorScheme>& GlobalAppSettings::GetColorSchemes() noexcept
|
|||
return _colorSchemes;
|
||||
}
|
||||
|
||||
const std::vector<winrt::TerminalApp::Action>& GlobalAppSettings::GetActions() const noexcept
|
||||
{
|
||||
return _actions;
|
||||
}
|
||||
|
||||
void GlobalAppSettings::SetDefaultProfile(const GUID defaultProfile) noexcept
|
||||
{
|
||||
_defaultProfile = defaultProfile;
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
|
||||
void ApplyToSettings(winrt::Microsoft::Terminal::Settings::TerminalSettings& settings) const noexcept;
|
||||
|
||||
const std::vector<winrt::TerminalApp::Action>& GetActions() const noexcept;
|
||||
|
||||
private:
|
||||
GUID _defaultProfile;
|
||||
winrt::TerminalApp::AppKeyBindings _keybindings;
|
||||
|
|
Loading…
Reference in a new issue