diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-01-16 18:20:32 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-15 17:03:28 +0200 |
commit | beb4ff332ca5b8406a75e8b2146464c5b0a81abd (patch) | |
tree | cb949f8710876153acaa146eda29abf89447a9f4 /examples | |
parent | 84ced937a0f9f2874e32e16c4c6ebf72b46904c9 (diff) |
Cleanup the QtWebEngineWidgets public headers and API
Headers were left intact to leave a trace of the evolution compared
to the QtWebKit API and to make it easier to work until we had a
basic subset of the API implemented.
With the upcoming release, this patch removes this convenience in the
aim of starting polishing the headers and the documentation for the
upcoming release.
Change-Id: Iae436b4ec041d771a7002575e122835802bc9f3e
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'examples')
13 files changed, 58 insertions, 9 deletions
diff --git a/examples/webenginewidgets/browser/bookmarks.cpp b/examples/webenginewidgets/browser/bookmarks.cpp index adc35bd50..616065816 100644 --- a/examples/webenginewidgets/browser/bookmarks.cpp +++ b/examples/webenginewidgets/browser/bookmarks.cpp @@ -58,8 +58,6 @@ #include <QtWidgets/QMessageBox> #include <QtWidgets/QToolButton> -#include <QWebEngineSettings> - #include <QtCore/QDebug> #define BOOKMARKBAR "Bookmarks Bar" diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp index da96b65b9..d1563ef05 100644 --- a/examples/webenginewidgets/browser/browserapplication.cpp +++ b/examples/webenginewidgets/browser/browserapplication.cpp @@ -66,7 +66,9 @@ #include <QtNetwork/QNetworkProxy> #include <QtNetwork/QSslSocket> +#if defined(QWEBENGINESETTINGS) #include <QWebEngineSettings> +#endif #include <QtCore/QDebug> diff --git a/examples/webenginewidgets/browser/browsermainwindow.cpp b/examples/webenginewidgets/browser/browsermainwindow.cpp index 3f54d8bb5..91096e8b9 100644 --- a/examples/webenginewidgets/browser/browsermainwindow.cpp +++ b/examples/webenginewidgets/browser/browsermainwindow.cpp @@ -138,8 +138,10 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) m_autoSaver, SLOT(changeOccurred())); connect(m_tabWidget, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(geometryChangeRequested(QRect))); +#if defined(QWEBENGINEPAGE_PRINTREQUESTED) connect(m_tabWidget, SIGNAL(printRequested(QWebEngineFrame*)), this, SLOT(printRequested(QWebEngineFrame*))); +#endif connect(m_tabWidget, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); connect(m_tabWidget, SIGNAL(statusBarVisibilityChangeRequested(bool)), @@ -682,9 +684,9 @@ void BrowserMainWindow::slotFilePrint() #endif } +#if defined(QWEBENGINEPAGE_PRINT) void BrowserMainWindow::printRequested(QWebEngineFrame *frame) { -#if defined(QWEBENGINEPAGE_PRINT) #ifndef QT_NO_PRINTDIALOG QPrinter printer; QPrintDialog *dialog = new QPrintDialog(&printer, this); @@ -693,8 +695,8 @@ void BrowserMainWindow::printRequested(QWebEngineFrame *frame) return; frame->print(&printer); #endif -#endif } +#endif void BrowserMainWindow::slotPrivateBrowsing() { diff --git a/examples/webenginewidgets/browser/browsermainwindow.h b/examples/webenginewidgets/browser/browsermainwindow.h index 3c3df9117..4dd1945d0 100644 --- a/examples/webenginewidgets/browser/browsermainwindow.h +++ b/examples/webenginewidgets/browser/browsermainwindow.h @@ -127,7 +127,9 @@ private slots: void slotShowWindow(); void slotSwapFocus(); +#if defined(QWEBENGINEPAGE_PRINT) void printRequested(QWebEngineFrame *frame); +#endif void geometryChangeRequested(const QRect &geometry); void updateToolbarActionText(bool visible); void updateBookmarksToolbarActionText(bool visible); diff --git a/examples/webenginewidgets/browser/downloadmanager.cpp b/examples/webenginewidgets/browser/downloadmanager.cpp index 6f4c6c8ad..b5fdcb185 100644 --- a/examples/webenginewidgets/browser/downloadmanager.cpp +++ b/examples/webenginewidgets/browser/downloadmanager.cpp @@ -57,7 +57,9 @@ #include <QtCore/QDebug> +#if defined(QWEBENGINESETTINGS) #include <QWebEngineSettings> +#endif /*! DownloadItem is a widget that is displayed in the download manager list. diff --git a/examples/webenginewidgets/browser/history.cpp b/examples/webenginewidgets/browser/history.cpp index 9d599f876..caf6a4aac 100644 --- a/examples/webenginewidgets/browser/history.cpp +++ b/examples/webenginewidgets/browser/history.cpp @@ -59,8 +59,12 @@ #include <QtWidgets/QHeaderView> #include <QtWidgets/QStyle> +#if defined(QWEBENGINEHISTORYINTERFACE) #include <QWebEngineHistoryInterface> +#endif +#if defined(QWEBENGINESETTINGS) #include <QWebEngineSettings> +#endif #include <QtCore/QDebug> diff --git a/examples/webenginewidgets/browser/history.h b/examples/webenginewidgets/browser/history.h index 4006f3415..fecc168da 100644 --- a/examples/webenginewidgets/browser/history.h +++ b/examples/webenginewidgets/browser/history.h @@ -52,7 +52,9 @@ #include <QtCore/QSortFilterProxyModel> +#if defined(QWEBENGINEHISTORYINTERFACE) #include <QWebEngineHistoryInterface> +#endif class HistoryItem { diff --git a/examples/webenginewidgets/browser/tabwidget.cpp b/examples/webenginewidgets/browser/tabwidget.cpp index 3c71b2d53..af18b5a37 100644 --- a/examples/webenginewidgets/browser/tabwidget.cpp +++ b/examples/webenginewidgets/browser/tabwidget.cpp @@ -306,18 +306,26 @@ void TabWidget::currentChanged(int index) WebView *oldWebView = this->webView(m_lineEdits->currentIndex()); if (oldWebView) { +#if defined(QWEBENGINEVIEW_STATUSBARMESSAGE) disconnect(oldWebView, SIGNAL(statusBarMessage(QString)), this, SIGNAL(showStatusBarMessage(QString))); +#endif +#if defined(QWEBENGINEVIEW_LINKHOVERED) disconnect(oldWebView->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SIGNAL(linkHovered(QString))); +#endif disconnect(oldWebView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); } +#if defined(QWEBENGINEVIEW_STATUSBARMESSAGE) connect(webView, SIGNAL(statusBarMessage(QString)), this, SIGNAL(showStatusBarMessage(QString))); +#endif +#if defined(QWEBENGINEVIEW_LINKHOVERED) connect(webView->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SIGNAL(linkHovered(QString))); +#endif connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); @@ -450,8 +458,10 @@ WebView *TabWidget::newTab(bool makeCurrent) this, SLOT(webViewLoadStarted())); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged())); +#if defined(QWEBENGINEVIEW_ICONCHANGED) connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); +#endif connect(webView, SIGNAL(titleChanged(QString)), this, SLOT(webViewTitleChanged(QString))); connect(webView, SIGNAL(urlChanged(QUrl)), @@ -460,14 +470,22 @@ WebView *TabWidget::newTab(bool makeCurrent) this, SLOT(windowCloseRequested())); connect(webView->page(), SIGNAL(geometryChangeRequested(QRect)), this, SIGNAL(geometryChangeRequested(QRect))); +#if defined(QWEBENGINEPAGE_PRINTREQUESTED) connect(webView->page(), SIGNAL(printRequested(QWebEngineFrame*)), this, SIGNAL(printRequested(QWebEngineFrame*))); +#endif +#if defined(QWEBENGINEPAGE_MENUBARVISIBILITYCHANGEREQUESTED) connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SIGNAL(menuBarVisibilityChangeRequested(bool))); +#endif +#if defined(QWEBENGINEPAGE_STATUSBARVISIBILITYCHANGEREQUESTED) connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SIGNAL(statusBarVisibilityChangeRequested(bool))); +#endif +#if defined(QWEBENGINEPAGE_TOOLBARVISIBILITYCHANGEREQUESTED) connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool))); +#endif addTab(webView, tr("(Untitled)")); if (makeCurrent) setCurrentWidget(webView); diff --git a/examples/webenginewidgets/browser/tabwidget.h b/examples/webenginewidgets/browser/tabwidget.h index e5e1cb606..497a2c572 100644 --- a/examples/webenginewidgets/browser/tabwidget.h +++ b/examples/webenginewidgets/browser/tabwidget.h @@ -152,7 +152,9 @@ signals: void menuBarVisibilityChangeRequested(bool visible); void statusBarVisibilityChangeRequested(bool visible); void toolBarVisibilityChangeRequested(bool visible); +#if defined(QWEBENGINEPAGE_PRINTREQUESTED) void printRequested(QWebEngineFrame *frame); +#endif public: TabWidget(QWidget *parent = 0); diff --git a/examples/webenginewidgets/browser/toolbarsearch.cpp b/examples/webenginewidgets/browser/toolbarsearch.cpp index d6d1ec1da..0a94b6dba 100644 --- a/examples/webenginewidgets/browser/toolbarsearch.cpp +++ b/examples/webenginewidgets/browser/toolbarsearch.cpp @@ -50,7 +50,9 @@ #include <QtWidgets/QMenu> #include <QtCore/QStringListModel> +#if defined(QWEBENGINESETTINGS) #include <QWebEngineSettings> +#endif /* ToolbarSearch is a very basic search widget that also contains a small history. diff --git a/examples/webenginewidgets/browser/urllineedit.cpp b/examples/webenginewidgets/browser/urllineedit.cpp index 47828d95f..306e56e9a 100644 --- a/examples/webenginewidgets/browser/urllineedit.cpp +++ b/examples/webenginewidgets/browser/urllineedit.cpp @@ -276,8 +276,10 @@ void UrlLineEdit::setWebView(WebView *webView) this, SLOT(webViewUrlChanged(QUrl))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged())); +#if defined(QWEBENGINEVIEW_ICONCHANGED) connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); +#endif connect(webView, SIGNAL(loadProgress(int)), this, SLOT(update())); } diff --git a/examples/webenginewidgets/browser/webview.cpp b/examples/webenginewidgets/browser/webview.cpp index 6fdf316bd..bc2a4d906 100644 --- a/examples/webenginewidgets/browser/webview.cpp +++ b/examples/webenginewidgets/browser/webview.cpp @@ -55,7 +55,9 @@ #include <QtWidgets/QMessageBox> #include <QtGui/QMouseEvent> +#if defined(QWEBENGINEPAGE_HITTESTCONTENT) #include <QWebEngineHitTestResult> +#endif #ifndef QT_NO_UITOOLS #include <QtUiTools/QUiLoader> @@ -73,8 +75,10 @@ WebPage::WebPage(QObject *parent) #if defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) setNetworkAccessManager(BrowserApplication::networkAccessManager()); #endif +#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*))); +#endif connect(this, SIGNAL(authenticationRequired(const QUrl &, QAuthenticator*)), SLOT(authenticationRequired(const QUrl &, QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(const QUrl &, QAuthenticator *, const QString &)), @@ -92,9 +96,9 @@ BrowserMainWindow *WebPage::mainWindow() return BrowserApplication::instance()->mainWindow(); } +#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) bool WebPage::acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequest &request, NavigationType type) { -#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) // ctrl open in new tab // ctrl-shift open in new tab and select // ctrl-alt open in new window @@ -121,9 +125,8 @@ bool WebPage::acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequ } m_loadingUrl = request.url(); emit loadingUrl(m_loadingUrl); -#endif - return QWebEnginePage::acceptNavigationRequest(frame, request, type); } +#endif class PopupWindow : public QWidget { Q_OBJECT @@ -201,9 +204,9 @@ QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QS } #endif // !defined(QT_NO_UITOOLS) +#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) void WebPage::handleUnsupportedContent(QNetworkReply *reply) { -#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) QString errorString = reply->errorString(); if (m_loadingUrl != reply->url()) { @@ -252,8 +255,8 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) if (m_loadingUrl == reply->url()) { mainFrame()->setHtml(html, reply->url()); } -#endif } +#endif void WebPage::authenticationRequired(const QUrl &requestUrl, QAuthenticator *auth) { @@ -309,16 +312,20 @@ WebView::WebView(QWidget* parent) , m_page(new WebPage(this)) { setPage(m_page); +#if defined(QWEBENGINEPAGE_STATUSBARMESSAGE) connect(page(), SIGNAL(statusBarMessage(QString)), SLOT(setStatusBarText(QString))); +#endif connect(this, SIGNAL(loadProgress(int)), this, SLOT(setProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(page(), SIGNAL(loadingUrl(QUrl)), this, SIGNAL(urlChanged(QUrl))); +#if defined(QWEBENGINEPAGE_DOWNLOADREQUESTED) connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); +#endif #if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) page()->setForwardUnsupportedContent(true); #endif @@ -363,8 +370,10 @@ void WebView::wheelEvent(QWheelEvent *event) void WebView::openLinkInNewTab() { +#if defined(QWEBENGINEPAGE_WEBACTION_OPENLINKINNEWWINDOW) m_page->m_openInNewTab = true; pageAction(QWebEnginePage::OpenLinkInNewWindow)->trigger(); +#endif } void WebView::setProgress(int progress) diff --git a/examples/webenginewidgets/browser/webview.h b/examples/webenginewidgets/browser/webview.h index 2d3ec50cc..1fb64c8b2 100644 --- a/examples/webenginewidgets/browser/webview.h +++ b/examples/webenginewidgets/browser/webview.h @@ -64,14 +64,18 @@ public: BrowserMainWindow *mainWindow(); protected: +#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) bool acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequest &request, NavigationType type); +#endif QWebEnginePage *createWindow(QWebEnginePage::WebWindowType type); #if !defined(QT_NO_UITOOLS) QObject *createPlugin(const QString &classId, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); #endif private slots: +#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) void handleUnsupportedContent(QNetworkReply *reply); +#endif void authenticationRequired(const QUrl &requestUrl, QAuthenticator *auth); void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth, const QString &proxyHost); |