Add proxy support for QtWebEngine with Qt >= 5.8

See #666
Fixes #2082
This commit is contained in:
Florian Bruhin 2017-02-04 21:39:22 +01:00
parent b6e31d4172
commit fd29528e4f
3 changed files with 13 additions and 4 deletions

View File

@ -47,6 +47,7 @@ from qutebrowser.commands import cmdutils, runners, cmdexc
from qutebrowser.config import style, config, websettings, configexc
from qutebrowser.browser import (urlmarks, adblock, history, browsertab,
downloads)
from qutebrowser.browser.network import proxy
from qutebrowser.browser.webkit import cookies, cache
from qutebrowser.browser.webkit.network import networkmanager
from qutebrowser.keyinput import macros
@ -386,6 +387,11 @@ def _init_modules(args, crash_handler):
log.init.debug("Initializing network...")
networkmanager.init()
if qtutils.version_check('5.8'):
# Otherwise we can only initialize it for QtWebKit because of crashes
log.init.debug("Initializing proxy...")
proxy.init()
log.init.debug("Initializing readline-bridge...")
readline_bridge = readline.ReadlineBridge()
objreg.register('readline-bridge', readline_bridge)

View File

@ -42,6 +42,8 @@ def init():
"""Initialize QtWebKit-specific modules."""
qapp = QApplication.instance()
if not qtutils.version_check('5.8'):
# Otherwise we initialize it globally in app.py
log.init.debug("Initializing proxy...")
proxy.init()

View File

@ -35,7 +35,7 @@ from qutebrowser.config import configtypes as typ
from qutebrowser.config import sections as sect
from qutebrowser.config.value import SettingValue
from qutebrowser.utils.qtutils import MAXVALS
from qutebrowser.utils import usertypes
from qutebrowser.utils import usertypes, qtutils
FIRST_COMMENT = r"""
@ -433,7 +433,8 @@ def data(readonly=False):
('proxy',
SettingValue(typ.Proxy(), 'system',
backends=[usertypes.Backend.QtWebKit]),
backends=(None if qtutils.version_check('5.8')
else [usertypes.Backend.QtWebKit])),
"The proxy to use.\n\n"
"In addition to the listed values, you can use a `socks://...` "
"or `http://...` URL."),