LibWebView+UI: Launch the DevTools server if --devtools is specified

This replaces the --devtools-port flag with a --devtools flag, which
optionally accepts a port. If the --devtools flag is set, we will now
automatically launch the DevTools server.
This commit is contained in:
Timothy Flynn 2025-07-02 12:42:53 -04:00 committed by Tim Flynn
commit b55d2909f6
Notes: github-actions[bot] 2025-07-02 19:29:12 +00:00
5 changed files with 43 additions and 11 deletions

View file

@ -75,6 +75,8 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
, m_new_tab_button_toolbar(new QToolBar("New Tab", m_tabs_container))
, m_is_popup_window(is_popup_window)
{
auto const& browser_options = WebView::Application::browser_options();
setWindowIcon(app_icon());
// Listen for DPI changes
@ -549,7 +551,7 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
m_enable_scripting_action = new QAction("Enable Scripting", this);
m_enable_scripting_action->setCheckable(true);
m_enable_scripting_action->setChecked(WebView::Application::browser_options().disable_scripting == WebView::DisableScripting::No);
m_enable_scripting_action->setChecked(browser_options.disable_scripting == WebView::DisableScripting::No);
debug_menu->addAction(m_enable_scripting_action);
QObject::connect(m_enable_scripting_action, &QAction::triggered, this, [this] {
bool state = m_enable_scripting_action->isChecked();
@ -571,7 +573,7 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
m_block_pop_ups_action = new QAction("Block Pop-ups", this);
m_block_pop_ups_action->setCheckable(true);
m_block_pop_ups_action->setChecked(WebView::Application::browser_options().allow_popups == WebView::AllowPopups::No);
m_block_pop_ups_action->setChecked(browser_options.allow_popups == WebView::AllowPopups::No);
debug_menu->addAction(m_block_pop_ups_action);
QObject::connect(m_block_pop_ups_action, &QAction::triggered, this, [this] {
bool state = m_block_pop_ups_action->isChecked();
@ -683,6 +685,9 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
setCentralWidget(m_tabs_container);
setContextMenuPolicy(Qt::PreventContextMenu);
if (browser_options.devtools_port.has_value())
devtools_enabled();
}
void BrowserWindow::devtools_disabled()