1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Use QTWEBENGINE_VERSION instead of QT_VERSION

Allows to build against separate QtWebEngine releases.
This commit is contained in:
David Rosca 2018-05-14 13:53:05 +02:00
parent e01024942f
commit 148d2d94c1
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
12 changed files with 19 additions and 20 deletions

View File

@ -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)

View File

@ -9,6 +9,3 @@
/* Disable DBus support */
#cmakedefine DISABLE_DBUS
/* QtWebEngine is at least version 5.10 */
#cmakedefine01 HAVE_QTWEBENGINE_5_10

View File

@ -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

View File

@ -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());

View File

@ -20,6 +20,7 @@
#include <QDebug>
#include <QFlags>
#include <QtWebEngineVersion>
#ifdef FALKON_SHAREDLIBRARY
#define FALKON_EXPORT Q_DECL_EXPORT

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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) {