Prechádzať zdrojové kódy

UI/Qt: Add a debug menu item to dump RequestServer connection info

Timothy Flynn 11 mesiacov pred
rodič
commit
96bb8fe944

BIN
Base/res/icons/16x16/network.png


+ 11 - 0
Ladybird/Qt/BrowserWindow.cpp

@@ -432,6 +432,11 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, WebView::Cook
         debug_request("dump-local-storage");
         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();
     debug_menu->addSeparator();
 
 
     m_show_line_box_borders_action = new QAction("Show Line Box Borders", this);
     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);
     QMainWindow::closeEvent(event);
 }
 }
 
 
+void BrowserWindow::dump_connection_info()
+{
+    if (auto& application = static_cast<Application&>(WebView::Application::the()); application.request_server_client)
+        application.request_server_client->dump_connection_info();
+}
+
 }
 }

+ 2 - 0
Ladybird/Qt/BrowserWindow.h

@@ -183,6 +183,8 @@ private:
     Web::CSS::PreferredColorScheme m_preferred_color_scheme;
     Web::CSS::PreferredColorScheme m_preferred_color_scheme;
     void set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme);
     void set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme);
 
 
+    static void dump_connection_info();
+
     QTabWidget* m_tabs_container { nullptr };
     QTabWidget* m_tabs_container { nullptr };
     Tab* m_current_tab { nullptr };
     Tab* m_current_tab { nullptr };
     QMenu* m_zoom_menu { nullptr };
     QMenu* m_zoom_menu { nullptr };

+ 1 - 0
Ladybird/cmake/ResourceFiles.cmake

@@ -23,6 +23,7 @@ set(16x16_ICONS
     history.png
     history.png
     layers.png
     layers.png
     layout.png
     layout.png
+    network.png
     new-tab.png
     new-tab.png
     open-parent-directory.png
     open-parent-directory.png
     paste.png
     paste.png

+ 1 - 0
Meta/gn/secondary/Ladybird/BUILD.gn

@@ -226,6 +226,7 @@ icons_16x16 = [
   "//Base/res/icons/16x16/history.png",
   "//Base/res/icons/16x16/history.png",
   "//Base/res/icons/16x16/layers.png",
   "//Base/res/icons/16x16/layers.png",
   "//Base/res/icons/16x16/layout.png",
   "//Base/res/icons/16x16/layout.png",
+  "//Base/res/icons/16x16/network.png",
   "//Base/res/icons/16x16/new-tab.png",
   "//Base/res/icons/16x16/new-tab.png",
   "//Base/res/icons/16x16/open-parent-directory.png",
   "//Base/res/icons/16x16/open-parent-directory.png",
   "//Base/res/icons/16x16/paste.png",
   "//Base/res/icons/16x16/paste.png",