mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Use QTWEBENGINE_VERSION instead of QT_VERSION
Allows to build against separate QtWebEngine releases.
This commit is contained in:
parent
e01024942f
commit
148d2d94c1
@ -45,7 +45,7 @@ add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DQT_NO_CAS
|
||||
|
||||
# Mandatory: Qt5
|
||||
set(QT_MIN_VERSION "5.9.0")
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngineWidgets WebChannel)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngine WebEngineWidgets WebChannel)
|
||||
if (BUILD_TESTING)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test)
|
||||
endif()
|
||||
@ -85,8 +85,6 @@ if (WIN32)
|
||||
add_definitions(-D_WIN32_WINNT=${ver})
|
||||
endif()
|
||||
|
||||
set(HAVE_QTWEBENGINE_5_10 NOT Qt5WebEngineWidgets_VERSION VERSION_LESS 5.10.0)
|
||||
|
||||
# Mandatory: OpenSSL
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
|
@ -9,6 +9,3 @@
|
||||
|
||||
/* Disable DBus support */
|
||||
#cmakedefine DISABLE_DBUS
|
||||
|
||||
/* QtWebEngine is at least version 5.10 */
|
||||
#cmakedefine01 HAVE_QTWEBENGINE_5_10
|
||||
|
@ -293,6 +293,9 @@ qt5_add_resources(SRCS
|
||||
|
||||
add_library(FalkonPrivate SHARED ${SRCS})
|
||||
|
||||
get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt5::WebEngine PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(FalkonPrivate SYSTEM PUBLIC ${QT_WEBENGINE_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(FalkonPrivate
|
||||
Qt5::Widgets
|
||||
Qt5::WebEngineWidgets
|
||||
|
@ -921,11 +921,11 @@ void MainApplication::loadSettings()
|
||||
webSettings->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
|
||||
webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value("allowJavaScriptActivateWindow", false).toBool());
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value("allowJavaScriptPaste", true).toBool());
|
||||
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, settings.value("DisableVideoAutoPlay", false).toBool());
|
||||
webSettings->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, settings.value("WebRTCPublicIpOnly", true).toBool());
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFlags>
|
||||
#include <QtWebEngineVersion>
|
||||
|
||||
#ifdef FALKON_SHAREDLIBRARY
|
||||
#define FALKON_EXPORT Q_DECL_EXPORT
|
||||
|
@ -36,7 +36,7 @@ CookieJar::CookieJar(QObject* parent)
|
||||
loadSettings();
|
||||
m_client->loadAllCookies();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
m_client->setCookieFilter(std::bind(&CookieJar::cookieFilter, this, std::placeholders::_1));
|
||||
#endif
|
||||
|
||||
@ -46,7 +46,7 @@ CookieJar::CookieJar(QObject* parent)
|
||||
|
||||
CookieJar::~CookieJar()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
m_client->setCookieFilter(nullptr);
|
||||
#endif
|
||||
}
|
||||
@ -127,7 +127,7 @@ void CookieJar::slotCookieRemoved(const QNetworkCookie &cookie)
|
||||
emit cookieRemoved(cookie);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
bool CookieJar::cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const
|
||||
{
|
||||
if (!m_allowCookies) {
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
void slotCookieAdded(const QNetworkCookie &cookie);
|
||||
void slotCookieRemoved(const QNetworkCookie &cookie);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
bool cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const;
|
||||
#endif
|
||||
|
||||
|
@ -75,7 +75,7 @@ CookieManager::CookieManager(QWidget *parent)
|
||||
ui->blackList->addItems(settings.value("blacklist", QStringList()).toStringList());
|
||||
settings.endGroup();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
ui->filter3rdParty->hide();
|
||||
#endif
|
||||
|
||||
|
@ -29,11 +29,11 @@ JsOptions::JsOptions(QWidget* parent)
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||
ui->jscanActivateWindow->setVisible(false);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
ui->jscanPaste->setVisible(false);
|
||||
#endif
|
||||
|
||||
|
@ -110,7 +110,7 @@ Preferences::Preferences(BrowserWindow* window)
|
||||
ui->checkUpdates->setVisible(false);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
ui->disableVideoAutoPlay->setVisible(false);
|
||||
ui->webRTCPublicIpOnly->setVisible(false);
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ void WebInspector::setView(WebView *view)
|
||||
m_view = view;
|
||||
Q_ASSERT(isEnabled());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
page()->setInspectedPage(m_view->page());
|
||||
connect(m_view, &WebView::pageChanged, this, &WebInspector::deleteLater);
|
||||
#else
|
||||
@ -97,7 +97,7 @@ void WebInspector::inspectElement()
|
||||
|
||||
bool WebInspector::isEnabled()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
if (!qEnvironmentVariableIsSet("QTWEBENGINE_REMOTE_DEBUGGING")) {
|
||||
return false;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ void WebView::copyLinkToClipboard()
|
||||
|
||||
void WebView::savePageAs()
|
||||
{
|
||||
#if HAVE_QTWEBENGINE_5_10
|
||||
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) {
|
||||
const QSet<QString> webPageTypes = {
|
||||
QSL("text/html"),
|
||||
@ -1250,7 +1250,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
bool WebView::focusNextPrevChild(bool next)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
#if QTWEBENGINE_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
// QTBUG-67043
|
||||
// Workaround QtWebEngine issue where QWebEngineView loses focus on second load() call.
|
||||
if (next) {
|
||||
|
Loading…
Reference in New Issue
Block a user