summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-06-24 01:03:10 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-06-30 19:29:28 +0200
commit58ee4cc21a4344ec0017b11e533f97956076df6a (patch)
treece237dd4d2b318abfb54313a381c9c2d37450404
parentffc06e58d6d6254d1758f8328f6dc43cc38651d5 (diff)
downloadqutebrowser-58ee4cc21a4344ec0017b11e533f97956076df6a.tar.gz
qutebrowser-58ee4cc21a4344ec0017b11e533f97956076df6a.zip
qt6: Add a Qt 5 warning
Closes #7742
-rw-r--r--qutebrowser/app.py8
-rw-r--r--qutebrowser/browser/qutescheme.py7
-rw-r--r--qutebrowser/html/warning-qt5.html28
3 files changed, 43 insertions, 0 deletions
diff --git a/qutebrowser/app.py b/qutebrowser/app.py
index bb2ff56e7..fbfa3df12 100644
--- a/qutebrowser/app.py
+++ b/qutebrowser/app.py
@@ -367,6 +367,14 @@ def _open_special_pages(args):
os.environ.get("QTWEBENGINE_DISABLE_SANDBOX") == "1"
),
'qute://warning/sandboxing'),
+
+ ('qt5-warning-shown',
+ (
+ machinery.IS_QT5 and
+ machinery.INFO.reason == machinery.SelectionReason.auto and
+ objects.backend != usertypes.Backend.QtWebKit,
+ ),
+ 'qute://warning/qt5'),
]
if 'quickstart-done' not in general_sect:
diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py
index 25834670b..0073f9bd2 100644
--- a/qutebrowser/browser/qutescheme.py
+++ b/qutebrowser/browser/qutescheme.py
@@ -22,6 +22,7 @@ Module attributes:
_HANDLERS: The handlers registered via decorators.
"""
+import sys
import html
import json
import os
@@ -583,6 +584,12 @@ def qute_warning(url: QUrl) -> _HandlerRet:
elif path == '/sandboxing':
src = jinja.render('warning-sandboxing.html',
title='Qt 6 macOS sandboxing warning')
+ elif path == '/qt5':
+ is_venv = hasattr(sys, 'real_prefix') or sys.base_prefix != sys.prefix
+ src = jinja.render('warning-qt5.html',
+ title='Switch to Qt 6',
+ is_venv=is_venv,
+ prefix=sys.prefix)
else:
raise NotFoundError("Invalid warning page {}".format(path))
return 'text/html', src
diff --git a/qutebrowser/html/warning-qt5.html b/qutebrowser/html/warning-qt5.html
new file mode 100644
index 000000000..17af2f72c
--- /dev/null
+++ b/qutebrowser/html/warning-qt5.html
@@ -0,0 +1,28 @@
+{% extends "styled.html" %}
+
+{% block content %}
+<h1>{{ title }}</h1>
+<span class="note">Note this warning will only appear once. Use <span class="mono">:open
+qute://warning/qt5</span> to show it again at a later time.</span>
+
+<p>
+ qutebrowser <b>now supports Qt 6</b>.
+</p>
+<p>
+ However, in your environment, <b>Qt 6 is not installed</b>. Thus, qutebrowser is still using Qt 5 instead.
+
+ Qt 5.15 based on a very old Chromium version (83 or 87, from mid/late 2020).
+</p>
+{% if is_venv %}
+<p>
+ You are using a virtualenv. If you want to use Qt 6, you need to create a new
+ virtualenv with PyQt6 installed.
+
+ If using <span class="mono">mkvenv.py</span>, <b>rerun the script</b> to create a
+ new virtualenv with Qt 6.
+</p>
+{% endif %}
+<p>
+ <span class="note">Python installation prefix: <span class="mono">{{ prefix }}</span></span>
+</p>
+{% endblock %}