summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/webview/minibrowser/minibrowser.pro2
-rw-r--r--src/webview/qtwebviewfunctions.cpp2
-rw-r--r--src/webview/qwebview_darwin.mm45
-rw-r--r--src/webview/qwebview_ios.mm267
-rw-r--r--src/webview/qwebview_ios_p.h104
-rw-r--r--src/webview/qwebview_osx.mm248
-rw-r--r--src/webview/qwebview_osx_p.h98
-rw-r--r--src/webview/webview-lib.pri13
-rw-r--r--tests/auto/qml/tests.pri2
-rw-r--r--tests/auto/webview/qwebview/qwebview.pro2
10 files changed, 11 insertions, 772 deletions
diff --git a/examples/webview/minibrowser/minibrowser.pro b/examples/webview/minibrowser/minibrowser.pro
index 04fe228..266c996 100644
--- a/examples/webview/minibrowser/minibrowser.pro
+++ b/examples/webview/minibrowser/minibrowser.pro
@@ -9,7 +9,7 @@ RESOURCES += qml.qrc
EXAMPLE_FILES += doc
-osx:QMAKE_INFO_PLIST = macos/Info.plist
+macos:QMAKE_INFO_PLIST = macos/Info.plist
ios:QMAKE_INFO_PLIST = ios/Info.plist
target.path = $$[QT_INSTALL_EXAMPLES]/webview/minibrowser
diff --git a/src/webview/qtwebviewfunctions.cpp b/src/webview/qtwebviewfunctions.cpp
index 710df0c..7509f21 100644
--- a/src/webview/qtwebviewfunctions.cpp
+++ b/src/webview/qtwebviewfunctions.cpp
@@ -41,7 +41,7 @@
#include <QtWebEngine/qtwebengineglobal.h>
#endif // QT_WEBVIEW_WEBENGINE_BACKEND
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
#include <QtCore/qbytearray.h>
#endif
diff --git a/src/webview/qwebview_darwin.mm b/src/webview/qwebview_darwin.mm
index 6d337c2..45add1d 100644
--- a/src/webview/qwebview_darwin.mm
+++ b/src/webview/qwebview_darwin.mm
@@ -48,19 +48,11 @@
#include <WebKit/WebKit.h>
#ifdef Q_OS_IOS
-#include "qwebview_ios_p.h"
-
-#include <UIKit/UIKit.h>
-
-#import <UIKit/UIView.h>
-#import <UIKit/UIWindow.h>
-#import <UIKit/UIViewController.h>
-#import <UIKit/UITapGestureRecognizer.h>
+#import <UIKit/UIKit.h>
#import <UIKit/UIGestureRecognizerSubclass.h>
#endif
-#ifdef Q_OS_OSX
-#include "qwebview_osx_p.h"
+#ifdef Q_OS_MACOS
#include "qwebview_webengine_p.h"
#include <AppKit/AppKit.h>
@@ -70,35 +62,13 @@ typedef NSView UIView;
QT_BEGIN_NAMESPACE
-inline QSysInfo::MacVersion qt_OS_limit(QSysInfo::MacVersion osxVersion,
- QSysInfo::MacVersion iosVersion)
-{
-#ifdef Q_OS_OSX
- Q_UNUSED(iosVersion)
- return osxVersion;
-#else
- Q_UNUSED(osxVersion)
- return iosVersion;
-#endif
-}
-
QWebViewPrivate *QWebViewPrivate::create(QWebView *q)
{
-#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_10, QSysInfo::MV_IOS_8_0)
- && QtWebViewPrivate::useNativeWebView())
- return new QDarwinWebViewPrivate(q);
-#endif
-
-#if defined(Q_OS_IOS)
- return new QIosWebViewPrivate(q);
-#else
-# if defined(Q_OS_MACOS)
- if (QtWebViewPrivate::useNativeWebView())
- return new QOsxWebViewPrivate(q);
-# endif
- return new QWebEngineWebViewPrivate(q);
+#ifdef Q_OS_MACOS
+ if (!QtWebViewPrivate::useNativeWebView())
+ return new QWebEngineWebViewPrivate(q);
#endif
+ return new QDarwinWebViewPrivate(q);
}
static inline CGRect toCGRect(const QRectF &rect)
@@ -153,8 +123,6 @@ QT_END_NAMESPACE
// -------------------------------------------------------------------------
-#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0)
-
@interface QtWKWebViewDelegate : NSObject<WKNavigationDelegate> {
QDarwinWebViewPrivate *qDarwinWebViewPrivate;
}
@@ -433,6 +401,5 @@ void QDarwinWebViewPrivate::runJavaScriptPrivate(const QString &script, int call
Q_EMIT javaScriptResult(callbackId, fromJSValue(result));
}];
}
-#endif
QT_END_NAMESPACE
diff --git a/src/webview/qwebview_ios.mm b/src/webview/qwebview_ios.mm
deleted file mode 100644
index fe0f17f..0000000
--- a/src/webview/qwebview_ios.mm
+++ /dev/null
@@ -1,267 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebView module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwebview_ios_p.h"
-#include "qwebview_darwin_p.h"
-#include "qwebview_p.h"
-#include "qwebviewloadrequest_p.h"
-
-#include <QtCore/qmap.h>
-#include <QtCore/qvariant.h>
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <UIKit/UIKit.h>
-
-#import <UIKit/UIView.h>
-#import <UIKit/UIWindow.h>
-#import <UIKit/UIViewController.h>
-#import <UIKit/UITapGestureRecognizer.h>
-#import <UIKit/UIGestureRecognizerSubclass.h>
-
-QT_BEGIN_NAMESPACE
-
-static inline CGRect toCGRect(const QRectF &rect)
-{
- return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-// -------------------------------------------------------------------------
-
-class QWebViewInterface;
-
-@interface QtWebViewDelegate : NSObject<UIWebViewDelegate> {
- QIosWebViewPrivate *qIosWebViewPrivate;
-}
-- (QtWebViewDelegate *)initWithQAbstractWebView:(QIosWebViewPrivate *)webViewPrivate;
-- (void)pageDone;
-
-// protocol:
-- (void)webViewDidStartLoad:(UIWebView *)webView;
-- (void)webViewDidFinishLoad:(UIWebView *)webView;
-- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;
-@end
-
-@implementation QtWebViewDelegate
-- (QtWebViewDelegate *)initWithQAbstractWebView:(QIosWebViewPrivate *)webViewPrivate
-{
- qIosWebViewPrivate = webViewPrivate;
- return self;
-}
-
-- (void)pageDone
-{
- Q_EMIT qIosWebViewPrivate->loadProgressChanged(qIosWebViewPrivate->loadProgress());
- Q_EMIT qIosWebViewPrivate->titleChanged(qIosWebViewPrivate->title());
-}
-
-- (void)webViewDidStartLoad:(UIWebView *)webView
-{
- Q_UNUSED(webView);
- // UIWebViewDelegate gives us per-frame notifications while the QWebView API
- // should provide per-page notifications. Keep track of started frame loads
- // and emit notifications when the final frame completes.
- if (++qIosWebViewPrivate->requestFrameCount == 1) {
- Q_EMIT qIosWebViewPrivate->loadingChanged(QWebViewLoadRequestPrivate(qIosWebViewPrivate->url(),
- QWebView::LoadStartedStatus,
- QString()));
- }
-
- Q_EMIT qIosWebViewPrivate->loadProgressChanged(qIosWebViewPrivate->loadProgress());
-}
-
-- (void)webViewDidFinishLoad:(UIWebView *)webView
-{
- Q_UNUSED(webView);
- if (--qIosWebViewPrivate->requestFrameCount == 0) {
- [self pageDone];
- Q_EMIT qIosWebViewPrivate->loadingChanged(QWebViewLoadRequestPrivate(qIosWebViewPrivate->url(),
- QWebView::LoadSucceededStatus,
- QString()));
- }
-}
-
-- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
-{
- Q_UNUSED(webView);
- if (--qIosWebViewPrivate->requestFrameCount == 0) {
- [self pageDone];
- NSString *errorString = [error localizedFailureReason];
- Q_EMIT qIosWebViewPrivate->loadingChanged(QWebViewLoadRequestPrivate(qIosWebViewPrivate->url(),
- QWebView::LoadFailedStatus,
- QString::fromNSString(errorString)));
- }
-}
-@end
-
-QIosWebViewPrivate::QIosWebViewPrivate(QObject *p)
- : QWebViewPrivate(p)
- , uiWebView(0)
- , m_recognizer(0)
-{
- CGRect frame = CGRectMake(0.0, 0.0, 400, 400);
- uiWebView = [[UIWebView alloc] initWithFrame:frame];
- uiWebView.delegate = [[QtWebViewDelegate alloc] initWithQAbstractWebView:this];
-
- m_recognizer = [[QIOSNativeViewSelectedRecognizer alloc] initWithQWindowControllerItem:this];
- [uiWebView addGestureRecognizer:m_recognizer];
- uiWebView.scalesPageToFit = YES;
-}
-
-QIosWebViewPrivate::~QIosWebViewPrivate()
-{
- [uiWebView.delegate release];
- uiWebView.delegate = nil; // reset as per UIWebViewDelegate documentation
- [uiWebView release];
- [m_recognizer release];
-}
-
-QUrl QIosWebViewPrivate::url() const
-{
- NSURL *url = [[uiWebView request] URL];
- return QUrl::fromNSURL(url).toString();
-}
-
-void QIosWebViewPrivate::setUrl(const QUrl &url)
-{
- requestFrameCount = 0;
- [uiWebView loadRequest:[NSURLRequest requestWithURL:url.toNSURL()]];
-}
-
-void QIosWebViewPrivate::loadHtml(const QString &html, const QUrl &baseUrl)
-{
- [uiWebView loadHTMLString:html.toNSString() baseURL:baseUrl.toNSURL()];
-}
-
-bool QIosWebViewPrivate::canGoBack() const
-{
- return uiWebView.canGoBack;
-}
-
-bool QIosWebViewPrivate::canGoForward() const
-{
- return uiWebView.canGoForward;
-}
-
-QString QIosWebViewPrivate::title() const
-{
- NSString *title = [uiWebView stringByEvaluatingJavaScriptFromString:@"document.title"];
- return QString::fromNSString(title);
-}
-
-int QIosWebViewPrivate::loadProgress() const
-{
- // TODO:
- return isLoading() ? 100 : 0;
-}
-
-bool QIosWebViewPrivate::isLoading() const
-{
- return uiWebView.loading;
-}
-
-void QIosWebViewPrivate::setParentView(QObject *view)
-{
- m_parentView = view;
-
- if (!uiWebView)
- return;
-
- QWindow *w = qobject_cast<QWindow *>(view);
- if (w) {
- UIView *parentView = reinterpret_cast<UIView *>(w->winId());
- [parentView addSubview:uiWebView];
- } else {
- [uiWebView removeFromSuperview];
- }
-}
-
-QObject *QIosWebViewPrivate::parentView() const
-{
- return m_parentView;
-}
-
-void QIosWebViewPrivate::setGeometry(const QRect &geometry)
-{
- if (!uiWebView)
- return;
-
- [uiWebView setFrame:toCGRect(geometry)];
-}
-
-void QIosWebViewPrivate::setVisibility(QWindow::Visibility visibility)
-{
- Q_UNUSED(visibility);
-}
-
-void QIosWebViewPrivate::setVisible(bool visible)
-{
- [uiWebView setHidden:!visible];
-}
-
-void QIosWebViewPrivate::setFocus(bool focus)
-{
- Q_EMIT requestFocus(focus);
-}
-
-void QIosWebViewPrivate::goBack()
-{
- [uiWebView goBack];
-}
-
-void QIosWebViewPrivate::goForward()
-{
- [uiWebView goForward];
-}
-
-void QIosWebViewPrivate::stop()
-{
- [uiWebView stopLoading];
-}
-
-void QIosWebViewPrivate::reload()
-{
- [uiWebView reload];
-}
-
-void QIosWebViewPrivate::runJavaScriptPrivate(const QString &script, int callbackId)
-{
- // ### TODO needs more async
- NSString *result = [uiWebView stringByEvaluatingJavaScriptFromString:script.toNSString()];
- if (callbackId != -1)
- Q_EMIT javaScriptResult(callbackId, QString::fromNSString(result));
-}
-
-QT_END_NAMESPACE
diff --git a/src/webview/qwebview_ios_p.h b/src/webview/qwebview_ios_p.h
deleted file mode 100644
index 840e358..0000000
--- a/src/webview/qwebview_ios_p.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebView module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWEBVIEW_IOS_P_H
-#define QWEBVIEW_IOS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtGui/qwindow.h>
-
-#include "qwebview_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-Q_FORWARD_DECLARE_OBJC_CLASS(UIWebView);
-Q_FORWARD_DECLARE_OBJC_CLASS(UIGestureRecognizer);
-
-class QIosWebViewPrivate : public QWebViewPrivate
-{
- Q_OBJECT
-public:
- explicit QIosWebViewPrivate(QObject *p = 0);
- ~QIosWebViewPrivate() Q_DECL_OVERRIDE;
-
- QUrl url() const Q_DECL_OVERRIDE;
- void setUrl(const QUrl &url) Q_DECL_OVERRIDE;
- bool canGoBack() const Q_DECL_OVERRIDE;
- bool canGoForward() const Q_DECL_OVERRIDE;
- QString title() const Q_DECL_OVERRIDE;
- int loadProgress() const Q_DECL_OVERRIDE;
- bool isLoading() const Q_DECL_OVERRIDE;
-
- void setParentView(QObject *view) Q_DECL_OVERRIDE;
- QObject *parentView() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect &geometry) Q_DECL_OVERRIDE;
- void setVisibility(QWindow::Visibility visibility) Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void setFocus(bool focus) Q_DECL_OVERRIDE;
-
-public Q_SLOTS:
- void goBack() Q_DECL_OVERRIDE;
- void goForward() Q_DECL_OVERRIDE;
- void reload() Q_DECL_OVERRIDE;
- void stop() Q_DECL_OVERRIDE;
- void loadHtml(const QString &html, const QUrl &baseUrl = QUrl()) Q_DECL_OVERRIDE;
-
-protected:
- void runJavaScriptPrivate(const QString& script,
- int callbackId) Q_DECL_OVERRIDE;
-
-public:
- UIWebView *uiWebView;
- UIGestureRecognizer *m_recognizer;
- int requestFrameCount;
- QPointer<QObject> m_parentView;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWEBVIEW_IOS_P_H
diff --git a/src/webview/qwebview_osx.mm b/src/webview/qwebview_osx.mm
deleted file mode 100644
index 80d33e5..0000000
--- a/src/webview/qwebview_osx.mm
+++ /dev/null
@@ -1,248 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebView module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwebview_p.h"
-#include "qwebview_osx_p.h"
-#include "qwebviewloadrequest_p.h"
-
-#include <QtCore/qglobal.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qvariant.h>
-
-#import <CoreFoundation/CoreFoundation.h>
-#import <WebKit/WebKit.h>
-
-#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11)
-#define QtFrameLoadDelegateProtocol <WebFrameLoadDelegate>
-#else
-// WebFrameLoadDelegate is an informal protocol in <= 10.10 SDK.
-#define QtFrameLoadDelegateProtocol
-#endif
-
-@interface QtFrameLoadDelegate : NSObject QtFrameLoadDelegateProtocol {
- QOsxWebViewPrivate *qtWebViewPrivate;
-}
-- (QtFrameLoadDelegate *)initWithQWebViewPrivate:(QOsxWebViewPrivate *)webViewPrivate;
-- (void)pageDone;
-
-// protocol:
-- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame;
-- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame;
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame;
-- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
-@end
-
-@implementation QtFrameLoadDelegate
-
-- (QtFrameLoadDelegate *)initWithQWebViewPrivate:(QOsxWebViewPrivate *)webViewPrivate
-{
- qtWebViewPrivate = webViewPrivate;
- return self;
-}
-
-- (void)pageDone
-{
- Q_EMIT qtWebViewPrivate->titleChanged(qtWebViewPrivate->title());
- Q_EMIT qtWebViewPrivate->loadProgressChanged(qtWebViewPrivate->loadProgress());
-}
-
-- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
-{
- Q_UNUSED(sender);
- Q_UNUSED(frame);
-
- // WebView gives us per-frame notifications while the QWebView API
- // should provide per-page notifications. Keep track of started frame loads
- // and emit notifications when the final frame completes.
- if (++qtWebViewPrivate->requestFrameCount == 1) {
- Q_EMIT qtWebViewPrivate->loadingChanged(QWebViewLoadRequestPrivate(qtWebViewPrivate->url(),
- QWebView::LoadStartedStatus,
- QString()));
- }
-}
-
-- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame
-{
- Q_UNUSED(sender);
- Q_UNUSED(frame);
-}
-
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
-{
- Q_UNUSED(sender);
- Q_UNUSED(frame);
- if (--qtWebViewPrivate->requestFrameCount == 0) {
- [self pageDone];
- Q_EMIT qtWebViewPrivate->loadingChanged(QWebViewLoadRequestPrivate(qtWebViewPrivate->url(),
- QWebView::LoadSucceededStatus,
- QString()));
- }
-}
-
-- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
-{
- Q_UNUSED(sender);
- Q_UNUSED(error);
- Q_UNUSED(frame);
- if (--qtWebViewPrivate->requestFrameCount == 0) {
- [self pageDone];
- NSString *errorString = [error localizedFailureReason];
- Q_EMIT qtWebViewPrivate->loadingChanged(QWebViewLoadRequestPrivate(qtWebViewPrivate->url(),
- QWebView::LoadFailedStatus,
- QString::fromNSString(errorString)));
- }
-}
-
-@end
-
-QT_BEGIN_NAMESPACE
-
-QOsxWebViewPrivate::QOsxWebViewPrivate(QWebView *q)
- : QWebViewPrivate(q)
-{
- NSRect frame = NSMakeRect(0.0, 0.0, 400, 400);
- webView = [[WebView alloc] initWithFrame:frame frameName:@"Qt Frame" groupName:nil];
- [webView setFrameLoadDelegate:[[QtFrameLoadDelegate alloc] initWithQWebViewPrivate:this]];
- m_window = QWindow::fromWinId(reinterpret_cast<WId>(webView));
-}
-
-QOsxWebViewPrivate::~QOsxWebViewPrivate()
-{
- [webView.frameLoadDelegate release];
- [webView release];
- if (m_window != 0 && m_window->parent() == 0)
- delete m_window;
-}
-
-QUrl QOsxWebViewPrivate::url() const
-{
- NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location.href"];
- return QString::fromNSString(currentURL);
-}
-
-void QOsxWebViewPrivate::setUrl(const QUrl &url)
-{
- requestFrameCount = 0;
- [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url.toNSURL()]];
-}
-
-bool QOsxWebViewPrivate::canGoBack() const
-{
- return webView.canGoBack;
-}
-
-void QOsxWebViewPrivate::goBack()
-{
- [webView goBack];
-}
-
-bool QOsxWebViewPrivate::canGoForward() const
-{
- return webView.canGoForward;
-}
-
-void QOsxWebViewPrivate::goForward()
-{
- [webView goForward];
-}
-
-void QOsxWebViewPrivate::reload()
-{
- [[webView mainFrame] reload];
-}
-
-QString QOsxWebViewPrivate::title() const
-{
- NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
- return QString::fromNSString(title);
-}
-
-int QOsxWebViewPrivate::loadProgress() const
-{
- // TODO:
- return isLoading() ? 100 : 0;
-}
-
-bool QOsxWebViewPrivate::isLoading() const
-{
- return webView.isLoading;
-}
-
-void QOsxWebViewPrivate::runJavaScriptPrivate(const QString& script, int callbackId)
-{
- // ### TODO needs more async
- NSString *result = [webView stringByEvaluatingJavaScriptFromString:script.toNSString()];
- if (callbackId != -1)
- Q_EMIT javaScriptResult(callbackId, QVariant::fromValue(QString::fromNSString(result)));
-}
-
-void QOsxWebViewPrivate::setParentView(QObject *view)
-{
- m_window->setParent(qobject_cast<QWindow *>(view));
-}
-
-QObject *QOsxWebViewPrivate::parentView() const
-{
- return m_window->parent();
-}
-
-void QOsxWebViewPrivate::setGeometry(const QRect &geometry)
-{
- m_window->setGeometry(geometry);
-}
-
-void QOsxWebViewPrivate::setVisibility(QWindow::Visibility visibility)
-{
- m_window->setVisibility(visibility);
-}
-
-void QOsxWebViewPrivate::setVisible(bool visible)
-{
- m_window->setVisible(visible);
-}
-
-void QOsxWebViewPrivate::stop()
-{
- [webView stopLoading:webView];
-}
-
-void QOsxWebViewPrivate::loadHtml(const QString &html, const QUrl &baseUrl)
-{
- Q_UNUSED(html);
- Q_UNUSED(baseUrl);
-}
-
-QT_END_NAMESPACE
diff --git a/src/webview/qwebview_osx_p.h b/src/webview/qwebview_osx_p.h
deleted file mode 100644
index 33d09a2..0000000
--- a/src/webview/qwebview_osx_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWebView module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWEBVIEW_IOS_P_H
-#define QWEBVIEW_IOS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtGui/qwindow.h>
-
-#include "qwebview_p_p.h"
-
-Q_FORWARD_DECLARE_OBJC_CLASS(WebView);
-
-QT_BEGIN_NAMESPACE
-
-class QOsxWebViewPrivate : public QWebViewPrivate
-{
- Q_OBJECT
-public:
- QOsxWebViewPrivate(QWebView *q);
- ~QOsxWebViewPrivate();
-
- QUrl url() const Q_DECL_OVERRIDE;
- void setUrl(const QUrl &url) Q_DECL_OVERRIDE;
- bool canGoBack() const Q_DECL_OVERRIDE;
- bool canGoForward() const Q_DECL_OVERRIDE;
- QString title() const Q_DECL_OVERRIDE;
- int loadProgress() const Q_DECL_OVERRIDE;
- bool isLoading() const Q_DECL_OVERRIDE;
- void runJavaScriptPrivate(const QString& script, int callbackId) Q_DECL_OVERRIDE;
-
- void setParentView(QObject *view) Q_DECL_OVERRIDE;
- QObject *parentView() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect &geometry) Q_DECL_OVERRIDE;
- void setVisibility(QWindow::Visibility visibility) Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
-
-public Q_SLOTS:
- void goBack() Q_DECL_OVERRIDE;
- void goForward() Q_DECL_OVERRIDE;
- void reload() Q_DECL_OVERRIDE;
- void stop() Q_DECL_OVERRIDE;
- void loadHtml(const QString &html, const QUrl &baseUrl = QUrl()) Q_DECL_OVERRIDE;
-
-public:
- QWindow *m_window;
- WebView *webView;
- int requestFrameCount;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWEBVIEW_IOS_P_H
diff --git a/src/webview/webview-lib.pri b/src/webview/webview-lib.pri
index 6b6fbbe..39ebd46 100644
--- a/src/webview/webview-lib.pri
+++ b/src/webview/webview-lib.pri
@@ -52,18 +52,7 @@ android {
qwebview_darwin_p.h
LIBS_PRIVATE += -framework Foundation -framework WebKit
- ios {
- LIBS_PRIVATE += -framework UIKit
- PRIVATE_HEADERS += qwebview_ios_p.h
- OBJECTIVE_SOURCES += qwebview_ios.mm
- }
-
- osx {
- LIBS_PRIVATE += -framework AppKit
- PRIVATE_HEADERS += qwebview_osx_p.h
- OBJECTIVE_SOURCES += qwebview_osx.mm
- CONFIG += use_webengine_backend
- }
+ macos: CONFIG += use_webengine_backend
} else: winrt {
NO_PCH_SOURCES += qwebview_winrt.cpp
SOURCES += $$COMMON_SOURCES
diff --git a/tests/auto/qml/tests.pri b/tests/auto/qml/tests.pri
index e23f416..627a7f0 100644
--- a/tests/auto/qml/tests.pri
+++ b/tests/auto/qml/tests.pri
@@ -13,7 +13,7 @@ INCLUDEPATH += \
QT += testlib network quick webview-private
-osx: CONFIG -= app_bundle
+macos: CONFIG -= app_bundle
DISTFILES += \
$$PWD/qquickwebview/dummy.qml
diff --git a/tests/auto/webview/qwebview/qwebview.pro b/tests/auto/webview/qwebview/qwebview.pro
index a9f1aa8..168b6ab 100644
--- a/tests/auto/webview/qwebview/qwebview.pro
+++ b/tests/auto/webview/qwebview/qwebview.pro
@@ -1,6 +1,6 @@
CONFIG += testcase parallel_test
TARGET = tst_qwebview
-osx:CONFIG -= app_bundle
+macos:CONFIG -= app_bundle
!qtHaveModule(quick) {
DEFINES += QT_NO_QQUICKWEBVIEW_TESTS