summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-05-01 07:38:12 +0200
committerMichal Klocek <michal.klocek@qt.io>2018-06-12 08:39:19 +0000
commit2715088397641a85c1fb61d64bdb4c677713337f (patch)
tree030309fb1dbf51553273f0b1948087088e6d4935 /src/webenginewidgets
parentb7f36051fb0bd16fa61e08ecd77978a45a125dea (diff)
Fine tune configure and clean up header includes
Previously configure was generating two config headers qtwebengine-config.h and qtwebengine-config_p.h, however those headers were never installed or included as dependency in Makefiles. Moreover, due to the name clash all features were included into qt_lib_webengine_*.pri which is QtWebEngine QML module. Move configure to core so all features belong now to qt_lib_webenginecore*.pri. Fix global includes to include qtwebenginecore-config*.h. Drop all DEFINES and use QT_CONFIG instead. Cleanup all evil looking includes in headers for webengine and webenginewidgets. Change-Id: Iddbc8bf4487d9a5f0c19a71a9569535083507756 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp47
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h2
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp2
-rw-r--r--src/webenginewidgets/webenginewidgets.pro11
4 files changed, 23 insertions, 39 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 8badd4f7a..66a84e677 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -47,6 +47,9 @@
#include "favicon_manager.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
+#if QT_CONFIG(webengine_printing_and_pdf)
+#include "printing/pdfium_document_wrapper_qt.h"
+#endif
#include "qwebenginefullscreenrequest.h"
#include "qwebenginehistory.h"
#include "qwebenginehistory_p.h"
@@ -78,7 +81,7 @@
#include <QMenu>
#include <QMessageBox>
#include <QMimeData>
-#ifdef ENABLE_PRINTING
+#if QT_CONFIG(webengine_printing_and_pdf)
#include <QPrinter>
#endif
#include <QStandardPaths>
@@ -86,17 +89,13 @@
#include <QTimer>
#include <QUrl>
-#if defined(ENABLE_PRINTING) && defined(ENABLE_PDF)
-#include "printing/pdfium_document_wrapper_qt.h"
-#endif
-
QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
static const int MaxTooltipLength = 1024;
-#if defined(ENABLE_PRINTING) && defined(ENABLE_PDF)
+#if QT_CONFIG(webengine_printing_and_pdf)
static bool printPdfDataOnPrinter(const QByteArray& data, QPrinter& printer)
{
if (!data.size()) {
@@ -177,7 +176,7 @@ static bool printPdfDataOnPrinter(const QByteArray& data, QPrinter& printer)
return true;
}
-#endif // defined(ENABLE_PRINTING) && defined(ENABLE_PDF)
+#endif // QT_CONFIG(webengine_printing_and_pdf)
static QWebEnginePage::WebWindowType toWindowType(WebContentsAdapterClient::WindowOpenDisposition disposition)
{
@@ -231,7 +230,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
, webChannelWorldId(QWebEngineScript::MainWorld)
, defaultAudioMuted(false)
, defaultZoomFactor(1.0)
-#if defined(ENABLE_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
, currentPrinter(nullptr)
#endif
{
@@ -498,8 +497,7 @@ void QWebEnginePagePrivate::didFindText(quint64 requestId, int matchCount)
void QWebEnginePagePrivate::didPrintPage(quint64 requestId, const QByteArray &result)
{
-#if defined(ENABLE_PDF)
-#if defined(ENABLE_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
// If no currentPrinter is set that means that were printing to PDF only.
if (!currentPrinter) {
m_callbacks.invoke(requestId, result);
@@ -510,14 +508,11 @@ void QWebEnginePagePrivate::didPrintPage(quint64 requestId, const QByteArray &re
m_callbacks.invoke(requestId, printerResult);
currentPrinter = nullptr;
-#else // If print support is disabled, only PDF printing is available.
- m_callbacks.invoke(requestId, result);
-#endif // defined(ENABLE_PRINTING)
-#else // defined(ENABLE_PDF)
+#else
// we should never enter this branch, but just for safe-keeping...
Q_UNUSED(result);
m_callbacks.invoke(requestId, QByteArray());
-#endif // defined(ENABLE_PDF)
+#endif
}
void QWebEnginePagePrivate::passOnFocus(bool reverse)
@@ -2211,20 +2206,18 @@ QSizeF QWebEnginePage::contentsSize() const
*/
void QWebEnginePage::printToPdf(const QString &filePath, const QPageLayout &pageLayout)
{
-#if defined(ENABLE_PDF)
+#if QT_CONFIG(webengine_printing_and_pdf)
Q_D(const QWebEnginePage);
-#if defined(ENABLE_PRINTING)
if (d->currentPrinter) {
qWarning("Cannot print to PDF while at the same time printing on printer %ls", qUtf16Printable(d->currentPrinter->printerName()));
return;
}
-#endif // ENABLE_PRINTING
d->ensureInitialized();
d->adapter->printToPDF(pageLayout, filePath);
#else
Q_UNUSED(filePath);
Q_UNUSED(pageLayout);
-#endif // if defined(ENABLE_PDF)
+#endif
}
@@ -2241,21 +2234,19 @@ void QWebEnginePage::printToPdf(const QString &filePath, const QPageLayout &page
void QWebEnginePage::printToPdf(const QWebEngineCallback<const QByteArray&> &resultCallback, const QPageLayout &pageLayout)
{
Q_D(QWebEnginePage);
-#if defined(ENABLE_PDF)
-#if defined(ENABLE_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
if (d->currentPrinter) {
qWarning("Cannot print to PDF while at the same time printing on printer %ls", qUtf16Printable(d->currentPrinter->printerName()));
d->m_callbacks.invokeEmpty(resultCallback);
return;
}
-#endif // ENABLE_PRINTING
d->ensureInitialized();
quint64 requestId = d->adapter->printToPDFCallbackResult(pageLayout);
d->m_callbacks.registerCallback(requestId, resultCallback);
-#else // if defined(ENABLE_PDF)
+#else
Q_UNUSED(pageLayout);
d->m_callbacks.invokeEmpty(resultCallback);
-#endif // if defined(ENABLE_PDF)
+#endif
}
/*!
@@ -2273,24 +2264,22 @@ void QWebEnginePage::printToPdf(const QWebEngineCallback<const QByteArray&> &res
void QWebEnginePage::print(QPrinter *printer, const QWebEngineCallback<bool> &resultCallback)
{
Q_D(QWebEnginePage);
-#if defined(ENABLE_PDF)
-#if defined(ENABLE_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
if (d->currentPrinter) {
qWarning("Cannot print page on printer %ls: Already printing on %ls.", qUtf16Printable(printer->printerName()), qUtf16Printable(d->currentPrinter->printerName()));
d->m_callbacks.invokeDirectly(resultCallback, false);
return;
}
d->currentPrinter = printer;
-#endif // ENABLE_PRINTING
d->ensureInitialized();
quint64 requestId = d->adapter->printToPDFCallbackResult(printer->pageLayout(),
printer->colorMode() == QPrinter::Color,
false);
d->m_callbacks.registerCallback(requestId, resultCallback);
-#else // if defined(ENABLE_PDF)
+#else
Q_UNUSED(printer);
d->m_callbacks.invokeDirectly(resultCallback, false);
-#endif // if defined(ENABLE_PDF)
+#endif
}
/*!
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index 9c87cbfe7..831879127 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -187,7 +187,7 @@ public:
mutable QtWebEngineCore::CallbackDirectory m_callbacks;
mutable QAction *actions[QWebEnginePage::WebActionCount];
-#if defined(ENABLE_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
QPrinter *currentPrinter;
#endif
};
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 81cf2e0e5..9497ba0fa 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -49,7 +49,7 @@
#include <QSGAbstractRenderer>
#include <QSGNode>
#include <QWindow>
-#include <private/qquickwindow_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
namespace QtWebEngineCore {
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index a891c062e..c96bf15bb 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -1,4 +1,5 @@
-QT_FOR_CONFIG += webengine-private
+include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
+QT_FOR_CONFIG += webenginecore-private
TARGET = QtWebEngineWidgets
@@ -6,7 +7,7 @@ TARGET = QtWebEngineWidgets
DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB
QT += webenginecore widgets network quick
-QT_PRIVATE += quick-private gui-private core-private widgets-private quickwidgets
+QT_PRIVATE += quick-private gui-private core-private widgets-private quickwidgets webenginecore-private
INCLUDEPATH += $$PWD api ../core ../core/api ../webengine/api
@@ -44,13 +45,7 @@ HEADERS = \
api/qwebengineview_p.h \
render_widget_host_view_qt_delegate_widget.h
-qtConfig(webengine-spellchecker) {
- DEFINES += ENABLE_SPELLCHECK
-}
-
qtConfig(webengine-printing-and-pdf) {
- DEFINES += ENABLE_PRINTING
- DEFINES += ENABLE_PDF
QT += printsupport
}