Commit Graph

145 Commits

Author SHA1 Message Date
Florian Bruhin 3eb826f664 reuse: Update remaining copyright texts
git ls-files | \
    xargs sed -Ei 's/Copyright [0-9]{4}(-[0-9]{4}) ([^<]*)<([^>]*)>/SPDX-FileCopyrightText: \2<\3>/'
2023-07-23 12:52:01 +02:00
Florian Bruhin 0718b25796 reuse: Initial copyright text update for myself
git ls-files | \
    xargs sed -Ei 's/Copyright [0-9]{4}(-[0-9]{4}) Florian Bruhin \(The Compiler\) <mail@qutebrowser\.org>/SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>/'
2023-07-23 12:49:05 +02:00
Florian Bruhin 77ca342cff reuse: Remove some more old license headers
git ls-files | \
xargs grep -l "This file is part of qutebrowser" | \
xargs grep -l SPDX-License-Identifier | \
xargs sed -i '/# This file is part of qutebrowser\./,/along with qutebrowser\.  If not, see <https:\/\/www\.gnu.org\/licenses\/>./d'
2023-07-23 12:15:03 +02:00
Florian Bruhin b2aaba6043 reuse: Adjust most license headers
git ls-files | xargs grep -l "is free software"  | xargs reuse annotate --license="GPL-3.0-or-later" --skip-unrecognised
2023-07-23 12:11:07 +02:00
Philipp Albrecht d9e8b638bf Remove vim modelines
We're deprecating vim modelines in favor of `.editorconfig`.

Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:

```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```

Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:

