Userland: Let applications make use of make_command_palette_action()

This commit is contained in:
demostanis 2022-10-14 22:27:30 +02:00 committed by Linus Groh
parent eb8c2bde90
commit 34acae90c7
Notes: sideshowbarker 2024-07-17 05:07:16 +09:00
45 changed files with 47 additions and 0 deletions

View file

@ -576,6 +576,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
texture_mag_filter_nearest_action->set_checked(true);
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action("3D File Viewer", app_icon, window));
window->show();

View file

@ -419,6 +419,7 @@ void BrowserWindow::build_menus()
debug_menu.add_action(same_origin_policy_action);
auto& help_menu = add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(this));
help_menu.add_action(WindowActions::the().about_action());
}

View file

@ -121,6 +121,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
round_menu.action_at(last_rounding_mode.value())->activate();
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action("Calculator", app_icon, window));
window->show();

View file

@ -146,6 +146,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_action(*view_year_action));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Calendar", app_icon, window)));
window->show();

View file

@ -157,6 +157,7 @@ void CharacterMapWidget::initialize_menubar(GUI::Window& window)
}));
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(&window));
help_menu.add_action(GUI::CommonActions::make_help_action([&](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/CharacterMap.md"), "/bin/Help");
}));

View file

@ -1047,6 +1047,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
TRY(go_menu->try_add_action(directory_view->open_terminal_action()));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("File Manager"sv, GUI::Icon::default_icon("app-file-manager"sv), window)));
(void)TRY(main_toolbar.try_add_action(go_back_action));

View file

@ -669,6 +669,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
TRY(scale_menu->try_add_action(*m_scale_fifteen_action));
auto help_menu = TRY(window.try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/FontEditor.md"), "/bin/Help");
})));

View file

@ -244,6 +244,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
TRY(go_menu->try_add_action(*m_go_home_action));
auto help_menu = TRY(window.try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window)));
TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [&](auto&) {
String path = "/usr/share/man/man1/Help.md";
open_page(path);

View file

@ -469,6 +469,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window)
little_endian_mode->set_checked(true);
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(&window));
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/HexEditor.md"), "/bin/Help");
}));

View file

@ -329,6 +329,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_action(hide_show_toolbar_action));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/ImageViewer.md"), "/bin/Help");
})));

View file

@ -100,6 +100,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
settings_menu.add_action(auto_modifier_action);
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action("Keyboard Mapper", app_icon, window));
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {

View file

@ -206,6 +206,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(accessibility_menu->try_add_action(achromatomaly_accessibility_action));
auto help_menu = TRY(window->try_add_menu("&Help"));
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu->add_action(GUI::CommonActions::make_about_action("Magnifier", app_icon, window));
window->show();

View file

@ -54,6 +54,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}));
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action("Mail", app_icon, window));
window->on_close_request = [&] {

View file

@ -67,6 +67,7 @@ void PDFViewerWidget::initialize_menubar(GUI::Window& window)
view_menu.add_action(*m_reset_zoom_action);
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(&window));
help_menu.add_action(GUI::CommonActions::make_about_action("PDF Viewer", GUI::Icon::default_icon("app-pdf-viewer"sv), &window));
}

View file

@ -80,6 +80,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Partition Editor", app_icon, window)));
window->show();

View file

@ -73,6 +73,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
main_widget->add_track_actions(edit_menu);
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action("Piano", app_icon, window));
window->show();

View file

@ -877,6 +877,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
}));
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(&window));
help_menu.add_action(GUI::CommonActions::make_about_action("Pixel Paint", GUI::Icon::default_icon("app-pixel-paint"sv), &window));
m_levels_dialog_action = GUI::Action::create(

View file

@ -99,6 +99,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Settings", app_icon, window)));
auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());

View file

@ -131,6 +131,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
visualization_actions.add_action(album_cover_visualization);
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Sound Player", app_icon, window)));
window->show();

View file

@ -333,6 +333,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}));
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action(APP_NAME, app_icon, window));
// Configure the nodes context menu.

View file

