diff options
author | Christian Strømme <[email protected]> | 2015-01-16 11:04:58 +0100 |
---|---|---|
committer | Christian Stromme <[email protected]> | 2015-02-09 16:35:06 +0000 |
commit | 56da39587414f127774e1b5e9f88a84f8f27db08 (patch) | |
tree | 5d7bcc9e60df41ca8c70b3ae1ad1adeff4bc5669 /src/webview/qwebview_ios_p.h | |
parent | ea443a6960316d5070c1a3a5dbe21037a96ff7e4 (diff) |
Refactor QWebView code.
In an attempt to make the code more future proof, this patch tries to
improve the abstraction between the native WebViews/View controllers
and the public APIs. This should make it easier to add new platforms
and alternative public interfaces, e.g., a Window/Widget API. It should
also make it easier to implement a plugin system if needed.
In addition the following changes were done:
- reload() implementation in the android controller.
- reload() calls the native reload function on both Android and iOS.
- loadProgress() calls the native getProgress() directly on Android.
- isLoading() calls loading() on the UIWebView (iOS)
- runJavaScript() will now only pass the script and an id to the platform
implementation to avoid creating a strong coupling to QJSValue.
Change-Id: I3cbd81c7fd8d93bacf9134be32ad061d1f9e1183
Reviewed-by: Friedemann Kleint <[email protected]>
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
Diffstat (limited to 'src/webview/qwebview_ios_p.h')
-rw-r--r-- | src/webview/qwebview_ios_p.h | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/webview/qwebview_ios_p.h b/src/webview/qwebview_ios_p.h index b7cbbf2..774d707 100644 --- a/src/webview/qwebview_ios_p.h +++ b/src/webview/qwebview_ios_p.h @@ -52,34 +52,43 @@ #include <QtCore/qurl.h> #include <QtGui/qwindow.h> -#include "qwebview_p.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 +class QIosWebViewPrivate : public QWebViewPrivate { Q_OBJECT public: - QIOSWebViewPrivate(QWebView *q); - virtual ~QIOSWebViewPrivate(); + explicit QIosWebViewPrivate(QObject *p = 0); + ~QIosWebViewPrivate() Q_DECL_OVERRIDE; - QString getUrl() const; - bool canGoBack() const; - bool canGoForward() const; - QString getTitle() const; + 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 *nativeWebView() const; + void setParentView(QObject *view) 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 loadUrl(const QString &url); - void goBack() const; - void goForward() const; - void stopLoading() const; + void goBack() Q_DECL_OVERRIDE; + void goForward() Q_DECL_OVERRIDE; + void reload() Q_DECL_OVERRIDE; + void stop() Q_DECL_OVERRIDE; + public: UIWebView *uiWebView; - QString requestUrl; + UIGestureRecognizer *m_recognizer; int requestFrameCount; }; |