```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
2023-06-30 11:03:06 +02:00
Florian Bruhin 4793070db3 Merge branch 'qt6-v2' into master-qt6 2023-03-17 20:30:13 +01:00
toofar ce134c9662 lint: superfluous-parens and useless-suppression
Unnecessary parens after '=' keyword
2023-02-06 19:50:22 +13:00
Florian Bruhin 769ef6859f Adjust some fixme comments 2022-08-23 18:31:42 +02:00
Florian Bruhin 541d49d08b test that enums match their Qt equivalents
Also changes reloaded -> reload for consistency
(both to Qt and between the names).
2022-08-23 18:31:42 +02:00
Florian Bruhin ec8eebf996 lint: Fix remaining pylint issues 2022-08-23 18:31:41 +02:00
Florian Bruhin e658ce6acf lint: Remove unused imports
Via autoflake and git add -p
2022-08-23 18:31:41 +02:00
Florian Bruhin ae910113a7 tests: Validate some places with declarative stringly-typed settings 2022-08-23 18:31:41 +02:00
Florian Bruhin c5a51eb0bc Drop Qt < 5.15
Fixes #7091

TODO: Add changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin 437caf4516 qt 6: Fix getting enum members in tests 2022-08-23 18:31:41 +02:00
Florian Bruhin d387b1a108 tests: Adjust most imports 2022-08-23 18:31:40 +02:00
Florian Bruhin 9cd011e2b3 qt6: Use Qt 5.14 API for download filename
Based on 8a068d91e5 and
a0cf3ffcf3.
2022-08-23 18:31:40 +02:00
Florian Bruhin 0877fb0d78 Run scripts/dev/rewrite_enums.py 2022-08-23 18:31:38 +02:00
Florian Bruhin d47cfd99d7 Run scripts/dev/rewrite_qt_imports.sh 2022-08-23 18:09:11 +02:00
Florian Bruhin dd68a84bc9 Correctly set initial content.{javascript.clipboard,default_encoding}
Those are handled separately from the other settings, but were never initialized
properly in init_settings().

For content.javascript.clipboard, this is a recent regression introduced in
4a6df3a8e8. For content.default_encoding, this has
been around since 2018: 3956f81e73.

Fixes #7281
2022-06-22 11:52:41 +02:00
Florian Bruhin cd1be710de Fix lint with FindFlags change 2022-06-13 19:37:05 +02:00
Florian Bruhin bf045f7ec7 Add a helper dataclass for find flags
When e.g. doing:
- '?foo' (search with reverse=True -> FindBackwards)
- 'N' (prev_result -> no FindBackwards)
- 'n' (next_result -> FindBackwards again)

we need to take a copy of the flags so that we can temporarily clear
FindBackwards when pressing 'N'.

Relevant history:

- We originally did int(self._flags) in
  d450257485.
- In f0da508c21, we used
  QWebPage.FindFlags(int(self._flags)) instead.
- With 97bdcb8e674c8ff27ab92448effef263880ab3aa (picked from
  c349fbd180) we instead do:
  flags = QWebEnginePage.FindFlag(self._flags)

Using FindFlag instead of FindFlags seemed to work fine with PyQt6 and
enum.Flag. With PyQt5, however, later clearing a flag bit ends up with us
getting 0 as an integer, thus losing the type information about this being a
FindFlag instance, and resulting in a TypeError when calling into Qt.

We could use FindFlags() with PyQt 6 but FindFlag() with PyQt 5 to copy the
original flags, but that's getting rather cumbersome. Instead, let's have a
helper dataclass of bools, do away with the bit-twiddling, and only convert it
to a Qt flags when we actually need them. This solves the copying issue nicely,
and also makes the code a lot nicer.

Finally, this also adds a test case which fails when the flags are mutated in
place instead of copied.

We could do the same kind of change for QtWebKit as well, but given that it's
somewhat dead - and perhaps more importantly, won't run with Qt 6 - let's not
bother. To not break the end2end tests with QtWebKit, the output still is the
same as before.

(cherry picked from commit 96a0cc39512753445bc7a01b218b2f1290819ddd)
2022-06-13 18:40:08 +02:00
Florian Bruhin b0d3c8eee3 Greasemonkey: Make sure script names are unique
Fixes #6353
2021-06-11 19:14:14 +02:00
Florian Bruhin d2e69454ce notifications: Rename/consolidate settings 2021-03-27 15:30:02 +01:00
Florian Bruhin fb4a56318c Simplify TestWebengineScripts 2021-03-09 18:23:10 +01:00
Florian Bruhin 7eae8f0694 Fix @run-at default for GreaseMonkey 2021-03-09 18:10:51 +01:00
Lembrun e8b05af233 Qtbot methods changed to snake case,snake case check added 2021-02-26 22:07:08 +01:00
Lembrun 0a453396c1 Rename utils.py to testutils.py 2021-02-25 21:28:56 +01:00
Florian Bruhin c6ac39053f Update data: download URL workaround for QtWebEngine 5.15.3
See https://github.com/qutebrowser/qutebrowser/issues/6147#issuecomment-776558369
2021-02-13 11:09:50 +01:00
Florian Bruhin 94967ee979 Improve QtWebEngine version checking in qtargs.py
We now use versions.webengine_versions() to get the real QtWebEngine
version. This is more accurate and also allows us to drop the
InstalledApp workaround with QtWebEngine 5.15.3.

Also, we pass a WebEngineVersions object around instead of asking for
the versions multiple times. This also leads to less patching in tests.

See #3785
2021-02-11 16:06:15 +01:00
Florian Bruhin 9eabd09645 darkmode: Improve/fix various tests 2021-02-11 15:25:16 +01:00
Florian Bruhin f50a43d716 Change colors.webpage.prefers_color_scheme_dark to colors.webpage.preferred_color_scheme
See #6097
2021-02-11 14:18:30 +01:00
Florian Bruhin 4e3a6a1c60 darkmode: Pass through existing blink settings 2021-02-11 14:18:30 +01:00
Florian Bruhin 3ff51a62d5 darkmode: Fix/update unit tests 2021-02-11 14:18:30 +01:00
Florian Bruhin 8d94a33b0a Improve tests in various corner cases 2021-02-10 16:13:22 +01:00
Florian Bruhin f8692cb141 Add more tests 2021-02-10 16:13:22 +01:00
Florian Bruhin d52fa7442f Fix tests 2021-02-10 16:13:22 +01:00
Florian Bruhin 1a45325572 Make WebEngineVersions.webengine non-Optional
Instead, we try to infer based on Qt, or return None if QtWebEngine is unavailable.
2021-02-10 16:13:22 +01:00
Florian Bruhin e0a0e1797d Fix darkmode tests 2021-02-10 16:13:22 +01:00
Florian Bruhin 1a4fff1a42 doc: Switch URLs to https 2021-01-26 15:19:01 +01:00
Florian Bruhin 222f1f19a1 Bump copyright years
Closes #6015
2021-01-20 20:06:19 +01:00
Florian Bruhin b29a8c50de downloads: Handle data: URLs with explicit filename
This is a follow-up to 9ae08c0f15.

See #1099
Fixes #6041
2021-01-16 11:34:12 +01:00
Florian Bruhin fbe29a2a25 tests: Improve tests for data: URL workaround 2021-01-16 11:25:52 +01:00
Florian Bruhin 9ae08c0f15 Improve download filenames for data: URLs
With QtWebEngine, downloading a data: URL seems to give us the raw data:
URL as filename, similar to #1214 / #1321 but for QtWebEngine.

With QtWebKit, the logic is now also improved so that we get a proper
extension rather than a "binary blob" filename.

See #1099
2021-01-05 11:19:01 +01:00
Florian Bruhin f5353970d3 webenginesettings: Move _init_settings() 2020-12-04 18:41:01 +01:00
Florian Bruhin 77186e49d6 webenginesettings: Don't special-case set_dictionary_language 2020-12-04 18:41:00 +01:00
Florian Bruhin 5a1e4f1972 Fix lint 2020-12-04 18:05:17 +01:00
Florian Bruhin 1933081ad4 tests: Avoid calling webenginesettings.init()
Since #5813, we now do more work there - and there already is quite a
bit of odd patching, so this isn't really the right way forward.

For now, replicate the initialization steps we *actually* need inside
the tests. I'm not entirely happy with this solution, but it's likely we
can revisit this to find something nicer when refactoring profile
initialization in general, see #5935.

This unfortunately also means there's no good way we can do what
`test_default_user_agent_saved` did, so I ended up removing it.
2020-12-04 17:06:50 +01:00
Ted Morse 1f67527662 Only apply blink-settings on Qt 15.5.2
Turns out Qt 5.15.{0,1} also needs `--force-dark-mode`. This commit
fixes it to only use the blink-setting on Qt 5.15.2 and up. It also
parameterizes the tests better to test that the settings work on their
respective Qt versions.
2020-11-29 10:58:27 -08:00
Ted Morse 314c81b24e Use blink-setting for colorscheme on Qt 5.15+
On Qt 5.15+, `--force-dark-mode` does not set the preferred colorscheme.
A blink-setting is used instead to set the preferred colorscheme.

The `--force-dark-mode` flag is only set for Qt 5.14. All later versions
will use the blink-setting flag.
2020-11-28 22:58:32 -08:00
Florian Bruhin 3afdd9b946 Add override for darkmode variant 2020-11-23 14:42:25 +01:00