@ -279,6 +279,8 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
},
window());
m_search_action = GUI::CommonActions::make_command_palette_action(&parent_window);
m_about_action = GUI::CommonActions::make_about_action("Spreadsheet", GUI::Icon::default_icon("app-spreadsheet"sv), &parent_window);
toolbar.add_action(*m_new_action);
@ -664,6 +666,7 @@ void SpreadsheetWidget::initialize_menubar(GUI::Window& window)
edit_menu.add_action(*m_insert_emoji_action);
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(*m_search_action);
help_menu.add_action(*m_functions_help_action);
help_menu.add_action(*m_about_action);
}

View file

@ -96,6 +96,7 @@ private:
RefPtr<GUI::Action> m_change_background_color_action;
RefPtr<GUI::Action> m_change_foreground_color_action;
RefPtr<GUI::Action> m_search_action;
RefPtr<GUI::Action> m_functions_help_action;
RefPtr<GUI::Action> m_about_action;

View file

@ -447,6 +447,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
make_frequency_action(5);
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_about_action("System Monitor", app_icon, window));
process_table_view.on_activation = [&](auto&) {

View file

@ -411,6 +411,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_action(terminal->clear_including_history_action()));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Terminal.md"), "/bin/Help");
})));

View file

@ -617,6 +617,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
syntax_menu.add_action(*m_sql_highlight);
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(&window));
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/TextEditor.md"), "/bin/Help");
}));

View file

@ -304,6 +304,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
TRY(accessibility_menu->try_add_action(achromatomaly_accessibility_action));
auto help_menu = TRY(window.try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Theme Editor", GUI::Icon::default_icon("app-theme-editor"sv), &window)));
return {};

View file

@ -239,6 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(file_menu->try_add_separator());
TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Cube Demo", app_icon, window)));
cube->on_context_menu_request = [&](auto& event) {

View file

@ -91,6 +91,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Eyes.md"), "/bin/Help");
})));

View file

@ -473,6 +473,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_action(zoom_out_action));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Mandelbrot Demo", app_icon, window)));
window->show();

View file

@ -178,6 +178,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Mouse Demo", app_icon, window)));
window->set_resizable(false);

View file

@ -260,6 +260,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/GMLPlayground.md"), "/bin/Help");
})));

View file

@ -1524,6 +1524,7 @@ void HackStudioWidget::create_view_menu(GUI::Window& window)
void HackStudioWidget::create_help_menu(GUI::Window& window)
{
auto& help_menu = window.add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(&window));
help_menu.add_action(GUI::CommonActions::make_about_action("Hack Studio", GUI::Icon::default_icon("app-hack-studio"sv), &window));
}

View file

@ -93,6 +93,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
file_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Inspector.md"), "/bin/Help");
}));

View file

@ -300,6 +300,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_action(source_action));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Profiler.md"), "/bin/Help");
})));

View file

@ -264,6 +264,7 @@ void MainWidget::initialize_menu(GUI::Window* window)
edit_menu.add_action(*m_run_script_action);
auto& help_menu = window->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/SQLStudio.md"), "/bin/Help");
}));

View file

@ -203,6 +203,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/2048.md"), "/bin/Help");
})));

View file

@ -176,6 +176,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/Chess.md"), "/bin/Help");
})));

View file

@ -61,6 +61,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/FlappyBug.md"), "/bin/Help");
})));

View file

@ -139,6 +139,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/GameOfLife.md"), "/bin/Help");
})));

View file

@ -100,6 +100,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(game_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/Hearts.md"), "/bin/Help");
})));

View file

@ -132,6 +132,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
theme_actions.add_action(wordle_theme_action);
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/MasterWord.md"), "/bin/Help");
})));

View file

@ -123,6 +123,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
difficulty_actions.add_action(action);
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/Minesweeper.md"), "/bin/Help");
})));

View file

@ -58,6 +58,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
})));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man6/Snake.md"), "/bin/Help");
})));

View file

@ -205,6 +205,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(game_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })));
auto help_menu = TRY(window->try_add_menu("&Help"));
TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(window)));
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Solitaire", app_icon, window)));
window->set_resizable(false);

View file

@ -273,6 +273,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(view_menu->try_add_action(best_time_actions));
auto help_menu = TRY(window->try_add_menu("&Help"));
help_menu->add_action(GUI::CommonActions::make_command_palette_action(window));
help_menu->add_action(GUI::CommonActions::make_about_action("Spider", app_icon, window));
window->set_resizable(false);