From 0cd5d4300b4955cb9a8e74506fd1b181f5f72e01 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 11 Oct 2017 07:45:38 +0200 Subject: [PATCH] Rename qt_args and force_software_rendering to add qt. prefix Closes #3077 --- doc/changelog.asciidoc | 2 +- doc/help/settings.asciidoc | 30 ++++++------ qutebrowser/config/configdata.yml | 60 ++++++++++++++---------- qutebrowser/config/configinit.py | 4 +- qutebrowser/misc/backendproblem.py | 4 +- tests/end2end/test_invocations.py | 2 +- tests/unit/config/test_configcommands.py | 2 +- tests/unit/config/test_configinit.py | 4 +- 8 files changed, 59 insertions(+), 49 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index abd454bae..1fc7fcec4 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -56,7 +56,7 @@ Added - New back/forward indicator in the statusbar - New `bindings.key_mappings` setting to map keys to other keys -- New `qt_args` setting to pass additional arguments to Qt/Chromium +- New `qt.args` setting to pass additional arguments to Qt/Chromium - New `backend` setting to select the backend to use (auto/webengine/webkit). Together with the previous setting, this should make wrapper scripts unnecessary. diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 2d8008b38..3ef3f8439 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -179,7 +179,6 @@ |<>|The default font size for fixed-pitch text. |<>|The hard minimum font size. |<>|The minimum logical font size that is applied when zooming out. -|<>|Force software rendering for QtWebEngine. |<>|Controls when a hint can be automatically followed without pressing Enter. |<>|A timeout (in milliseconds) to ignore normal-mode key bindings after a successful auto-follow. |<>|CSS border value for hints. @@ -211,7 +210,8 @@ |<>|Which window to choose when opening links as new tabs. |<>|Show a filebrowser in upload/download prompts. |<>|The rounding radius for the edges of prompts. -|<>|Additional arguments to pass to Qt, without leading `--`. +|<>|Additional arguments to pass to Qt, without leading `--`. +|<>|Force software rendering for QtWebEngine. |<>|Show a scrollbar. |<>|Enable smooth scrolling for web pages. |<>|The name of the session to save by default. @@ -2115,17 +2115,6 @@ Type: <> Default: +pass:[6]+ -[[force_software_rendering]] -=== force_software_rendering -Force software rendering for QtWebEngine. -This is needed for QtWebEngine to work with Nouveau drivers. This setting requires a restart. - -Type: <> - -Default: +pass:[false]+ - -This setting is only available with the QtWebEngine backend. - [[hints.auto_follow]] === hints.auto_follow Controls when a hint can be automatically followed without pressing Enter. @@ -2444,8 +2433,8 @@ Type: <> Default: +pass:[8]+ -[[qt_args]] -=== qt_args +[[qt.args]] +=== qt.args Additional arguments to pass to Qt, without leading `--`. With QtWebEngine, some Chromium arguments (see https://peter.sh/experiments/chromium-command-line-switches/ for a list) will work. This setting requires a restart. @@ -2454,6 +2443,17 @@ Type: <> Default: empty +[[qt.force_software_rendering]] +=== qt.force_software_rendering +Force software rendering for QtWebEngine. +This is needed for QtWebEngine to work with Nouveau drivers. This setting requires a restart. + +Type: <> + +Default: +pass:[false]+ + +This setting is only available with the QtWebEngine backend. + [[scrolling.bar]] === scrolling.bar Show a scrollbar. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 3f69d91b3..881e5595e 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -88,31 +88,6 @@ session_default_name: If this is set to null, the session which was last loaded is saved. -qt_args: - type: - name: List - valtype: String - none_ok: true - default: [] - desc: >- - Additional arguments to pass to Qt, without leading `--`. - - With QtWebEngine, some Chromium arguments (see - https://peter.sh/experiments/chromium-command-line-switches/ for a list) - will work. - - This setting requires a restart. - -force_software_rendering: - type: Bool - default: false - backend: QtWebEngine - desc: >- - Force software rendering for QtWebEngine. - - This is needed for QtWebEngine to work with Nouveau drivers. - This setting requires a restart. - backend: type: name: String @@ -136,6 +111,41 @@ backend: This setting requires a restart. + +## qt + +qt_args: + renamed: qt.args + +qt.args: + type: + name: List + valtype: String + none_ok: true + default: [] + desc: >- + Additional arguments to pass to Qt, without leading `--`. + + With QtWebEngine, some Chromium arguments (see + https://peter.sh/experiments/chromium-command-line-switches/ for a list) + will work. + + This setting requires a restart. + +force_software_rendering: + renamed: qt.force_software_rendering + +qt.force_software_rendering: + type: Bool + default: false + backend: QtWebEngine + desc: >- + Force software rendering for QtWebEngine. + + This is needed for QtWebEngine to work with Nouveau drivers. + This setting requires a restart. + + ## auto_save auto_save.interval: diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index 162b5ddb5..bd2d46a12 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -82,7 +82,7 @@ def early_init(args): def _init_envvars(): """Initialize environment variables which need to be set early.""" if (objects.backend == usertypes.Backend.QtWebEngine and - config.val.force_software_rendering): + config.val.qt.force_software_rendering): os.environ['QT_XCB_FORCE_SOFTWARE_OPENGL'] = '1' if config.val.window.hide_wayland_decoration: @@ -138,5 +138,5 @@ def qt_args(namespace): for name, value in namespace.qt_arg: argv += ['--' + name, value] - argv += ['--' + arg for arg in config.val.qt_args] + argv += ['--' + arg for arg in config.val.qt.args] return argv diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index 0aa5879c6..f6438ce25 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -167,7 +167,7 @@ def _handle_nouveau_graphics(): 'QT_XCB_FORCE_SOFTWARE_OPENGL' in os.environ): return - button = _Button("Force software rendering", 'force_software_rendering', + button = _Button("Force software rendering", 'qt.force_software_rendering', True) _show_dialog( backend=usertypes.Backend.QtWebEngine, @@ -177,7 +177,7 @@ def _handle_nouveau_graphics(): "

