From 96bb8fe9441d11caaa8f1bc205bc9d11a2e098fb Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 3 Aug 2024 13:28:07 -0400 Subject: [PATCH] UI/Qt: Add a debug menu item to dump RequestServer connection info --- Base/res/icons/16x16/network.png | Bin 0 -> 454 bytes Ladybird/Qt/BrowserWindow.cpp | 11 +++++++++++ Ladybird/Qt/BrowserWindow.h | 2 ++ Ladybird/cmake/ResourceFiles.cmake | 1 + Meta/gn/secondary/Ladybird/BUILD.gn | 1 + 5 files changed, 15 insertions(+) create mode 100644 Base/res/icons/16x16/network.png diff --git a/Base/res/icons/16x16/network.png b/Base/res/icons/16x16/network.png new file mode 100644 index 0000000000000000000000000000000000000000..a784ac1206212554cd4c7fc18fb44fbf126155c9 GIT binary patch literal 454 zcmV;%0XhDOP)b6huRVR1yeUn2@N2 z{e?HUn!*P#>{!U193COTKiTZ=?9RWlGxMu33|WQmmjMWZDVw0O*#lt<1i@4RH~^#3 zI5mpbw|B$}Vg+k0A{HwaYlTwDlOUKXCvwPSGR$T(T-PP~*5GlF`nu;G@iczsqKuT{WCB1wpO4qeXm*A)Y89HD zVQjMt0u9h=-6R}V_sb-41oL@Jpi;}Uf1OGaN3fVR+rrBK2&~xOB&L?i-&yON%jGr` z6pO{U`=XK^exC8M+ebvWIIoiE#8vcqJ(Sis#$b%0+r4KGsB-#O3#lqoV6;YQjWLFL w{R(3oJkL|UUycR1mZ0B%NVT`yw+Z!r1ADlOdOu2lLI3~&07*qoM6N<$f=m>>mjD0& literal 0 HcmV?d00001 diff --git a/Ladybird/Qt/BrowserWindow.cpp b/Ladybird/Qt/BrowserWindow.cpp index 0b010b7cb8..c14fb46903 100644 --- a/Ladybird/Qt/BrowserWindow.cpp +++ b/Ladybird/Qt/BrowserWindow.cpp @@ -432,6 +432,11 @@ BrowserWindow::BrowserWindow(Vector const& initial_urls, WebView::Cook debug_request("dump-local-storage"); }); + auto* dump_connection_info = new QAction("Dump Co&nnection Info", this); + dump_connection_info->setIcon(load_icon_from_uri("resource://icons/16x16/network.png"sv)); + debug_menu->addAction(dump_connection_info); + QObject::connect(dump_connection_info, &QAction::triggered, this, &BrowserWindow::dump_connection_info); + debug_menu->addSeparator(); m_show_line_box_borders_action = new QAction("Show Line Box Borders", this); @@ -1227,4 +1232,10 @@ void BrowserWindow::closeEvent(QCloseEvent* event) QMainWindow::closeEvent(event); } +void BrowserWindow::dump_connection_info() +{ + if (auto& application = static_cast(WebView::Application::the()); application.request_server_client) + application.request_server_client->dump_connection_info(); +} + } diff --git a/Ladybird/Qt/BrowserWindow.h b/Ladybird/Qt/BrowserWindow.h index 86ab2d09da..31d278fd07 100644 --- a/Ladybird/Qt/BrowserWindow.h +++ b/Ladybird/Qt/BrowserWindow.h @@ -183,6 +183,8 @@ private: Web::CSS::PreferredColorScheme m_preferred_color_scheme; void set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme); + static void dump_connection_info(); + QTabWidget* m_tabs_container { nullptr }; Tab* m_current_tab { nullptr }; QMenu* m_zoom_menu { nullptr }; diff --git a/Ladybird/cmake/ResourceFiles.cmake b/Ladybird/cmake/ResourceFiles.cmake index ca5b6743f5..ff371ffcec 100644 --- a/Ladybird/cmake/ResourceFiles.cmake +++ b/Ladybird/cmake/ResourceFiles.cmake @@ -23,6 +23,7 @@ set(16x16_ICONS history.png layers.png layout.png + network.png new-tab.png open-parent-directory.png paste.png diff --git a/Meta/gn/secondary/Ladybird/BUILD.gn b/Meta/gn/secondary/Ladybird/BUILD.gn index fe0002ecb6..b9d5653891 100644 --- a/Meta/gn/secondary/Ladybird/BUILD.gn +++ b/Meta/gn/secondary/Ladybird/BUILD.gn @@ -226,6 +226,7 @@ icons_16x16 = [ "//Base/res/icons/16x16/history.png", "//Base/res/icons/16x16/layers.png", "//Base/res/icons/16x16/layout.png", + "//Base/res/icons/16x16/network.png", "//Base/res/icons/16x16/new-tab.png", "//Base/res/icons/16x16/open-parent-directory.png", "//Base/res/icons/16x16/paste.png",