1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-08-06 22:07:49 +00:00

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
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 {};