This allows you to use the newer QtWebEngine backend (based " "on Chromium) but could have noticable performance impact " "(depending on your hardware). " - "This sets the force_software_rendering = True option " + "This sets the qt.force_software_rendering = True option " "(if you have a config.py file, you'll need to set this " "manually).

", buttons=[button], diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index ecb824f95..1a91be2e0 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -329,7 +329,7 @@ def test_force_software_rendering(request, quteproc_new): pytest.skip("Only runs with QtWebEngine") args = (_base_args(request.config) + - ['--temp-basedir', '-s', 'force_software_rendering', 'true']) + ['--temp-basedir', '-s', 'qt.force_software_rendering', 'true']) quteproc_new.start(args) quteproc_new.open_path('chrome://gpu') message = 'Canvas: Software only, hardware acceleration unavailable' diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py index fa6d98567..1841e6260 100644 --- a/tests/unit/config/test_configcommands.py +++ b/tests/unit/config/test_configcommands.py @@ -179,7 +179,7 @@ class TestCycle: For example, we use [foo] which is represented as ["foo"]. """ - opt = 'qt_args' + opt = 'qt.args' config_stub.set_obj(opt, ['foo']) commands.config_cycle(opt, '[foo]', '[bar]') assert config_stub.get(opt) == ['bar'] diff --git a/tests/unit/config/test_configinit.py b/tests/unit/config/test_configinit.py index 9c4ffc859..702e39110 100644 --- a/tests/unit/config/test_configinit.py +++ b/tests/unit/config/test_configinit.py @@ -207,7 +207,7 @@ class TestEarlyInit: usertypes.Backend.QtWebEngine) monkeypatch.delenv(envvar, raising=False) - config_stub.val.force_software_rendering = True + config_stub.val.qt.force_software_rendering = True configinit._init_envvars() @@ -300,7 +300,7 @@ class TestQtArgs: def test_with_settings(self, config_stub, parser): parsed = parser.parse_args(['--qt-flag', 'foo']) - config_stub.val.qt_args = ['bar'] + config_stub.val.qt.args = ['bar'] assert configinit.qt_args(parsed) == [sys.argv[0], '--foo', '--bar']