mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
WebInspector: Disable web inspector by default
It is now needed to manually set the QTWEBENGINE_REMOTE_DEBUGGING environment variable.
This commit is contained in:
parent
a819fca7dc
commit
4a1b67ec2b
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2015 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -74,6 +74,9 @@ void PopupWebView::requestFullScreen(bool enable)
|
|||||||
|
|
||||||
void PopupWebView::inspectElement()
|
void PopupWebView::inspectElement()
|
||||||
{
|
{
|
||||||
|
if (!WebInspector::isEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_inspector) {
|
if (m_inspector) {
|
||||||
triggerPageAction(QWebEnginePage::InspectElement);
|
triggerPageAction(QWebEnginePage::InspectElement);
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -48,8 +48,10 @@ WebInspector::~WebInspector()
|
|||||||
void WebInspector::setView(QWebEngineView *view)
|
void WebInspector::setView(QWebEngineView *view)
|
||||||
{
|
{
|
||||||
m_view = view;
|
m_view = view;
|
||||||
|
Q_ASSERT(isEnabled());
|
||||||
|
|
||||||
QUrl inspectorUrl = QUrl(QSL("http://localhost:%1").arg(WEBINSPECTOR_PORT));
|
int port = qEnvironmentVariableIntValue("QTWEBENGINE_REMOTE_DEBUGGING");
|
||||||
|
QUrl inspectorUrl = QUrl(QSL("http://localhost:%1").arg(port));
|
||||||
int index = s_views.indexOf(m_view);
|
int index = s_views.indexOf(m_view);
|
||||||
|
|
||||||
QNetworkReply *reply = mApp->networkManager()->get(QNetworkRequest(inspectorUrl.resolved(QUrl("json/list"))));
|
QNetworkReply *reply = mApp->networkManager()->get(QNetworkRequest(inspectorUrl.resolved(QUrl("json/list"))));
|
||||||
@ -71,6 +73,11 @@ void WebInspector::inspectElement()
|
|||||||
m_inspectElement = true;
|
m_inspectElement = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WebInspector::isEnabled()
|
||||||
|
{
|
||||||
|
return qEnvironmentVariableIsSet("QTWEBENGINE_REMOTE_DEBUGGING");
|
||||||
|
}
|
||||||
|
|
||||||
void WebInspector::pushView(QWebEngineView *view)
|
void WebInspector::pushView(QWebEngineView *view)
|
||||||
{
|
{
|
||||||
s_views.removeOne(view);
|
s_views.removeOne(view);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,8 +18,6 @@
|
|||||||
#ifndef WEBINSPECTORDOCKWIDGET_H
|
#ifndef WEBINSPECTORDOCKWIDGET_H
|
||||||
#define WEBINSPECTORDOCKWIDGET_H
|
#define WEBINSPECTORDOCKWIDGET_H
|
||||||
|
|
||||||
#define WEBINSPECTOR_PORT "33417"
|
|
||||||
|
|
||||||
#include <QWebEngineView>
|
#include <QWebEngineView>
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
@ -37,6 +35,7 @@ public:
|
|||||||
void setView(QWebEngineView *view);
|
void setView(QWebEngineView *view);
|
||||||
void inspectElement();
|
void inspectElement();
|
||||||
|
|
||||||
|
static bool isEnabled();
|
||||||
static void pushView(QWebEngineView *view);
|
static void pushView(QWebEngineView *view);
|
||||||
static void registerView(QWebEngineView *view);
|
static void registerView(QWebEngineView *view);
|
||||||
static void unregisterView(QWebEngineView *view);
|
static void unregisterView(QWebEngineView *view);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -156,7 +156,7 @@ bool WebTab::haveInspector() const
|
|||||||
|
|
||||||
void WebTab::showWebInspector(bool inspectElement)
|
void WebTab::showWebInspector(bool inspectElement)
|
||||||
{
|
{
|
||||||
if (haveInspector())
|
if (!WebInspector::isEnabled() || haveInspector())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WebInspector *inspector = new WebInspector(this);
|
WebInspector *inspector = new WebInspector(this);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,7 +16,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "webinspector.h"
|
|
||||||
#include "proxystyle.h"
|
#include "proxystyle.h"
|
||||||
#include "datapaths.h"
|
#include "datapaths.h"
|
||||||
|
|
||||||
@ -153,8 +152,6 @@ int main(int argc, char* argv[])
|
|||||||
argv = args;
|
argv = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", WEBINSPECTOR_PORT);
|
|
||||||
|
|
||||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user