mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
LibWebView+UI: Generate the entire Inspect menu
Now that all the actions in the Inspect menu are generated, we can generate the menu itself.
This commit is contained in:
parent
14d49d5a3a
commit
8b2187bf92
Notes:
github-actions[bot]
2025-09-18 11:28:38 +00:00
Author: https://github.com/trflynn89
Commit: 8b2187bf92
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6221
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/konradekk
4 changed files with 30 additions and 27 deletions
|
@ -679,20 +679,9 @@ void Application::initialize_actions()
|
|||
m_open_about_page_action = Action::create("About Ladybird"sv, ActionID::OpenAboutPage, [this]() {
|
||||
open_url_in_new_tab(URL::about_version(), Web::HTML::ActivateTab::Yes);
|
||||
});
|
||||
m_open_processes_page_action = Action::create("Open Task Manager"sv, ActionID::OpenProcessesPage, [this]() {
|
||||
open_url_in_new_tab(URL::about_processes(), Web::HTML::ActivateTab::Yes);
|
||||
});
|
||||
m_open_settings_page_action = Action::create("Settings"sv, ActionID::OpenSettingsPage, [this]() {
|
||||
open_url_in_new_tab(URL::about_settings(), Web::HTML::ActivateTab::Yes);
|
||||
});
|
||||
m_toggle_devtools_action = Action::create("Enable DevTools"sv, ActionID::ToggleDevTools, [this]() {
|
||||
if (auto result = toggle_devtools_enabled(); result.is_error())
|
||||
display_error_dialog(MUST(String::formatted("Unable to start DevTools: {}", result.error())));
|
||||
});
|
||||
m_view_source_action = Action::create("View Source"sv, ActionID::ViewSource, [this]() {
|
||||
if (auto view = active_web_view(); view.has_value())
|
||||
view->get_source();
|
||||
});
|
||||
|
||||
m_zoom_menu = Menu::create_group("Zoom"sv);
|
||||
m_zoom_menu->add_action(Action::create("Zoom In"sv, ActionID::ZoomIn, [this]() {
|
||||
|
@ -762,8 +751,25 @@ void Application::initialize_actions()
|
|||
m_motion_menu->add_action(Action::create_checkable("No Preference"sv, ActionID::PreferredMotion, set_motion(Web::CSS::PreferredMotion::NoPreference)));
|
||||
m_motion_menu->items().first().get<NonnullRefPtr<Action>>()->set_checked(true);
|
||||
|
||||
m_debug_menu = Menu::create("Debug"sv);
|
||||
m_inspect_menu = Menu::create("Inspect"sv);
|
||||
|
||||
m_view_source_action = Action::create("View Source"sv, ActionID::ViewSource, [this]() {
|
||||
if (auto view = active_web_view(); view.has_value())
|
||||
view->get_source();
|
||||
});
|
||||
m_inspect_menu->add_action(*m_view_source_action);
|
||||
|
||||
m_inspect_menu->add_action(Action::create("Open Task Manager"sv, ActionID::OpenProcessesPage, [this]() {
|
||||
open_url_in_new_tab(URL::about_processes(), Web::HTML::ActivateTab::Yes);
|
||||
}));
|
||||
|
||||
m_toggle_devtools_action = Action::create("Enable DevTools"sv, ActionID::ToggleDevTools, [this]() {
|
||||
if (auto result = toggle_devtools_enabled(); result.is_error())
|
||||
display_error_dialog(MUST(String::formatted("Unable to start DevTools: {}", result.error())));
|
||||
});
|
||||
m_inspect_menu->add_action(*m_toggle_devtools_action);
|
||||
|
||||
m_debug_menu = Menu::create("Debug"sv);
|
||||
m_debug_menu->add_action(Action::create("Dump Session History Tree"sv, ActionID::DumpSessionHistoryTree, debug_request("dump-session-history"sv)));
|
||||
m_debug_menu->add_action(Action::create("Dump DOM Tree"sv, ActionID::DumpDOMTree, debug_request("dump-dom-tree"sv)));
|
||||
m_debug_menu->add_action(Action::create("Dump Layout Tree"sv, ActionID::DumpLayoutTree, debug_request("dump-layout-tree"sv)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue