1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36: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:
David Rosca 2016-02-20 15:07:36 +01:00
parent a819fca7dc
commit 4a1b67ec2b
5 changed files with 18 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* 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
* 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()
{
if (!WebInspector::isEnabled())
return;
if (m_inspector) {
triggerPageAction(QWebEnginePage::InspectElement);
return;

View File

@ -1,6 +1,6 @@
/* ============================================================
* 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
* it under the terms of the GNU General Public License as published by
@ -48,8 +48,10 @@ WebInspector::~WebInspector()
void WebInspector::setView(QWebEngineView *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);
QNetworkReply *reply = mApp->networkManager()->get(QNetworkRequest(inspectorUrl.resolved(QUrl("json/list"))));
@ -71,6 +73,11 @@ void WebInspector::inspectElement()
m_inspectElement = true;
}
bool WebInspector::isEnabled()
{
return qEnvironmentVariableIsSet("QTWEBENGINE_REMOTE_DEBUGGING");
}
void WebInspector::pushView(QWebEngineView *view)
{
s_views.removeOne(view);

View File

@ -1,6 +1,6 @@
/* ============================================================
* 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
* it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
#ifndef WEBINSPECTORDOCKWIDGET_H
#define WEBINSPECTORDOCKWIDGET_H
#define WEBINSPECTOR_PORT "33417"
#include <QWebEngineView>
#include "qzcommon.h"
@ -37,6 +35,7 @@ public:
void setView(QWebEngineView *view);
void inspectElement();
static bool isEnabled();
static void pushView(QWebEngineView *view);
static void registerView(QWebEngineView *view);
static void unregisterView(QWebEngineView *view);

View File

@ -1,6 +1,6 @@
/* ============================================================
* 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
* 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)
{
if (haveInspector())
if (!WebInspector::isEnabled() || haveInspector())
return;
WebInspector *inspector = new WebInspector(this);

View File

@ -1,6 +1,6 @@
/* ============================================================
* 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
* 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/>.
* ============================================================ */
#include "mainapplication.h"
#include "webinspector.h"
#include "proxystyle.h"
#include "datapaths.h"
@ -153,8 +152,6 @@ int main(int argc, char* argv[])
argv = args;
}
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", WEBINSPECTOR_PORT);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);