diff options
Diffstat (limited to 'src/webengine')
112 files changed, 0 insertions, 23329 deletions
diff --git a/src/webengine/api/qquickwebengineaction.cpp b/src/webengine/api/qquickwebengineaction.cpp deleted file mode 100644 index 77ac8d340..000000000 --- a/src/webengine/api/qquickwebengineaction.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qquickwebengineaction_p.h" -#include "qquickwebengineaction_p_p.h" -#include "qquickwebengineview_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype WebEngineAction - \instantiates QQuickWebEngineAction - \inqmlmodule QtWebEngine - \since QtWebEngine 1.8 - - \brief An action that represents a \l WebEngineView::WebAction. - - A WebEngineAction is returned by the \l WebEngineView::action() - method. It provides information about the action, such as - whether it is \l enabled. - - The following code uses the \l WebEngineView::action() method to check if the - the copy action is enabled: - - \code - var copyAction = webEngineView.action(WebEngineView.Copy); - if (copyAction.enabled) - console.log("Copy is enabled."); - else - console.log("Copy is disabled."); - \endcode -*/ - -QQuickWebEngineActionPrivate::QQuickWebEngineActionPrivate(const QVariant &data, const QString &text, const QString &iconName, bool enabled) - : m_data(data) - , m_text(text) - , m_iconName(iconName) - , m_enabled(enabled) -{ -} - -QQuickWebEngineActionPrivate::~QQuickWebEngineActionPrivate() -{ -} - -void QQuickWebEngineActionPrivate::setEnabled(bool enabled) -{ - Q_Q(QQuickWebEngineAction); - if (m_enabled == enabled) - return; - m_enabled = enabled; - emit q->enabledChanged(); -} - -QVariant QQuickWebEngineActionPrivate::data() const -{ - return m_data; -} - -void QQuickWebEngineActionPrivate::trigger() -{ - Q_Q(QQuickWebEngineAction); - if (QQuickWebEngineView *view = static_cast<QQuickWebEngineView*>(q->parent())) { - view->triggerWebAction(static_cast<QQuickWebEngineView::WebAction>(data().toInt())); - } -} - -QQuickWebEngineAction::QQuickWebEngineAction(const QVariant &data, const QString &text, const QString &iconName, bool enabled, QObject *parent) - : QObject(parent) - , d_ptr(new QQuickWebEngineActionPrivate(data, text, iconName, enabled)) -{ - d_ptr->q_ptr = this; -} - -QQuickWebEngineAction::QQuickWebEngineAction(QObject *parent) - : QObject(parent) - , d_ptr(new QQuickWebEngineActionPrivate(-1, QStringLiteral(""), QStringLiteral(""), false)) -{ - d_ptr->q_ptr = this; -} - -QQuickWebEngineAction::~QQuickWebEngineAction() -{ -} - -/*! - \qmlproperty int WebEngineAction::text - - This property holds a textual description of the action. -*/ -QString QQuickWebEngineAction::text() const -{ - Q_D(const QQuickWebEngineAction); - return d->m_text; -} - -/*! - \qmlproperty string WebEngineAction::iconName - - This property holds the name of the icon for the action. This name - can be used to pick the icon from a theme. -*/ -QString QQuickWebEngineAction::iconName() const -{ - Q_D(const QQuickWebEngineAction); - return d->m_iconName; -} - -/*! - \qmlproperty bool WebEngineAction::enabled - - This property holds whether the action is enabled. -*/ -bool QQuickWebEngineAction::isEnabled() const -{ - Q_D(const QQuickWebEngineAction); - return d->m_enabled; -} - -/*! - \qmlmethod void WebEngineAction::trigger() - - Triggers the action. -*/ -void QQuickWebEngineAction::trigger() -{ - Q_D(QQuickWebEngineAction); - if (!isEnabled()) - return; - - d->trigger(); - emit triggered(); -} - -QT_END_NAMESPACE - diff --git a/src/webengine/api/qquickwebengineaction_p.h b/src/webengine/api/qquickwebengineaction_p.h deleted file mode 100644 index 8f5f3386c..000000000 --- a/src/webengine/api/qquickwebengineaction_p.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEACTION_P_H -#define QQUICKWEBENGINEACTION_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 <QObject> -#include <QtQml/qqml.h> -#include "qtwebengineglobal_p.h" -#include <QVariant> - -namespace QtWebEngineCore { - class UIDelegatesManager; - class UI2DelegatesManager; -} - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineActionPrivate; - -class Q_WEBENGINE_EXPORT QQuickWebEngineAction : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString text READ text CONSTANT FINAL) - Q_PROPERTY(QString iconName READ iconName CONSTANT FINAL) - Q_PROPERTY(bool enabled READ isEnabled NOTIFY enabledChanged FINAL) - -public: - QQuickWebEngineAction(const QVariant &data, const QString &text, const QString &iconName, bool enabled, QObject *parent); - QQuickWebEngineAction(QObject *parent); - ~QQuickWebEngineAction(); - - QString text() const; - QString iconName() const; - bool isEnabled() const; - -public Q_SLOTS: - Q_INVOKABLE void trigger(); - -Q_SIGNALS: - void triggered(); - void enabledChanged(); - -private: - Q_DECLARE_PRIVATE(QQuickWebEngineAction) - friend class QQuickWebEngineView; - friend class QQuickWebEngineViewPrivate; - friend class QtWebEngineCore::UIDelegatesManager; - friend class QtWebEngineCore::UI2DelegatesManager; - friend class QQuickContextMenuBuilder; - - QScopedPointer<QQuickWebEngineActionPrivate> d_ptr; -}; - - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineAction) - -#endif // QQUICKWEBENGINEACTION_P_H diff --git a/src/webengine/api/qquickwebengineaction_p_p.h b/src/webengine/api/qquickwebengineaction_p_p.h deleted file mode 100644 index d2ead30e9..000000000 --- a/src/webengine/api/qquickwebengineaction_p_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEACTION_P_P_H -#define QQUICKWEBENGINEACTION_P_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 <QObject> -#include "qtwebengineglobal_p.h" -#include <QVariant> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineAction; - -class QQuickWebEngineActionPrivate -{ -public: - Q_DECLARE_PUBLIC(QQuickWebEngineAction) - QQuickWebEngineActionPrivate(const QVariant &data, const QString &text, const QString &iconName, bool enabled); - ~QQuickWebEngineActionPrivate(); - - void setEnabled(bool enabled); - - QVariant data() const; - - void trigger(); - - QVariant m_data; - QString m_text; - QString m_iconName; - bool m_enabled; - -private: - QQuickWebEngineAction *q_ptr; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEACTION_P_P_H diff --git a/src/webengine/api/qquickwebenginecertificateerror.cpp b/src/webengine/api/qquickwebenginecertificateerror.cpp deleted file mode 100644 index 855e61817..000000000 --- a/src/webengine/api/qquickwebenginecertificateerror.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qquickwebenginecertificateerror_p.h> -#include "certificate_error_controller.h" -QT_BEGIN_NAMESPACE - -class QQuickWebEngineCertificateErrorPrivate { -public: - QQuickWebEngineCertificateErrorPrivate(const QSharedPointer<CertificateErrorController> &controller) - : weakRefCertErrorController(controller), - error(static_cast<QQuickWebEngineCertificateError::Error>(static_cast<int>(controller->error()))), - description(controller->errorString()), - overridable(controller->overridable()), - async(false), - answered(false) - { - } - - const QWeakPointer<CertificateErrorController> weakRefCertErrorController; - QQuickWebEngineCertificateError::Error error; - QString description; - bool overridable; - bool async; - bool answered; -}; - -/*! - \qmltype WebEngineCertificateError - \instantiates QQuickWebEngineCertificateError - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - - \brief A utility type for ignoring certificate errors or rejecting erroneous certificates. - - This QML type contains information about a certificate error that occurred. The \l error - property holds the reason that the error occurred and the \l description property holds a - short localized description of the error. The \l url property holds the URL that triggered - the error. - - The certificate can be rejected by calling \l rejectCertificate, which will stop loading the - web engine request. By default, an invalid certificate will be automatically rejected. - - The certificate error can be ignored by calling \l ignoreCertificateError, which will - resume loading the request. - - It is possible to defer the decision of rejecting a certificate by calling \l defer, - which is useful when waiting for user input. - - \sa WebEngineView::certificateError -*/ -QQuickWebEngineCertificateError::QQuickWebEngineCertificateError(const QSharedPointer<CertificateErrorController> &controller, QObject *parent) - : QObject(parent) - , d_ptr(new QQuickWebEngineCertificateErrorPrivate(controller)) -{ -} - -QQuickWebEngineCertificateError::~QQuickWebEngineCertificateError() -{ - Q_D(QQuickWebEngineCertificateError); - if (!d->answered) - rejectCertificate(); -} - - -/*! - \qmlmethod void WebEngineCertificateError::defer() - - This function should be called when there is a need to postpone the decision whether to ignore a - certificate error, for example, while waiting for user input. When called, the function pauses the - URL request until WebEngineCertificateError::ignoreCertificateError() or - WebEngineCertificateError::rejectCertificate() is called. - */ -void QQuickWebEngineCertificateError::defer() -{ - Q_D(QQuickWebEngineCertificateError); - d->async = true; -} -/*! - \qmlmethod void WebEngineCertificateError::ignoreCertificateError() - - The certificate error is ignored, and the web engine view continues to load the requested URL. - */ -void QQuickWebEngineCertificateError::ignoreCertificateError() -{ - Q_D(QQuickWebEngineCertificateError); - - d->answered = true; - - QSharedPointer<CertificateErrorController> strongRefCert = d->weakRefCertErrorController.toStrongRef(); - if (strongRefCert) - strongRefCert->accept(true); -} - -/*! - \qmlmethod void WebEngineCertificateError::rejectCertificate() - - The certificate is rejected, and the web engine view stops loading the requested URL. - */ -void QQuickWebEngineCertificateError::rejectCertificate() -{ - Q_D(QQuickWebEngineCertificateError); - - d->answered = true; - - QSharedPointer<CertificateErrorController> strongRefCert = d->weakRefCertErrorController.toStrongRef(); - if (strongRefCert) - strongRefCert->accept(false); -} - -/*! - \qmlproperty url WebEngineCertificateError::url - \readonly - - The URL that triggered the error. - */ -QUrl QQuickWebEngineCertificateError::url() const -{ - Q_D(const QQuickWebEngineCertificateError); - QSharedPointer<CertificateErrorController> strongRefCert = d->weakRefCertErrorController.toStrongRef(); - if (strongRefCert) - return strongRefCert->url(); - return QUrl(); -} - -/*! - \qmlproperty enumeration WebEngineCertificateError::error - \readonly - - The type of the error. - - \value WebEngineCertificateError.SslPinnedKeyNotInCertificateChain - The certificate did not match the built-in public keys pinned for - the host name. - \value WebEngineCertificateError.CertificateCommonNameInvalid - The certificate's common name did not match the host name. - \value WebEngineCertificateError.CertificateDateInvalid - The certificate is not valid at the current date and time. - \value WebEngineCertificateError.CertificateAuthorityInvalid - The certificate is not signed by a trusted authority. - \value WebEngineCertificateError.CertificateContainsErrors - The certificate contains errors. - \value WebEngineCertificateError.CertificateNoRevocationMechanism - The certificate has no mechanism for determining if it has been - revoked. - \value WebEngineCertificateError.CertificateUnableToCheckRevocation - Revocation information for the certificate is not available. - \value WebEngineCertificateError.CertificateRevoked - The certificate has been revoked. - \value WebEngineCertificateError.CertificateInvalid - The certificate is invalid. - \value WebEngineCertificateError.CertificateWeakSignatureAlgorithm - The certificate is signed using a weak signature algorithm. - \value WebEngineCertificateError.CertificateNonUniqueName - The host name specified in the certificate is not unique. - \value WebEngineCertificateError.CertificateWeakKey - The certificate contains a weak key. - \value WebEngineCertificateError.CertificateNameConstraintViolation - The certificate claimed DNS names that are in violation of name - constraints. - \value WebEngineCertificateError.CertificateValidityTooLong - The certificate has a validity period that is too long. - (Added in 5.7) - \value WebEngineCertificateError.CertificateTransparencyRequired - Certificate Transparency was required for this connection, but the server - did not provide CT information that complied with the policy. (Added in 5.8) -*/ -QQuickWebEngineCertificateError::Error QQuickWebEngineCertificateError::error() const -{ - Q_D(const QQuickWebEngineCertificateError); - return d->error; -} - -/*! - \qmlproperty string WebEngineCertificateError::description - \readonly - - A short localized human-readable description of the error. -*/ -QString QQuickWebEngineCertificateError::description() const -{ - Q_D(const QQuickWebEngineCertificateError); - return d->description; -} - -/*! - \qmlproperty bool WebEngineCertificateError::overridable - \readonly - - A boolean that indicates whether the certificate error can be overridden and ignored. -*/ -bool QQuickWebEngineCertificateError::overridable() const -{ - Q_D(const QQuickWebEngineCertificateError); - return d->overridable; -} - -bool QQuickWebEngineCertificateError::deferred() const -{ - Q_D(const QQuickWebEngineCertificateError); - return d->async; -} - -bool QQuickWebEngineCertificateError::answered() const -{ - Q_D(const QQuickWebEngineCertificateError); - return d->answered; -} - -QT_END_NAMESPACE - diff --git a/src/webengine/api/qquickwebenginecertificateerror_p.h b/src/webengine/api/qquickwebenginecertificateerror_p.h deleted file mode 100644 index 77fbe27aa..000000000 --- a/src/webengine/api/qquickwebenginecertificateerror_p.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINECERTIFICATEERROR_P_H -#define QQUICKWEBENGINECERTIFICATEERROR_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 <QObject> -#include "qquickwebengineview_p.h" - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineCertificateErrorPrivate; -class CertificateErrorController; - -class Q_WEBENGINE_EXPORT QQuickWebEngineCertificateError : public QObject { - Q_OBJECT - Q_PROPERTY(QUrl url READ url CONSTANT FINAL) - Q_PROPERTY(Error error READ error CONSTANT FINAL) - Q_PROPERTY(QString description READ description CONSTANT FINAL) - Q_PROPERTY(bool overridable READ overridable CONSTANT FINAL) - -public: - - // Keep this identical to CertificateErrorController::CertificateError, or add mapping layer. - enum Error { - SslPinnedKeyNotInCertificateChain = -150, - CertificateCommonNameInvalid = -200, - CertificateDateInvalid = -201, - CertificateAuthorityInvalid = -202, - CertificateContainsErrors = -203, - CertificateNoRevocationMechanism = -204, - CertificateUnableToCheckRevocation = -205, - CertificateRevoked = -206, - CertificateInvalid = -207, - CertificateWeakSignatureAlgorithm = -208, - CertificateNonUniqueName = -210, - CertificateWeakKey = -211, - CertificateNameConstraintViolation = -212, - CertificateValidityTooLong = -213, - CertificateTransparencyRequired = -214, - }; - Q_ENUM(Error) - - QQuickWebEngineCertificateError(const QSharedPointer<CertificateErrorController> &controller, QObject *parent = 0); - ~QQuickWebEngineCertificateError(); - - Q_INVOKABLE void defer(); - Q_INVOKABLE void ignoreCertificateError(); - Q_INVOKABLE void rejectCertificate(); - QUrl url() const; - Error error() const; - QString description() const; - bool overridable() const; - bool deferred() const; - bool answered() const; - -private: - Q_DISABLE_COPY(QQuickWebEngineCertificateError) - Q_DECLARE_PRIVATE(QQuickWebEngineCertificateError) - QScopedPointer<QQuickWebEngineCertificateErrorPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineCertificateError) - -#endif // QQUICKWEBENGINECERTIFICATEERROR_P_H diff --git a/src/webengine/api/qquickwebengineclientcertificateselection.cpp b/src/webengine/api/qquickwebengineclientcertificateselection.cpp deleted file mode 100644 index c48a59887..000000000 --- a/src/webengine/api/qquickwebengineclientcertificateselection.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebengineclientcertificateselection_p.h" - -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - -#include "client_cert_select_controller.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype WebEngineClientCertificateOption - \instantiates QQuickWebEngineClientCertificateOption - \inqmlmodule QtWebEngine - \since QtWebEngine 1.9 - \brief Represents a client certificate option. - - \sa {WebEngineClientCertificateSelection::certificates} {WebEngineClientCertificateSelection.certificates} -*/ - -QQuickWebEngineClientCertificateOption::QQuickWebEngineClientCertificateOption(QQuickWebEngineClientCertificateSelection *selection, int index) - : QObject(selection), m_selection(selection), m_index(index) -{} - -/*! - \qmlproperty string WebEngineClientCertificateOption::issuer - \brief The issuer of the certificate. -*/ - -QString QQuickWebEngineClientCertificateOption::issuer() const -{ - return m_selection->d_ptr->certificates().at(m_index).issuerDisplayName(); -} - -/*! - \qmlproperty string WebEngineClientCertificateOption::subject - \brief The subject of the certificate. -*/ -QString QQuickWebEngineClientCertificateOption::subject() const -{ - return m_selection->d_ptr->certificates().at(m_index).subjectDisplayName(); -} - -/*! - \qmlproperty datetime WebEngineClientCertificateOption::effectiveDate - \brief The date and time when the certificate becomes valid. -*/ -QDateTime QQuickWebEngineClientCertificateOption::effectiveDate() const -{ - return m_selection->d_ptr->certificates().at(m_index).effectiveDate(); -} - -/*! - \qmlproperty datetime WebEngineClientCertificateOption::expiryDate - \brief The date and time when the certificate becomes invalid. -*/ -QDateTime QQuickWebEngineClientCertificateOption::expiryDate() const -{ - return m_selection->d_ptr->certificates().at(m_index).expiryDate(); -} - -/*! - \qmlproperty bool WebEngineClientCertificateOption::isSelfSigned - \brief Whether the certificate is only self-signed. -*/ -bool QQuickWebEngineClientCertificateOption::isSelfSigned() const -{ - return m_selection->d_ptr->certificates().at(m_index).isSelfSigned(); -} - -/*! - \qmlmethod void WebEngineClientCertificateOption::select() - - Selects this client certificate option. -*/ -void QQuickWebEngineClientCertificateOption::select() -{ - m_selection->select(m_index); -} - -/*! - \qmltype WebEngineClientCertificateSelection - \instantiates QQuickWebEngineClientCertificateSelection - \inqmlmodule QtWebEngine - \since QtWebEngine 1.9 - \brief Provides a selection of client certificates. - - When a web site requests an SSL client certificate, and one or more certificates - are found in the system's client certificate store, this type provides access to - the certificates to choose from, as well as a method for selecting one. - - The selection is asynchronous. If no certificate is selected and no copy of the - object is kept alive, loading will continue without a certificate. - - \sa {WebEngineView::selectClientCertificate}{WebEngineView.selectClientCertificate} -*/ - -QQuickWebEngineClientCertificateSelection::QQuickWebEngineClientCertificateSelection(QSharedPointer<ClientCertSelectController> selectController) - : QObject(), d_ptr(selectController) -{} - -int QQuickWebEngineClientCertificateSelection::certificates_count( - QQmlListProperty<QQuickWebEngineClientCertificateOption> *p) -{ - Q_ASSERT(p && p->object); - QQuickWebEngineClientCertificateSelection *d = static_cast<QQuickWebEngineClientCertificateSelection *>(p->object); - return d->m_certificates.size(); -} - -QQuickWebEngineClientCertificateOption *QQuickWebEngineClientCertificateSelection::certificates_at( - QQmlListProperty<QQuickWebEngineClientCertificateOption> *p, int idx) -{ - Q_ASSERT(p && p->object); - QQuickWebEngineClientCertificateSelection *d = static_cast<QQuickWebEngineClientCertificateSelection *>(p->object); - if (idx < 0 || idx >= d->m_certificates.size()) - return nullptr; - return d->m_certificates[idx]; -} - -/*! - \qmlproperty list<WebEngineClientCertificateOption> WebEngineClientCertificateSelection::certificates - \brief The client certificates available to choose from. -*/ - -QQmlListProperty<QQuickWebEngineClientCertificateOption> QQuickWebEngineClientCertificateSelection::certificates() -{ - if (m_certificates.empty()) { - QVector<QSslCertificate> certificates = d_ptr->certificates(); - for (int i = 0; i < certificates.count(); ++i) - m_certificates.push_back(new QQuickWebEngineClientCertificateOption(this, i)); - } - - return QQmlListProperty<QQuickWebEngineClientCertificateOption>( - this, nullptr, - certificates_count, - certificates_at); -} - -/*! - \qmlmethod void WebEngineClientCertificateSelection::select(WebEngineClientCertificateOption certificate) - - Selects the client certificate \a certificate. The certificate must be one - of the offered certificates. - - \sa selectNone() -*/ -void QQuickWebEngineClientCertificateSelection::select(const QQuickWebEngineClientCertificateOption *certificate) -{ - select(certificate->m_index); -} - -/*! - \qmlmethod void WebEngineClientCertificateSelection::select(int index) - - Selects the client certificate at the index \a index in the list of offered certificates. - - \sa selectNone() -*/ -void QQuickWebEngineClientCertificateSelection::select(int index) -{ - d_ptr->select(index); -} - -/*! - \qmlmethod void WebEngineClientCertificateSelection::selectNone() - - Continues without using any of the offered certificates. This is the same - action as taken when destroying the last copy of this object if no - selection has been made. - - \sa select() -*/ -void QQuickWebEngineClientCertificateSelection::selectNone() -{ - d_ptr->selectNone(); -} - -/*! - \qmlproperty url WebEngineClientCertificateSelection::host - \brief The host and port of the server requesting the client certificate. -*/ -QUrl QQuickWebEngineClientCertificateSelection::host() const -{ - return d_ptr->hostAndPort(); -} - -QT_END_NAMESPACE - -#endif // QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) diff --git a/src/webengine/api/qquickwebengineclientcertificateselection_p.h b/src/webengine/api/qquickwebengineclientcertificateselection_p.h deleted file mode 100644 index adf8b5f7c..000000000 --- a/src/webengine/api/qquickwebengineclientcertificateselection_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINECERTSELECTION_P_H -#define QQUICKWEBENGINECERTSELECTION_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 <QtWebEngine/private/qtwebengineglobal_p.h> - -#include <QtCore/QDateTime> -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> -#include <QtCore/QUrl> -#include <QtCore/QVector> -#include <QtQml/QQmlListProperty> - -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - -QT_BEGIN_NAMESPACE - -class ClientCertSelectController; -class QQuickWebEngineClientCertificateSelection; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineClientCertificateOption : public QObject { - Q_OBJECT - Q_PROPERTY(QString issuer READ issuer CONSTANT FINAL) - Q_PROPERTY(QString subject READ subject CONSTANT FINAL) - Q_PROPERTY(QDateTime effectiveDate READ effectiveDate CONSTANT FINAL) - Q_PROPERTY(QDateTime expiryDate READ expiryDate CONSTANT FINAL) - Q_PROPERTY(bool isSelfSigned READ isSelfSigned CONSTANT FINAL) - -public: - QString issuer() const; - QString subject() const; - QDateTime effectiveDate() const; - QDateTime expiryDate() const; - bool isSelfSigned() const; - - Q_INVOKABLE void select(); - -private: - friend class QQuickWebEngineClientCertificateSelection; - QQuickWebEngineClientCertificateOption(QQuickWebEngineClientCertificateSelection *selection, int index); - - QQuickWebEngineClientCertificateSelection *m_selection; - int m_index; -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineClientCertificateSelection : public QObject { - Q_OBJECT - Q_PROPERTY(QUrl host READ host CONSTANT FINAL) - Q_PROPERTY(QQmlListProperty<QQuickWebEngineClientCertificateOption> certificates READ certificates CONSTANT FINAL) - -public: - QQuickWebEngineClientCertificateSelection() = default; - - QUrl host() const; - - Q_INVOKABLE void select(int idx); - Q_INVOKABLE void select(const QQuickWebEngineClientCertificateOption *certificate); - Q_INVOKABLE void selectNone(); - QQmlListProperty<QQuickWebEngineClientCertificateOption> certificates(); - -private: - friend class QQuickWebEngineViewPrivate; - friend class QQuickWebEngineClientCertificateOption; - - static int certificates_count(QQmlListProperty<QQuickWebEngineClientCertificateOption> *p); - static QQuickWebEngineClientCertificateOption *certificates_at(QQmlListProperty<QQuickWebEngineClientCertificateOption> *p, int idx); - - explicit QQuickWebEngineClientCertificateSelection(QSharedPointer<ClientCertSelectController>); - - mutable QVector<QQuickWebEngineClientCertificateOption *> m_certificates; - QSharedPointer<ClientCertSelectController> d_ptr; -}; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(QQuickWebEngineClientCertificateOption *) -Q_DECLARE_METATYPE(QQmlListProperty<QQuickWebEngineClientCertificateOption>) -Q_DECLARE_METATYPE(QQuickWebEngineClientCertificateSelection *) - -#endif - -#endif // QQUICKWEBENGINECERTSELECTION_P_H diff --git a/src/webengine/api/qquickwebenginecontextmenurequest.cpp b/src/webengine/api/qquickwebenginecontextmenurequest.cpp deleted file mode 100644 index e1ebd4c8c..000000000 --- a/src/webengine/api/qquickwebenginecontextmenurequest.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginecontextmenurequest_p.h" -#include "web_contents_adapter_client.h" - -QT_BEGIN_NAMESPACE - -// Match MediaType enum -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeNone, - QQuickWebEngineContextMenuRequest::MediaTypeNone) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeImage, - QQuickWebEngineContextMenuRequest::MediaTypeImage) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeAudio, - QQuickWebEngineContextMenuRequest::MediaTypeAudio) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeVideo, - QQuickWebEngineContextMenuRequest::MediaTypeVideo) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeCanvas, - QQuickWebEngineContextMenuRequest::MediaTypeCanvas) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeFile, - QQuickWebEngineContextMenuRequest::MediaTypeFile) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypePlugin, - QQuickWebEngineContextMenuRequest::MediaTypePlugin) - -// Match MediaFlag enum -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaInError, - QQuickWebEngineContextMenuRequest::MediaInError) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaPaused, - QQuickWebEngineContextMenuRequest::MediaPaused) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaMuted, - QQuickWebEngineContextMenuRequest::MediaMuted) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaLoop, - QQuickWebEngineContextMenuRequest::MediaLoop) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanSave, - QQuickWebEngineContextMenuRequest::MediaCanSave) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaHasAudio, - QQuickWebEngineContextMenuRequest::MediaHasAudio) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanToggleControls, - QQuickWebEngineContextMenuRequest::MediaCanToggleControls) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaControls, - QQuickWebEngineContextMenuRequest::MediaControls) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanPrint, - QQuickWebEngineContextMenuRequest::MediaCanPrint) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanRotate, - QQuickWebEngineContextMenuRequest::MediaCanRotate) - -// Match EditFlag enum -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanUndo, - QQuickWebEngineContextMenuRequest::CanUndo) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanRedo, - QQuickWebEngineContextMenuRequest::CanRedo) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanCut, - QQuickWebEngineContextMenuRequest::CanCut) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanCopy, - QQuickWebEngineContextMenuRequest::CanCopy) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanPaste, - QQuickWebEngineContextMenuRequest::CanPaste) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanDelete, - QQuickWebEngineContextMenuRequest::CanDelete) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanSelectAll, - QQuickWebEngineContextMenuRequest::CanSelectAll) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanTranslate, - QQuickWebEngineContextMenuRequest::CanTranslate) -ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanEditRichly, - QQuickWebEngineContextMenuRequest::CanEditRichly) - -/*! - \qmltype ContextMenuRequest - \instantiates QQuickWebEngineContextMenuRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.4 - - \brief A request for showing a context menu. - - A ContextMenuRequest is passed as an argument of the - WebEngineView::contextMenuRequested signal. It provides further - information about the context of the request. The position of the - request origin can be found via the \l x and \l y properties. - - The \l accepted property of the request indicates whether the request - is handled by the user code or the default context menu should - be displayed. - - The following code uses a custom menu to handle the request: - - \code - WebEngineView { - id: view - // ... - onContextMenuRequested: function(request) { - request.accepted = true; - myMenu.x = request.x; - myMenu.y = request.y; - myMenu.trigger.connect(view.triggerWebAction); - myMenu.popup(); - } - // ... - } - \endcode -*/ - -QQuickWebEngineContextMenuRequest::QQuickWebEngineContextMenuRequest( - const QtWebEngineCore::WebEngineContextMenuData &data, QObject *parent): - QObject(parent) - , m_data(new QtWebEngineCore::WebEngineContextMenuData(data)) - , m_accepted(false) -{ -} - -QQuickWebEngineContextMenuRequest::~QQuickWebEngineContextMenuRequest() -{ -} - -/*! - \qmlproperty int ContextMenuRequest::x - \readonly - - The x coordinate of the user action from where the context - menu request originates. -*/ - -int QQuickWebEngineContextMenuRequest::x() const -{ - return m_data->position().x(); -} - -/*! - \qmlproperty int ContextMenuRequest::y - \readonly - - The y coordinate of the user action from where the context - menu request originates. -*/ - -int QQuickWebEngineContextMenuRequest::y() const -{ - return m_data->position().y(); -} - -/*! - \qmlproperty string ContextMenuRequest::selectedText - \readonly - - The selected text the context menu was created for. -*/ - -QString QQuickWebEngineContextMenuRequest::selectedText() const -{ - return m_data->selectedText(); -} - -/*! - \qmlproperty string ContextMenuRequest::linkText - \readonly - - The text of the link if the context menu was requested for a link. -*/ - -QString QQuickWebEngineContextMenuRequest::linkText() const -{ - return m_data->linkText(); -} - -/*! - \qmlproperty url ContextMenuRequest::linkUrl - \readonly - - The URL of the link if the selected web page content is a link. - It is not guaranteed to be a valid URL. -*/ - -QUrl QQuickWebEngineContextMenuRequest::linkUrl() const -{ - return m_data->unfilteredLinkUrl(); -} - -/*! - \qmlproperty url ContextMenuRequest::mediaUrl - \readonly - - The URL of media if the selected web content is a media element. -*/ - -QUrl QQuickWebEngineContextMenuRequest::mediaUrl() const -{ - return m_data->mediaUrl(); -} - -/*! - \qmlproperty enumeration ContextMenuRequest::mediaType - \readonly - - The type of the media element or \c MediaTypeNone if - the selected web page content is not a media element. - - \value ContextMenuRequest.MediaTypeNone - Not a media. - \value ContextMenuRequest.MediaTypeImage - An image. - \value ContextMenuRequest.MediaTypeVideo - A video. - \value ContextMenuRequest.MediaTypeAudio - An audio element. - \value ContextMenuRequest.MediaTypeCanvas - A canvas. - \value ContextMenuRequest.MediaTypeFile - A file. - \value ContextMenuRequest.MediaTypePlugin - A plugin. -*/ - -QQuickWebEngineContextMenuRequest::MediaType QQuickWebEngineContextMenuRequest::mediaType() const -{ - return static_cast<QQuickWebEngineContextMenuRequest::MediaType>(m_data->mediaType()); -} - -/*! - \qmlproperty bool ContextMenuRequest::isContentEditable - \readonly - - Indicates whether the selected web content is editable. -*/ - -bool QQuickWebEngineContextMenuRequest::isContentEditable() const -{ - return m_data->isEditable(); -} - -/*! - \qmlproperty string ContextMenuRequest::misspelledWord - \readonly - - If the context is a word considered misspelled by the spell-checker, - returns the misspelled word. -*/ - -QString QQuickWebEngineContextMenuRequest::misspelledWord() const -{ - return m_data->misspelledWord(); -} - -/*! - \qmlproperty stringlist ContextMenuRequest::spellCheckerSuggestions - \readonly - - If the context is a word considered misspelled by the spell-checker, - returns a list of suggested replacements. -*/ - -QStringList QQuickWebEngineContextMenuRequest::spellCheckerSuggestions() const -{ - return m_data->spellCheckerSuggestions(); -} - -/*! - \qmlproperty bool ContextMenuRequest::accepted - - Indicates whether the context menu request has been - handled by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::contextMenuRequested have been executed, - a default context menu will be shown. - To prevent this, set \c{request.accepted} to \c true. - - The default is \c false. - - \note The default content of the context menu depends on the - web element for which the request was actually generated. -*/ - -bool QQuickWebEngineContextMenuRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineContextMenuRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - -/*! - \qmlproperty flags ContextMenuRequest::mediaFlags - \readonly - \since QtWebEngine 1.7 - - The current media element's status and its available operations. - \c MediaNone if the selected web page content is not a media element. - - \value ContextMenuRequest.MediaInError - An error occurred. - \value ContextMenuRequest.MediaPaused - Media is paused. - \value ContextMenuRequest.MediaMuted - Media is muted. - \value ContextMenuRequest.MediaLoop - Media can be looped. - \value ContextMenuRequest.MediaCanSave - Media can be saved. - \value ContextMenuRequest.MediaHasAudio - Media has audio. - \value ContextMenuRequest.MediaCanToggleControls - Media can show controls. - \value ContextMenuRequest.MediaControls - Media controls are shown. - \value ContextMenuRequest.MediaCanPrint - Media is printable. - \value ContextMenuRequest.MediaCanRotate - Media is rotatable. -*/ -QQuickWebEngineContextMenuRequest::MediaFlags QQuickWebEngineContextMenuRequest::mediaFlags() const -{ - return static_cast<QQuickWebEngineContextMenuRequest::MediaFlags>(m_data->mediaFlags()); -} - -/*! - \qmlproperty flags ContextMenuRequest::editFlags - \readonly - \since QtWebEngine 1.7 - - The available edit operations in the current context or \c CanDoNone if no actions are available. - - \value ContextMenuRequest.CanUndo - Undo is available. - \value ContextMenuRequest.CanRedo - Redo is available. - \value ContextMenuRequest.CanCut - Cut is available. - \value ContextMenuRequest.CanCopy - Copy is available. - \value ContextMenuRequest.CanPaste - Paste is available. - \value ContextMenuRequest.CanDelete - Delete is available. - \value ContextMenuRequest.CanSelectAll - Select All is available. - \value ContextMenuRequest.CanTranslate - Translate is available. - \value ContextMenuRequest.CanEditRichly - Context is richly editable. -*/ -QQuickWebEngineContextMenuRequest::EditFlags QQuickWebEngineContextMenuRequest::editFlags() const -{ - return static_cast<QQuickWebEngineContextMenuRequest::EditFlags>(m_data->editFlags()); -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginecontextmenurequest_p.h b/src/webengine/api/qquickwebenginecontextmenurequest_p.h deleted file mode 100644 index bc50eccb8..000000000 --- a/src/webengine/api/qquickwebenginecontextmenurequest_p.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINECONTEXTMENUREQUEST_H -#define QQUICKWEBENGINECONTEXTMENUREQUEST_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QtCore/QScopedPointer> -#include <QtCore/QObject> -#include <QtCore/QUrl> - -namespace QtWebEngineCore { - class WebEngineContextMenuData; -} - -QT_BEGIN_NAMESPACE - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineContextMenuRequest: public QObject { - Q_OBJECT -public: - enum MediaType { - MediaTypeNone, - MediaTypeImage, - MediaTypeVideo, - MediaTypeAudio, - MediaTypeCanvas, - MediaTypeFile, - MediaTypePlugin - }; - Q_ENUM(MediaType) - - // Must match QWebEngineCore::WebEngineContextMenuData::MediaFlags: - enum MediaFlag { - MediaInError = 0x1, - MediaPaused = 0x2, - MediaMuted = 0x4, - MediaLoop = 0x8, - MediaCanSave = 0x10, - MediaHasAudio = 0x20, - MediaCanToggleControls = 0x40, - MediaControls = 0x80, - MediaCanPrint = 0x100, - MediaCanRotate = 0x200, - }; - Q_DECLARE_FLAGS(MediaFlags, MediaFlag) - Q_FLAG(MediaFlags) - - // Must match QWebEngineCore::WebEngineContextMenuData::EditFlags: - enum EditFlag { - CanUndo = 0x1, - CanRedo = 0x2, - CanCut = 0x4, - CanCopy = 0x8, - CanPaste = 0x10, - CanDelete = 0x20, - CanSelectAll = 0x40, - CanTranslate = 0x80, - CanEditRichly = 0x100, - }; - Q_DECLARE_FLAGS(EditFlags, EditFlag) - Q_FLAG(EditFlags) - - Q_PROPERTY(int x READ x CONSTANT FINAL) - Q_PROPERTY(int y READ y CONSTANT FINAL) - Q_PROPERTY(QString selectedText READ selectedText CONSTANT FINAL) - Q_PROPERTY(QString linkText READ linkText CONSTANT FINAL) - Q_PROPERTY(QUrl linkUrl READ linkUrl CONSTANT FINAL) - Q_PROPERTY(QUrl mediaUrl READ mediaUrl CONSTANT FINAL) - Q_PROPERTY(MediaType mediaType READ mediaType CONSTANT FINAL) - Q_PROPERTY(bool isContentEditable READ isContentEditable CONSTANT FINAL) - Q_PROPERTY(QString misspelledWord READ misspelledWord CONSTANT FINAL) - Q_PROPERTY(QStringList spellCheckerSuggestions READ spellCheckerSuggestions CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - Q_PROPERTY(MediaFlags mediaFlags READ mediaFlags CONSTANT FINAL REVISION 1) - Q_PROPERTY(EditFlags editFlags READ editFlags CONSTANT FINAL REVISION 1) - - ~QQuickWebEngineContextMenuRequest(); - int x() const; - int y() const; - QString selectedText() const; - QString linkText() const; - QUrl linkUrl() const; - QUrl mediaUrl() const; - MediaType mediaType() const; - bool isContentEditable() const; - QString misspelledWord() const; - QStringList spellCheckerSuggestions() const; - bool isAccepted() const; - void setAccepted(bool accepted); - MediaFlags mediaFlags() const; - EditFlags editFlags() const; - -private: - QQuickWebEngineContextMenuRequest(const QtWebEngineCore::WebEngineContextMenuData &data, QObject *parent = nullptr); - QScopedPointer<QtWebEngineCore::WebEngineContextMenuData> m_data; - bool m_accepted; - friend class QQuickWebEngineView; - friend class QQuickWebEngineViewPrivate; - Q_DISABLE_COPY(QQuickWebEngineContextMenuRequest) -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINECONTEXTMENUREQUEST_H diff --git a/src/webengine/api/qquickwebenginedialogrequests.cpp b/src/webengine/api/qquickwebenginedialogrequests.cpp deleted file mode 100644 index da1aecaf6..000000000 --- a/src/webengine/api/qquickwebenginedialogrequests.cpp +++ /dev/null @@ -1,936 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginedialogrequests_p.h" -#include "authentication_dialog_controller.h" -#include "javascript_dialog_controller.h" -#include "color_chooser_controller.h" -#include "file_picker_controller.h" -#include "web_contents_adapter_client.h" - -#include <QCursor> -#include <QQuickItem> - -QT_BEGIN_NAMESPACE - -using namespace QtWebEngineCore; - -ASSERT_ENUMS_MATCH(WebContentsAdapterClient::AlertDialog, - QQuickWebEngineJavaScriptDialogRequest::DialogTypeAlert) -ASSERT_ENUMS_MATCH(WebContentsAdapterClient::ConfirmDialog, - QQuickWebEngineJavaScriptDialogRequest::DialogTypeConfirm) -ASSERT_ENUMS_MATCH(WebContentsAdapterClient::PromptDialog, - QQuickWebEngineJavaScriptDialogRequest::DialogTypePrompt) -ASSERT_ENUMS_MATCH(WebContentsAdapterClient::UnloadDialog, - QQuickWebEngineJavaScriptDialogRequest::DialogTypeBeforeUnload) - -ASSERT_ENUMS_MATCH(FilePickerController::Open, - QQuickWebEngineFileDialogRequest::FileModeOpen) -ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, - QQuickWebEngineFileDialogRequest::FileModeOpenMultiple) -ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, - QQuickWebEngineFileDialogRequest::FileModeUploadFolder) -ASSERT_ENUMS_MATCH(FilePickerController::Save, - QQuickWebEngineFileDialogRequest::FileModeSave) - -/*! - \qmltype AuthenticationDialogRequest - \instantiates QQuickWebEngineAuthenticationDialogRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.4 - - \brief A request for providing authentication credentials required - by proxies or HTTP servers. - - An AuthenticationDialogRequest is passed as an argument of the - WebEngineView::authenticationDialogRequested signal. It is generated - when basic HTTP or proxy authentication is required. The type - of authentication can be checked with the \l type property. - - The \l accepted property of the request indicates whether the request - is handled by the user code or the default dialog should be displayed. - If you set the \l accepted property to \c true, make sure to call - either \l dialogAccept() or \l dialogReject() afterwards. - - The following code uses a custom dialog to handle the request: - \code - - WebEngineView { - // ... - onAuthenticationDialogRequested: function(request) { - request.accepted = true; - myDialog.request = request // keep the reference to the request - myDialog.accept.connect(request.dialogAccept); - myDialog.reject.connect(request.dialogReject); - myDialog.visible = true; - } - // ... - } - - \endcode -*/ - -QQuickWebEngineAuthenticationDialogRequest::QQuickWebEngineAuthenticationDialogRequest( - QSharedPointer<AuthenticationDialogController> controller, - QObject *parent): - QObject(parent) - , m_controller(controller.toWeakRef()) - , m_url(controller->url()) - , m_realm(controller->realm()) - , m_type(controller->isProxy() ? AuthenticationTypeProxy - : AuthenticationTypeHTTP) - , m_host(controller->host()) - , m_accepted(false) -{ - -} - -QQuickWebEngineAuthenticationDialogRequest::~QQuickWebEngineAuthenticationDialogRequest() -{ -} - -/*! - \qmlproperty url AuthenticationDialogRequest::url - \readonly - - The URL of the HTTP request for which authentication was requested. - In case of proxy authentication, this is a request URL which is proxied - via host. - - \sa proxyHost -*/ - -QUrl QQuickWebEngineAuthenticationDialogRequest::url() const -{ - return m_url; -} - -/*! - \qmlproperty string AuthenticationDialogRequest::realm - \readonly - - The HTTP authentication realm attribute value of the \c WWW-Authenticate - header. Empty if \l type is AuthenticationTypeProxy. -*/ - -QString QQuickWebEngineAuthenticationDialogRequest::realm() const -{ - return m_realm; -} - -/*! - \qmlproperty string AuthenticationDialogRequest::proxyHost - \readonly - - The hostname of the authentication proxy. - Empty if \l type is AuthenticationTypeHTTP. -*/ - -QString QQuickWebEngineAuthenticationDialogRequest::proxyHost() const -{ - return m_host; -} - -/*! - \qmlproperty enumeration AuthenticationDialogRequest::type - \readonly - - The type of the authentication request. - - \value WebEngineAuthenticationDialogRequest.AuthenticationTypeHTTP - HTTP authentication. - \value WebEngineAuthenticationDialogRequest.AuthenticationTypeProxy - Proxy authentication. -*/ - -QQuickWebEngineAuthenticationDialogRequest::AuthenticationType -QQuickWebEngineAuthenticationDialogRequest::type() const -{ - return m_type; -} - -/*! - \qmlproperty bool AuthenticationDialogRequest::accepted - - Indicates whether the authentication dialog request has been - accepted by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::authenticationDialogRequested have been executed, - a default authentication dialog will be shown. - To prevent this, set \c{request.accepted} to \c true. - - The default is \c false. -*/ - -bool QQuickWebEngineAuthenticationDialogRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineAuthenticationDialogRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - -/*! - \qmlmethod void AuthenticationDialogRequest::dialogAccept(string username, string password) - - This function notifies the engine that the user accepted the dialog, - providing the \a username and the \a password required for authentication. -*/ - -void QQuickWebEngineAuthenticationDialogRequest::dialogAccept(const QString &user, - const QString &password) -{ - m_accepted = true; - QSharedPointer<AuthenticationDialogController> controller - = m_controller.toStrongRef(); - if (controller) - controller->accept(user,password); -} - -/*! - \qmlmethod void AuthenticationDialogRequest::dialogReject() - - This function notifies the engine that the user rejected the dialog and the - authentication shall not proceed. -*/ - -void QQuickWebEngineAuthenticationDialogRequest::dialogReject() -{ - m_accepted = true; - QSharedPointer<AuthenticationDialogController> controller - = m_controller.toStrongRef(); - if (controller) - controller->reject(); -} - -/////////////////////////////////////////////////////////////////////////////// - -/*! - \qmltype JavaScriptDialogRequest - \instantiates QQuickWebEngineJavaScriptDialogRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.4 - - \brief A request for showing an alert, a confirmation, or a prompt dialog - from within JavaScript to the user. - - A JavaScriptDialogRequest is passed as an argument of the - WebEngineView::javaScriptDialogRequested signal. The request is emitted - if JavaScript on the page calls HTML5's - \l{https://www.w3.org/TR/html5/webappapis.html#simple-dialogs}{Simple Dialogs} - API, or in response to HTML5's - \l {https://www.w3.org/TR/html5/browsers.html#beforeunloadevent}{BeforeUnloadEvent}. - The type of a particular dialog can be checked with the \l type property. - - The \l accepted property of the request indicates whether the request - is handled by the user code or the default dialog should be displayed. - If you set the \l accepted property to \c true, make sure to call either - \l dialogAccept() or \l dialogReject() afterwards. The JavaScript call - causing the request will be blocked until then. - - The following code uses a custom dialog to handle the request: - - \code - WebEngineView { - // ... - onJavaScriptDialogRequested: function(request) { - request.accepted = true; - myDialog.request = request // keep the reference to the request - myDialog.accept.connect(request.dialogAccept); - myDialog.reject.connect(request.dialogReject); - myDialog.visible = true; - } - // ... - } - \endcode -*/ - -QQuickWebEngineJavaScriptDialogRequest::QQuickWebEngineJavaScriptDialogRequest( - QSharedPointer<JavaScriptDialogController> controller, QObject *parent): - QObject(parent) - , m_controller(controller.toWeakRef()) - , m_message(controller->message()) - , m_defaultPrompt(controller->defaultPrompt()) - , m_title(controller->title()) - , m_type(static_cast<QQuickWebEngineJavaScriptDialogRequest::DialogType>(controller->type())) - , m_securityOrigin(controller->securityOrigin()) - , m_accepted(false) -{ -} - -QQuickWebEngineJavaScriptDialogRequest::~QQuickWebEngineJavaScriptDialogRequest() -{ - -} - -/*! - \qmlproperty string JavaScriptDialogRequest::message - \readonly - - The message to be shown to the user. -*/ - -QString QQuickWebEngineJavaScriptDialogRequest::message() const -{ - return m_message; -} - -/*! - \qmlproperty string JavaScriptDialogRequest::defaultText - \readonly - - The default prompt text, if the requested dialog is a prompt. -*/ - - -QString QQuickWebEngineJavaScriptDialogRequest::defaultText() const -{ - return m_defaultPrompt; -} - -/*! - \qmlproperty string JavaScriptDialogRequest::title - \readonly - - A default title for the dialog. -*/ - -QString QQuickWebEngineJavaScriptDialogRequest::title() const -{ - return m_title; -} - -/*! - \qmlproperty enumeration JavaScriptDialogRequest::type - \readonly - - Returns the type of the requested dialog box. For more information, see - HTML5's - \l{https://www.w3.org/TR/html5/webappapis.html#simple-dialogs}{Simple Dialogs}. - - \value JavaScriptDialogRequest.DialogTypeAlert - A JavaScript alert dialog. - \value JavaScriptDialogRequest.DialogTypeConfirm - A JavaScript confirmation dialog. - \value JavaScriptDialogRequest.DialogTypePrompt - A JavaScript prompt dialog. - \value JavaScriptDialogRequest.DialogTypeBeforeUnload - The users should be asked if they want to leave the page. -*/ - -QQuickWebEngineJavaScriptDialogRequest::DialogType QQuickWebEngineJavaScriptDialogRequest::type() const -{ - return m_type; -} - -/*! - \qmlproperty url JavaScriptDialogRequest::securityOrigin - \readonly - - The URL of the security origin. -*/ - -QUrl QQuickWebEngineJavaScriptDialogRequest::securityOrigin() const -{ - return m_securityOrigin; -} - -/*! - \qmlproperty bool JavaScriptDialogRequest::accepted - - Indicates whether the JavaScript dialog request has been - accepted by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::javaScriptDialogRequested have been executed, - a default dialog will be shown. - To prevent this, set \c{request.accepted} to \c true. - - The default is \c false. -*/ - -bool QQuickWebEngineJavaScriptDialogRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineJavaScriptDialogRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - -/*! - \qmlmethod void JavaScriptDialogRequest::dialogAccept() - - This function notifies the engine that the user accepted the dialog. -*/ - -/*! - \qmlmethod void JavaScriptDialogRequest::dialogAccept(string text) - - This function notifies the engine that the user accepted the dialog, - providing the \a text in case of a prompt message box. -*/ - -void QQuickWebEngineJavaScriptDialogRequest::dialogAccept(const QString& text) -{ - m_accepted = true; - QSharedPointer<JavaScriptDialogController> controller - = m_controller.toStrongRef(); - if (controller) { - controller->textProvided(text); - controller->accept(); - } -} - -/*! - \qmlmethod void JavaScriptDialogRequest::dialogReject() - - This function notifies the engine that the user rejected the dialog. -*/ - -void QQuickWebEngineJavaScriptDialogRequest::dialogReject() -{ - m_accepted = true; - QSharedPointer<JavaScriptDialogController> controller - = m_controller.toStrongRef(); - if (controller) - controller->reject(); -} - -/////////////////////////////////////////////////////////////////////////////// - -/*! - \qmltype ColorDialogRequest - \instantiates QQuickWebEngineColorDialogRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.4 - - \brief A request for selecting a color by the user. - - A ColorDialogRequest is passed as an argument of the - WebEngineView::colorDialogRequested signal. It is generated when - a color picker dialog is requested. See - \l { https://www.w3.org/TR/html5/forms.html#color-state-(type=color)} - {HTML5 Color State}. - - The \l accepted property of the request indicates whether the request - is handled by the user code or the default dialog should be displayed. - If you set the \l accepted property to \c true, make sure to call either - \l dialogAccept() or \l dialogReject() afterwards. - - The following code uses a custom dialog to handle the request: - - \code - WebEngineView { - // ... - onColorDialogRequested: function(request) { - request.accepted = true; - myDialog.request = request // keep the reference to the request - myDialog.accept.connect(request.dialogAccept); - myDialog.reject.connect(request.dialogReject); - myDialog.visible = true; - } - // ... - } - \endcode -*/ - -QQuickWebEngineColorDialogRequest::QQuickWebEngineColorDialogRequest( - QSharedPointer<ColorChooserController> controller, QObject *parent): - QObject(parent) - , m_controller(controller.toWeakRef()) - , m_color(controller->initialColor()) - , m_accepted(false) -{ - -} - -QQuickWebEngineColorDialogRequest::~QQuickWebEngineColorDialogRequest() -{ - -} - -/*! - \qmlproperty color ColorDialogRequest::color - \readonly - - The default color to be selected in the dialog. -*/ - -QColor QQuickWebEngineColorDialogRequest::color() const -{ - return m_color; -} - -/*! - \qmlproperty bool ColorDialogRequest::accepted - - Indicates whether the color picker dialog request has been - accepted by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::colorDialogRequested have been executed, - a default color picker dialog will be shown. - To prevent this, set \c{request.accepted} to \c true. - - The default is \c false. -*/ - -bool QQuickWebEngineColorDialogRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineColorDialogRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - - -/*! - \qmlmethod void ColorDialogRequest::dialogAccept(color color) - - This function notifies the engine that the user accepted the dialog, - providing the \a color. -*/ - -void QQuickWebEngineColorDialogRequest::dialogAccept(const QColor &color) -{ - m_accepted = true; - QSharedPointer<ColorChooserController> controller = m_controller.toStrongRef(); - if (controller) - controller->accept(color); -} - -/*! - \qmlmethod void ColorDialogRequest::dialogReject() - - This function notifies the engine that the user rejected the dialog. -*/ - -void QQuickWebEngineColorDialogRequest::dialogReject() -{ - m_accepted = true; - QSharedPointer<ColorChooserController> controller = m_controller.toStrongRef(); - if (controller) - controller->reject(); -} - -/////////////////////////////////////////////////////////////////////////////// - -/*! - \qmltype FileDialogRequest - \instantiates QQuickWebEngineFileDialogRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.4 - - \brief A request for letting the user choose a (new or existing) file or - directory. - - A FileDialogRequest is passed as an argument of the - WebEngineView::fileDialogRequested signal. It is generated - when the file dialog is requested by the input element. - See \l {https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)}{File Upload state}. - - The \l accepted property of the request indicates whether the request - is handled by the user code or the default dialog should be displayed. - If you set the \l accepted property to \c true, make sure to call either - \l dialogAccept() or \l dialogReject() afterwards. - - The following code uses a custom dialog to handle the request: - - \code - WebEngineView { - // ... - onFileDialogRequested: function(request) { - request.accepted = true; - myDialog.request = request // keep the reference to the request - myDialog.accept.connect(request.dialogAccept); - myDialog.reject.connect(request.dialogReject); - myDialog.visible = true; - } - // ... - } - \endcode -*/ - -QQuickWebEngineFileDialogRequest::QQuickWebEngineFileDialogRequest( - QSharedPointer<FilePickerController> controller, QObject *parent): - QObject(parent) - , m_controller(controller.toWeakRef()) - , m_filename(controller->defaultFileName()) - , m_acceptedMimeTypes(controller->acceptedMimeTypes()) - , m_mode(static_cast<QQuickWebEngineFileDialogRequest::FileMode>(controller->mode())) - , m_accepted(false) -{ - -} - -QQuickWebEngineFileDialogRequest::~QQuickWebEngineFileDialogRequest() -{ - -} - -/*! - \qmlproperty stringlist FileDialogRequest::acceptedMimeTypes - \readonly - - A list of MIME types specified in the input element. The selection - should be restricted to only these types of files. -*/ - -QStringList QQuickWebEngineFileDialogRequest::acceptedMimeTypes() const -{ - return m_acceptedMimeTypes; -} - -/*! - \qmlproperty string FileDialogRequest::defaultFileName - \readonly - - The default name of the file to be selected in the dialog. -*/ - -QString QQuickWebEngineFileDialogRequest::defaultFileName() const -{ - return m_filename; -} - -/*! - \qmlproperty enumeration FileDialogRequest::mode - \readonly - - The mode of the file dialog. - - \value FileDialogRequest.FileModeOpen - Allows users to specify a single existing file. - \value FileDialogRequest.FileModeOpenMultiple - Allows users to specify multiple existing files. - \value FileDialogRequest.FileModeUploadFolder - Allows users to specify a single existing folder for upload. - \value FileDialogRequest.FileModeSave - Allows users to specify a non-existing file. If an existing file - is selected, the users should be informed that the file is going - to be overwritten. -*/ - -QQuickWebEngineFileDialogRequest::FileMode QQuickWebEngineFileDialogRequest::mode() const -{ - return m_mode; -} - -/*! - \qmlproperty bool FileDialogRequest::accepted - - Indicates whether the file picker dialog request has been - handled by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::fileDialogRequested have been executed, - a default file picker dialog will be shown. - To prevent this, set \c{request.accepted} to \c true. - - The default is \c false. -*/ - -bool QQuickWebEngineFileDialogRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineFileDialogRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - -/*! - \qmlmethod void FileDialogRequest::dialogAccept(stringlist files) - - This function needs to be called when the user accepted the dialog with - \a files. -*/ - -void QQuickWebEngineFileDialogRequest::dialogAccept(const QStringList &files) -{ - m_accepted = true; - QSharedPointer<FilePickerController> controller = m_controller.toStrongRef(); - if (controller) - controller->accepted(files); -} - -/*! - \qmlmethod void FileDialogRequest::dialogReject() - - This function needs to be called when the user did not accepted the dialog. -*/ - -void QQuickWebEngineFileDialogRequest::dialogReject() -{ - m_accepted = true; - QSharedPointer<FilePickerController> controller = m_controller.toStrongRef(); - if (controller) - controller->rejected(); -} - -/////////////////////////////////////////////////////////////////////////////// - -/*! - \qmltype FormValidationMessageRequest - \instantiates QQuickWebEngineFormValidationMessageRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.4 - \obsolete - - \brief A request for showing a HTML5 form validation message to the user. - - No longer used since 5.11, as Blink now renders Validation messages internally. -*/ - -QQuickWebEngineFormValidationMessageRequest::QQuickWebEngineFormValidationMessageRequest( - QQuickWebEngineFormValidationMessageRequest::RequestType type, const QRect& anchor, - const QString &mainText, const QString &subText, QObject *parent): - QObject(parent) - , m_anchor(anchor) - , m_mainText(mainText) - , m_subText(subText) - , m_type(type) - , m_accepted(false) -{ - -} - -QQuickWebEngineFormValidationMessageRequest::~QQuickWebEngineFormValidationMessageRequest() -{ - -} - -/*! - \qmlproperty rectangle FormValidationMessageRequest::anchor - \readonly - - An anchor of an element in the viewport for which the form - validation message should be displayed. -*/ - -QRect QQuickWebEngineFormValidationMessageRequest::anchor() const -{ - return m_anchor; -} - -/*! - \qmlproperty bool FormValidationMessageRequest::text - \readonly - - The text of the form validation message. -*/ - - -QString QQuickWebEngineFormValidationMessageRequest::text() const -{ - return m_mainText; -} - -/*! - \qmlproperty bool FormValidationMessageRequest::subText - \readonly - - The subtext of the form validation message. -*/ - - -QString QQuickWebEngineFormValidationMessageRequest::subText() const -{ - return m_subText; -} - -/*! - \qmlproperty enumeration FormValidationMessageRequest::type - \readonly - - The type of the form validation message request. - - \value ValidationMessageRequest.Show - The form validation message should be shown. - \value ValidationMessageRequest.Hide - The form validation message should be hidden. - \value ValidationMessageRequest.Move - The form validation message should be moved. -*/ - -QQuickWebEngineFormValidationMessageRequest::RequestType QQuickWebEngineFormValidationMessageRequest::type() const -{ - return m_type; -} - -/*! - \qmlproperty bool FormValidationMessageRequest::accepted - - Indicates whether the form validation request has been - accepted by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::validationMessageRequested have been executed, - a default file validation message will be shown. - To prevent this, set \c {request.accepted} to \c true. - - The default is \c false. -*/ - -bool QQuickWebEngineFormValidationMessageRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineFormValidationMessageRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - -/////////////////////////////////////////////////////////////////////////////// - -/*! - \qmltype TooltipRequest - \instantiates QQuickWebEngineTooltipRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.10 - - \brief A request for showing a tooltip to the user. -*/ - -QQuickWebEngineTooltipRequest::QQuickWebEngineTooltipRequest( - const QString &text, QObject *parent): - QObject(parent) - , m_text(text) - , m_type(text.isEmpty() ? RequestType::Hide : RequestType::Show) - , m_accepted(false) -{ - Q_ASSERT(parent); - if (QQuickItem *view = qobject_cast<QQuickItem *>(parent)) - m_position = view->mapFromGlobal(view->cursor().pos()).toPoint(); -} - -QQuickWebEngineTooltipRequest::~QQuickWebEngineTooltipRequest() -{ - -} - -/*! - \qmlproperty int TooltipRequest::x - \readonly - - The x coordinate of the top-left corner of the requested tooltip. -*/ - -int QQuickWebEngineTooltipRequest::x() const -{ - return m_position.x(); -} - -/*! - \qmlproperty int TooltipRequest::y - \readonly - - The y coordinate of the top-left corner of the requested tooltip. -*/ - -int QQuickWebEngineTooltipRequest::y() const -{ - return m_position.y(); -} - -/*! - \qmlproperty bool TooltipRequest::text - \readonly - - The text of the tooltip. It contains an empty string when the - tooltip should be hidden. -*/ - - -QString QQuickWebEngineTooltipRequest::text() const -{ - return m_text; -} - -/*! - \qmlproperty enumeration TooltipRequest::type - \readonly - - The type of the tooltip request. - - \value TooltipRequest.Show - The tooltip should be shown. - \value TooltipRequest.Hide - The tooltip should be hidden. -*/ - -QQuickWebEngineTooltipRequest::RequestType QQuickWebEngineTooltipRequest::type() const -{ - return m_type; -} - -/*! - \qmlproperty bool TooltipRequest::accepted - - Indicates whether the tooltip request has been accepted - by the signal handler. - - If the property is \c false after any signal handlers - for WebEngineView::tooltipRequested have been executed, - a default tooltip will be shown. - To prevent this, set \c {request.accepted} to \c true. - - The default is \c false. -*/ - -bool QQuickWebEngineTooltipRequest::isAccepted() const -{ - return m_accepted; -} - -void QQuickWebEngineTooltipRequest::setAccepted(bool accepted) -{ - m_accepted = accepted; -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginedialogrequests_p.h b/src/webengine/api/qquickwebenginedialogrequests_p.h deleted file mode 100644 index 5e3f7c547..000000000 --- a/src/webengine/api/qquickwebenginedialogrequests_p.h +++ /dev/null @@ -1,298 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINDIALOGREQUESTS_H -#define QQUICKWEBENGINDIALOGREQUESTS_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QtCore/QUrl> -#include <QtCore/QWeakPointer> -#include <QtCore/QRect> -#include <QtGui/QColor> - -namespace QtWebEngineCore { - class AuthenticationDialogController; - class ColorChooserController; - class FilePickerController; - class JavaScriptDialogController; -} - -QT_BEGIN_NAMESPACE - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineAuthenticationDialogRequest : public QObject { - Q_OBJECT -public: - - enum AuthenticationType { - AuthenticationTypeHTTP, - AuthenticationTypeProxy - }; - - Q_ENUM(AuthenticationType) - - Q_PROPERTY(QUrl url READ url CONSTANT FINAL) - Q_PROPERTY(QString realm READ realm CONSTANT FINAL) - Q_PROPERTY(QString proxyHost READ proxyHost CONSTANT FINAL) - Q_PROPERTY(AuthenticationType type READ type CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - - ~QQuickWebEngineAuthenticationDialogRequest(); - - QUrl url() const; - QString realm() const; - QString proxyHost() const; - AuthenticationType type() const; - bool isAccepted() const; - void setAccepted(bool accepted); - -public slots: - void dialogAccept(const QString &user, const QString &password); - void dialogReject(); - -private: - QQuickWebEngineAuthenticationDialogRequest(QSharedPointer<QtWebEngineCore::AuthenticationDialogController> controller, - QObject *parent = nullptr); - QWeakPointer<QtWebEngineCore::AuthenticationDialogController> m_controller; - QUrl m_url; - QString m_realm; - AuthenticationType m_type; - QString m_host; - bool m_accepted; - friend class QQuickWebEngineViewPrivate; - Q_DISABLE_COPY(QQuickWebEngineAuthenticationDialogRequest) -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineJavaScriptDialogRequest : public QObject { - Q_OBJECT -public: - - enum DialogType { - DialogTypeAlert, - DialogTypeConfirm, - DialogTypePrompt, - DialogTypeBeforeUnload, - }; - Q_ENUM(DialogType) - - Q_PROPERTY(QString message READ message CONSTANT FINAL) - Q_PROPERTY(QString defaultText READ defaultText CONSTANT FINAL) - Q_PROPERTY(QString title READ title CONSTANT FINAL) - Q_PROPERTY(DialogType type READ type CONSTANT FINAL) - Q_PROPERTY(QUrl securityOrigin READ securityOrigin CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - - ~QQuickWebEngineJavaScriptDialogRequest(); - - QString message() const; - QString defaultText() const; - QString title() const; - DialogType type() const; - QUrl securityOrigin() const; - bool isAccepted() const; - void setAccepted(bool accepted); - -public slots: - void dialogAccept(const QString& text = QString()); - void dialogReject(); - -private: - QQuickWebEngineJavaScriptDialogRequest(QSharedPointer<QtWebEngineCore::JavaScriptDialogController> controller, - QObject *parent = nullptr); - QWeakPointer<QtWebEngineCore::JavaScriptDialogController> m_controller; - QString m_message; - QString m_defaultPrompt; - QString m_title; - DialogType m_type; - QUrl m_securityOrigin; - bool m_accepted; - friend class QQuickWebEngineViewPrivate; - Q_DISABLE_COPY(QQuickWebEngineJavaScriptDialogRequest) -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineColorDialogRequest : public QObject { - Q_OBJECT -public: - - Q_PROPERTY(QColor color READ color CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - - ~QQuickWebEngineColorDialogRequest(); - - QColor color() const; - bool isAccepted() const; - void setAccepted(bool accepted); - -public slots: - void dialogAccept(const QColor &color); - void dialogReject(); - -private: - QQuickWebEngineColorDialogRequest(QSharedPointer<QtWebEngineCore::ColorChooserController> controller, - QObject *parent = nullptr); - QWeakPointer<QtWebEngineCore::ColorChooserController> m_controller; - QColor m_color; - bool m_accepted; - friend class QQuickWebEngineViewPrivate; - Q_DISABLE_COPY(QQuickWebEngineColorDialogRequest) -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineFileDialogRequest : public QObject { - Q_OBJECT -public: - - enum FileMode { - FileModeOpen, - FileModeOpenMultiple, - FileModeUploadFolder, - FileModeSave - }; - Q_ENUM(FileMode) - - Q_PROPERTY(QString defaultFileName READ defaultFileName CONSTANT FINAL) - Q_PROPERTY(QStringList acceptedMimeTypes READ acceptedMimeTypes CONSTANT FINAL) - Q_PROPERTY(FileMode mode READ mode CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - - ~QQuickWebEngineFileDialogRequest(); - - QStringList acceptedMimeTypes() const; - QString defaultFileName() const; - FileMode mode() const; - bool isAccepted() const; - void setAccepted(bool accepted); - -public slots: - void dialogAccept(const QStringList &files); - void dialogReject(); - -private: - QQuickWebEngineFileDialogRequest(QSharedPointer<QtWebEngineCore::FilePickerController> controller, - QObject *parent = nullptr); - QWeakPointer<QtWebEngineCore::FilePickerController> m_controller; - QString m_filename; - QStringList m_acceptedMimeTypes; - FileMode m_mode; - bool m_accepted; - friend class QQuickWebEngineViewPrivate; - Q_DISABLE_COPY(QQuickWebEngineFileDialogRequest) -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineFormValidationMessageRequest : public QObject { - Q_OBJECT -public: - enum RequestType { - Show, - Hide, - Move, - }; - Q_ENUM(RequestType) - Q_PROPERTY(QRect anchor READ anchor CONSTANT FINAL) - Q_PROPERTY(QString text READ text CONSTANT FINAL) - Q_PROPERTY(QString subText READ subText CONSTANT FINAL) - Q_PROPERTY(RequestType type READ type CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - - ~QQuickWebEngineFormValidationMessageRequest(); - QRect anchor() const; - QString text() const; - QString subText() const; - RequestType type() const; - bool isAccepted() const; - void setAccepted(bool accepted); - -private: - QQuickWebEngineFormValidationMessageRequest(RequestType type, const QRect &anchor = QRect(), - const QString &mainText = QString(), - const QString &subText = QString(), - QObject *parent = nullptr); - QRect m_anchor; - QString m_mainText; - QString m_subText; - RequestType m_type; - bool m_accepted; - friend class QQuickWebEngineViewPrivate; -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTooltipRequest : public QObject { - Q_OBJECT -public: - enum RequestType { - Show, - Hide, - }; - Q_ENUM(RequestType) - Q_PROPERTY(int x READ x CONSTANT FINAL) - Q_PROPERTY(int y READ y CONSTANT FINAL) - Q_PROPERTY(QString text READ text CONSTANT FINAL) - Q_PROPERTY(RequestType type READ type CONSTANT FINAL) - Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL) - - ~QQuickWebEngineTooltipRequest(); - int x() const; - int y() const; - QString text() const; - RequestType type() const; - bool isAccepted() const; - void setAccepted(bool accepted); - -private: - QQuickWebEngineTooltipRequest(const QString &text = QString(), - QObject *parent = nullptr); - QPoint m_position; - QString m_text; - RequestType m_type; - bool m_accepted; - friend class QQuickWebEngineViewPrivate; - Q_DISABLE_COPY(QQuickWebEngineTooltipRequest) -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINDIALOGREQUESTS_H diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp deleted file mode 100644 index f9b305e88..000000000 --- a/src/webengine/api/qquickwebenginedownloaditem.cpp +++ /dev/null @@ -1,778 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginedownloaditem_p.h" -#include "qquickwebenginedownloaditem_p_p.h" - -#include "profile_adapter.h" -#include "qquickwebengineprofile_p.h" - -#include <QDir> -#include "QFileInfo" - -using QtWebEngineCore::ProfileAdapterClient; - -QT_BEGIN_NAMESPACE - -ASSERT_ENUMS_MATCH(ProfileAdapterClient::NoReason, QQuickWebEngineDownloadItem::NoReason) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileFailed, QQuickWebEngineDownloadItem::FileFailed) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileAccessDenied, QQuickWebEngineDownloadItem::FileAccessDenied) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNoSpace, QQuickWebEngineDownloadItem::FileNoSpace) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileNameTooLong, QQuickWebEngineDownloadItem::FileNameTooLong) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooLarge, QQuickWebEngineDownloadItem::FileTooLarge) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileVirusInfected, QQuickWebEngineDownloadItem::FileVirusInfected) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTransientError, QQuickWebEngineDownloadItem::FileTransientError) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileBlocked, QQuickWebEngineDownloadItem::FileBlocked) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileSecurityCheckFailed, QQuickWebEngineDownloadItem::FileSecurityCheckFailed) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileTooShort, QQuickWebEngineDownloadItem::FileTooShort) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::FileHashMismatch, QQuickWebEngineDownloadItem::FileHashMismatch) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkFailed, QQuickWebEngineDownloadItem::NetworkFailed) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkTimeout, QQuickWebEngineDownloadItem::NetworkTimeout) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkDisconnected, QQuickWebEngineDownloadItem::NetworkDisconnected) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkServerDown, QQuickWebEngineDownloadItem::NetworkServerDown) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::NetworkInvalidRequest, QQuickWebEngineDownloadItem::NetworkInvalidRequest) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerFailed, QQuickWebEngineDownloadItem::ServerFailed) -//ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerNoRange, QQuickWebEngineDownloadItem::ServerNoRange) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerBadContent, QQuickWebEngineDownloadItem::ServerBadContent) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnauthorized, QQuickWebEngineDownloadItem::ServerUnauthorized) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerCertProblem, QQuickWebEngineDownloadItem::ServerCertProblem) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerForbidden, QQuickWebEngineDownloadItem::ServerForbidden) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::ServerUnreachable, QQuickWebEngineDownloadItem::ServerUnreachable) -ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserCanceled, QQuickWebEngineDownloadItem::UserCanceled) -//ASSERT_ENUMS_MATCH(ProfileAdapterClient::UserShutdown, QQuickWebEngineDownloadItem::UserShutdown) -//ASSERT_ENUMS_MATCH(ProfileAdapterClient::Crash, QQuickWebEngineDownloadItem::Crash) - -static inline QQuickWebEngineDownloadItem::DownloadState toDownloadState(int state) { - switch (state) { - case ProfileAdapterClient::DownloadInProgress: - return QQuickWebEngineDownloadItem::DownloadInProgress; - case ProfileAdapterClient::DownloadCompleted: - return QQuickWebEngineDownloadItem::DownloadCompleted; - case ProfileAdapterClient::DownloadCancelled: - return QQuickWebEngineDownloadItem::DownloadCancelled; - case ProfileAdapterClient::DownloadInterrupted: - return QQuickWebEngineDownloadItem::DownloadInterrupted; - default: - Q_UNREACHABLE(); - return QQuickWebEngineDownloadItem::DownloadCancelled; - } -} - -static inline QQuickWebEngineDownloadItem::DownloadInterruptReason toDownloadInterruptReason(int reason) -{ - return static_cast<QQuickWebEngineDownloadItem::DownloadInterruptReason>(reason); -} - -QQuickWebEngineDownloadItemPrivate::QQuickWebEngineDownloadItemPrivate(QQuickWebEngineProfile *p, const QUrl &url) - : profile(p) - , downloadId(-1) - , downloadState(QQuickWebEngineDownloadItem::DownloadCancelled) - , savePageFormat(QQuickWebEngineDownloadItem::UnknownSaveFormat) - , type(QQuickWebEngineDownloadItem::Attachment) - , interruptReason(QQuickWebEngineDownloadItem::NoReason) - , totalBytes(-1) - , receivedBytes(0) - , downloadFinished(false) - , downloadPaused(false) - , view(nullptr) - , downloadUrl(url) -{ -} - -QQuickWebEngineDownloadItemPrivate::~QQuickWebEngineDownloadItemPrivate() -{ - if (profile) - profile->d_ptr->downloadDestroyed(downloadId); -} - -/*! - \qmltype WebEngineDownloadItem - \instantiates QQuickWebEngineDownloadItem - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - \brief Provides information about a download. - - WebEngineDownloadItem models a download throughout its life cycle, starting - with a pending download request and finishing with a completed download. It - can be used, for example, to get information about new downloads, to monitor - progress, and to pause, resume, and cancel downloads. - - Downloads are usually triggered by user interaction on a web page. It is the - WebEngineProfile's responsibility to notify the application of new download - requests, which it does by emitting the - \l{WebEngineProfile::downloadRequested}{downloadRequested} signal together - with a newly created WebEngineDownloadItem. The application can then examine - this item and decide whether to accept it or not. A signal handler must - explicitly call accept() on the item for \QWE to actually start - downloading and writing data to disk. If no signal handler calls accept(), - then the download request will be automatically rejected and nothing will be - written to disk. - - \note Some properties, like the \l path under which the file will be saved, - can only be changed before calling accept(). - - \section2 Object Life Cycle - - All items are guaranteed to be valid during the emission of the - \l{WebEngineProfile::downloadRequested}{downloadRequested} signal. If - accept() is \e not called by any signal handler, then the item will be - deleted \e immediately after signal emission. This means that the - application \b{must not} keep references to rejected download items. - - \section2 Web Page Downloads - - In addition to normal file downloads, which consist simply of retrieving - some raw bytes from the network and writing them to disk, \QWE also - supports saving complete web pages, which involves parsing the page's HTML, - downloading any dependent resources, and potentially packaging everything - into a special file format (\l savePageFormat). To check if a download is - for a file or a web page, use \l isSavePageDownload. - - \sa WebEngineProfile, WebEngineProfile::downloadRequested, - WebEngineProfile::downloadFinished -*/ - -void QQuickWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadItemInfo &info) -{ - Q_Q(QQuickWebEngineDownloadItem); - - updateState(toDownloadState(info.state)); - - if (toDownloadInterruptReason(info.downloadInterruptReason) != interruptReason) { - interruptReason = toDownloadInterruptReason(info.downloadInterruptReason); - Q_EMIT q->interruptReasonChanged(); - } - - if (info.receivedBytes != receivedBytes) { - receivedBytes = info.receivedBytes; - Q_EMIT q->receivedBytesChanged(); - } - - if (info.totalBytes != totalBytes) { - totalBytes = info.totalBytes; - Q_EMIT q->totalBytesChanged(); - } - - if (info.done) - setFinished(); - - if (info.paused != downloadPaused) { - downloadPaused = info.paused; - Q_EMIT q->isPausedChanged(); - } -} - -void QQuickWebEngineDownloadItemPrivate::updateState(QQuickWebEngineDownloadItem::DownloadState newState) -{ - Q_Q(QQuickWebEngineDownloadItem); - - if (downloadState != newState) { - downloadState = newState; - Q_EMIT q->stateChanged(); - } -} - -void QQuickWebEngineDownloadItemPrivate::setFinished() -{ - Q_Q(QQuickWebEngineDownloadItem); - - if (downloadFinished) - return; - - downloadFinished = true; - Q_EMIT q->isFinishedChanged(); -} - -/*! - \qmlmethod void WebEngineDownloadItem::accept() - - Accepts the download request, which will start the download. - - If the item is in the \c DownloadRequested state, then it will transition - into the \c DownloadInProgress state and the downloading will begin. If the - item is in any other state, then nothing will happen. - - \sa state -*/ - -void QQuickWebEngineDownloadItem::accept() -{ - Q_D(QQuickWebEngineDownloadItem); - - if (d->downloadState != QQuickWebEngineDownloadItem::DownloadRequested) - return; - - d->updateState(QQuickWebEngineDownloadItem::DownloadInProgress); -} - -/*! - \qmlmethod void WebEngineDownloadItem::cancel() - - Cancels the download. - - If the item is in the \c DownloadInProgress state, then it will transition - into the \c DownloadCancelled state, the downloading will stop, and - partially downloaded files will be deleted from disk. - - If the item is in the \c DownloadCompleted state, then nothing will happen. - If the item is in any other state, then it will transition into the \c - DownloadCancelled state without further effect. - - \sa state -*/ - -void QQuickWebEngineDownloadItem::cancel() -{ - Q_D(QQuickWebEngineDownloadItem); - - QQuickWebEngineDownloadItem::DownloadState state = d->downloadState; - - if (state == QQuickWebEngineDownloadItem::DownloadCompleted - || state == QQuickWebEngineDownloadItem::DownloadCancelled) - return; - - d->updateState(QQuickWebEngineDownloadItem::DownloadCancelled); - d->setFinished(); - - // We directly cancel the download if the user cancels before - // it even started, so no need to notify the profile here. - if (state == QQuickWebEngineDownloadItem::DownloadInProgress) { - if (d->profile) - d->profile->d_ptr->cancelDownload(d->downloadId); - } -} - - -/*! - \qmlmethod void WebEngineDownloadItem::pause() - \since QtWebEngine 1.6 - - Pauses the download. - - Has no effect if the state is not \c DownloadInProgress. Does not change the - state. - - \sa resume, isPaused -*/ - -void QQuickWebEngineDownloadItem::pause() -{ - Q_D(QQuickWebEngineDownloadItem); - - QQuickWebEngineDownloadItem::DownloadState state = d->downloadState; - - if (state != QQuickWebEngineDownloadItem::DownloadInProgress) - return; - - if (d->profile) - d->profile->d_ptr->profileAdapter()->pauseDownload(d->downloadId); -} - -/*! - \qmlmethod void WebEngineDownloadItem::resume() - \since QtWebEngine 1.6 - - Resumes the download if it was paused or interrupted. - - Has no effect if the state is not \c DownloadInProgress or \c - DownloadInterrupted. Does not change the state. - - \sa pause, isPaused -*/ -void QQuickWebEngineDownloadItem::resume() -{ - Q_D(QQuickWebEngineDownloadItem); - - QQuickWebEngineDownloadItem::DownloadState state = d->downloadState; - - if (d->downloadFinished || (state != QQuickWebEngineDownloadItem::DownloadInProgress && state != QQuickWebEngineDownloadItem::DownloadInterrupted)) - return; - - if (d->profile) - d->profile->d_ptr->profileAdapter()->resumeDownload(d->downloadId); -} - -/*! - \qmlproperty int WebEngineDownloadItem::id - - Holds the download item's ID. -*/ - -quint32 QQuickWebEngineDownloadItem::id() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadId; -} - -/*! - \qmlproperty enumeration WebEngineDownloadItem::state - - Describes the state of the download: - - \value WebEngineDownloadItem.DownloadRequested - Download has been requested, but it has not been accepted yet. - \value WebEngineDownloadItem.DownloadInProgress - Download is in progress. - \value WebEngineDownloadItem.DownloadCompleted - Download completed successfully. - \value WebEngineDownloadItem.DownloadCancelled - Download was cancelled by the user. - \value WebEngineDownloadItem.DownloadInterrupted - Download has been interrupted (by the server or because of lost connectivity). -*/ - -QQuickWebEngineDownloadItem::DownloadState QQuickWebEngineDownloadItem::state() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadState; -} - -/*! - \qmlproperty int WebEngineDownloadItem::totalBytes - - Holds the total amount of data to download in bytes. - - \c -1 means the total size is unknown. -*/ - -qint64 QQuickWebEngineDownloadItem::totalBytes() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->totalBytes; -} - -/*! - \qmlproperty int WebEngineDownloadItem::receivedBytes - - Holds the amount of data in bytes that has been downloaded so far. -*/ - -qint64 QQuickWebEngineDownloadItem::receivedBytes() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->receivedBytes; -} - -/*! - \qmlproperty url WebEngineDownloadItem::url - \readonly - \since QtWebEngine 1.10 - - Returns the download's origin URL. -*/ - -QUrl QQuickWebEngineDownloadItem::url() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadUrl; -} - -/*! - \qmlproperty string WebEngineDownloadItem::mimeType - \since QtWebEngine 1.2 - - Holds the MIME type of the download. -*/ - -QString QQuickWebEngineDownloadItem::mimeType() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->mimeType; -} - -/*! - \qmlproperty string WebEngineDownloadItem::path - \obsolete - - Holds the full target path where data is being downloaded to. - - The path includes the file name. The default suggested path is the standard - download location and file name is deduced not to overwrite already existing files. - - The download path can only be set in the - \l{WebEngineProfile::downloadRequested}{downloadRequested} handler before - the download is accepted. - - \sa WebEngineProfile::downloadRequested(), accept() -*/ - -QString QQuickWebEngineDownloadItem::path() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return QDir::cleanPath(QDir(d->downloadDirectory).filePath(d->downloadFileName)); -} - -void QQuickWebEngineDownloadItem::setPath(QString path) -{ - Q_D(QQuickWebEngineDownloadItem); - if (d->downloadState != QQuickWebEngineDownloadItem::DownloadRequested) { - qWarning("Setting the download path is not allowed after the download has been accepted."); - return; - } - if (QDir(d->downloadDirectory).filePath(d->downloadFileName) != path) { - if (QFileInfo(path).fileName().isEmpty()) { - qWarning("The download path does not include file name."); - return; - } - - if (QFileInfo(path).isDir()) { - qWarning("The download path matches with an already existing directory path."); - return; - } - - QString newDirectory; - QString newFileName; - - if (QFileInfo(path).fileName() == path) { - newDirectory = QStringLiteral(""); - newFileName = path; - } else { - newDirectory = QFileInfo(path).filePath(); - newFileName = QFileInfo(path).fileName(); - } - - if (d->downloadDirectory != newDirectory) { - d->downloadDirectory = newDirectory; - Q_EMIT pathChanged(); - Q_EMIT downloadDirectoryChanged(); - } - - if (d->downloadFileName != newFileName) { - d->downloadFileName = newFileName; - Q_EMIT pathChanged(); - Q_EMIT downloadFileNameChanged(); - } - } -} - -/*! - \qmlproperty string WebEngineDownloadItem::downloadDirectory - \since QtWebEngine 1.10 - - Holds the full target path without file name where data is being downloaded to. - - The download directory can only be set in the - \l{WebEngineProfile::downloadRequested}{downloadRequested} handler before - the download is accepted. - - \sa WebEngineProfile::downloadRequested(), accept() -*/ - -QString QQuickWebEngineDownloadItem::downloadDirectory() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadDirectory; -} - -void QQuickWebEngineDownloadItem::setDownloadDirectory(QString directory) -{ - Q_D(QQuickWebEngineDownloadItem); - if (d->downloadState != QQuickWebEngineDownloadItem::DownloadRequested) { - qWarning("Setting the download directory is not allowed after the download has been accepted."); - return; - } - - QString changeDirectory = d->downloadDirectory; - if (!directory.isEmpty() && changeDirectory != directory) { - changeDirectory = directory; - - if (d->downloadDirectory != changeDirectory) { - d->downloadDirectory = changeDirectory; - Q_EMIT pathChanged(); - Q_EMIT downloadDirectoryChanged(); - } - - QString newFileName = QFileInfo(d->profile->d_ptr->profileAdapter()->updateDownloadPath(d->downloadId, - d->downloadDirectory, - d->suggestedFileName)).fileName(); - if (d->downloadFileName != newFileName) { - d->downloadFileName = newFileName; - Q_EMIT pathChanged(); - Q_EMIT downloadFileNameChanged(); - } - } -} - -/*! - \qmlproperty string WebEngineDownloadItem::downloadFileName - \since QtWebEngine 1.10 - - Holds the name of the file to which data is being downloaded. - - The download file name can only be set in the - \l{WebEngineProfile::downloadRequested}{downloadRequested} handler before - the download is accepted. - - \sa WebEngineProfile::downloadRequested(), accept() -*/ - -QString QQuickWebEngineDownloadItem::downloadFileName() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadFileName; -} - -void QQuickWebEngineDownloadItem::setDownloadFileName(QString fileName) -{ - Q_D(QQuickWebEngineDownloadItem); - if (d->downloadState != QQuickWebEngineDownloadItem::DownloadRequested) { - qWarning("Setting the download file name is not allowed after the download has been accepted."); - return; - } - - if (d->downloadFileName != fileName && !fileName.isEmpty()) { - d->downloadFileName = fileName; - Q_EMIT pathChanged(); - Q_EMIT downloadFileNameChanged(); - } -} - -/*! - \qmlproperty string WebEngineDownloadItem::suggestedFileName - \since QtWebEngine 1.10 - - Returns the suggested file name. -*/ - -QString QQuickWebEngineDownloadItem::suggestedFileName() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->suggestedFileName; -} - -/*! - \qmlproperty enumeration WebEngineDownloadItem::savePageFormat - \since QtWebEngine 1.3 - - Describes the format that is used to save a web page. - - \value WebEngineDownloadItem.UnknownSaveFormat - This is not a request for downloading a complete web page. - \value WebEngineDownloadItem.SingleHtmlSaveFormat - The page is saved as a single HTML page. Resources such as images - are not saved. - \value WebEngineDownloadItem.CompleteHtmlSaveFormat - The page is saved as a complete HTML page, for example a directory - containing the single HTML page and the resources. - \value WebEngineDownloadItem.MimeHtmlSaveFormat - The page is saved as a complete web page in the MIME HTML format. -*/ - -QQuickWebEngineDownloadItem::SavePageFormat QQuickWebEngineDownloadItem::savePageFormat() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->savePageFormat; -} - -void QQuickWebEngineDownloadItem::setSavePageFormat(QQuickWebEngineDownloadItem::SavePageFormat format) -{ - Q_D(QQuickWebEngineDownloadItem); - if (d->savePageFormat != format) { - d->savePageFormat = format; - Q_EMIT savePageFormatChanged(); - } -} - -/*! - \qmlproperty enumeration WebEngineDownloadItem::type - \readonly - \since QtWebEngine 1.4 - \obsolete - - Describes the requested download's type. - - \note This property works unreliably, except for \c SavePage - downloads. Use \l isSavePageDownload instead. - - \value WebEngineDownloadItem.Attachment The web server's response includes a - \c Content-Disposition header with the \c attachment directive. If \c Content-Disposition - is present in the reply, the web server is indicating that the client should prompt the - user to save the content regardless of the content type. - See \l {RFC 2616 section 19.5.1} for details. - \value WebEngineDownloadItem.DownloadAttribute The user clicked a link with the \c download - attribute. - \value WebEngineDownloadItem.UserRequested The user initiated the download, for example by - selecting a web action. - \value WebEngineDownloadItem.SavePage Saving of the current page was requested (for example by - the \l{WebEngineView::WebAction}{WebEngineView.SavePage} web action). - -*/ - -QQuickWebEngineDownloadItem::DownloadType QQuickWebEngineDownloadItem::type() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->type; -} - -/*! - \qmlproperty bool WebEngineDownloadItem::isSavePageDownload - \readonly - \since QtWebEngine 1.7 - - Whether this is a download request for saving a web page or a file. - - \sa savePageFormat -*/ -bool QQuickWebEngineDownloadItem::isSavePageDownload() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->type == QQuickWebEngineDownloadItem::SavePage; -} - -/*! - \qmlproperty enumeration WebEngineDownloadItem::interruptReason - \readonly - \since QtWebEngine 1.5 - - Returns the reason why the download was interrupted: - - \value WebEngineDownloadItem.NoReason Unknown reason or not interrupted. - \value WebEngineDownloadItem.FileFailed General file operation failure. - \value WebEngineDownloadItem.FileAccessDenied The file cannot be written locally, due to access restrictions. - \value WebEngineDownloadItem.FileNoSpace Insufficient space on the target drive. - \value WebEngineDownloadItem.FileNameTooLong The directory or file name is too long. - \value WebEngineDownloadItem.FileTooLarge The file size exceeds the file system limitation. - \value WebEngineDownloadItem.FileVirusInfected The file is infected with a virus. - \value WebEngineDownloadItem.FileTransientError Temporary problem (for example the file is in use, - out of memory, or too many files are opened at once). - \value WebEngineDownloadItem.FileBlocked The file was blocked due to local policy. - \value WebEngineDownloadItem.FileSecurityCheckFailed An attempt to check the safety of the download - failed due to unexpected reasons. - \value WebEngineDownloadItem.FileTooShort An attempt was made to seek past the end of a file when - opening a file (as part of resuming a previously interrupted download). - \value WebEngineDownloadItem.FileHashMismatch The partial file did not match the expected hash. - - \value WebEngineDownloadItem.NetworkFailed General network failure. - \value WebEngineDownloadItem.NetworkTimeout The network operation has timed out. - \value WebEngineDownloadItem.NetworkDisconnected The network connection has been terminated. - \value WebEngineDownloadItem.NetworkServerDown The server has gone down. - \value WebEngineDownloadItem.NetworkInvalidRequest The network request was invalid (for example, the - original or redirected URL is invalid, has an unsupported scheme, or is disallowed by policy). - - \value WebEngineDownloadItem.ServerFailed General server failure. - \value WebEngineDownloadItem.ServerBadContent The server does not have the requested data. - \value WebEngineDownloadItem.ServerUnauthorized The server did not authorize access to the resource. - \value WebEngineDownloadItem.ServerCertProblem A problem with the server certificate occurred. - \value WebEngineDownloadItem.ServerForbidden Access forbidden by the server. - \value WebEngineDownloadItem.ServerUnreachable Unexpected server response (might indicate that - the responding server may not be the intended server). - \value WebEngineDownloadItem.UserCanceled The user canceled the download. - - \sa interruptReasonString -*/ - -QQuickWebEngineDownloadItem::DownloadInterruptReason QQuickWebEngineDownloadItem::interruptReason() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->interruptReason; -} - -/*! - \qmlproperty string WebEngineDownloadItem::interruptReasonString - Returns a human-readable description of the reason for interrupting the download. - \since QtWebEngine 1.5 - - \sa interruptReason -*/ -QString QQuickWebEngineDownloadItem::interruptReasonString() const -{ - return ProfileAdapterClient::downloadInterruptReasonToString( - static_cast<ProfileAdapterClient::DownloadInterruptReason>(interruptReason())); -} - -/*! - \qmlproperty bool WebEngineDownloadItem::isFinished - \readonly - \since QtWebEngine 1.6 - - Whether this download is finished (completed, cancelled, or non-resumable interrupted state). - */ - -bool QQuickWebEngineDownloadItem::isFinished() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadFinished; -} - -/*! - \qmlproperty bool WebEngineDownloadItem::isPaused - \readonly - \since QtWebEngine 1.6 - - Whether this download is paused. - - \sa pause, resume - */ - -bool QQuickWebEngineDownloadItem::isPaused() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->downloadPaused; -} - -/*! - \qmlproperty WebEngineView WebEngineDownloadItem::view - \readonly - \since QtWebEngine 1.8 - - Returns the view the download was requested on. If the download was not triggered by content in a view, - \c nullptr is returned. - - \sa WebEngineView -*/ -QQuickWebEngineView *QQuickWebEngineDownloadItem::view() const -{ - Q_D(const QQuickWebEngineDownloadItem); - return d->view; -} - -QQuickWebEngineDownloadItem::QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate *p, QObject *parent) - : QObject(parent) - , d_ptr(p) -{ - p->q_ptr = this; -} - -QQuickWebEngineDownloadItem::~QQuickWebEngineDownloadItem() -{ - if (!isFinished()) - cancel(); -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h deleted file mode 100644 index cef99e534..000000000 --- a/src/webengine/api/qquickwebenginedownloaditem_p.h +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEDOWNLOADITEM_P_H -#define QQUICKWEBENGINEDOWNLOADITEM_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QObject> -#include <QScopedPointer> -#include <QString> -#include <QUrl> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineDownloadItemPrivate; -class QQuickWebEngineProfilePrivate; -class QQuickWebEngineView; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineDownloadItem: public QObject { - Q_OBJECT -public: - ~QQuickWebEngineDownloadItem(); - enum DownloadState { - DownloadRequested, - DownloadInProgress, - DownloadCompleted, - DownloadCancelled, - DownloadInterrupted - }; - Q_ENUM(DownloadState) - - enum SavePageFormat { - UnknownSaveFormat = -1, - SingleHtmlSaveFormat, - CompleteHtmlSaveFormat, - MimeHtmlSaveFormat - }; - Q_ENUM(SavePageFormat) - - enum DownloadInterruptReason { - NoReason = 0, - FileFailed = 1, - FileAccessDenied = 2, - FileNoSpace = 3, - FileNameTooLong = 5, - FileTooLarge = 6, - FileVirusInfected = 7, - FileTransientError = 10, - FileBlocked = 11, - FileSecurityCheckFailed = 12, - FileTooShort = 13, - FileHashMismatch = 14, - NetworkFailed = 20, - NetworkTimeout = 21, - NetworkDisconnected = 22, - NetworkServerDown = 23, - NetworkInvalidRequest = 24, - ServerFailed = 30, - //ServerNoRange = 31, - ServerBadContent = 33, - ServerUnauthorized = 34, - ServerCertProblem = 35, - ServerForbidden = 36, - ServerUnreachable = 37, - UserCanceled = 40, - //UserShutdown = 41, - //Crash = 50 - }; - Q_ENUM(DownloadInterruptReason) - - enum DownloadType { - Attachment = 0, - DownloadAttribute, - UserRequested, - SavePage - }; - Q_ENUM(DownloadType) - - Q_PROPERTY(quint32 id READ id CONSTANT FINAL) - Q_PROPERTY(DownloadState state READ state NOTIFY stateChanged FINAL) - Q_PROPERTY(SavePageFormat savePageFormat READ savePageFormat WRITE setSavePageFormat NOTIFY savePageFormatChanged REVISION 2 FINAL) - Q_PROPERTY(qint64 totalBytes READ totalBytes NOTIFY totalBytesChanged FINAL) - Q_PROPERTY(qint64 receivedBytes READ receivedBytes NOTIFY receivedBytesChanged FINAL) - Q_PROPERTY(QString mimeType READ mimeType NOTIFY mimeTypeChanged REVISION 1 FINAL) - Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged FINAL) - Q_PROPERTY(DownloadType type READ type NOTIFY typeChanged REVISION 3 FINAL) - Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged REVISION 4 FINAL) - Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged REVISION 4 FINAL) - Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged REVISION 5 FINAL) - Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL) - Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT REVISION 6 FINAL) - Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT REVISION 7 FINAL) - Q_PROPERTY(QUrl url READ url CONSTANT REVISION 8 FINAL) - Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 8 FINAL) - Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 8 FINAL) - Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 8 FINAL) - - Q_INVOKABLE void accept(); - Q_INVOKABLE void cancel(); - Q_INVOKABLE void pause(); - Q_INVOKABLE void resume(); - - quint32 id() const; - DownloadState state() const; - qint64 totalBytes() const; - qint64 receivedBytes() const; - QString mimeType() const; - QString Q_DECL_DEPRECATED path() const; - void Q_DECL_DEPRECATED setPath(QString path); - SavePageFormat savePageFormat() const; - void setSavePageFormat(SavePageFormat format); - DownloadType Q_DECL_DEPRECATED type() const; - DownloadInterruptReason interruptReason() const; - QString interruptReasonString() const; - bool isFinished() const; - bool isPaused() const; - bool isSavePageDownload() const; - QQuickWebEngineView *view() const; - QUrl url() const; - QString suggestedFileName() const; - QString downloadDirectory() const; - void setDownloadDirectory(QString directory); - QString downloadFileName() const; - void setDownloadFileName(QString fileName); - -Q_SIGNALS: - void stateChanged(); - Q_REVISION(2) void savePageFormatChanged(); - void receivedBytesChanged(); - void totalBytesChanged(); - Q_REVISION(1) void mimeTypeChanged(); - void Q_DECL_DEPRECATED pathChanged(); - Q_REVISION(3) void typeChanged(); - Q_REVISION(4) void interruptReasonChanged(); - Q_REVISION(5) void isFinishedChanged(); - Q_REVISION(5) void isPausedChanged(); - Q_REVISION(8) void downloadDirectoryChanged(); - Q_REVISION(8) void downloadFileNameChanged(); - -private: - QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate*, QObject *parent = 0); - Q_DISABLE_COPY(QQuickWebEngineDownloadItem) - Q_DECLARE_PRIVATE(QQuickWebEngineDownloadItem) - friend class QQuickWebEngineProfilePrivate; - - QScopedPointer<QQuickWebEngineDownloadItemPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEDOWNLOADITEM_P_H diff --git a/src/webengine/api/qquickwebenginedownloaditem_p_p.h b/src/webengine/api/qquickwebenginedownloaditem_p_p.h deleted file mode 100644 index 51deee18b..000000000 --- a/src/webengine/api/qquickwebenginedownloaditem_p_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEDOWNLOADITEM_P_P_H -#define QQUICKWEBENGINEDOWNLOADITEM_P_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 "profile_adapter_client.h" -#include "qquickwebenginedownloaditem_p.h" -#include "qquickwebengineprofile.h" -#include <QString> -#include <QPointer> - -QT_BEGIN_NAMESPACE -class QQuickWebEngineProfilePrivate; -class QQuickWebEngineView; - -class QQuickWebEngineDownloadItemPrivate { - QQuickWebEngineDownloadItem *q_ptr; - QPointer<QQuickWebEngineProfile> profile; - friend class QQuickWebEngineProfilePrivate; -public: - Q_DECLARE_PUBLIC(QQuickWebEngineDownloadItem) - QQuickWebEngineDownloadItemPrivate(QQuickWebEngineProfile *p, const QUrl &url); - ~QQuickWebEngineDownloadItemPrivate(); - - quint32 downloadId; - QQuickWebEngineDownloadItem::DownloadState downloadState; - QQuickWebEngineDownloadItem::SavePageFormat savePageFormat; - QQuickWebEngineDownloadItem::DownloadType type; - QQuickWebEngineDownloadItem::DownloadInterruptReason interruptReason; - qint64 totalBytes; - qint64 receivedBytes; - QString mimeType; - QString downloadPath; - bool downloadFinished; - bool downloadPaused; - QQuickWebEngineView *view; - QUrl downloadUrl; - QString suggestedFileName; - QString downloadDirectory; - QString downloadFileName; - - void update(const QtWebEngineCore::ProfileAdapterClient::DownloadItemInfo &info); - void updateState(QQuickWebEngineDownloadItem::DownloadState newState); - void setFinished(); -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEDOWNLOADITEM_P_P_H diff --git a/src/webengine/api/qquickwebenginefaviconprovider.cpp b/src/webengine/api/qquickwebenginefaviconprovider.cpp deleted file mode 100644 index 3255f22be..000000000 --- a/src/webengine/api/qquickwebenginefaviconprovider.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginefaviconprovider_p_p.h" - -#include "favicon_manager.h" -#include "qquickwebengineview_p.h" -#include "qquickwebengineview_p_p.h" -#include "web_contents_adapter.h" - -#include <QtGui/QIcon> -#include <QtGui/QPixmap> - -QT_BEGIN_NAMESPACE - -using QtWebEngineCore::FaviconInfo; -using QtWebEngineCore::FaviconManager; - -static inline unsigned area(const QSize &size) -{ - return size.width() * size.height(); -} - -QString QQuickWebEngineFaviconProvider::identifier() -{ - return QStringLiteral("favicon"); -} - -QUrl QQuickWebEngineFaviconProvider::faviconProviderUrl(const QUrl &url) -{ - if (url.isEmpty()) - return url; - - QUrl providerUrl; - providerUrl.setScheme(QStringLiteral("image")); - providerUrl.setHost(identifier()); - providerUrl.setPath(QStringLiteral("/%1").arg(url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment))); - if (url.hasQuery()) - providerUrl.setQuery(url.query(QUrl::FullyDecoded)); - if (url.hasFragment()) - providerUrl.setFragment(url.fragment(QUrl::FullyDecoded)); - - return providerUrl; -} - -QQuickWebEngineFaviconProvider::QQuickWebEngineFaviconProvider() - : QQuickImageProvider(QQuickImageProvider::Pixmap) - , m_latestView(0) -{ -} - -QQuickWebEngineFaviconProvider::~QQuickWebEngineFaviconProvider() -{ - qDeleteAll(m_iconUrlMap); -} - -QUrl QQuickWebEngineFaviconProvider::attach(QQuickWebEngineView *view, const QUrl &iconUrl) -{ - if (iconUrl.isEmpty()) - return QUrl(); - - m_latestView = view; - - if (!m_iconUrlMap.contains(view)) - m_iconUrlMap.insert(view, new QList<QUrl>()); - - QList<QUrl> *iconUrls = m_iconUrlMap[view]; - if (!iconUrls->contains(iconUrl)) - iconUrls->append(iconUrl); - - return faviconProviderUrl(iconUrl); -} - -void QQuickWebEngineFaviconProvider::detach(QQuickWebEngineView *view) -{ - QList<QUrl> *iconUrls = m_iconUrlMap.take(view); - delete iconUrls; -} - -QPixmap QQuickWebEngineFaviconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(size); - Q_UNUSED(requestedSize); - - QUrl iconUrl(id); - QQuickWebEngineView *view = viewForIconUrl(iconUrl); - - if (!view || iconUrl.isEmpty()) - return QPixmap(); - - FaviconManager *faviconManager = view->d_ptr->adapter->faviconManager(); - - Q_ASSERT(faviconManager); - const FaviconInfo &faviconInfo = faviconManager->getFaviconInfo(iconUrl); - const QIcon &icon = faviconManager->getIcon(faviconInfo.candidate ? QUrl() : iconUrl); - - Q_ASSERT(!icon.isNull()); - const QSize &bestSize = faviconInfo.size; - - // If source size is not specified, use the best quality - if (!requestedSize.isValid()) { - if (size) - *size = bestSize; - - return icon.pixmap(bestSize).copy(); - } - - const QSize &fitSize = findFitSize(icon.availableSizes(), requestedSize, bestSize); - const QPixmap &iconPixmap = icon.pixmap(fitSize); - - if (size) - *size = iconPixmap.size(); - - return iconPixmap.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation).copy(); -} - -QQuickWebEngineView *QQuickWebEngineFaviconProvider::viewForIconUrl(const QUrl &iconUrl) const -{ - // The most common use case is that the requested iconUrl belongs to the - // latest WebEngineView which was raised an iconChanged signal. - if (m_latestView) { - QList<QUrl> *iconUrls = m_iconUrlMap[m_latestView]; - if (iconUrls && iconUrls->contains(iconUrl)) - return m_latestView; - } - - for (auto it = m_iconUrlMap.cbegin(), end = m_iconUrlMap.cend(); it != end; ++it) { - if (it.value()->contains(iconUrl)) - return it.key(); - } - - return 0; -} - -QSize QQuickWebEngineFaviconProvider::findFitSize(const QList<QSize> &availableSizes, - const QSize &requestedSize, - const QSize &bestSize) const -{ - Q_ASSERT(availableSizes.count()); - if (availableSizes.count() == 1 || area(requestedSize) >= area(bestSize)) - return bestSize; - - QSize fitSize = bestSize; - for (const QSize &size : availableSizes) { - if (area(size) == area(requestedSize)) - return size; - - if (area(requestedSize) < area(size) && area(size) < area(fitSize)) - fitSize = size; - } - - return fitSize; -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginefaviconprovider_p_p.h b/src/webengine/api/qquickwebenginefaviconprovider_p_p.h deleted file mode 100644 index 18b6d61c8..000000000 --- a/src/webengine/api/qquickwebenginefaviconprovider_p_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEFAVICONPROVIDER_P_P_H -#define QQUICKWEBENGINEFAVICONPROVIDER_P_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QtQuick/QQuickImageProvider> - -#include <QtCore/QMap> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineView; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineFaviconProvider : public QQuickImageProvider { -public: - static QString identifier(); - static QUrl faviconProviderUrl(const QUrl &); - - QQuickWebEngineFaviconProvider(); - ~QQuickWebEngineFaviconProvider(); - - QUrl attach(QQuickWebEngineView *, const QUrl &); - void detach(QQuickWebEngineView *); - - - virtual QPixmap requestPixmap(const QString &, QSize *, const QSize &); - -private: - QQuickWebEngineView *viewForIconUrl(const QUrl &) const; - QSize findFitSize(const QList<QSize> &, const QSize &, const QSize &) const; - - QMap<QQuickWebEngineView *, QList<QUrl> *> m_iconUrlMap; - QQuickWebEngineView *m_latestView; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEFAVICONPROVIDER_P_P_H diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp deleted file mode 100644 index d3c4a0026..000000000 --- a/src/webengine/api/qquickwebenginehistory.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginehistory_p.h" -#include "qquickwebenginehistory_p_p.h" - -#include "qquickwebenginefaviconprovider_p_p.h" -#include "qquickwebengineloadrequest_p.h" -#include "qquickwebengineview_p_p.h" -#include "web_contents_adapter.h" - -QT_BEGIN_NAMESPACE - -QQuickWebEngineHistoryListModelPrivate::QQuickWebEngineHistoryListModelPrivate(QQuickWebEngineViewPrivate *view) - : view(view) -{ -} - -QQuickWebEngineHistoryListModelPrivate::~QQuickWebEngineHistoryListModelPrivate() -{ -} - -int QQuickWebEngineHistoryListModelPrivate::count() const -{ - return adapter()->navigationEntryCount(); -} - -int QQuickWebEngineHistoryListModelPrivate::index(int index) const -{ - return index; -} - -int QQuickWebEngineHistoryListModelPrivate::offsetForIndex(int index) const -{ - return index - adapter()->currentNavigationEntryIndex(); -} - -QtWebEngineCore::WebContentsAdapter *QQuickWebEngineHistoryListModelPrivate::adapter() const -{ - return view->adapter.data(); -} - -QQuickWebEngineBackHistoryListModelPrivate::QQuickWebEngineBackHistoryListModelPrivate(QQuickWebEngineViewPrivate *view) - : QQuickWebEngineHistoryListModelPrivate(view) -{ -} - -int QQuickWebEngineBackHistoryListModelPrivate::count() const -{ - return adapter()->currentNavigationEntryIndex(); -} - -int QQuickWebEngineBackHistoryListModelPrivate::index(int i) const -{ - Q_ASSERT(i >= 0 && i < count()); - return count() - 1 - i; -} - -int QQuickWebEngineBackHistoryListModelPrivate::offsetForIndex(int index) const -{ - return - index - 1; -} - -QQuickWebEngineForwardHistoryListModelPrivate::QQuickWebEngineForwardHistoryListModelPrivate(QQuickWebEngineViewPrivate *view) - : QQuickWebEngineHistoryListModelPrivate(view) -{ -} - -int QQuickWebEngineForwardHistoryListModelPrivate::count() const -{ - if (!adapter()->isInitialized()) - return 0; - return adapter()->navigationEntryCount() - adapter()->currentNavigationEntryIndex() - 1; -} - -int QQuickWebEngineForwardHistoryListModelPrivate::index(int i) const -{ - return adapter()->currentNavigationEntryIndex() + i + 1; -} - -int QQuickWebEngineForwardHistoryListModelPrivate::offsetForIndex(int index) const -{ - return index + 1; -} - -/*! - \qmltype WebEngineHistoryListModel - \instantiates QQuickWebEngineHistoryListModel - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - - \brief A data model that represents the history of a web engine page. - - The WebEngineHistoryListModel type exposes the \e title, \e url, \e icon, and \e offset roles. - The \e title, \e url and \e icon specify the title, URL, and favicon of the visited page. - The \e offset specifies - the position of the page in respect to the current page (0). A positive number indicates that - the page was visited after the current page, whereas a negative number indicates that the page - was visited before the current page. - - This type is uncreatable, but it can be accessed by using the - \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property. - - \sa WebEngineHistory -*/ - -QQuickWebEngineHistoryListModel::QQuickWebEngineHistoryListModel() - : QAbstractListModel() -{ -} - -QQuickWebEngineHistoryListModel::QQuickWebEngineHistoryListModel(QQuickWebEngineHistoryListModelPrivate *d) - : QAbstractListModel() - , d_ptr(d) -{ -} - -QQuickWebEngineHistoryListModel::~QQuickWebEngineHistoryListModel() -{ -} - -QHash<int, QByteArray> QQuickWebEngineHistoryListModel::roleNames() const -{ - QHash<int, QByteArray> roles; - roles[QQuickWebEngineHistory::UrlRole] = "url"; - roles[QQuickWebEngineHistory::TitleRole] = "title"; - roles[QQuickWebEngineHistory::OffsetRole] = "offset"; - roles[QQuickWebEngineHistory::IconUrlRole] = "icon"; - return roles; -} - -int QQuickWebEngineHistoryListModel::rowCount(const QModelIndex &index) const -{ - Q_UNUSED(index); - Q_D(const QQuickWebEngineHistoryListModel); - return d->count(); -} - -QVariant QQuickWebEngineHistoryListModel::data(const QModelIndex &index, int role) const -{ - Q_D(const QQuickWebEngineHistoryListModel); - - if (!index.isValid()) - return QVariant(); - - if (role < QQuickWebEngineHistory::UrlRole || role > QQuickWebEngineHistory::IconUrlRole) - return QVariant(); - - if (role == QQuickWebEngineHistory::UrlRole) - return QUrl(d->adapter()->getNavigationEntryUrl(d->index(index.row()))); - - if (role == QQuickWebEngineHistory::TitleRole) - return QString(d->adapter()->getNavigationEntryTitle(d->index(index.row()))); - - if (role == QQuickWebEngineHistory::OffsetRole) - return d->offsetForIndex(index.row()); - - if (role == QQuickWebEngineHistory::IconUrlRole) { - QUrl iconUrl = QUrl(d->adapter()->getNavigationEntryIconUrl(d->index(index.row()))); - return QQuickWebEngineFaviconProvider::faviconProviderUrl(iconUrl); - } - - return QVariant(); -} - -void QQuickWebEngineHistoryListModel::reset() -{ - beginResetModel(); - endResetModel(); -} - -QQuickWebEngineHistoryPrivate::QQuickWebEngineHistoryPrivate(QQuickWebEngineViewPrivate *view) - : m_view(view) -{ -} - -QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() -{ -} - -/*! - \qmltype WebEngineHistory - \instantiates QQuickWebEngineHistory - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - - \brief Provides data models that represent the history of a web engine page. - - The WebEngineHistory type can be accessed by using the - \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property. - - The WebEngineHistory type provides the following WebEngineHistoryListModel data model objects: - - \list - \li \c backItems, which contains the URLs of visited pages. - \li \c forwardItems, which contains the URLs of the pages that were visited after visiting - the current page. - \li \c items, which contains the URLs of the back and forward items, as well as the URL of - the current page. - \endlist - - The easiest way to use these models is to use them in a ListView as illustrated by the - following code snippet: - - \code - ListView { - id: historyItemsList - anchors.fill: parent - model: webEngineView.navigationHistory.items - delegate: - Text { - color: "black" - text: model.title + " - " + model.url + " (" + model.offset + ")" - } - } - \endcode - - The ListView shows the content of the corresponding model. The delegate is responsible for the - format of the list items. The appearance of each item of the list in the delegate can be defined - separately (it is not web engine specific). - - The model roles \e title, \e url, and \e icon specify the title, URL, and favicon of the - visited page. The \e offset - role specifies the position of the page in respect to the current page (0). A positive number - indicates that the page was visited after the current page, whereas a negative number indicates - that the page was visited before the current page. - - The data models can also be used to create a menu, as illustrated by the following code - snippet: - - \quotefromfile webengine/quicknanobrowser/BrowserWindow.qml - \skipto ToolBar - \printuntil onObjectRemoved - \printuntil } - \printuntil } - \printuntil } - - For the complete example, see \l{WebEngine Quick Nano Browser}. - - \sa WebEngineHistoryListModel -*/ - -QQuickWebEngineHistory::QQuickWebEngineHistory(QQuickWebEngineViewPrivate *view) - : d_ptr(new QQuickWebEngineHistoryPrivate(view)) -{ -} - -QQuickWebEngineHistory::~QQuickWebEngineHistory() -{ -} - -/*! - \qmlproperty WebEngineHistoryListModel WebEngineHistory::items - \readonly - - URLs of back items, forward items, and the current item in the history. -*/ -QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const -{ - Q_D(const QQuickWebEngineHistory); - if (!d->m_navigationModel) - d->m_navigationModel.reset(new QQuickWebEngineHistoryListModel(new QQuickWebEngineHistoryListModelPrivate(d->m_view))); - return d->m_navigationModel.data(); -} - -/*! - \qmlproperty WebEngineHistoryListModel WebEngineHistory::backItems - \readonly - - URLs of visited pages. -*/ -QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const -{ - Q_D(const QQuickWebEngineHistory); - if (!d->m_backNavigationModel) - d->m_backNavigationModel.reset(new QQuickWebEngineHistoryListModel(new QQuickWebEngineBackHistoryListModelPrivate(d->m_view))); - return d->m_backNavigationModel.data(); -} - -/*! - \qmlproperty WebEngineHistoryListModel WebEngineHistory::forwardItems - \readonly - - URLs of the pages that were visited after visiting the current page. -*/ -QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::forwardItems() const -{ - Q_D(const QQuickWebEngineHistory); - if (!d->m_forwardNavigationModel) - d->m_forwardNavigationModel.reset(new QQuickWebEngineHistoryListModel(new QQuickWebEngineForwardHistoryListModelPrivate(d->m_view))); - return d->m_forwardNavigationModel.data(); -} - -void QQuickWebEngineHistory::reset() -{ - Q_D(QQuickWebEngineHistory); - if (d->m_navigationModel) - d->m_navigationModel->reset(); - if (d->m_backNavigationModel) - d->m_backNavigationModel->reset(); - if (d->m_forwardNavigationModel) - d->m_forwardNavigationModel->reset(); -} - - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginehistory_p.h b/src/webengine/api/qquickwebenginehistory_p.h deleted file mode 100644 index bf049b2a6..000000000 --- a/src/webengine/api/qquickwebenginehistory_p.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEHISTORY_P_H -#define QQUICKWEBENGINEHISTORY_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 <QtWebEngine/qtwebengineglobal.h> -#include <QAbstractListModel> -#include <QtCore/qshareddata.h> -#include <QQuickItem> -#include <QUrl> -#include <QVariant> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineHistory; -class QQuickWebEngineHistoryPrivate; -class QQuickWebEngineHistoryListModelPrivate; -class QQuickWebEngineLoadRequest; -class QQuickWebEngineViewPrivate; - -class Q_WEBENGINE_EXPORT QQuickWebEngineHistoryListModel : public QAbstractListModel { - Q_OBJECT - -public: - QQuickWebEngineHistoryListModel(QQuickWebEngineHistoryListModelPrivate*); - virtual ~QQuickWebEngineHistoryListModel(); - - int rowCount(const QModelIndex& parent = QModelIndex()) const; - QVariant data(const QModelIndex& index, int role) const; - QHash<int, QByteArray> roleNames() const; - void reset(); - -private: - QQuickWebEngineHistoryListModel(); - - Q_DECLARE_PRIVATE(QQuickWebEngineHistoryListModel) - QScopedPointer<QQuickWebEngineHistoryListModelPrivate> d_ptr; - - friend class QQuickWebEngineHistory; -}; - -class Q_WEBENGINE_EXPORT QQuickWebEngineHistory : public QQuickItem { - Q_OBJECT - Q_PROPERTY(QQuickWebEngineHistoryListModel *items READ items CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineHistoryListModel *backItems READ backItems CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineHistoryListModel *forwardItems READ forwardItems CONSTANT FINAL) - -public: - QQuickWebEngineHistory(QQuickWebEngineViewPrivate*); - virtual ~QQuickWebEngineHistory(); - - enum NavigationHistoryRoles { - UrlRole = Qt::UserRole + 1, - TitleRole = Qt::UserRole + 2, - OffsetRole = Qt::UserRole + 3, - IconUrlRole = Qt::UserRole + 4, - }; - - QQuickWebEngineHistoryListModel *items() const; - QQuickWebEngineHistoryListModel *backItems() const; - QQuickWebEngineHistoryListModel *forwardItems() const; - - void reset(); - -private: - QQuickWebEngineHistory(); - - Q_DECLARE_PRIVATE(QQuickWebEngineHistory) - QScopedPointer<QQuickWebEngineHistoryPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineHistory) - -#endif // QQUICKWEBENGINEHISTORY_P_H diff --git a/src/webengine/api/qquickwebenginehistory_p_p.h b/src/webengine/api/qquickwebenginehistory_p_p.h deleted file mode 100644 index 019c6f0ad..000000000 --- a/src/webengine/api/qquickwebenginehistory_p_p.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEHISTORY_P_P_H -#define QQUICKWEBENGINEHISTORY_P_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. -// - -namespace QtWebEngineCore { -class WebContentsAdapter; -} - -QT_BEGIN_NAMESPACE -class QQuickWebEngineHistoryListModel; -class QQuickWebEngineViewPrivate; - -class QQuickWebEngineHistoryListModelPrivate { -public: - QQuickWebEngineHistoryListModelPrivate(QQuickWebEngineViewPrivate*); - virtual ~QQuickWebEngineHistoryListModelPrivate(); - - virtual int count() const; - virtual int index(int) const; - virtual int offsetForIndex(int) const; - - QtWebEngineCore::WebContentsAdapter *adapter() const; - - QQuickWebEngineViewPrivate *view; -}; - -class QQuickWebEngineBackHistoryListModelPrivate : public QQuickWebEngineHistoryListModelPrivate { -public: - QQuickWebEngineBackHistoryListModelPrivate(QQuickWebEngineViewPrivate*); - - int count() const override; - int index(int) const override; - int offsetForIndex(int) const override; -}; - -class QQuickWebEngineForwardHistoryListModelPrivate : public QQuickWebEngineHistoryListModelPrivate { -public: - QQuickWebEngineForwardHistoryListModelPrivate(QQuickWebEngineViewPrivate*); - - int count() const override; - int index(int) const override; - int offsetForIndex(int) const override; -}; - -class QQuickWebEngineHistoryPrivate { -public: - QQuickWebEngineHistoryPrivate(QQuickWebEngineViewPrivate*); - ~QQuickWebEngineHistoryPrivate(); - - QQuickWebEngineViewPrivate *m_view; - mutable QScopedPointer<QQuickWebEngineHistoryListModel> m_navigationModel; - mutable QScopedPointer<QQuickWebEngineHistoryListModel> m_backNavigationModel; - mutable QScopedPointer<QQuickWebEngineHistoryListModel> m_forwardNavigationModel; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEHISTORY_P_P_H diff --git a/src/webengine/api/qquickwebengineloadrequest.cpp b/src/webengine/api/qquickwebengineloadrequest.cpp deleted file mode 100644 index 5ad99ea2e..000000000 --- a/src/webengine/api/qquickwebengineloadrequest.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qquickwebengineloadrequest_p.h> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineLoadRequestPrivate { -public: - QQuickWebEngineLoadRequestPrivate(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString, int errorCode, QQuickWebEngineView::ErrorDomain errorDomain) - : url(url) - , status(status) - , errorString(errorString) - , errorCode(errorCode) - , errorDomain(errorDomain) - { - } - - QUrl url; - QQuickWebEngineView::LoadStatus status; - QString errorString; - int errorCode; - QQuickWebEngineView::ErrorDomain errorDomain; -}; - -/*! - \qmltype WebEngineLoadRequest - \instantiates QQuickWebEngineLoadRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.0 - - \brief A utility type for the WebEngineView::loadingChanged signal. - - Contains information about a request for loading a web page, such as the URL and - current loading status (started, succeeded, failed). - - \sa WebEngineView::loadingChanged -*/ -QQuickWebEngineLoadRequest::QQuickWebEngineLoadRequest(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString, int errorCode, QQuickWebEngineView::ErrorDomain errorDomain, QObject* parent) - : QObject(parent) - , d_ptr(new QQuickWebEngineLoadRequestPrivate(url, status, errorString, errorCode, errorDomain)) -{ -} - -QQuickWebEngineLoadRequest::~QQuickWebEngineLoadRequest() -{ -} - -/*! - \qmlproperty url WebEngineLoadRequest::url - \brief Holds the URL of the load request. - */ -QUrl QQuickWebEngineLoadRequest::url() const -{ - Q_D(const QQuickWebEngineLoadRequest); - return d->url; -} - -/*! - \qmlproperty enumeration WebEngineLoadRequest::status - - This enumeration represents the load status of a web page load request: - - \value WebEngineLoadRequest.LoadStartedStatus Page is currently loading. - \value WebEngineLoadRequest.LoadSucceededStatus - Page has been loaded with success. - \value WebEngineLoadRequest.LoadFailedStatus Page could not be loaded. - - \sa WebEngineView::loadingChanged -*/ -QQuickWebEngineView::LoadStatus QQuickWebEngineLoadRequest::status() const -{ - Q_D(const QQuickWebEngineLoadRequest); - return d->status; -} - -/*! - \qmlproperty string WebEngineLoadRequest::errorString - \brief Holds the error message. -*/ -QString QQuickWebEngineLoadRequest::errorString() const -{ - Q_D(const QQuickWebEngineLoadRequest); - return d->errorString; -} - -/*! - \qmlproperty enumeration WebEngineLoadRequest::errorDomain - This enumeration holds the type of a load request error: - - \value WebEngineView.NoErrorDomain - Error type is not known. - \value WebEngineView.InternalErrorDomain - Content cannot be interpreted by \QWE. - \value WebEngineView.ConnectionErrorDomain - Error results from a faulty network connection. - \value WebEngineView.CertificateErrorDomain - Error is related to the SSL/TLS certificate. - \value WebEngineView.HttpErrorDomain - Error is related to the HTTP connection. - \value WebEngineView.FtpErrorDomain - Error is related to the FTP connection. - \value WebEngineView.DnsErrorDomain - Error is related to the DNS connection. -*/ - -QQuickWebEngineView::ErrorDomain QQuickWebEngineLoadRequest::errorDomain() const -{ - Q_D(const QQuickWebEngineLoadRequest); - return d->errorDomain; -} - -/*! - \qmlproperty int WebEngineLoadRequest::errorCode - \brief Holds the error code. -*/ -int QQuickWebEngineLoadRequest::errorCode() const -{ - Q_D(const QQuickWebEngineLoadRequest); - return d->errorCode; -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebengineloadrequest_p.h b/src/webengine/api/qquickwebengineloadrequest_p.h deleted file mode 100644 index 6d8dd8061..000000000 --- a/src/webengine/api/qquickwebengineloadrequest_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINELOADREQUEST_P_H -#define QQUICKWEBENGINELOADREQUEST_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include "qquickwebengineview_p.h" - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineLoadRequestPrivate; - -class Q_WEBENGINE_EXPORT QQuickWebEngineLoadRequest : public QObject { - Q_OBJECT - Q_PROPERTY(QUrl url READ url CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineView::LoadStatus status READ status CONSTANT FINAL) - Q_PROPERTY(QString errorString READ errorString CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineView::ErrorDomain errorDomain READ errorDomain CONSTANT FINAL) - Q_PROPERTY(int errorCode READ errorCode CONSTANT FINAL) - -public: - QQuickWebEngineLoadRequest(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString = QString(), int errorCode = 0, QQuickWebEngineView::ErrorDomain errorDomain = QQuickWebEngineView::NoErrorDomain, QObject* parent = 0); - ~QQuickWebEngineLoadRequest(); - QUrl url() const; - QQuickWebEngineView::LoadStatus status() const; - QString errorString() const; - QQuickWebEngineView::ErrorDomain errorDomain() const; - int errorCode() const; - -private: - Q_DECLARE_PRIVATE(QQuickWebEngineLoadRequest) - QScopedPointer<QQuickWebEngineLoadRequestPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineLoadRequest) - -#endif // QQUICKWEBENGINELOADREQUEST_P_H diff --git a/src/webengine/api/qquickwebenginenavigationrequest.cpp b/src/webengine/api/qquickwebenginenavigationrequest.cpp deleted file mode 100644 index 03c1d3d78..000000000 --- a/src/webengine/api/qquickwebenginenavigationrequest.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginenavigationrequest_p.h" - -#include "qquickwebengineview_p.h" - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineNavigationRequestPrivate { -public: - QQuickWebEngineNavigationRequestPrivate(const QUrl& url, QQuickWebEngineView::NavigationType navigationType, bool mainFrame) - : url(url) - , action(QQuickWebEngineView::AcceptRequest) - , navigationType(navigationType) - , isMainFrame(mainFrame) - { - } - - ~QQuickWebEngineNavigationRequestPrivate() - { - } - - QUrl url; - QQuickWebEngineView::NavigationRequestAction action; - QQuickWebEngineView::NavigationType navigationType; - bool isMainFrame; -}; - -/*! - \qmltype WebEngineNavigationRequest - \instantiates QQuickWebEngineNavigationRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.0 - - \brief Represents a request for navigating to a web page as part of - \l{WebEngineView::navigationRequested()}. - - To accept or reject a request, set \l action to - \c WebEngineNavigationRequest.AcceptRequest or - \c WebEngineNavigationRequest.IgnoreRequest. -*/ - -QQuickWebEngineNavigationRequest::QQuickWebEngineNavigationRequest(const QUrl& url, QQuickWebEngineView::NavigationType navigationType, bool mainFrame, QObject* parent) - : QObject(parent) - , d_ptr(new QQuickWebEngineNavigationRequestPrivate(url, navigationType, mainFrame)) -{ -} - -QQuickWebEngineNavigationRequest::~QQuickWebEngineNavigationRequest() -{ -} - -/*! - \qmlproperty enumeration WebEngineNavigationRequest::action - - Whether to accept or ignore the navigation request. - - \value WebEngineNavigationRequest.AcceptRequest - Accepts a navigation request. - \value WebEngineNavigationRequest.IgnoreRequest - Ignores a navigation request. -*/ - -void QQuickWebEngineNavigationRequest::setAction(QQuickWebEngineView::NavigationRequestAction action) -{ - Q_D(QQuickWebEngineNavigationRequest); - if (d->action == action) - return; - - d->action = action; - emit actionChanged(); -} - -/*! - \qmlproperty url WebEngineNavigationRequest::url - \readonly - - The URL of the web page to go to. -*/ - -QUrl QQuickWebEngineNavigationRequest::url() const -{ - Q_D(const QQuickWebEngineNavigationRequest); - return d->url; -} - -QQuickWebEngineView::NavigationRequestAction QQuickWebEngineNavigationRequest::action() const -{ - Q_D(const QQuickWebEngineNavigationRequest); - return d->action; -} - -/*! - \qmlproperty enumeration WebEngineNavigationRequest::navigationType - \readonly - - The method used to navigate to a web page. - - \value WebEngineNavigationRequest.LinkClickedNavigation - Clicking a link. - \value WebEngineNavigationRequest.TypedNavigation - Entering an URL on the address bar. - \value WebEngineNavigationRequest.FormSubmittedNavigation - Submitting a form. - \value WebEngineNavigationRequest.BackForwardNavigation - Using navigation history to go to the previous or next page. - \value WebEngineNavigationRequest.ReloadNavigation - Reloading the page. - \value WebEngineNavigationRequest.RedirectNavigation - Page content or server triggered a redirection or page refresh. - \value WebEngineNavigationRequest.OtherNavigation - Using some other method to go to a page. -*/ - -QQuickWebEngineView::NavigationType QQuickWebEngineNavigationRequest::navigationType() const -{ - Q_D(const QQuickWebEngineNavigationRequest); - return d->navigationType; -} - -/*! - \qmlproperty bool WebEngineNavigationRequest::isMainFrame - \readonly - - Whether the navigation issue is requested for a top level page. -*/ - -bool QQuickWebEngineNavigationRequest::isMainFrame() const -{ - Q_D(const QQuickWebEngineNavigationRequest); - return d->isMainFrame; -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginenavigationrequest_p.h b/src/webengine/api/qquickwebenginenavigationrequest_p.h deleted file mode 100644 index 55e3ca673..000000000 --- a/src/webengine/api/qquickwebenginenavigationrequest_p.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINENAVIGATIONREQUEST_P_H -#define QQUICKWEBENGINENAVIGATIONREQUEST_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 "qquickwebengineview_p.h" - -#include <QtCore/QObject> -#include <QtCore/QUrl> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineNavigationRequestPrivate; - -class Q_WEBENGINE_EXPORT QQuickWebEngineNavigationRequest : public QObject { - Q_OBJECT - Q_PROPERTY(QUrl url READ url CONSTANT FINAL) - Q_PROPERTY(bool isMainFrame READ isMainFrame CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineView::NavigationRequestAction action READ action WRITE setAction NOTIFY actionChanged FINAL) - Q_PROPERTY(QQuickWebEngineView::NavigationType navigationType READ navigationType CONSTANT FINAL) - -public: - QQuickWebEngineNavigationRequest(const QUrl& url, QQuickWebEngineView::NavigationType navigationType, bool mainFrame, QObject* parent = 0); - ~QQuickWebEngineNavigationRequest(); - - QUrl url() const; - bool isMainFrame() const; - QQuickWebEngineView::NavigationRequestAction action() const; - - void setAction(QQuickWebEngineView::NavigationRequestAction action); - QQuickWebEngineView::NavigationType navigationType() const; - -Q_SIGNALS: - void actionChanged(); - -private: - Q_DECLARE_PRIVATE(QQuickWebEngineNavigationRequest) - QScopedPointer<QQuickWebEngineNavigationRequestPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineNavigationRequest) - -#endif // QQUICKWEBENGINENAVIGATIONREQUEST_P_H diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp deleted file mode 100644 index 0af943de8..000000000 --- a/src/webengine/api/qquickwebenginenewviewrequest.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginenewviewrequest_p.h" - -#include "qquickwebengineview_p_p.h" -#include "web_contents_adapter.h" - -/*! - \qmltype WebEngineNewViewRequest - \instantiates QQuickWebEngineNewViewRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - - \brief A utility type for the WebEngineView::newViewRequested signal. - - Contains information about a request to load a page in a separate web engine view. - - \sa WebEngineView::newViewRequested -*/ -QQuickWebEngineNewViewRequest::QQuickWebEngineNewViewRequest() -{ -} - -QQuickWebEngineNewViewRequest::~QQuickWebEngineNewViewRequest() -{ -} - -/*! - \qmlproperty WebEngineView::NewViewDestination WebEngineNewViewRequest::destination - The type of the view that is requested by the page. - */ -QQuickWebEngineView::NewViewDestination QQuickWebEngineNewViewRequest::destination() const -{ - return m_destination; -} - -/*! - \qmlproperty QUrl WebEngineNewViewRequest::requestedUrl - The URL that is requested by the page. - \since QtWebEngine 1.5 - */ -QUrl QQuickWebEngineNewViewRequest::requestedUrl() const -{ - return m_requestedUrl; -} - -/*! - \qmlproperty bool WebEngineNewViewRequest::userInitiated - Whether this window request was directly triggered as the result of a keyboard or mouse event. - - Use this property to block possibly unwanted \e popups. - */ -bool QQuickWebEngineNewViewRequest::isUserInitiated() const -{ - return m_isUserInitiated; -} - -/*! - \qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view) - - Opens the requested page in the new web engine view \a view. State and history of the - view and the page possibly loaded in it will be lost. - - \sa WebEngineView::newViewRequested - */ -void QQuickWebEngineNewViewRequest::openIn(QQuickWebEngineView *view) -{ - if (!m_adapter && !m_requestedUrl.isValid()) { - qWarning("Trying to open an empty request, it was either already used or was invalidated." - "\nYou must complete the request synchronously within the newViewRequested signal handler." - " If a view hasn't been adopted before returning, the request will be invalidated."); - return; - } - - if (!view) { - qWarning("Trying to open a WebEngineNewViewRequest in an invalid WebEngineView."); - return; - } - if (m_adapter) - view->d_func()->adoptWebContents(m_adapter.data()); - else - view->setUrl(m_requestedUrl); - m_adapter.reset(); -} diff --git a/src/webengine/api/qquickwebenginenewviewrequest_p.h b/src/webengine/api/qquickwebenginenewviewrequest_p.h deleted file mode 100644 index e21f76111..000000000 --- a/src/webengine/api/qquickwebenginenewviewrequest_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINENEWVIEWREQUEST_P_H -#define QQUICKWEBENGINENEWVIEWREQUEST_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include "qquickwebengineview_p.h" - -namespace QtWebEngineCore { -class WebContentsAdapter; -} - -QT_BEGIN_NAMESPACE - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QObject { - Q_OBJECT - Q_PROPERTY(QQuickWebEngineView::NewViewDestination destination READ destination CONSTANT FINAL) - Q_PROPERTY(QUrl requestedUrl READ requestedUrl CONSTANT REVISION 1 FINAL) - Q_PROPERTY(bool userInitiated READ isUserInitiated CONSTANT FINAL) -public: - ~QQuickWebEngineNewViewRequest(); - - QQuickWebEngineView::NewViewDestination destination() const; - QUrl requestedUrl() const; - bool isUserInitiated() const; - Q_INVOKABLE void openIn(QQuickWebEngineView *view); - -private: - QQuickWebEngineNewViewRequest(); - QQuickWebEngineView::NewViewDestination m_destination; - bool m_isUserInitiated; - QSharedPointer<QtWebEngineCore::WebContentsAdapter> m_adapter; - QUrl m_requestedUrl; - friend class QQuickWebEngineView; - friend class QQuickWebEngineViewPrivate; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineNewViewRequest) - -#endif // QQUICKWEBENGINENEWVIEWREQUEST_P_H diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp deleted file mode 100644 index 57434e296..000000000 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ /dev/null @@ -1,1101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebengineprofile.h" - -#include "qquickwebenginedownloaditem_p.h" -#include "qquickwebenginedownloaditem_p_p.h" -#include "qquickwebengineprofile_p.h" -#include "qquickwebenginescript_p.h" -#include "qquickwebenginesettings_p.h" -#include "qquickwebengineview_p_p.h" -#include "qwebenginecookiestore.h" -#include "qwebenginenotification.h" - -#include <QFileInfo> -#include <QDir> -#include <QQmlEngine> - -#include "profile_adapter.h" -#include "renderer_host/user_resource_controller_host.h" -#include "web_engine_settings.h" - -#include <QtWebEngineCore/qwebengineurlscheme.h> - -using QtWebEngineCore::ProfileAdapter; - -QT_BEGIN_NAMESPACE - -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::UnknownSaveFormat, QtWebEngineCore::ProfileAdapterClient::UnknownSavePageFormat) -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::SingleHtmlSaveFormat) -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::CompleteHtmlSaveFormat) -ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::ProfileAdapterClient::MimeHtmlSaveFormat) - -/*! - \class QQuickWebEngineProfile - \brief The QQuickWebEngineProfile class provides a web engine profile shared by multiple pages. - \since 5.6 - - \inmodule QtWebEngine - - A web engine profile contains settings, scripts, persistent cookie policy, and the list of - visited links shared by all web engine pages that belong to the profile. - - Information about visited links is stored together with persistent cookies - and other persistent data in a storage determined by the storageName - property. Persistent data is stored in a subdirectory determined by the - persistentStoragePath property and the cache in a subdirectory determined by - the cachePath property. The httpCacheType property describes the type of the - cache: \e in-memory or \e on-disk. If only the storageName property is set, - the other values are generated automatically based on it. If you specify - any of the values manually, you should do it before creating any pages that - belong to the profile. - - Profiles can be used to isolate pages from each other. A typical use case is a dedicated - \e {off-the-record profile} for a \e {private browsing} mode. An off-the-record profile forces - cookies, the HTTP cache, and other normally persistent data to be stored only in memory. The - offTheRecord property holds whether a profile is off-the-record. - - The default profile can be accessed by defaultProfile(). It is a built-in profile that all - web pages not specifically created with another profile belong to. - - A WebEngineProfile instance can be created and accessed from C++ through the - QQuickWebEngineProfile class, which exposes further functionality in C++. This allows Qt Quick - applications to intercept URL requests (QQuickWebEngineProfile::setRequestInterceptor), or - register custom URL schemes (QQuickWebEngineProfile::installUrlSchemeHandler). - - Spellchecking HTML form fields can be enabled per profile by setting the \l spellCheckEnabled - property and the current languages used for spellchecking can be set by using the - \l spellCheckLanguages property. -*/ - -/*! - \enum QQuickWebEngineProfile::HttpCacheType - - This enum describes the HTTP cache type: - - \value MemoryHttpCache Use an in-memory cache. This is the default if - \c off-the-record is set. - \value DiskHttpCache Use a disk cache. This is the default if \c off-the-record - is not set. Falls back to \c MemoryHttpCache if \c off-the-record is set. - \value NoCache Disable both in-memory and disk caching. (Added in Qt 5.7) -*/ - -/*! - \enum QQuickWebEngineProfile::PersistentCookiesPolicy - - This enum describes policy for cookie persistency: - - \value NoPersistentCookies - Both session and persistent cookies are stored in memory. This is the only setting - possible if \c off-the-record is set or no persistent data path is available. - \value AllowPersistentCookies - Cookies marked persistent are saved to and restored from disk, whereas session cookies - are only stored to disk for crash recovery. This is the default setting. - \value ForcePersistentCookies - Both session and persistent cookies are saved to and restored from disk. -*/ - -/*! - \fn QQuickWebEngineProfile::downloadRequested(QQuickWebEngineDownloadItem *download) - - This signal is emitted whenever a download has been triggered. - The \a download argument holds the state of the download. - The download has to be explicitly accepted with - \c{QQuickWebEngineDownloadItem::accept()} or it will be - cancelled by default. - The download item is parented by the profile. If it is not accepted, it - will be deleted immediately after the signal emission. - This signal cannot be used with a queued connection. -*/ - -/*! - \fn QQuickWebEngineProfile::downloadFinished(QQuickWebEngineDownloadItem *download) - - This signal is emitted whenever downloading stops, because it finished successfully, was - cancelled, or was interrupted (for example, because connectivity was lost). - The \a download argument holds the state of the finished download instance. -*/ - -/*! - \fn QQuickWebEngineProfile::presentNotification(QWebEngineNotification *notification) - - This signal is emitted whenever there is a newly created user notification. - The \a notification argument holds the notification instance to query data and interact with. -*/ - -QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter) - : m_settings(new QQuickWebEngineSettings()) - , m_profileAdapter(profileAdapter) -{ - profileAdapter->addClient(this); - m_settings->d_ptr->initDefaults(); - // Fullscreen API was implemented before the supported setting, so we must - // make it default true to avoid change in default API behavior. - m_settings->d_ptr->setAttribute(QtWebEngineCore::WebEngineSettings::FullScreenSupportEnabled, true); -} - -QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate() -{ - if (m_profileAdapter) { - // In the case the user sets this profile as the parent of the interceptor - // it can be deleted before the browser-context still referencing it is. - m_profileAdapter->setRequestInterceptor(nullptr); - m_profileAdapter->removeClient(this); - } - - if (m_profileAdapter != QtWebEngineCore::ProfileAdapter::defaultProfileAdapter()) - delete m_profileAdapter; -} - -void QQuickWebEngineProfilePrivate::addWebContentsAdapterClient(QtWebEngineCore::WebContentsAdapterClient *adapter) -{ - Q_ASSERT(m_profileAdapter); - m_profileAdapter->addWebContentsAdapterClient(adapter); -} - -void QQuickWebEngineProfilePrivate::removeWebContentsAdapterClient(QtWebEngineCore::WebContentsAdapterClient*adapter) -{ - Q_ASSERT(m_profileAdapter); - m_profileAdapter->removeWebContentsAdapterClient(adapter); -} - -QtWebEngineCore::ProfileAdapter *QQuickWebEngineProfilePrivate::profileAdapter() const -{ - return m_profileAdapter; -} - -QQuickWebEngineSettings *QQuickWebEngineProfilePrivate::settings() const -{ - return m_settings.data(); -} - -void QQuickWebEngineProfilePrivate::cancelDownload(quint32 downloadId) -{ - if (m_profileAdapter) - m_profileAdapter->cancelDownload(downloadId); -} - -void QQuickWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId) -{ - m_ongoingDownloads.remove(downloadId); - if (m_profileAdapter) - m_profileAdapter->removeDownload(downloadId); -} - -void QQuickWebEngineProfilePrivate::cleanDownloads() -{ - for (auto download : m_ongoingDownloads.values()) { - if (!download) - continue; - - if (!download->isFinished()) - download->cancel(); - - if (m_profileAdapter) - m_profileAdapter->removeDownload(download->id()); - } - m_ongoingDownloads.clear(); -} - -void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) -{ - Q_Q(QQuickWebEngineProfile); - - Q_ASSERT(!m_ongoingDownloads.contains(info.id)); - QQuickWebEngineDownloadItemPrivate *itemPrivate = new QQuickWebEngineDownloadItemPrivate(q, info.url); - itemPrivate->downloadId = info.id; - itemPrivate->downloadState = QQuickWebEngineDownloadItem::DownloadRequested; - itemPrivate->totalBytes = info.totalBytes; - itemPrivate->mimeType = info.mimeType; - itemPrivate->downloadDirectory = QFileInfo(info.path).path(); - itemPrivate->downloadFileName = QFileInfo(info.path).fileName(); - itemPrivate->suggestedFileName = info.suggestedFileName; - itemPrivate->savePageFormat = static_cast<QQuickWebEngineDownloadItem::SavePageFormat>( - info.savePageFormat); - itemPrivate->type = static_cast<QQuickWebEngineDownloadItem::DownloadType>(info.downloadType); - if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient) - itemPrivate->view = static_cast<QQuickWebEngineViewPrivate *>(info.page)->q_ptr; - else - itemPrivate->view = nullptr; - - QQuickWebEngineDownloadItem *download = new QQuickWebEngineDownloadItem(itemPrivate, q); - - m_ongoingDownloads.insert(info.id, download); - QObject::connect(download, &QQuickWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); }); - - QQmlEngine::setObjectOwnership(download, QQmlEngine::JavaScriptOwnership); - Q_EMIT q->downloadRequested(download); - - QQuickWebEngineDownloadItem::DownloadState state = download->state(); - info.path = QDir(download->downloadDirectory()).filePath(download->downloadFileName()); - info.savePageFormat = itemPrivate->savePageFormat; - info.accepted = state != QQuickWebEngineDownloadItem::DownloadCancelled - && state != QQuickWebEngineDownloadItem::DownloadRequested; - - if (state == QQuickWebEngineDownloadItem::DownloadRequested) { - // Delete unaccepted downloads. - info.accepted = false; - delete download; - } -} - -void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info) -{ - if (!m_ongoingDownloads.contains(info.id)) - return; - - Q_Q(QQuickWebEngineProfile); - - QQuickWebEngineDownloadItem* download = m_ongoingDownloads.value(info.id).data(); - - if (!download) { - downloadDestroyed(info.id); - return; - } - - download->d_func()->update(info); - - if (info.state != ProfileAdapterClient::DownloadInProgress) { - Q_EMIT q->downloadFinished(download); - } -} - -void QQuickWebEngineProfilePrivate::useForGlobalCertificateVerificationChanged() -{ - Q_Q(QQuickWebEngineProfile); - Q_EMIT q->useForGlobalCertificateVerificationChanged(); -} - -void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> &controller) -{ - Q_Q(QQuickWebEngineProfile); - auto notification = new QWebEngineNotification(controller); - QQmlEngine::setObjectOwnership(notification, QQmlEngine::JavaScriptOwnership); - Q_EMIT q->presentNotification(notification); -} - -void QQuickWebEngineProfilePrivate::userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - QtWebEngineCore::UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); - d->m_userScripts.append(script); - script->d_func()->bind(resourceController); -} - -int QQuickWebEngineProfilePrivate::userScripts_count(QQmlListProperty<QQuickWebEngineScript> *p) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - return d->m_userScripts.count(); -} - -QQuickWebEngineScript *QQuickWebEngineProfilePrivate::userScripts_at(QQmlListProperty<QQuickWebEngineScript> *p, int idx) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - return d->m_userScripts.at(idx); -} - -void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWebEngineScript> *p) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineProfilePrivate *d = static_cast<QQuickWebEngineProfilePrivate *>(p->data); - QtWebEngineCore::UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); - resourceController->clearAllScripts(NULL); - d->m_userScripts.clear(); -} - -/*! - \qmltype WebEngineProfile - \instantiates QQuickWebEngineProfile - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - \brief Contains settings, scripts, and visited links common to multiple web engine views. - - WebEngineProfile contains settings, scripts, and the list of visited links shared by all - views that belong to the profile. - - Information about visited links is stored together with persistent cookies - and other persistent data in a storage determined by the storageName - property. Persistent data is stored in a subdirectory determined by the - persistentStoragePath property and the cache in a subdirectory determined by - the cachePath property. The httpCacheType property describes the type of the - cache: \e in-memory or \e on-disk. If only the storageName property is set, - the other values are generated automatically based on it. If you specify - any of the values manually, you should do it before creating any pages that - belong to the profile. - - Profiles can be used to isolate pages from each other. A typical use case is - a dedicated \e {off-the-record profile} for a \e {private browsing} mode. An - off-the-record profile forces cookies, the HTTP cache, and other normally - persistent data to be stored only in memory. The offTheRecord property holds - whether a profile is off-the-record. - - Each web engine view has an associated profile. Views that do not have a specific profile set - share a common default one. -*/ - -/*! - \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadItem download) - - This signal is emitted whenever a download has been triggered. - The \a download argument holds the state of the download. - The download has to be explicitly accepted with WebEngineDownloadItem::accept() or the - download will be cancelled by default. -*/ - -/*! - \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadItem download) - - This signal is emitted whenever downloading stops, because it finished successfully, was - cancelled, or was interrupted (for example, because connectivity was lost). - The \a download argument holds the state of the finished download instance. -*/ - -/*! - \qmlsignal WebEngineProfile::presentNotification(WebEngineNotification notification) - \since QtWebEngine 1.9 - - This signal is emitted whenever there is a newly created user notification. - The \a notification argument holds the notification instance to query data and interact with. -*/ - -/*! - Constructs a new profile with the parent \a parent. -*/ -QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent) - : QObject(parent), - d_ptr(new QQuickWebEngineProfilePrivate(new QtWebEngineCore::ProfileAdapter())) -{ - d_ptr->q_ptr = this; -} - -QQuickWebEngineProfile::QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *privatePtr, QObject *parent) - : QObject(parent) - , d_ptr(privatePtr) -{ - d_ptr->q_ptr = this; -} - -/*! - \internal -*/ -QQuickWebEngineProfile::~QQuickWebEngineProfile() -{ - d_ptr->cleanDownloads(); -} - -/*! - \qmlproperty string WebEngineProfile::storageName - - The storage name that is used to create separate subdirectories for each profile that uses - the disk for storing persistent data and cache. - - \sa WebEngineProfile::persistentStoragePath, WebEngineProfile::cachePath -*/ - -/*! - \property QQuickWebEngineProfile::storageName - - The storage name that is used to create separate subdirectories for each profile that uses - the disk for storing persistent data and cache. - - \sa persistentStoragePath, cachePath -*/ - -QString QQuickWebEngineProfile::storageName() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->storageName(); -} - -void QQuickWebEngineProfile::setStorageName(const QString &name) -{ - Q_D(QQuickWebEngineProfile); - if (d->profileAdapter()->storageName() == name) - return; - ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); - ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); - d->profileAdapter()->setStorageName(name); - emit storageNameChanged(); - emit persistentStoragePathChanged(); - emit cachePathChanged(); - if (d->profileAdapter()->httpCacheType() != oldCacheType) - emit httpCacheTypeChanged(); - if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) - emit persistentCookiesPolicyChanged(); -} - -/*! - \qmlproperty bool WebEngineProfile::offTheRecord - - Whether the web engine profile is \e off-the-record. - An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data - to be stored only in memory. -*/ - - -/*! - \property QQuickWebEngineProfile::offTheRecord - - Whether the web engine profile is \e off-the-record. - An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data - to be stored only in memory. -*/ - -bool QQuickWebEngineProfile::isOffTheRecord() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->isOffTheRecord(); -} - -void QQuickWebEngineProfile::setOffTheRecord(bool offTheRecord) -{ - Q_D(QQuickWebEngineProfile); - if (d->profileAdapter()->isOffTheRecord() == offTheRecord) - return; - ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); - ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); - d->profileAdapter()->setOffTheRecord(offTheRecord); - emit offTheRecordChanged(); - if (d->profileAdapter()->httpCacheType() != oldCacheType) - emit httpCacheTypeChanged(); - if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) - emit persistentCookiesPolicyChanged(); -} - -/*! - \qmlproperty string WebEngineProfile::persistentStoragePath - - The path to the location where the persistent data for the browser and web content are - stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links. - - By default, the storage is located below - QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a directory named using - storageName. -*/ - -/*! - \property QQuickWebEngineProfile::persistentStoragePath - - The path to the location where the persistent data for the browser and web content are - stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links. - - By default, the storage is located below - QStandardPaths::writableLocation(QStandardPaths::DataLocation) in a directory named using - storageName. -*/ - -QString QQuickWebEngineProfile::persistentStoragePath() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->dataPath(); -} - -void QQuickWebEngineProfile::setPersistentStoragePath(const QString &path) -{ - Q_D(QQuickWebEngineProfile); - if (persistentStoragePath() == path) - return; - d->profileAdapter()->setDataPath(path); - emit persistentStoragePathChanged(); -} - -/*! - \qmlproperty string WebEngineProfile::cachePath - - The path to the location where the profile's caches are stored, in particular the HTTP cache. - - By default, the caches are stored - below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a directory named using - storageName. -*/ - -/*! - \property QQuickWebEngineProfile::cachePath - - The path to the location where the profile's caches are stored, in particular the HTTP cache. - - By default, the caches are stored - below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a directory named using - storageName. -*/ - -QString QQuickWebEngineProfile::cachePath() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->cachePath(); -} - -void QQuickWebEngineProfile::setCachePath(const QString &path) -{ - Q_D(QQuickWebEngineProfile); - if (cachePath() == path) - return; - d->profileAdapter()->setCachePath(path); - emit cachePathChanged(); -} - -/*! - \qmlproperty string WebEngineProfile::httpUserAgent - - The user-agent string sent with HTTP to identify the browser. - - \note On Windows 8.1 and newer, the default user agent will always report - "Windows NT 6.2" (Windows 8), unless the application does contain a manifest - that declares newer Windows versions as supported. -*/ - -/*! - \property QQuickWebEngineProfile::httpUserAgent - - The user-agent string sent with HTTP to identify the browser. -*/ - -QString QQuickWebEngineProfile::httpUserAgent() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->httpUserAgent(); -} - -void QQuickWebEngineProfile::setHttpUserAgent(const QString &userAgent) -{ - Q_D(QQuickWebEngineProfile); - if (d->profileAdapter()->httpUserAgent() == userAgent) - return; - d->profileAdapter()->setHttpUserAgent(userAgent); - emit httpUserAgentChanged(); -} - - -/*! - \qmlproperty enumeration WebEngineProfile::httpCacheType - - This enumeration describes the type of the HTTP cache: - - \value WebEngineProfile.MemoryHttpCache - Uses an in-memory cache. This is the only setting possible if offTheRecord is set or - no persistentStoragePath is available. - \value WebEngineProfile.DiskHttpCache - Uses a disk cache. This is the default value. - \value WebEngineProfile.NoCache - Disables caching. (Added in 5.7) -*/ - -/*! - \property QQuickWebEngineProfile::httpCacheType - - This enumeration describes the type of the HTTP cache. - - If the profile is off-the-record, MemoryHttpCache is returned. -*/ - -QQuickWebEngineProfile::HttpCacheType QQuickWebEngineProfile::httpCacheType() const -{ - const Q_D(QQuickWebEngineProfile); - return QQuickWebEngineProfile::HttpCacheType(d->profileAdapter()->httpCacheType()); -} - -void QQuickWebEngineProfile::setHttpCacheType(QQuickWebEngineProfile::HttpCacheType httpCacheType) -{ - Q_D(QQuickWebEngineProfile); - ProfileAdapter::HttpCacheType oldCacheType = d->profileAdapter()->httpCacheType(); - d->profileAdapter()->setHttpCacheType(ProfileAdapter::HttpCacheType(httpCacheType)); - if (d->profileAdapter()->httpCacheType() != oldCacheType) - emit httpCacheTypeChanged(); -} - -/*! - \qmlproperty enumeration WebEngineProfile::persistentCookiesPolicy - - This enumeration describes the policy of cookie persistency: - - \value WebEngineProfile.NoPersistentCookies - Both session and persistent cookies are stored in memory. This is the only setting - possible if offTheRecord is set or no persistentStoragePath is available. - \value WebEngineProfile.AllowPersistentCookies - Cookies marked persistent are saved to and restored from disk, whereas session cookies - are only stored to disk for crash recovery. This is the default setting. - \value WebEngineProfile.ForcePersistentCookies - Both session and persistent cookies are saved to and restored from disk. -*/ - -/*! - \property QQuickWebEngineProfile::persistentCookiesPolicy - - This enumeration describes the policy of cookie persistency. - If the profile is off-the-record, NoPersistentCookies is returned. -*/ - -QQuickWebEngineProfile::PersistentCookiesPolicy QQuickWebEngineProfile::persistentCookiesPolicy() const -{ - const Q_D(QQuickWebEngineProfile); - return QQuickWebEngineProfile::PersistentCookiesPolicy(d->profileAdapter()->persistentCookiesPolicy()); -} - -void QQuickWebEngineProfile::setPersistentCookiesPolicy(QQuickWebEngineProfile::PersistentCookiesPolicy newPersistentCookiesPolicy) -{ - Q_D(QQuickWebEngineProfile); - ProfileAdapter::PersistentCookiesPolicy oldPolicy = d->profileAdapter()->persistentCookiesPolicy(); - d->profileAdapter()->setPersistentCookiesPolicy(ProfileAdapter::PersistentCookiesPolicy(newPersistentCookiesPolicy)); - if (d->profileAdapter()->persistentCookiesPolicy() != oldPolicy) - emit persistentCookiesPolicyChanged(); -} - -/*! - \qmlproperty int WebEngineProfile::httpCacheMaximumSize - - The maximum size of the HTTP cache. If \c 0, the size will be controlled automatically by - QtWebEngine. The default value is \c 0. - - \sa httpCacheType -*/ - -/*! - \property QQuickWebEngineProfile::httpCacheMaximumSize - - The maximum size of the HTTP cache. If \c 0, the size will be controlled automatically by - QtWebEngine. The default value is \c 0. - - \sa httpCacheType -*/ - -int QQuickWebEngineProfile::httpCacheMaximumSize() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->httpCacheMaxSize(); -} - -void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize) -{ - Q_D(QQuickWebEngineProfile); - if (d->profileAdapter()->httpCacheMaxSize() == maximumSize) - return; - d->profileAdapter()->setHttpCacheMaxSize(maximumSize); - emit httpCacheMaximumSizeChanged(); -} - -/*! - \qmlproperty string WebEngineProfile::httpAcceptLanguage - - The value of the Accept-Language HTTP request-header field. - - \since QtWebEngine 1.2 -*/ - -/*! - \property QQuickWebEngineProfile::httpAcceptLanguage - - The value of the Accept-Language HTTP request-header field. -*/ - -QString QQuickWebEngineProfile::httpAcceptLanguage() const -{ - Q_D(const QQuickWebEngineProfile); - return d->profileAdapter()->httpAcceptLanguage(); -} - -void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLanguage) -{ - Q_D(QQuickWebEngineProfile); - if (d->profileAdapter()->httpAcceptLanguage() == httpAcceptLanguage) - return; - d->profileAdapter()->setHttpAcceptLanguage(httpAcceptLanguage); - emit httpAcceptLanguageChanged(); -} - -/*! - Returns the default profile. - - The default profile uses the storage name "Default". - - \sa storageName() -*/ -QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() -{ - static QQuickWebEngineProfile *profile = new QQuickWebEngineProfile( - new QQuickWebEngineProfilePrivate(ProfileAdapter::createDefaultProfileAdapter()), - ProfileAdapter::globalQObjectRoot()); - return profile; -} - -/*! - \property QQuickWebEngineProfile::spellCheckLanguages - \brief The languages used by the spell checker. - - \since QtWebEngine 1.4 -*/ - -/*! - \qmlproperty list<string> WebEngineProfile::spellCheckLanguages - - This property holds the list of languages used by the spell checker. - Each language should match the name of the \c .bdic dictionary. - For example, the language \c en-US will load the \c en-US.bdic - dictionary file. - - See the \l {Spellchecker}{Spellchecker feature documentation} for how - dictionary files are searched. - - For more information about how to compile \c .bdic dictionaries, see the - \l{WebEngine Widgets Spellchecker Example}{Spellchecker Example}. - - \since QtWebEngine 1.4 -*/ -void QQuickWebEngineProfile::setSpellCheckLanguages(const QStringList &languages) -{ - Q_D(QQuickWebEngineProfile); - if (languages != d->profileAdapter()->spellCheckLanguages()) { - d->profileAdapter()->setSpellCheckLanguages(languages); - emit spellCheckLanguagesChanged(); - } -} - -/*! - \since 5.8 - - Returns the list of languages used by the spell checker. -*/ -QStringList QQuickWebEngineProfile::spellCheckLanguages() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->spellCheckLanguages(); -} - -/*! - \property QQuickWebEngineProfile::spellCheckEnabled - \brief whether the web engine spell checker is enabled. - - \since QtWebEngine 1.4 -*/ - -/*! - \qmlproperty bool WebEngineProfile::spellCheckEnabled - - This property holds whether the web engine spell checker is enabled. - - \since QtWebEngine 1.4 -*/ -void QQuickWebEngineProfile::setSpellCheckEnabled(bool enable) -{ - Q_D(QQuickWebEngineProfile); - if (enable != isSpellCheckEnabled()) { - d->profileAdapter()->setSpellCheckEnabled(enable); - emit spellCheckEnabledChanged(); - } -} - -bool QQuickWebEngineProfile::isSpellCheckEnabled() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->isSpellCheckEnabled(); -} - -/*! - \property QQuickWebEngineProfile::useForGlobalCertificateVerification - \since 5.13 - - This property holds whether this profile is used for downloading and - caching during global certificate verification when using the online - certificate status protocol (OCSP), certificate revokation lists (CRLs), - and authority information access (AIA), for example. - - As long as one profile has this option enabled, all other profiles will be - able to use it for certificate verification. Only one profile at a time can - have this option enabled. It is recommended that the profile has a disk HTTP - cache to avoid needlessly re-downloading. - - By default, no profile has this property enabled. - - Currently, only affects Linux/NSS installations, where having a profile with - this role enables OCSP. -*/ - -/*! - \qmlproperty bool WebEngineProfile::useForGlobalCertificateVerification - \since QtWebEngine 1.9 - - This property holds whether this profile is used for downloading and - caching during global certificate verification when using the online - certificate status protocol (OCSP), certificate revokation lists (CRLs), - and authority information access (AIA), for example. - - As long as one profile has this option enabled, all other profiles will be - able to use it for certificate verification. Only one profile at a time can - have this option enabled. It is recommended that the profile has a disk HTTP - cache to avoid needlessly re-downloading. - - By default, no profile has this property enabled. - - Currently, only affects Linux/NSS installations, where having a profile with - this role enables OCSP. -*/ - -void QQuickWebEngineProfile::setUseForGlobalCertificateVerification(bool enable) -{ - Q_D(QQuickWebEngineProfile); - if (enable != d->profileAdapter()->isUsedForGlobalCertificateVerification()) { - d->profileAdapter()->setUseForGlobalCertificateVerification(enable); - emit useForGlobalCertificateVerificationChanged(); - } -} - -bool QQuickWebEngineProfile::isUsedForGlobalCertificateVerification() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->isUsedForGlobalCertificateVerification(); -} - -/*! - \qmlproperty string WebEngineProfile::downloadPath - \since QtWebEngine 1.9 - - The path to the location where the downloaded files are stored. - - Overrides the default path used for download location. - - If set to an empty string, the default path is restored. - - \note By default, the download path is QStandardPaths::DownloadLocation. -*/ - -/*! - \property QQuickWebEngineProfile::downloadPath - \since QtWebEngine 1.9 - - The path to the location where the downloaded files are stored. - - Overrides the default path used for download location, setting it to \a path. - - If set to an empty string, the default path is restored. - - \note By default, the download path is QStandardPaths::DownloadLocation. -*/ - -void QQuickWebEngineProfile::setDownloadPath(const QString &path) -{ - Q_D(QQuickWebEngineProfile); - if (downloadPath() == path) - return; - d->profileAdapter()->setDownloadPath(path); - emit downloadPathChanged(); -} - -QString QQuickWebEngineProfile::downloadPath() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->downloadPath(); -} - -/*! - - Returns the cookie store for this profile. -*/ -QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->cookieStore(); -} - -/*! - \qmlmethod void WebEngineProfile::clearHttpCache() - \since QtWebEngine 1.3 - - Removes the profile's cache entries. - - \sa WebEngineProfile::cachePath -*/ - -/*! - \since 5.7 - - Removes the profile's cache entries. - - \sa WebEngineProfile::clearHttpCache -*/ -void QQuickWebEngineProfile::clearHttpCache() -{ - Q_D(QQuickWebEngineProfile); - d->profileAdapter()->clearHttpCache(); -} - -#if QT_DEPRECATED_SINCE(5, 13) -/*! - Registers a request interceptor singleton \a interceptor to intercept URL requests. - - The profile does not take ownership of the pointer. - - \obsolete - - Interceptors installed with this method will call - QWebEngineUrlRequestInterceptor::interceptRequest on the I/O thread. Therefore - the user has to provide thread-safe interaction with the other user classes. - Use setUrlRequestInterceptor instead. - - \sa QWebEngineUrlRequestInterceptor - -*/ -void QQuickWebEngineProfile::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) -{ - Q_D(QQuickWebEngineProfile); - interceptor->setProperty("deprecated", true); - d->profileAdapter()->setRequestInterceptor(interceptor); - qWarning("Use of deprecated not tread-safe setter, use setUrlRequestInterceptor instead."); -} -#endif - -/*! - Registers a request interceptor singleton \a interceptor to intercept URL requests. - - The profile does not take ownership of the pointer. - - \sa QWebEngineUrlRequestInfo QWebEngineUrlRequestInterceptor -*/ -void QQuickWebEngineProfile::setUrlRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) -{ - Q_D(QQuickWebEngineProfile); - d->profileAdapter()->setRequestInterceptor(interceptor); -} - - -/*! - Returns the custom URL scheme handler register for the URL scheme \a scheme. -*/ -const QWebEngineUrlSchemeHandler *QQuickWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const -{ - const Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->urlSchemeHandler(scheme); -} - -/*! - Registers a handler \a handler for custom URL scheme \a scheme in the profile. - - It is necessary to first register the scheme with \l - QWebEngineUrlScheme::registerScheme at application startup. -*/ -void QQuickWebEngineProfile::installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *handler) -{ - Q_D(QQuickWebEngineProfile); - d->profileAdapter()->installUrlSchemeHandler(scheme, handler); -} - -/*! - Removes the custom URL scheme handler \a handler from the profile. - - \sa removeUrlScheme() -*/ -void QQuickWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) -{ - Q_D(QQuickWebEngineProfile); - d->profileAdapter()->removeUrlSchemeHandler(handler); -} - -/*! - Removes the custom URL scheme \a scheme from the profile. - - \sa removeUrlSchemeHandler() -*/ -void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme) -{ - Q_D(QQuickWebEngineProfile); - d->profileAdapter()->removeUrlScheme(scheme); -} - -/*! - Removes all custom URL scheme handlers installed in the profile. -*/ -void QQuickWebEngineProfile::removeAllUrlSchemeHandlers() -{ - Q_D(QQuickWebEngineProfile); - d->profileAdapter()->removeAllUrlSchemeHandlers(); -} - -QQuickWebEngineSettings *QQuickWebEngineProfile::settings() const -{ - const Q_D(QQuickWebEngineProfile); - return d->settings(); -} - -/*! - \qmlproperty list<WebEngineScript> WebEngineProfile::userScripts - \since 1.5 - - Returns the collection of WebEngineScripts that are injected into all pages that share - this profile. - - \sa WebEngineScript -*/ - -/*! - \property QQuickWebEngineProfile::userScripts - \since 5.9 - - \brief The collection of scripts that are injected into all pages that share - this profile. - - \sa QQuickWebEngineScript, QQmlListReference -*/ -QQmlListProperty<QQuickWebEngineScript> QQuickWebEngineProfile::userScripts() -{ - Q_D(QQuickWebEngineProfile); - return QQmlListProperty<QQuickWebEngineScript>(this, d, - d->userScripts_append, - d->userScripts_count, - d->userScripts_at, - d->userScripts_clear); -} - -/*! - \since 5.13 - - Returns the profile's client certificate store. -*/ -QWebEngineClientCertificateStore *QQuickWebEngineProfile::clientCertificateStore() -{ -#if QT_CONFIG(ssl) - Q_D(QQuickWebEngineProfile); - return d->profileAdapter()->clientCertificateStore(); -#else - return nullptr; -#endif -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h deleted file mode 100644 index e5f7ff713..000000000 --- a/src/webengine/api/qquickwebengineprofile.h +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEPROFILE_H -#define QQUICKWEBENGINEPROFILE_H - - -#include <QtWebEngine/qtwebengineglobal.h> - -#include <QtCore/QObject> -#include <QtCore/QScopedPointer> -#include <QtCore/QString> -#include <QtQml/QQmlListProperty> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineDownloadItem; -class QQuickWebEngineProfilePrivate; -class QQuickWebEngineScript; -class QQuickWebEngineSettings; -class QWebEngineClientCertificateStore; -class QWebEngineCookieStore; -class QWebEngineNotification; -class QWebEngineUrlRequestInterceptor; -class QWebEngineUrlSchemeHandler; - -class Q_WEBENGINE_EXPORT QQuickWebEngineProfile : public QObject { - Q_OBJECT - Q_PROPERTY(QString storageName READ storageName WRITE setStorageName NOTIFY storageNameChanged FINAL) - Q_PROPERTY(bool offTheRecord READ isOffTheRecord WRITE setOffTheRecord NOTIFY offTheRecordChanged FINAL) - Q_PROPERTY(QString persistentStoragePath READ persistentStoragePath WRITE setPersistentStoragePath NOTIFY persistentStoragePathChanged FINAL) - Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged FINAL) - Q_PROPERTY(QString httpUserAgent READ httpUserAgent WRITE setHttpUserAgent NOTIFY httpUserAgentChanged FINAL) - Q_PROPERTY(HttpCacheType httpCacheType READ httpCacheType WRITE setHttpCacheType NOTIFY httpCacheTypeChanged FINAL) - Q_PROPERTY(QString httpAcceptLanguage READ httpAcceptLanguage WRITE setHttpAcceptLanguage NOTIFY httpAcceptLanguageChanged FINAL REVISION 1) - Q_PROPERTY(PersistentCookiesPolicy persistentCookiesPolicy READ persistentCookiesPolicy WRITE setPersistentCookiesPolicy NOTIFY persistentCookiesPolicyChanged FINAL) - Q_PROPERTY(int httpCacheMaximumSize READ httpCacheMaximumSize WRITE setHttpCacheMaximumSize NOTIFY httpCacheMaximumSizeChanged FINAL) - Q_PROPERTY(QStringList spellCheckLanguages READ spellCheckLanguages WRITE setSpellCheckLanguages NOTIFY spellCheckLanguagesChanged FINAL REVISION 3) - Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged FINAL REVISION 3) - Q_PROPERTY(QQmlListProperty<QQuickWebEngineScript> userScripts READ userScripts FINAL REVISION 4) - Q_PROPERTY(bool useForGlobalCertificateVerification - READ isUsedForGlobalCertificateVerification - WRITE setUseForGlobalCertificateVerification - NOTIFY useForGlobalCertificateVerificationChanged - FINAL REVISION 5) - Q_PROPERTY(QString downloadPath READ downloadPath WRITE setDownloadPath NOTIFY downloadPathChanged FINAL REVISION 5) - -public: - QQuickWebEngineProfile(QObject *parent = Q_NULLPTR); - ~QQuickWebEngineProfile(); - - enum HttpCacheType { - MemoryHttpCache, - DiskHttpCache, - NoCache - }; - Q_ENUM(HttpCacheType) - - enum PersistentCookiesPolicy { - NoPersistentCookies, - AllowPersistentCookies, - ForcePersistentCookies - }; - Q_ENUM(PersistentCookiesPolicy) - - QString storageName() const; - void setStorageName(const QString &name); - - bool isOffTheRecord() const; - void setOffTheRecord(bool offTheRecord); - - QString persistentStoragePath() const; - void setPersistentStoragePath(const QString &path); - - QString cachePath() const; - void setCachePath(const QString &path); - - QString httpUserAgent() const; - void setHttpUserAgent(const QString &userAgent); - - HttpCacheType httpCacheType() const; - void setHttpCacheType(QQuickWebEngineProfile::HttpCacheType); - - PersistentCookiesPolicy persistentCookiesPolicy() const; - void setPersistentCookiesPolicy(QQuickWebEngineProfile::PersistentCookiesPolicy); - - int httpCacheMaximumSize() const; - void setHttpCacheMaximumSize(int maxSize); - - QString httpAcceptLanguage() const; - void setHttpAcceptLanguage(const QString &httpAcceptLanguage); - - QWebEngineCookieStore *cookieStore() const; - -#if QT_DEPRECATED_SINCE(5, 13) - void setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor); -#endif - void setUrlRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor); - - const QWebEngineUrlSchemeHandler *urlSchemeHandler(const QByteArray &) const; - void installUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler *); - void removeUrlScheme(const QByteArray &scheme); - void removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *); - void removeAllUrlSchemeHandlers(); - - Q_REVISION(2) Q_INVOKABLE void clearHttpCache(); - - void setSpellCheckLanguages(const QStringList &languages); - QStringList spellCheckLanguages() const; - void setSpellCheckEnabled(bool enabled); - bool isSpellCheckEnabled() const; - - QQmlListProperty<QQuickWebEngineScript> userScripts(); - - void setUseForGlobalCertificateVerification(bool b); - bool isUsedForGlobalCertificateVerification() const; - - QString downloadPath() const; - void setDownloadPath(const QString &path); - - QWebEngineClientCertificateStore *clientCertificateStore(); - - static QQuickWebEngineProfile *defaultProfile(); - -Q_SIGNALS: - void storageNameChanged(); - void offTheRecordChanged(); - void persistentStoragePathChanged(); - void cachePathChanged(); - void httpUserAgentChanged(); - void httpCacheTypeChanged(); - void persistentCookiesPolicyChanged(); - void httpCacheMaximumSizeChanged(); - Q_REVISION(1) void httpAcceptLanguageChanged(); - Q_REVISION(3) void spellCheckLanguagesChanged(); - Q_REVISION(3) void spellCheckEnabledChanged(); - Q_REVISION(5) void useForGlobalCertificateVerificationChanged(); - Q_REVISION(5) void downloadPathChanged(); - - void downloadRequested(QQuickWebEngineDownloadItem *download); - void downloadFinished(QQuickWebEngineDownloadItem *download); - - Q_REVISION(5) void presentNotification(QWebEngineNotification *notification); - -private: - Q_DECLARE_PRIVATE(QQuickWebEngineProfile) - QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *, QObject *parent = Q_NULLPTR); - QQuickWebEngineSettings *settings() const; - - friend class QQuickWebEngineSettings; - friend class QQuickWebEngineSingleton; - friend class QQuickWebEngineViewPrivate; - friend class QQuickWebEngineDownloadItem; - friend class QQuickWebEngineDownloadItemPrivate; - friend class QQuickWebEngineView; - QScopedPointer<QQuickWebEngineProfilePrivate> d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEPROFILE_H diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h deleted file mode 100644 index c6d412ab3..000000000 --- a/src/webengine/api/qquickwebengineprofile_p.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEPROFILE_P_H -#define QQUICKWEBENGINEPROFILE_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 "profile_adapter_client.h" -#include "profile_adapter.h" -#include "qquickwebengineprofile.h" - -#include <QExplicitlySharedDataPointer> -#include <QMap> -#include <QPointer> -#include <QSharedPointer> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineDownloadItem; -class QQuickWebEngineSettings; -class QQuickWebEngineViewPrivate; - -class QQuickWebEngineProfilePrivate : public QtWebEngineCore::ProfileAdapterClient { -public: - Q_DECLARE_PUBLIC(QQuickWebEngineProfile) - QQuickWebEngineProfilePrivate(QtWebEngineCore::ProfileAdapter *profileAdapter); - ~QQuickWebEngineProfilePrivate(); - void addWebContentsAdapterClient(QtWebEngineCore::WebContentsAdapterClient *adapter) override; - void removeWebContentsAdapterClient(QtWebEngineCore::WebContentsAdapterClient *adapter) override; - - QtWebEngineCore::ProfileAdapter* profileAdapter() const; - QQuickWebEngineSettings *settings() const; - - void cancelDownload(quint32 downloadId); - void downloadDestroyed(quint32 downloadId); - - void cleanDownloads(); - - void downloadRequested(DownloadItemInfo &info) override; - void downloadUpdated(const DownloadItemInfo &info) override; - - void useForGlobalCertificateVerificationChanged() override; - - void showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> &controller) override; - - // QQmlListPropertyHelpers - static void userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script); - static int userScripts_count(QQmlListProperty<QQuickWebEngineScript> *p); - static QQuickWebEngineScript *userScripts_at(QQmlListProperty<QQuickWebEngineScript> *p, int idx); - static void userScripts_clear(QQmlListProperty<QQuickWebEngineScript> *p); - -private: - friend class QQuickWebEngineView; - QQuickWebEngineProfile *q_ptr; - QScopedPointer<QQuickWebEngineSettings> m_settings; - QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; - QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads; - QList<QQuickWebEngineScript *> m_userScripts; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEPROFILE_P_H diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp deleted file mode 100644 index ab7aee4cb..000000000 --- a/src/webengine/api/qquickwebenginescript.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginescript.h" -#include "qquickwebenginescript_p.h" - -#include <QQmlFile> -#include <QtCore/QDebug> -#include <QtCore/QFile> -#include <QtCore/QTimerEvent> -#include "renderer_host/user_resource_controller_host.h" - -using QtWebEngineCore::UserScript; - -QT_BEGIN_NAMESPACE - -/*! - \class QQuickWebEngineScript - \brief Enables the injection of scripts in the JavaScript engine. - \inmodule QtWebEngine - \since 5.9 - - The QQuickWebEngineScript type enables the programmatic injection of so called \e {user scripts} in - the JavaScript engine at different points, determined by injectionPoint, during the loading of - web content. - - Scripts can be executed either in the main JavaScript \e world, along with the rest of the - JavaScript coming from the web contents, or in their own isolated world. While the DOM of the - page can be accessed from any world, JavaScript variables of a function defined in one world are - not accessible from a different one. The worldId property provides some predefined IDs for this - purpose. -*/ - -/*! - \enum QQuickWebEngineScript::InjectionPoint - - The point in the loading process at which the script will be executed. - - \value DocumentCreation - The script will be executed as soon as the document is created. This is not suitable for - any DOM operation. - \value DocumentReady - The script will run as soon as the DOM is ready. This is equivalent to the - \c DOMContentLoaded event firing in JavaScript. - \value Deferred - The script will run when the page load finishes, or 500 ms after the document is ready, - whichever comes first. -*/ - -/*! - \enum QQuickWebEngineScript::ScriptWorldId - - The world ID defining which isolated world the script is executed in. Besides these predefined - IDs custom IDs can be used, but must be integers between \c 0 and \c 256. - - \value MainWorld - The world used by the page's web contents. It can be useful in order to expose custom - functionality to web contents in certain scenarios. - \value ApplicationWorld - The default isolated world used for application level functionality implemented in - JavaScript. - \value UserWorld - The first isolated world to be used by scripts set by users if the application is not - making use of more worlds. As a rule of thumb, if that functionality is exposed to the - application users, each individual script should probably get its own isolated world. -*/ - -/*! - \qmltype WebEngineScript - \instantiates QQuickWebEngineScript - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - \brief Enables the programmatic injection of scripts in the JavaScript engine. - - The WebEngineScript type enables the programmatic injection of so called \e {user scripts} in - the JavaScript engine at different points, determined by injectionPoint, during the loading of - web content. - - Scripts can be executed either in the main JavaScript \e world, along with the rest of the - JavaScript coming from the web contents, or in their own isolated world. While the DOM of the - page can be accessed from any world, JavaScript variables of a function defined in one world are - not accessible from a different one. The worldId property provides some predefined IDs for this - purpose. - - The following \l Greasemonkey attributes are supported since Qt 5.8: - \c @exclude, \c @include, \c @name, \c @match, and \c @run-at. - - Use \l{WebEngineView::userScripts}{WebEngineView.userScripts} to access a list of scripts - attached to the web view. -*/ - -/*! - Constructs a new QQuickWebEngineScript with the parent \a parent. -*/ -QQuickWebEngineScript::QQuickWebEngineScript(QObject *parent) - : QObject(parent) - , d_ptr(new QQuickWebEngineScriptPrivate) -{ - d_ptr->q_ptr = this; -} - -/*! - \internal -*/ -QQuickWebEngineScript::~QQuickWebEngineScript() -{ -} - -/*! - Returns the script object as string. -*/ -QString QQuickWebEngineScript::toString() const -{ - Q_D(const QQuickWebEngineScript); - if (d->coreScript.isNull()) - return QStringLiteral("QWebEngineScript()"); - QString ret = QStringLiteral("QWebEngineScript(") % d->coreScript.name() % QStringLiteral(", "); - switch (d->coreScript.injectionPoint()) { - case UserScript::DocumentElementCreation: - ret.append(QStringLiteral("WebEngineScript::DocumentCreation, ")); - break; - case UserScript::DocumentLoadFinished: - ret.append(QStringLiteral("WebEngineScript::DocumentReady, ")); - break; - case UserScript::AfterLoad: - ret.append(QStringLiteral("WebEngineScript::Deferred, ")); - break; - } - ret.append(QString::number(d->coreScript.worldId()) % QStringLiteral(", ") - % (d->coreScript.runsOnSubFrames() ? QStringLiteral("true") : QStringLiteral("false")) - % QStringLiteral(", ") % d->coreScript.sourceCode() % QLatin1Char(')')); - return ret; -} - -/*! - \property QQuickWebEngineScript::name - \brief The name of the script. - - Can be useful to retrieve a particular script from - QQuickWebEngineProfile::userScripts. -*/ - -/*! - \qmlproperty string WebEngineScript::name - - The name of the script. Can be useful to retrieve a particular script from - \l{WebEngineView::userScripts}{WebEngineView.userScripts}. -*/ -QString QQuickWebEngineScript::name() const -{ - Q_D(const QQuickWebEngineScript); - return d->coreScript.name(); -} - -/*! - \property QQuickWebEngineScript::sourceUrl - \brief The remote source location of the user script (if any). - - Unlike \l sourceCode, this property allows referring to user scripts that - are not already loaded in memory, for instance, when stored on disk. - - Setting this property will change the \l sourceCode of the script. - - \note At present, only file-based sources are supported. - - \sa QQuickWebEngineScript::sourceCode -*/ - -/*! - \qmlproperty url WebEngineScript::sourceUrl - - This property holds the remote source location of the user script (if any). - - Unlike \l sourceCode, this property allows referring to user scripts that - are not already loaded in memory, for instance, when stored on disk. - - Setting this property will change the \l sourceCode of the script. - - \note At present, only file-based sources are supported. - - \sa sourceCode -*/ -QUrl QQuickWebEngineScript::sourceUrl() const -{ - Q_D(const QQuickWebEngineScript); - return d->m_sourceUrl; -} - -/*! - \property QQuickWebEngineScript::sourceCode - \brief The JavaScript source code of the user script. - - \sa QQuickWebEngineScript::sourceUrl -*/ - -/*! - \qmlproperty string WebEngineScript::sourceCode - - This property holds the JavaScript source code of the user script. - - \sa sourceUrl -*/ -QString QQuickWebEngineScript::sourceCode() const -{ - Q_D(const QQuickWebEngineScript); - return d->coreScript.sourceCode(); -} - -ASSERT_ENUMS_MATCH(QQuickWebEngineScript::Deferred, UserScript::AfterLoad) -ASSERT_ENUMS_MATCH(QQuickWebEngineScript::DocumentReady, UserScript::DocumentLoadFinished) -ASSERT_ENUMS_MATCH(QQuickWebEngineScript::DocumentCreation, UserScript::DocumentElementCreation) - -/*! - \property QQuickWebEngineScript::injectionPoint - \brief The point in the loading process at which the script will be executed. - - The default value is \c Deferred. -*/ - -/*! - \qmlproperty enumeration WebEngineScript::injectionPoint - - The point in the loading process at which the script will be executed. - The default value is \c Deferred. - - \value WebEngineScript.DocumentCreation - The script will be executed as soon as the document is created. This is not suitable for - any DOM operation. - \value WebEngineScript.DocumentReady - The script will run as soon as the DOM is ready. This is equivalent to the - \c DOMContentLoaded event firing in JavaScript. - \value WebEngineScript.Deferred - The script will run when the page load finishes, or 500 ms after the document is ready, - whichever comes first. -*/ -QQuickWebEngineScript::InjectionPoint QQuickWebEngineScript::injectionPoint() const -{ - Q_D(const QQuickWebEngineScript); - return static_cast<QQuickWebEngineScript::InjectionPoint>(d->coreScript.injectionPoint()); -} - -/*! - \property QQuickWebEngineScript::worldId - \brief The world ID defining which isolated world the script is executed in. -*/ - -/*! - \qmlproperty enumeration WebEngineScript::worldId - - The world ID defining which isolated world the script is executed in. - - \value WebEngineScript.MainWorld - The world used by the page's web contents. It can be useful in order to expose custom - functionality to web contents in certain scenarios. - \value WebEngineScript.ApplicationWorld - The default isolated world used for application level functionality implemented in - JavaScript. - \value WebEngineScript.UserWorld - The first isolated world to be used by scripts set by users if the application is not - making use of more worlds. As a rule of thumb, if that functionality is exposed to the - application users, each individual script should probably get its own isolated world. -*/ -QQuickWebEngineScript::ScriptWorldId QQuickWebEngineScript::worldId() const -{ - Q_D(const QQuickWebEngineScript); - return static_cast<QQuickWebEngineScript::ScriptWorldId>(d->coreScript.worldId()); -} - -/*! - \property QQuickWebEngineScript::runOnSubframes - \brief Whether the script is executed on every frame or only on the main frame. - - Set this property to \c true if the script is executed on every frame in the page, or \c false - if it is only run for the main frame. - The default value is \c{false}. -*/ - -/*! - \qmlproperty int WebEngineScript::runOnSubframes - - Set this property to \c true if the script is executed on every frame in the page, or \c false - if it is only ran for the main frame. - The default value is \c{false}. - */ -bool QQuickWebEngineScript::runOnSubframes() const -{ - Q_D(const QQuickWebEngineScript); - return d->coreScript.runsOnSubFrames(); -} - -void QQuickWebEngineScript::setName(const QString &name) -{ - Q_D(QQuickWebEngineScript); - if (name == QQuickWebEngineScript::name()) - return; - d->aboutToUpdateUnderlyingScript(); - d->coreScript.setName(name); - Q_EMIT nameChanged(name); -} - -void QQuickWebEngineScript::setSourceCode(const QString &code) -{ - Q_D(QQuickWebEngineScript); - if (code == sourceCode()) - return; - - // setting the source directly resets the sourceUrl - if (d->m_sourceUrl != QUrl()) { - d->m_sourceUrl = QUrl(); - Q_EMIT sourceUrlChanged(d->m_sourceUrl); - } - - d->aboutToUpdateUnderlyingScript(); - d->coreScript.setSourceCode(code); - Q_EMIT sourceCodeChanged(code); -} - -void QQuickWebEngineScript::setSourceUrl(const QUrl &url) -{ - Q_D(QQuickWebEngineScript); - if (url == sourceUrl()) - return; - - d->m_sourceUrl = url; - Q_EMIT sourceUrlChanged(d->m_sourceUrl); - - QFile f(QQmlFile::urlToLocalFileOrQrc(url)); - if (!f.open(QIODevice::ReadOnly)) { - qWarning() << "Can't open user script " << url; - return; - } - - d->aboutToUpdateUnderlyingScript(); - QString source = QString::fromUtf8(f.readAll()); - d->coreScript.setSourceCode(source); - Q_EMIT sourceCodeChanged(source); -} - -void QQuickWebEngineScript::setInjectionPoint(QQuickWebEngineScript::InjectionPoint injectionPoint) -{ - Q_D(QQuickWebEngineScript); - if (injectionPoint == QQuickWebEngineScript::injectionPoint()) - return; - d->aboutToUpdateUnderlyingScript(); - d->coreScript.setInjectionPoint(static_cast<UserScript::InjectionPoint>(injectionPoint)); - Q_EMIT injectionPointChanged(injectionPoint); -} - - -void QQuickWebEngineScript::setWorldId(QQuickWebEngineScript::ScriptWorldId scriptWorldId) -{ - Q_D(QQuickWebEngineScript); - if (scriptWorldId == worldId()) - return; - d->aboutToUpdateUnderlyingScript(); - d->coreScript.setWorldId(scriptWorldId); - Q_EMIT worldIdChanged(scriptWorldId); -} - - -void QQuickWebEngineScript::setRunOnSubframes(bool on) -{ - Q_D(QQuickWebEngineScript); - if (on == runOnSubframes()) - return; - d->aboutToUpdateUnderlyingScript(); - d->coreScript.setRunsOnSubFrames(on); - Q_EMIT runOnSubframesChanged(on); -} - -/*! - \internal -*/ -void QQuickWebEngineScript::timerEvent(QTimerEvent *e) -{ - Q_D(QQuickWebEngineScript); - if (e->timerId() != d->m_basicTimer.timerId()) { - QObject::timerEvent(e); - return; - } - if (!d->m_controllerHost) - return; - d->m_basicTimer.stop(); - d->m_controllerHost->addUserScript(d->coreScript, d->m_adapter); -} - -void QQuickWebEngineScriptPrivate::bind(QtWebEngineCore::UserResourceControllerHost *resourceController, QtWebEngineCore::WebContentsAdapter *adapter) -{ - aboutToUpdateUnderlyingScript(); - m_adapter = adapter; - m_controllerHost = resourceController; -} - -QQuickWebEngineScriptPrivate::QQuickWebEngineScriptPrivate() - :m_controllerHost(0) - , m_adapter(0) - -{ -} - -void QQuickWebEngineScriptPrivate::aboutToUpdateUnderlyingScript() -{ - Q_Q(QQuickWebEngineScript); - if (m_controllerHost) - m_controllerHost->removeUserScript(coreScript, m_adapter); - // Defer updates to the next event loop - m_basicTimer.start(0, q); -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginescript.h b/src/webengine/api/qquickwebenginescript.h deleted file mode 100644 index d5c4310db..000000000 --- a/src/webengine/api/qquickwebenginescript.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINESCRIPT_H -#define QQUICKWEBENGINESCRIPT_H - -#include <QtCore/qobject.h> -#include <QtCore/qurl.h> -#include <QtWebEngine/qtwebengineglobal.h> - -QT_BEGIN_NAMESPACE -class QQuickWebEngineScriptPrivate; -class QQuickWebEngineView; - -class Q_WEBENGINE_EXPORT QQuickWebEngineScript : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL) - Q_PROPERTY(QUrl sourceUrl READ sourceUrl WRITE setSourceUrl NOTIFY sourceUrlChanged FINAL) - Q_PROPERTY(QString sourceCode READ sourceCode WRITE setSourceCode NOTIFY sourceCodeChanged FINAL) - Q_PROPERTY(InjectionPoint injectionPoint READ injectionPoint WRITE setInjectionPoint NOTIFY injectionPointChanged FINAL) - Q_PROPERTY(ScriptWorldId worldId READ worldId WRITE setWorldId NOTIFY worldIdChanged FINAL) - Q_PROPERTY(bool runOnSubframes READ runOnSubframes WRITE setRunOnSubframes NOTIFY runOnSubframesChanged FINAL) - - -public: - enum InjectionPoint { - Deferred, - DocumentReady, - DocumentCreation - }; - Q_ENUM(InjectionPoint) - - enum ScriptWorldId { - MainWorld = 0, - ApplicationWorld, - UserWorld - }; - Q_ENUM(ScriptWorldId) - - explicit QQuickWebEngineScript(QObject *parent = Q_NULLPTR); - ~QQuickWebEngineScript(); - Q_INVOKABLE QString toString() const; - - QString name() const; - QUrl sourceUrl() const; - QString sourceCode() const; - InjectionPoint injectionPoint() const; - ScriptWorldId worldId() const; - bool runOnSubframes() const; - - Q_INVOKABLE void setName(const QString &name); - Q_INVOKABLE void setSourceUrl(const QUrl &url); - Q_INVOKABLE void setSourceCode(const QString &code); - Q_INVOKABLE void setInjectionPoint(InjectionPoint injectionPoint); - Q_INVOKABLE void setWorldId(ScriptWorldId scriptWorldId); - Q_INVOKABLE void setRunOnSubframes(bool on); - -Q_SIGNALS: - void nameChanged(const QString &name); - void sourceUrlChanged(const QUrl &url); - void sourceCodeChanged(const QString &code); - void injectionPointChanged(InjectionPoint injectionPoint); - void worldIdChanged(ScriptWorldId scriptWorldId); - void runOnSubframesChanged(bool on); - -protected: - void timerEvent(QTimerEvent *e) override; - -private: - friend class QQuickWebEngineProfilePrivate; - friend class QQuickWebEngineViewPrivate; - Q_DECLARE_PRIVATE(QQuickWebEngineScript) - QScopedPointer<QQuickWebEngineScriptPrivate> d_ptr; -}; -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINESCRIPT_H diff --git a/src/webengine/api/qquickwebenginescript_p.h b/src/webengine/api/qquickwebenginescript_p.h deleted file mode 100644 index 30b47a654..000000000 --- a/src/webengine/api/qquickwebenginescript_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINESCRIPT_P_H -#define QQUICKWEBENGINESCRIPT_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 "qquickwebenginescript.h" - -#include <QtCore/QBasicTimer> -#include "user_script.h" -#include "web_contents_adapter.h" - -namespace QtWebEngineCore { -class UserResourceControllerHost; -class WebContentsAdapter; -} // namespace - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineScriptPrivate { -public: - Q_DECLARE_PUBLIC(QQuickWebEngineScript) - QQuickWebEngineScriptPrivate(); - void aboutToUpdateUnderlyingScript(); - void bind(QtWebEngineCore::UserResourceControllerHost *, QtWebEngineCore::WebContentsAdapter * = 0); - - QtWebEngineCore::UserScript coreScript; - QBasicTimer m_basicTimer; - QtWebEngineCore::UserResourceControllerHost *m_controllerHost; - QtWebEngineCore::WebContentsAdapter *m_adapter; - QUrl m_sourceUrl; - -private: - QQuickWebEngineScript *q_ptr; - -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINESCRIPT_P_H diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp deleted file mode 100644 index 93a3668ed..000000000 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ /dev/null @@ -1,762 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginesettings_p.h" - -#include "web_engine_settings.h" - -#include <QtWebEngine/QQuickWebEngineProfile> -#include <QtCore/QList> - -QT_BEGIN_NAMESPACE - -using QtWebEngineCore::WebEngineSettings; - -QQuickWebEngineSettings::QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings) - : d_ptr(new WebEngineSettings(parentSettings ? parentSettings->d_ptr.data() : 0)) -{ } - -/*! - \qmltype WebEngineSettings - \instantiates QQuickWebEngineSettings - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - \brief Allows configuration of browser properties and attributes. - - The WebEngineSettings type can be used to configure browser properties and generic - attributes, such as JavaScript support, focus behavior, and access to remote content. This type - is uncreatable, but the default settings for all web engine views can be accessed by using - the \l [QML] {WebEngine::settings}{WebEngine.settings} property. - - Each web engine view can have individual settings that can be accessed by using the - \l{WebEngineView::settings}{WebEngineView.settings} property. -*/ - - -QQuickWebEngineSettings::~QQuickWebEngineSettings() -{ } - -/*! - \enum QQuickWebEngineSettings::UnknownUrlSchemePolicy - \since WebEngine 1.7 - - This enum describes how navigation requests to URLs with unknown schemes are handled. - - \value DisallowUnknownUrlSchemes - Disallows all navigation requests to URLs with unknown schemes. - \value AllowUnknownUrlSchemesFromUserInteraction - Allows navigation requests to URLs with unknown schemes that are issued from - user-interaction (like a mouse-click), whereas other navigation requests (for example - from JavaScript) are suppressed. - \value AllowAllUnknownUrlSchemes - Allows all navigation requests to URLs with unknown schemes. -*/ - -/*! - \qmlproperty bool WebEngineSettings::autoLoadImages - - Automatically loads images on web pages. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::autoLoadImages() const -{ - return d_ptr->testAttribute(WebEngineSettings::AutoLoadImages); -} - -/*! - \qmlproperty bool WebEngineSettings::javascriptEnabled - - Enables the running of JavaScript programs. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::javascriptEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::JavascriptEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::javascriptCanOpenWindows - - Allows JavaScript programs to open popup windows without user interaction. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::javascriptCanOpenWindows() const -{ - return d_ptr->testAttribute(WebEngineSettings::JavascriptCanOpenWindows); -} - -/*! - \qmlproperty bool WebEngineSettings::javascriptCanAccessClipboard - - Allows JavaScript programs to read from or write to the clipboard. - Writing to the clipboard is always allowed if it is specifically requested by the user. - - To enable also the pasting of clipboard content from JavaScript, - use javascriptCanPaste. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::javascriptCanAccessClipboard() const -{ - return d_ptr->testAttribute(WebEngineSettings::JavascriptCanAccessClipboard); -} - -/*! - \qmlproperty bool WebEngineSettings::linksIncludedInFocusChain - - Includes hyperlinks in the keyboard focus chain. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::linksIncludedInFocusChain() const -{ - return d_ptr->testAttribute(WebEngineSettings::LinksIncludedInFocusChain); -} - -/*! - \qmlproperty bool WebEngineSettings::localStorageEnabled - - Enables support for the HTML 5 local storage feature. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::localStorageEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::LocalStorageEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::localContentCanAccessRemoteUrls - - Allows locally loaded documents to access remote URLs. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::localContentCanAccessRemoteUrls() const -{ - return d_ptr->testAttribute(WebEngineSettings::LocalContentCanAccessRemoteUrls); -} - -/*! - \qmlproperty bool WebEngineSettings::spatialNavigationEnabled - - Enables the Spatial Navigation feature, which means the ability to navigate between focusable - elements, such as hyperlinks and form controls, on a web page by using the Left, Right, Up and - Down arrow keys. - - For example, if a user presses the Right key, heuristics determine whether there is an element - they might be trying to reach towards the right and which element they probably want. - - Disabled by default. - -*/ -bool QQuickWebEngineSettings::spatialNavigationEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::SpatialNavigationEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::localContentCanAccessFileUrls - - Allows locally loaded documents to access other local URLs. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::localContentCanAccessFileUrls() const -{ - return d_ptr->testAttribute(WebEngineSettings::LocalContentCanAccessFileUrls); -} - -/*! - \qmlproperty bool WebEngineSettings::hyperlinkAuditingEnabled - - Enables support for the \c ping attribute for hyperlinks. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::hyperlinkAuditingEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::HyperlinkAuditingEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::errorPageEnabled - - Enables displaying the built-in error pages of Chromium. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::errorPageEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::ErrorPageEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::pluginsEnabled - - Enables support for Pepper plugins, such as the Flash player. - - Disabled by default. - - \sa {Pepper Plugin API} -*/ -bool QQuickWebEngineSettings::pluginsEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::PluginsEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::fullscreenSupportEnabled - \since QtWebEngine 1.2 - - Tells the web engine whether fullscreen is supported in this application or not. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::fullScreenSupportEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::FullScreenSupportEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::screenCaptureEnabled - \since QtWebEngine 1.3 - - Tells the web engine whether screen capture is supported in this application or not. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::screenCaptureEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::ScreenCaptureEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::webGLEnabled - \since QtWebEngine 1.3 - - Enables support for HTML 5 WebGL. - - Enabled by default if available. -*/ -bool QQuickWebEngineSettings::webGLEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::WebGLEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::accelerated2dCanvasEnabled - \since QtWebEngine 1.3 - - Specifies whether the HTML 5 2D canvas should be an OpenGL framebuffer. - This makes many painting operations faster, but slows down pixel access. - - Enabled by default if available. -*/ -bool QQuickWebEngineSettings::accelerated2dCanvasEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::Accelerated2dCanvasEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::autoLoadIconsForPage - \since QtWebEngine 1.3 - - Automatically downloads icons for web pages. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::autoLoadIconsForPage() const -{ - return d_ptr->testAttribute(WebEngineSettings::AutoLoadIconsForPage); -} - -/*! - \qmlproperty bool WebEngineSettings::touchIconsEnabled - \since QtWebEngine 1.3 - - Enables support for touch icons and precomposed touch icons. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::touchIconsEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::TouchIconsEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::focusOnNavigationEnabled - \since QtWebEngine 1.4 - - Focus is given to the view whenever a navigation operation occurs - (load, stop, reload, reload and bypass cache, forward, backward, set content, and so on). - - Disabled by default. -*/ -bool QQuickWebEngineSettings::focusOnNavigationEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::FocusOnNavigationEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::printElementBackgrounds - \since QtWebEngine 1.4 - - Turns on printing of CSS backgrounds when printing a web page. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::printElementBackgrounds() const -{ - return d_ptr->testAttribute(WebEngineSettings::PrintElementBackgrounds); -} - -/*! - \qmlproperty bool WebEngineSettings::allowRunningInsecureContent - \since QtWebEngine 1.4 - - By default, HTTPS pages cannot run JavaScript, CSS, plugins or - web-sockets from HTTP URLs. This used to be possible and this - provides an override to get the old behavior. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::allowRunningInsecureContent() const -{ - return d_ptr->testAttribute(WebEngineSettings::AllowRunningInsecureContent); -} - -/*! - \qmlproperty bool WebEngineSettings::allowGeolocationOnInsecureOrigins - \since QtWebEngine 1.5 - - Since Qt 5.7, only secure origins such as HTTPS have been able to request - Geolocation features. This provides an override to allow non secure - origins to access Geolocation again. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::allowGeolocationOnInsecureOrigins() const -{ - return d_ptr->testAttribute(WebEngineSettings::AllowGeolocationOnInsecureOrigins); -} - -/*! - \qmlproperty bool WebEngineSettings::allowWindowActivationFromJavaScript - \since QtWebEngine 1.6 - Allows the window.focus() method in JavaScript. Disallowed by default. -*/ -bool QQuickWebEngineSettings::allowWindowActivationFromJavaScript() const -{ - return d_ptr->testAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript); -} - -/*! - \qmlproperty bool WebEngineSettings::showScrollBars - \since QtWebEngine 1.6 - Shows scroll bars. Enabled by default. -*/ -bool QQuickWebEngineSettings::showScrollBars() const -{ - return d_ptr->testAttribute(WebEngineSettings::ShowScrollBars); -} - -/*! - \qmlproperty bool WebEngineSettings::playbackRequiresUserGesture - \since QtWebEngine 1.7 - Inhibits playback of media content until the user interacts with - the page. Disabled by default. - - \note The behavior is similar to Chrome on Android when enabled, - and similar to Chrome on desktops when disabled (default). -*/ -bool QQuickWebEngineSettings::playbackRequiresUserGesture() const -{ - return d_ptr->testAttribute(WebEngineSettings::PlaybackRequiresUserGesture); -} - -/*! - \qmlproperty bool WebEngineSettings::webRTCPublicInterfacesOnly - \since QtWebEngine 1.7 - Limits WebRTC to public IP addresses only. When disabled WebRTC may also use - local network IP addresses, but remote hosts can also see your local network - IP address. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::webRTCPublicInterfacesOnly() const -{ - return d_ptr->testAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly); -} - -/*! - \qmlproperty bool WebEngineSettings::javascriptCanPaste - \since QtWebEngine 1.7 - - Enables JavaScript \c{execCommand("paste")}. - This also requires enabling javascriptCanAccessClipboard. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::javascriptCanPaste() const -{ - return d_ptr->testAttribute(WebEngineSettings::JavascriptCanPaste); -} - -/*! - \qmlproperty bool WebEngineSettings::dnsPrefetchEnabled - \since QtWebEngine 1.8 - - Enables speculative prefetching of DNS records for HTML links before - they are activated. - - Disabled by default. -*/ -bool QQuickWebEngineSettings::dnsPrefetchEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::DnsPrefetchEnabled); -} - -/*! - \qmlproperty bool WebEngineSettings::pdfViewerEnabled - \since QtWebEngine 1.9 - - Specifies that PDF documents will be opened in the internal PDF viewer - instead of being downloaded. - - Enabled by default. -*/ -bool QQuickWebEngineSettings::pdfViewerEnabled() const -{ - return d_ptr->testAttribute(WebEngineSettings::PdfViewerEnabled); -} - -/*! - \qmlproperty string WebEngineSettings::defaultTextEncoding - \since QtWebEngine 1.2 - - Sets the default encoding. The value must be a string describing an encoding such as "utf-8" or - "iso-8859-1". - - If left empty, a default value will be used. -*/ -QString QQuickWebEngineSettings::defaultTextEncoding() const -{ - return d_ptr->defaultTextEncoding(); -} - -ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::DisallowUnknownUrlSchemes, WebEngineSettings::DisallowUnknownUrlSchemes) -ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction, WebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction) -ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowAllUnknownUrlSchemes, WebEngineSettings::AllowAllUnknownUrlSchemes) - -/*! - \qmlproperty WebEngineSettings::UnknownUrlSchemePolicy WebEngineSettings::unknownUrlSchemePolicy - \since QtWebEngine 1.7 - Specifies how navigation requests to URLs with unknown schemes are handled. - - Default is \l{QWebEngineSettings::UnknownUrlSchemePolicy}{WebEngineSettings.AllowUnknownUrlSchemesFromUserInteraction}. -*/ -QQuickWebEngineSettings::UnknownUrlSchemePolicy QQuickWebEngineSettings::unknownUrlSchemePolicy() const -{ - return static_cast<QQuickWebEngineSettings::UnknownUrlSchemePolicy>(d_ptr->unknownUrlSchemePolicy()); -} - -void QQuickWebEngineSettings::setAutoLoadImages(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::AutoLoadImages); - // Set unconditionally as it sets the override for the current settings while the current setting - // could be from the fallback and is prone to changing later on. - d_ptr->setAttribute(WebEngineSettings::AutoLoadImages, on); - if (wasOn != on) - Q_EMIT autoLoadImagesChanged(); -} - -void QQuickWebEngineSettings::setJavascriptEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::JavascriptEnabled); - d_ptr->setAttribute(WebEngineSettings::JavascriptEnabled, on); - if (wasOn != on) - Q_EMIT javascriptEnabledChanged(); -} - -void QQuickWebEngineSettings::setJavascriptCanOpenWindows(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::JavascriptCanOpenWindows); - d_ptr->setAttribute(WebEngineSettings::JavascriptCanOpenWindows, on); - if (wasOn != on) - Q_EMIT javascriptCanOpenWindowsChanged(); -} - -void QQuickWebEngineSettings::setJavascriptCanAccessClipboard(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::JavascriptCanAccessClipboard); - d_ptr->setAttribute(WebEngineSettings::JavascriptCanAccessClipboard, on); - if (wasOn != on) - Q_EMIT javascriptCanAccessClipboardChanged(); -} - -void QQuickWebEngineSettings::setLinksIncludedInFocusChain(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::LinksIncludedInFocusChain); - d_ptr->setAttribute(WebEngineSettings::LinksIncludedInFocusChain, on); - if (wasOn != on) - Q_EMIT linksIncludedInFocusChainChanged(); -} - -void QQuickWebEngineSettings::setLocalStorageEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::LocalStorageEnabled); - d_ptr->setAttribute(WebEngineSettings::LocalStorageEnabled, on); - if (wasOn != on) - Q_EMIT localStorageEnabledChanged(); -} - -void QQuickWebEngineSettings::setLocalContentCanAccessRemoteUrls(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::LocalContentCanAccessRemoteUrls); - d_ptr->setAttribute(WebEngineSettings::LocalContentCanAccessRemoteUrls, on); - if (wasOn != on) - Q_EMIT localContentCanAccessRemoteUrlsChanged(); -} - - -void QQuickWebEngineSettings::setSpatialNavigationEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::SpatialNavigationEnabled); - d_ptr->setAttribute(WebEngineSettings::SpatialNavigationEnabled, on); - if (wasOn != on) - Q_EMIT spatialNavigationEnabledChanged(); -} - -void QQuickWebEngineSettings::setLocalContentCanAccessFileUrls(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::LocalContentCanAccessFileUrls); - d_ptr->setAttribute(WebEngineSettings::LocalContentCanAccessFileUrls, on); - if (wasOn != on) - Q_EMIT localContentCanAccessFileUrlsChanged(); -} - -void QQuickWebEngineSettings::setHyperlinkAuditingEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::HyperlinkAuditingEnabled); - d_ptr->setAttribute(WebEngineSettings::HyperlinkAuditingEnabled, on); - if (wasOn != on) - Q_EMIT hyperlinkAuditingEnabledChanged(); -} - -void QQuickWebEngineSettings::setErrorPageEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::ErrorPageEnabled); - d_ptr->setAttribute(WebEngineSettings::ErrorPageEnabled, on); - if (wasOn != on) - Q_EMIT errorPageEnabledChanged(); -} - -void QQuickWebEngineSettings::setPluginsEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::PluginsEnabled); - d_ptr->setAttribute(WebEngineSettings::PluginsEnabled, on); - if (wasOn != on) - Q_EMIT pluginsEnabledChanged(); -} - -void QQuickWebEngineSettings::setFullScreenSupportEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::FullScreenSupportEnabled); - d_ptr->setAttribute(WebEngineSettings::FullScreenSupportEnabled, on); - if (wasOn != on) - Q_EMIT fullScreenSupportEnabledChanged(); -} - -void QQuickWebEngineSettings::setScreenCaptureEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::ScreenCaptureEnabled); - d_ptr->setAttribute(WebEngineSettings::ScreenCaptureEnabled, on); - if (wasOn != on) - Q_EMIT screenCaptureEnabledChanged(); -} - -void QQuickWebEngineSettings::setWebGLEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::WebGLEnabled); - d_ptr->setAttribute(WebEngineSettings::WebGLEnabled, on); - if (wasOn != on) - Q_EMIT webGLEnabledChanged(); -} - -void QQuickWebEngineSettings::setAccelerated2dCanvasEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::Accelerated2dCanvasEnabled); - d_ptr->setAttribute(WebEngineSettings::Accelerated2dCanvasEnabled, on); - if (wasOn != on) - Q_EMIT accelerated2dCanvasEnabledChanged(); -} - -void QQuickWebEngineSettings::setAutoLoadIconsForPage(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::AutoLoadIconsForPage); - d_ptr->setAttribute(WebEngineSettings::AutoLoadIconsForPage, on); - if (wasOn != on) - Q_EMIT autoLoadIconsForPageChanged(); -} - -void QQuickWebEngineSettings::setTouchIconsEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::TouchIconsEnabled); - d_ptr->setAttribute(WebEngineSettings::TouchIconsEnabled, on); - if (wasOn != on) - Q_EMIT touchIconsEnabledChanged(); -} - -void QQuickWebEngineSettings::setPrintElementBackgrounds(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::PrintElementBackgrounds); - d_ptr->setAttribute(WebEngineSettings::PrintElementBackgrounds, on); - if (wasOn != on) - Q_EMIT printElementBackgroundsChanged(); -} - -void QQuickWebEngineSettings::setDefaultTextEncoding(QString encoding) -{ - const QString oldDefaultTextEncoding = d_ptr->defaultTextEncoding(); - d_ptr->setDefaultTextEncoding(encoding); - if (oldDefaultTextEncoding.compare(encoding)) - Q_EMIT defaultTextEncodingChanged(); -} - -void QQuickWebEngineSettings::setFocusOnNavigationEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::FocusOnNavigationEnabled); - d_ptr->setAttribute(WebEngineSettings::FocusOnNavigationEnabled, on); - if (wasOn != on) - Q_EMIT focusOnNavigationEnabledChanged(); -} - - -void QQuickWebEngineSettings::setAllowRunningInsecureContent(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::AllowRunningInsecureContent); - d_ptr->setAttribute(WebEngineSettings::AllowRunningInsecureContent, on); - if (wasOn != on) - Q_EMIT allowRunningInsecureContentChanged(); -} - -void QQuickWebEngineSettings::setAllowGeolocationOnInsecureOrigins(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::AllowGeolocationOnInsecureOrigins); - d_ptr->setAttribute(WebEngineSettings::AllowGeolocationOnInsecureOrigins, on); - if (wasOn != on) - Q_EMIT allowGeolocationOnInsecureOriginsChanged(); -} - -void QQuickWebEngineSettings::setAllowWindowActivationFromJavaScript(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript); - d_ptr->setAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript, on); - if (wasOn != on) - Q_EMIT allowWindowActivationFromJavaScriptChanged(); -} - -void QQuickWebEngineSettings::setShowScrollBars(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::ShowScrollBars); - d_ptr->setAttribute(WebEngineSettings::ShowScrollBars, on); - if (wasOn != on) - Q_EMIT showScrollBarsChanged(); -} - -void QQuickWebEngineSettings::setPlaybackRequiresUserGesture(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::PlaybackRequiresUserGesture); - d_ptr->setAttribute(WebEngineSettings::PlaybackRequiresUserGesture, on); - if (wasOn != on) - Q_EMIT playbackRequiresUserGestureChanged(); -} - -void QQuickWebEngineSettings::setJavascriptCanPaste(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::JavascriptCanPaste); - d_ptr->setAttribute(WebEngineSettings::JavascriptCanPaste, on); - if (wasOn != on) - Q_EMIT javascriptCanPasteChanged(); -} - -void QQuickWebEngineSettings::setDnsPrefetchEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::DnsPrefetchEnabled); - d_ptr->setAttribute(WebEngineSettings::DnsPrefetchEnabled, on); - if (wasOn != on) - Q_EMIT dnsPrefetchEnabledChanged(); -} - -void QQuickWebEngineSettings::setPdfViewerEnabled(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::PdfViewerEnabled); - d_ptr->setAttribute(WebEngineSettings::PdfViewerEnabled, on); - if (wasOn != on) - Q_EMIT pdfViewerEnabledChanged(); -} - -void QQuickWebEngineSettings::setUnknownUrlSchemePolicy(QQuickWebEngineSettings::UnknownUrlSchemePolicy policy) -{ - WebEngineSettings::UnknownUrlSchemePolicy oldPolicy = d_ptr->unknownUrlSchemePolicy(); - WebEngineSettings::UnknownUrlSchemePolicy newPolicy = static_cast<WebEngineSettings::UnknownUrlSchemePolicy>(policy); - d_ptr->setUnknownUrlSchemePolicy(newPolicy); - if (oldPolicy != newPolicy) - Q_EMIT unknownUrlSchemePolicyChanged(); -} - -void QQuickWebEngineSettings::setWebRTCPublicInterfacesOnly(bool on) -{ - bool wasOn = d_ptr->testAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly); - d_ptr->setAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly, on); - if (wasOn != on) - Q_EMIT webRTCPublicInterfacesOnlyChanged(); -} - -void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings) -{ - d_ptr->setParentSettings(parentSettings->d_ptr.data()); - d_ptr->scheduleApplyRecursively(); -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h deleted file mode 100644 index ce43e0e9c..000000000 --- a/src/webengine/api/qquickwebenginesettings_p.h +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINESETTINGS_P_H -#define QQUICKWEBENGINESETTINGS_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QObject> -#include <QScopedPointer> - -namespace QtWebEngineCore { -class WebEngineSettings; -} - -QT_BEGIN_NAMESPACE - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject { - Q_OBJECT - Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages NOTIFY autoLoadImagesChanged FINAL) - Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled NOTIFY javascriptEnabledChanged FINAL) - Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows NOTIFY javascriptCanOpenWindowsChanged FINAL) - Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard NOTIFY javascriptCanAccessClipboardChanged FINAL) - Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain NOTIFY linksIncludedInFocusChainChanged FINAL) - Q_PROPERTY(bool localStorageEnabled READ localStorageEnabled WRITE setLocalStorageEnabled NOTIFY localStorageEnabledChanged FINAL) - Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls NOTIFY localContentCanAccessRemoteUrlsChanged FINAL) - Q_PROPERTY(bool spatialNavigationEnabled READ spatialNavigationEnabled WRITE setSpatialNavigationEnabled NOTIFY spatialNavigationEnabledChanged FINAL) - Q_PROPERTY(bool localContentCanAccessFileUrls READ localContentCanAccessFileUrls WRITE setLocalContentCanAccessFileUrls NOTIFY localContentCanAccessFileUrlsChanged FINAL) - Q_PROPERTY(bool hyperlinkAuditingEnabled READ hyperlinkAuditingEnabled WRITE setHyperlinkAuditingEnabled NOTIFY hyperlinkAuditingEnabledChanged FINAL) - Q_PROPERTY(bool errorPageEnabled READ errorPageEnabled WRITE setErrorPageEnabled NOTIFY errorPageEnabledChanged FINAL) - Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled NOTIFY pluginsEnabledChanged FINAL) - Q_PROPERTY(bool fullScreenSupportEnabled READ fullScreenSupportEnabled WRITE setFullScreenSupportEnabled NOTIFY fullScreenSupportEnabledChanged REVISION 1 FINAL) - Q_PROPERTY(QString defaultTextEncoding READ defaultTextEncoding WRITE setDefaultTextEncoding NOTIFY defaultTextEncodingChanged FINAL) - Q_PROPERTY(bool screenCaptureEnabled READ screenCaptureEnabled WRITE setScreenCaptureEnabled NOTIFY screenCaptureEnabledChanged REVISION 2 FINAL) - Q_PROPERTY(bool webGLEnabled READ webGLEnabled WRITE setWebGLEnabled NOTIFY webGLEnabledChanged REVISION 2 FINAL) - Q_PROPERTY(bool accelerated2dCanvasEnabled READ accelerated2dCanvasEnabled WRITE setAccelerated2dCanvasEnabled NOTIFY accelerated2dCanvasEnabledChanged REVISION 2 FINAL) - Q_PROPERTY(bool autoLoadIconsForPage READ autoLoadIconsForPage WRITE setAutoLoadIconsForPage NOTIFY autoLoadIconsForPageChanged REVISION 2 FINAL) - Q_PROPERTY(bool touchIconsEnabled READ touchIconsEnabled WRITE setTouchIconsEnabled NOTIFY touchIconsEnabledChanged REVISION 2 FINAL) - Q_PROPERTY(bool focusOnNavigationEnabled READ focusOnNavigationEnabled WRITE setFocusOnNavigationEnabled NOTIFY focusOnNavigationEnabledChanged REVISION 3 FINAL) - Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds NOTIFY printElementBackgroundsChanged REVISION 3 FINAL) - Q_PROPERTY(bool allowRunningInsecureContent READ allowRunningInsecureContent WRITE setAllowRunningInsecureContent NOTIFY allowRunningInsecureContentChanged REVISION 3 FINAL) - Q_PROPERTY(bool allowGeolocationOnInsecureOrigins READ allowGeolocationOnInsecureOrigins WRITE setAllowGeolocationOnInsecureOrigins NOTIFY allowGeolocationOnInsecureOriginsChanged REVISION 4 FINAL) - Q_PROPERTY(bool allowWindowActivationFromJavaScript READ allowWindowActivationFromJavaScript WRITE setAllowWindowActivationFromJavaScript NOTIFY allowWindowActivationFromJavaScriptChanged REVISION 5 FINAL) - Q_PROPERTY(bool showScrollBars READ showScrollBars WRITE setShowScrollBars NOTIFY showScrollBarsChanged REVISION 5 FINAL) - Q_PROPERTY(UnknownUrlSchemePolicy unknownUrlSchemePolicy READ unknownUrlSchemePolicy WRITE setUnknownUrlSchemePolicy NOTIFY unknownUrlSchemePolicyChanged REVISION 6 FINAL) - Q_PROPERTY(bool playbackRequiresUserGesture READ playbackRequiresUserGesture WRITE setPlaybackRequiresUserGesture NOTIFY playbackRequiresUserGestureChanged REVISION 6 FINAL) - Q_PROPERTY(bool webRTCPublicInterfacesOnly READ webRTCPublicInterfacesOnly WRITE setWebRTCPublicInterfacesOnly NOTIFY webRTCPublicInterfacesOnlyChanged REVISION 6 FINAL) - Q_PROPERTY(bool javascriptCanPaste READ javascriptCanPaste WRITE setJavascriptCanPaste NOTIFY javascriptCanPasteChanged REVISION 6 FINAL) - Q_PROPERTY(bool dnsPrefetchEnabled READ dnsPrefetchEnabled WRITE setDnsPrefetchEnabled NOTIFY dnsPrefetchEnabledChanged REVISION 7 FINAL) - Q_PROPERTY(bool pdfViewerEnabled READ pdfViewerEnabled WRITE setPdfViewerEnabled NOTIFY pdfViewerEnabledChanged REVISION 8 FINAL) - -public: - enum UnknownUrlSchemePolicy { - DisallowUnknownUrlSchemes = 1, - AllowUnknownUrlSchemesFromUserInteraction, - AllowAllUnknownUrlSchemes - }; - - Q_ENUM(UnknownUrlSchemePolicy) - - ~QQuickWebEngineSettings(); - - bool autoLoadImages() const; - bool javascriptEnabled() const; - bool javascriptCanOpenWindows() const; - bool javascriptCanAccessClipboard() const; - bool linksIncludedInFocusChain() const; - bool localStorageEnabled() const; - bool localContentCanAccessRemoteUrls() const; - bool spatialNavigationEnabled() const; - bool localContentCanAccessFileUrls() const; - bool hyperlinkAuditingEnabled() const; - bool errorPageEnabled() const; - bool pluginsEnabled() const; - bool fullScreenSupportEnabled() const; - QString defaultTextEncoding() const; - bool screenCaptureEnabled() const; - bool webGLEnabled() const; - bool accelerated2dCanvasEnabled() const; - bool autoLoadIconsForPage() const; - bool touchIconsEnabled() const; - bool focusOnNavigationEnabled() const; - bool printElementBackgrounds() const; - bool allowRunningInsecureContent() const; - bool allowGeolocationOnInsecureOrigins() const; - bool allowWindowActivationFromJavaScript() const; - bool showScrollBars() const; - UnknownUrlSchemePolicy unknownUrlSchemePolicy() const; - bool playbackRequiresUserGesture() const; - bool webRTCPublicInterfacesOnly() const; - bool javascriptCanPaste() const; - bool dnsPrefetchEnabled() const; - bool pdfViewerEnabled() const; - - void setAutoLoadImages(bool on); - void setJavascriptEnabled(bool on); - void setJavascriptCanOpenWindows(bool on); - void setJavascriptCanAccessClipboard(bool on); - void setLinksIncludedInFocusChain(bool on); - void setLocalStorageEnabled(bool on); - void setLocalContentCanAccessRemoteUrls(bool on); - void setSpatialNavigationEnabled(bool on); - void setLocalContentCanAccessFileUrls(bool on); - void setHyperlinkAuditingEnabled(bool on); - void setErrorPageEnabled(bool on); - void setPluginsEnabled(bool on); - void setFullScreenSupportEnabled(bool on); - void setDefaultTextEncoding(QString encoding); - void setScreenCaptureEnabled(bool on); - void setWebGLEnabled(bool on); - void setAccelerated2dCanvasEnabled(bool on); - void setAutoLoadIconsForPage(bool on); - void setTouchIconsEnabled(bool on); - void setFocusOnNavigationEnabled(bool on); - void setPrintElementBackgrounds(bool on); - void setAllowRunningInsecureContent(bool on); - void setAllowGeolocationOnInsecureOrigins(bool on); - void setAllowWindowActivationFromJavaScript(bool on); - void setShowScrollBars(bool on); - void setUnknownUrlSchemePolicy(UnknownUrlSchemePolicy policy); - void setPlaybackRequiresUserGesture(bool on); - void setWebRTCPublicInterfacesOnly(bool on); - void setJavascriptCanPaste(bool on); - void setDnsPrefetchEnabled(bool on); - void setPdfViewerEnabled(bool on); - -signals: - void autoLoadImagesChanged(); - void javascriptEnabledChanged(); - void javascriptCanOpenWindowsChanged(); - void javascriptCanAccessClipboardChanged(); - void linksIncludedInFocusChainChanged(); - void localStorageEnabledChanged(); - void localContentCanAccessRemoteUrlsChanged(); - void spatialNavigationEnabledChanged(); - void localContentCanAccessFileUrlsChanged(); - void hyperlinkAuditingEnabledChanged(); - void errorPageEnabledChanged(); - void pluginsEnabledChanged(); - Q_REVISION(1) void fullScreenSupportEnabledChanged(); - void defaultTextEncodingChanged(); - Q_REVISION(2) void screenCaptureEnabledChanged(); - Q_REVISION(2) void webGLEnabledChanged(); - Q_REVISION(2) void accelerated2dCanvasEnabledChanged(); - Q_REVISION(2) void autoLoadIconsForPageChanged(); - Q_REVISION(2) void touchIconsEnabledChanged(); - Q_REVISION(3) void focusOnNavigationEnabledChanged(); - Q_REVISION(3) void printElementBackgroundsChanged(); - Q_REVISION(3) void allowRunningInsecureContentChanged(); - Q_REVISION(4) void allowGeolocationOnInsecureOriginsChanged(); - Q_REVISION(5) void allowWindowActivationFromJavaScriptChanged(); - Q_REVISION(5) void showScrollBarsChanged(); - Q_REVISION(6) void unknownUrlSchemePolicyChanged(); - Q_REVISION(6) void playbackRequiresUserGestureChanged(); - Q_REVISION(6) void webRTCPublicInterfacesOnlyChanged(); - Q_REVISION(6) void javascriptCanPasteChanged(); - Q_REVISION(7) void dnsPrefetchEnabledChanged(); - Q_REVISION(8) void pdfViewerEnabledChanged(); - -private: - explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0); - Q_DISABLE_COPY(QQuickWebEngineSettings) - friend class QQuickWebEngineProfilePrivate; - friend class QQuickWebEngineViewPrivate; - friend class QQuickWebEngineView; - void setParentSettings(QQuickWebEngineSettings *parentSettings); - - QScopedPointer<QtWebEngineCore::WebEngineSettings> d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINESETTINGS_P_H diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp deleted file mode 100644 index 3e84f5cf0..000000000 --- a/src/webengine/api/qquickwebenginesingleton.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginesingleton_p.h" - -#include "qquickwebenginesettings_p.h" -#include <QtWebEngine/QQuickWebEngineProfile> - -QT_BEGIN_NAMESPACE - -/*! - \qmltype WebEngine - \instantiates QQuickWebEngineSingleton - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - \brief Provides access to the default settings and profiles shared by all web engine views. - - The WebEngine singleton type provides access to the default profile and the default settings - shared by all web engine views. It can be used to change settings globally, as illustrated by - the following code snippet: - - \code - Component.onCompleted: { - WebEngine.settings.pluginsEnabled = true; - } - \endcode -*/ - -/*! - \qmlproperty WebEngineSettings WebEngine::settings - \readonly - \since QtWebEngine 1.1 - - Default settings for all web engine views. - - \sa WebEngineSettings -*/ -QQuickWebEngineSettings *QQuickWebEngineSingleton::settings() const -{ - return defaultProfile()->settings(); -} - -/*! - \qmlproperty WebEngineProfile WebEngine::defaultProfile - \readonly - \since QtWebEngine 1.1 - - Default profile for all web engine views. - - \sa WebEngineProfile -*/ -QQuickWebEngineProfile *QQuickWebEngineSingleton::defaultProfile() const -{ - return QQuickWebEngineProfile::defaultProfile(); -} - -QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebenginesingleton_p.h b/src/webengine/api/qquickwebenginesingleton_p.h deleted file mode 100644 index ba63382e5..000000000 --- a/src/webengine/api/qquickwebenginesingleton_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINESINGLETON_P_H -#define QQUICKWEBENGINESINGLETON_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QObject> - -QT_BEGIN_NAMESPACE -class QQuickWebEngineProfile; -class QQuickWebEngineSettings; -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSingleton : public QObject { - Q_OBJECT - Q_PROPERTY(QQuickWebEngineSettings* settings READ settings CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineProfile* defaultProfile READ defaultProfile CONSTANT FINAL REVISION 1) - -public: - QQuickWebEngineSettings *settings() const; - QQuickWebEngineProfile *defaultProfile() const; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINESINGLETON_P_H diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp deleted file mode 100644 index b7b863125..000000000 --- a/src/webengine/api/qquickwebenginetestsupport.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginetestsupport_p.h" - -#include "qquickwebengineloadrequest_p.h" -#include <QQuickWindow> -#include <QtTest/qtest.h> -#include <QtCore/QTimer> - -QT_BEGIN_NAMESPACE - -namespace QTest { - int Q_TESTLIB_EXPORT defaultMouseDelay(); -} - -QQuickWebEngineErrorPage::QQuickWebEngineErrorPage() -{ -} - -void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url) -{ - Q_UNUSED(success); - QTimer::singleShot(0, this, [this, url]() { - QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus); - emit loadingChanged(&loadRequest); - }); -} - -void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl) -{ - QTimer::singleShot(0, this, [this, provisionalUrl]() { - QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus); - emit loadingChanged(&loadRequest); - }); -} - -QQuickWebEngineTestInputContext::QQuickWebEngineTestInputContext() - : m_visible(false) -{ -} - -QQuickWebEngineTestInputContext::~QQuickWebEngineTestInputContext() -{ - release(); -} - -void QQuickWebEngineTestInputContext::create() -{ - QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = this; -} - -void QQuickWebEngineTestInputContext::release() -{ - QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; -} - -void QQuickWebEngineTestInputContext::showInputPanel() -{ - m_visible = true; -} - -void QQuickWebEngineTestInputContext::hideInputPanel() -{ - m_visible = false; -} - -bool QQuickWebEngineTestInputContext::isInputPanelVisible() const -{ - return m_visible; -} - - -QQuickWebEngineTestEvent::QQuickWebEngineTestEvent() -{ -} - -bool QQuickWebEngineTestEvent::mouseMultiClick(QObject *item, qreal x, qreal y, int clickCount) -{ - QTEST_ASSERT(item); - - QWindow *view = eventWindow(item); - if (!view) - return false; - - for (int i = 0; i < clickCount; ++i) { - mouseEvent(QMouseEvent::MouseButtonPress, view, item, QPointF(x, y)); - mouseEvent(QMouseEvent::MouseButtonRelease, view, item, QPointF(x, y)); - } - QTest::lastMouseTimestamp += QTest::mouseDoubleClickInterval; - - return true; -} - -QWindow *QQuickWebEngineTestEvent::eventWindow(QObject *item) -{ - QWindow *window = qobject_cast<QWindow *>(item); - if (window) - return window; - - QQuickItem *quickItem = qobject_cast<QQuickItem *>(item); - if (quickItem) - return quickItem->window(); - - QQuickItem *testParentItem = qobject_cast<QQuickItem *>(parent()); - if (testParentItem) - return testParentItem->window(); - - return nullptr; -} - -void QQuickWebEngineTestEvent::mouseEvent(QEvent::Type type, QWindow *window, QObject *item, const QPointF &_pos) -{ - QTest::qWait(QTest::defaultMouseDelay()); - QTest::lastMouseTimestamp += QTest::defaultMouseDelay(); - - QPoint pos; - QQuickItem *sgitem = qobject_cast<QQuickItem *>(item); - if (sgitem) - pos = sgitem->mapToScene(_pos).toPoint(); - - QMouseEvent me(type, pos, window->mapFromGlobal(pos), Qt::LeftButton, Qt::LeftButton, 0); - me.setTimestamp(++QTest::lastMouseTimestamp); - - QSpontaneKeyEvent::setSpontaneous(&me); - if (!qApp->notify(window, &me)) - QTest::qWarn("Mouse click event not accepted by receiving window"); -} - - -QQuickWebEngineTestSupport::QQuickWebEngineTestSupport() - : m_errorPage(new QQuickWebEngineErrorPage) - , m_testInputContext(new QQuickWebEngineTestInputContext) - , m_testEvent(new QQuickWebEngineTestEvent) -{ -} - -QQuickWebEngineErrorPage *QQuickWebEngineTestSupport::errorPage() const -{ - return m_errorPage.data(); -} - -QQuickWebEngineTestInputContext *QQuickWebEngineTestSupport::testInputContext() const -{ - return m_testInputContext.data(); -} - -QQuickWebEngineTestEvent * QQuickWebEngineTestSupport::testEvent() const -{ - return m_testEvent.data(); -} - -QT_END_NAMESPACE - -#include "moc_qquickwebenginetestsupport_p.cpp" diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h deleted file mode 100644 index 30e6ee5c4..000000000 --- a/src/webengine/api/qquickwebenginetestsupport_p.h +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINETESTSUPPORT_P_H -#define QQUICKWEBENGINETESTSUPPORT_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 <QtGui/private/qinputmethod_p.h> -#include <QtWebEngine/private/qtwebengineglobal_p.h> - -#include <QEvent> -#include <QObject> -#include <QUrl> - -QT_BEGIN_NAMESPACE - -class QQuickWebEngineLoadRequest; -class QWindow; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineErrorPage : public QObject { - Q_OBJECT - -public: - QQuickWebEngineErrorPage(); - - void loadFinished(bool success, const QUrl &url); - void loadStarted(const QUrl &provisionalUrl); - -Q_SIGNALS: - void loadingChanged(QQuickWebEngineLoadRequest *loadRequest); -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestInputContext : public QPlatformInputContext { - Q_OBJECT - -public: - QQuickWebEngineTestInputContext(); - ~QQuickWebEngineTestInputContext(); - - Q_INVOKABLE void create(); - Q_INVOKABLE void release(); - - virtual void showInputPanel(); - virtual void hideInputPanel(); - virtual bool isInputPanelVisible() const; - -private: - bool m_visible; -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestEvent : public QObject { - Q_OBJECT - -public: - QQuickWebEngineTestEvent(); - -public Q_SLOTS: - bool mouseMultiClick(QObject *item, qreal x, qreal y, int clickCount); - -private: - QWindow *eventWindow(QObject *item = 0); - void mouseEvent(QEvent::Type type, QWindow *window, QObject *item, const QPointF &_pos); -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestSupport : public QObject { - Q_OBJECT - Q_PROPERTY(QQuickWebEngineErrorPage *errorPage READ errorPage CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineTestInputContext *testInputContext READ testInputContext CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineTestEvent *testEvent READ testEvent CONSTANT FINAL) - -public: - QQuickWebEngineTestSupport(); - QQuickWebEngineErrorPage *errorPage() const; - QQuickWebEngineTestInputContext *testInputContext() const; - QQuickWebEngineTestEvent *testEvent() const; - -Q_SIGNALS: - void windowCloseRejected(); - void loadVisuallyCommitted(); - -private: - QScopedPointer<QQuickWebEngineErrorPage> m_errorPage; - QScopedPointer<QQuickWebEngineTestInputContext> m_testInputContext; - QScopedPointer<QQuickWebEngineTestEvent> m_testEvent; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINETESTSUPPORT_P_H diff --git a/src/webengine/api/qquickwebenginetouchhandleprovider.cpp b/src/webengine/api/qquickwebenginetouchhandleprovider.cpp deleted file mode 100644 index 80f4727b6..000000000 --- a/src/webengine/api/qquickwebenginetouchhandleprovider.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebenginetouchhandleprovider_p_p.h" - -// static -QString QQuickWebEngineTouchHandleProvider::identifier() -{ - return QStringLiteral("touchhandle"); -} - -// static -QUrl QQuickWebEngineTouchHandleProvider::url(int orientation) -{ - return QUrl(QStringLiteral("image://%1/%2").arg(identifier(), QString::number(orientation))); -} - -QQuickWebEngineTouchHandleProvider::QQuickWebEngineTouchHandleProvider() - : QQuickImageProvider(QQuickImageProvider::Image) -{ -} - -QQuickWebEngineTouchHandleProvider::~QQuickWebEngineTouchHandleProvider() -{ -} - -void QQuickWebEngineTouchHandleProvider::init(const QMap<int, QImage> &images) -{ - if (!m_touchHandleMap.empty()) { - Q_ASSERT(images.size() == m_touchHandleMap.size()); - return; - } - - m_touchHandleMap.unite(images); -} - -QImage QQuickWebEngineTouchHandleProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) -{ - Q_UNUSED(size); - Q_UNUSED(requestedSize); - - Q_ASSERT(m_touchHandleMap.contains(id.toInt())); - return m_touchHandleMap.value(id.toInt()); -} diff --git a/src/webengine/api/qquickwebenginetouchhandleprovider_p_p.h b/src/webengine/api/qquickwebenginetouchhandleprovider_p_p.h deleted file mode 100644 index 277436289..000000000 --- a/src/webengine/api/qquickwebenginetouchhandleprovider_p_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINETOUCHHANDLEPROVIDER_P_P_H -#define QQUICKWEBENGINETOUCHHANDLEPROVIDER_P_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 <QtQuick/QQuickImageProvider> -#include <QtWebEngine/private/qtwebengineglobal_p.h> - -QT_BEGIN_NAMESPACE - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTouchHandleProvider : public QQuickImageProvider { -public: - static QString identifier(); - static QUrl url(int orientation); - - QQuickWebEngineTouchHandleProvider(); - ~QQuickWebEngineTouchHandleProvider(); - - void init(const QMap<int, QImage> &images); - virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); - -private: - QMap<int, QImage> m_touchHandleMap; -}; - - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINETOUCHHANDLEPROVIDER_P_P_H diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp deleted file mode 100644 index 58d950cd9..000000000 --- a/src/webengine/api/qquickwebengineview.cpp +++ /dev/null @@ -1,2429 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickwebengineview_p.h" -#include "qquickwebengineview_p_p.h" -#include "authentication_dialog_controller.h" -#include "profile_adapter.h" -#include "certificate_error_controller.h" -#include "file_picker_controller.h" -#include "find_text_helper.h" -#include "javascript_dialog_controller.h" -#include "touch_selection_menu_controller.h" - -#include "qquickwebengineaction_p.h" -#include "qquickwebengineaction_p_p.h" -#include "qquickwebenginehistory_p.h" -#include "qquickwebenginecertificateerror_p.h" -#include "qquickwebengineclientcertificateselection_p.h" -#include "qquickwebenginecontextmenurequest_p.h" -#include "qquickwebenginedialogrequests_p.h" -#include "qquickwebenginefaviconprovider_p_p.h" -#include "qquickwebengineloadrequest_p.h" -#include "qquickwebenginenavigationrequest_p.h" -#include "qquickwebenginenewviewrequest_p.h" -#include "qquickwebengineprofile_p.h" -#include "qquickwebenginesettings_p.h" -#include "qquickwebenginescript_p.h" -#include "qquickwebenginetouchhandleprovider_p_p.h" -#include "qwebenginefindtextresult.h" -#include "qwebenginequotarequest.h" -#include "qwebengineregisterprotocolhandlerrequest.h" - -#if QT_CONFIG(webengine_testsupport) -#include "qquickwebenginetestsupport_p.h" -#endif - -#include "render_widget_host_view_qt_delegate_quick.h" -#include "render_widget_host_view_qt_delegate_quickwindow.h" -#include "renderer_host/user_resource_controller_host.h" -#include "ui_delegates_manager.h" -#include "web_contents_adapter.h" -#include "web_engine_error.h" -#include "web_engine_settings.h" - -#include <QClipboard> -#include <QGuiApplication> -#include <QLoggingCategory> -#include <QMarginsF> -#include <QMimeData> -#include <QPageLayout> -#include <QPageSize> -#include <QQmlComponent> -#include <QQmlContext> -#include <QQmlEngine> -#include <QQmlProperty> -#if QT_CONFIG(webengine_webchannel) -#include <QQmlWebChannel> -#endif -#include <QQuickWebEngineProfile> -#include <QScreen> -#include <QUrl> -#include <QTimer> -#include <QtGui/private/qguiapplication_p.h> -#include <QtGui/qpa/qplatformintegration.h> - -QT_BEGIN_NAMESPACE -using namespace QtWebEngineCore; - -#ifndef QT_NO_ACCESSIBILITY -static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object) -{ - if (QQuickWebEngineView *v = qobject_cast<QQuickWebEngineView*>(object)) - return new QQuickWebEngineViewAccessible(v); - return 0; -} -#endif // QT_NO_ACCESSIBILITY - -static QLatin1String defaultMimeType("text/html;charset=UTF-8"); - -QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() - : m_profile(nullptr) - , adapter(QSharedPointer<WebContentsAdapter>::create()) - , m_history(new QQuickWebEngineHistory(this)) -#if QT_CONFIG(webengine_testsupport) - , m_testSupport(0) -#endif - , contextMenuExtraItems(0) - , faviconProvider(0) - , loadProgress(0) - , m_fullscreenMode(false) - , isLoading(false) - , m_activeFocusOnPress(true) - , devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio()) - , m_webChannel(0) - , m_webChannelWorld(0) - , m_isBeingAdopted(false) - , m_backgroundColor(Qt::white) - , m_zoomFactor(1.0) - , m_ui2Enabled(false) - , m_profileInitialized(false) -{ - memset(actions, 0, sizeof(actions)); - - QString platform = qApp->platformName().toLower(); - if (platform == QLatin1String("eglfs")) - m_ui2Enabled = true; - - const QByteArray dialogSet = qgetenv("QTWEBENGINE_DIALOG_SET"); - - if (!dialogSet.isEmpty()) { - if (dialogSet == QByteArrayLiteral("QtQuickControls2")) { - m_ui2Enabled = true; - } else if (dialogSet == QByteArrayLiteral("QtQuickControls1") - && m_ui2Enabled) { - m_ui2Enabled = false; - qWarning("QTWEBENGINE_DIALOG_SET=QtQuickControls1 forces use of Qt Quick Controls 1 " - "on an eglfs backend. This can crash your application!"); - } else { - qWarning("Ignoring QTWEBENGINE_DIALOG_SET environment variable set to %s. Accepted " - "values are \"QtQuickControls1\" and \"QtQuickControls2\"", dialogSet.data()); - } - } - -#ifndef QT_NO_ACCESSIBILITY - QAccessible::installFactory(&webAccessibleFactory); -#endif // QT_NO_ACCESSIBILITY -} - -QQuickWebEngineViewPrivate::~QQuickWebEngineViewPrivate() -{ - Q_ASSERT(m_profileInitialized); - m_profile->d_ptr->removeWebContentsAdapterClient(this); - if (faviconProvider) - faviconProvider->detach(q_ptr); - // q_ptr->d_ptr might be null due to destroy() - if (q_ptr->d_ptr) - bindViewAndWidget(q_ptr, nullptr); -} - -void QQuickWebEngineViewPrivate::initializeProfile() -{ - if (!m_profileInitialized) { - Q_ASSERT(!adapter->isInitialized()); - m_profileInitialized = true; - if (!m_profile) - m_profile = QQuickWebEngineProfile::defaultProfile(); - m_profile->d_ptr->addWebContentsAdapterClient(this); - m_settings.reset(new QQuickWebEngineSettings(m_profile->settings())); - adapter->setClient(this); - } -} - -bool QQuickWebEngineViewPrivate::profileInitialized() const -{ - return m_profileInitialized; -} - -void QQuickWebEngineViewPrivate::releaseProfile() -{ - // The profile for this web contents is about to be - // garbage collected, delete WebContents first and - // let the QQuickWebEngineView be collected later by gc. - bindViewAndWidget(q_ptr, nullptr); - delete q_ptr->d_ptr.take(); -} - -UIDelegatesManager *QQuickWebEngineViewPrivate::ui() -{ - Q_Q(QQuickWebEngineView); - if (m_uIDelegatesManager.isNull()) - m_uIDelegatesManager.reset(m_ui2Enabled ? new UI2DelegatesManager(q) : new UIDelegatesManager(q)); - return m_uIDelegatesManager.data(); -} - -RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQtDelegateClient *client) -{ - return new RenderWidgetHostViewQtDelegateQuick(client, /*isPopup = */ false); -} - -RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client) -{ - Q_Q(QQuickWebEngineView); - const bool hasWindowCapability = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows); - RenderWidgetHostViewQtDelegateQuick *quickDelegate = new RenderWidgetHostViewQtDelegateQuick(client, /*isPopup = */ true); - if (hasWindowCapability) { - RenderWidgetHostViewQtDelegateQuickWindow *wrapperWindow = new RenderWidgetHostViewQtDelegateQuickWindow(quickDelegate); - wrapperWindow->setVirtualParent(q); - quickDelegate->setParentItem(wrapperWindow->contentItem()); - return wrapperWindow; - } - quickDelegate->setParentItem(q); - return quickDelegate; -} - -void QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenuData &data) -{ - Q_Q(QQuickWebEngineView); - - m_contextMenuData = data; - - QQuickWebEngineContextMenuRequest *request = new QQuickWebEngineContextMenuRequest(data); - QQmlEngine *engine = qmlEngine(q); - - // TODO: this is a workaround for QTBUG-65044 - if (!engine) - return; - - // mark the object for gc by creating temporary jsvalue - engine->newQObject(request); - Q_EMIT q->contextMenuRequested(request); - - if (request->isAccepted()) - return; - - // Assign the WebEngineView as the parent of the menu, so mouse events are properly propagated - // on OSX. - QObject *menu = ui()->addMenu(q, QString(), data.position()); - if (!menu) - return; - - QQuickContextMenuBuilder contextMenuBuilder(data, q, menu); - - // Populate our menu - contextMenuBuilder.initMenu(); - - // FIXME: expose the context menu data as an attached property to make this more useful - if (contextMenuExtraItems) - contextMenuBuilder.appendExtraItems(engine); - - // Now fire the popup() method on the top level menu - ui()->showMenu(menu); -} - -void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineNavigationRequest navigationRequest(url, static_cast<QQuickWebEngineView::NavigationType>(navigationType), isMainFrame); - Q_EMIT q->navigationRequested(&navigationRequest); - - navigationRequestAction = navigationRequest.action(); - if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter->findTextHelper()->isFindTextInProgress()) - adapter->findTextHelper()->stopFinding(); -} - -void QQuickWebEngineViewPrivate::javascriptDialog(QSharedPointer<JavaScriptDialogController> dialog) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineJavaScriptDialogRequest *request = new QQuickWebEngineJavaScriptDialogRequest(dialog); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->javaScriptDialogRequested(request); - if (!request->isAccepted()) - ui()->showDialog(dialog); -} - -void QQuickWebEngineViewPrivate::allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) -{ - Q_Q(QQuickWebEngineView); - - QQuickWebEngineCertificateError *quickController = new QQuickWebEngineCertificateError(errorController); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(quickController); - Q_EMIT q->certificateError(quickController); - if (!quickController->deferred() && !quickController->answered()) - quickController->rejectCertificate(); - else - m_certificateErrorControllers.append(errorController); -} - -void QQuickWebEngineViewPrivate::selectClientCert(const QSharedPointer<ClientCertSelectController> &controller) -{ -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - Q_Q(QQuickWebEngineView); - QQuickWebEngineClientCertificateSelection *certSelection = new QQuickWebEngineClientCertificateSelection(controller); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(certSelection); - Q_EMIT q->selectClientCertificate(certSelection); -#else - Q_UNUSED(controller); -#endif -} - -void QQuickWebEngineViewPrivate::runGeolocationPermissionRequest(const QUrl &url) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->featurePermissionRequested(url, QQuickWebEngineView::Geolocation); -} - -void QQuickWebEngineViewPrivate::runUserNotificationPermissionRequest(const QUrl &url) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->featurePermissionRequested(url, QQuickWebEngineView::Notifications); -} - -void QQuickWebEngineViewPrivate::showColorDialog(QSharedPointer<ColorChooserController> controller) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineColorDialogRequest *request = new QQuickWebEngineColorDialogRequest(controller); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->colorDialogRequested(request); - if (!request->isAccepted()) - ui()->showColorDialog(controller); -} - -void QQuickWebEngineViewPrivate::runFileChooser(QSharedPointer<FilePickerController> controller) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineFileDialogRequest *request = new QQuickWebEngineFileDialogRequest(controller); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->fileDialogRequested(request); - if (!request->isAccepted()) - ui()->showFilePicker(controller); -} - -bool QQuickWebEngineViewPrivate::passOnFocus(bool reverse) -{ - Q_Q(QQuickWebEngineView); - // The child delegate currently has focus, find the next one from there and give it focus. - QQuickItem *next = q->scopedFocusItem()->nextItemInFocusChain(!reverse); - if (next) { - next->forceActiveFocus(reverse ? Qt::BacktabFocusReason : Qt::TabFocusReason); - return true; - } - return false; -} - -void QQuickWebEngineViewPrivate::titleChanged(const QString &title) -{ - Q_Q(QQuickWebEngineView); - Q_UNUSED(title); - Q_EMIT q->titleChanged(); -} - -void QQuickWebEngineViewPrivate::urlChanged(const QUrl &url) -{ - Q_Q(QQuickWebEngineView); - Q_UNUSED(url); - Q_EMIT q->urlChanged(); -} - -void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url) -{ - Q_Q(QQuickWebEngineView); - - if (iconUrl == QQuickWebEngineFaviconProvider::faviconProviderUrl(url)) - return; - - if (!faviconProvider) { - QQmlEngine *engine = qmlEngine(q); - - // TODO: this is a workaround for QTBUG-65044 - if (!engine) - return; - - Q_ASSERT(engine); - faviconProvider = static_cast<QQuickWebEngineFaviconProvider *>( - engine->imageProvider(QQuickWebEngineFaviconProvider::identifier())); - Q_ASSERT(faviconProvider); - } - - iconUrl = faviconProvider->attach(q, url); - m_history->reset(); - QTimer::singleShot(0, q, &QQuickWebEngineView::iconChanged); -} - -void QQuickWebEngineViewPrivate::loadProgressChanged(int progress) -{ - Q_Q(QQuickWebEngineView); - loadProgress = progress; - QTimer::singleShot(0, q, &QQuickWebEngineView::loadProgressChanged); -} - -void QQuickWebEngineViewPrivate::didUpdateTargetURL(const QUrl &hoveredUrl) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->linkHovered(hoveredUrl); -} - -void QQuickWebEngineViewPrivate::selectionChanged() -{ - updateEditActions(); -} - -void QQuickWebEngineViewPrivate::recentlyAudibleChanged(bool recentlyAudible) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->recentlyAudibleChanged(recentlyAudible); -} - -QRectF QQuickWebEngineViewPrivate::viewportRect() const -{ - Q_Q(const QQuickWebEngineView); - return QRectF(q->x(), q->y(), q->width(), q->height()); -} - -QColor QQuickWebEngineViewPrivate::backgroundColor() const -{ - return m_backgroundColor; -} - -void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage) -{ - Q_Q(QQuickWebEngineView); - if (isErrorPage) { -#if QT_CONFIG(webengine_testsupport) - if (m_testSupport) - m_testSupport->errorPage()->loadStarted(provisionalUrl); -#endif - return; - } - - isLoading = true; - m_history->reset(); - m_certificateErrorControllers.clear(); - - QTimer::singleShot(0, q, [q, provisionalUrl]() { - QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus); - - emit q->loadingChanged(&loadRequest); - }); -} - -void QQuickWebEngineViewPrivate::loadCommitted() -{ - m_history->reset(); -} - -void QQuickWebEngineViewPrivate::loadVisuallyCommitted() -{ -#if QT_CONFIG(webengine_testsupport) - if (m_testSupport) - Q_EMIT m_testSupport->loadVisuallyCommitted(); -#endif -} - -Q_STATIC_ASSERT(static_cast<int>(WebEngineError::NoErrorDomain) == static_cast<int>(QQuickWebEngineView::NoErrorDomain)); -Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == static_cast<int>(QQuickWebEngineView::CertificateErrorDomain)); -Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(QQuickWebEngineView::DnsErrorDomain)); - -void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription) -{ - Q_Q(QQuickWebEngineView); - - if (isErrorPage) { -#if QT_CONFIG(webengine_testsupport) - if (m_testSupport) - m_testSupport->errorPage()->loadFinished(success, url); -#endif - return; - } - - isLoading = false; - m_history->reset(); - if (errorCode == WebEngineError::UserAbortedError) { - QTimer::singleShot(0, q, [q, url]() { - QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus); - emit q->loadingChanged(&loadRequest); - }); - return; - } - if (success) { - QTimer::singleShot(0, q, [q, url, errorDescription, errorCode]() { - QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus, errorDescription, errorCode); - emit q->loadingChanged(&loadRequest); - }); - return; - } - - Q_ASSERT(errorCode); - QQuickWebEngineView::ErrorDomain errorDomain = static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode)); - QTimer::singleShot(0, q, [q, url, errorDescription, errorCode, errorDomain]() { - QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadFailedStatus,errorDescription, errorCode, errorDomain); - emit q->loadingChanged(&loadRequest); - }); - return; -} - -void QQuickWebEngineViewPrivate::focusContainer() -{ - Q_Q(QQuickWebEngineView); - QQuickWindow *window = q->window(); - if (window) - window->requestActivate(); - q->forceActiveFocus(); -} - -void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event) -{ - Q_Q(QQuickWebEngineView); - if (q->parentItem()) - QCoreApplication::sendEvent(q->parentItem(), event); -} - -void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineNewViewRequest request; - // This increases the ref-count of newWebContents and will tell Chromium - // to start loading it and possibly return it to its parent page window.open(). - request.m_adapter = newWebContents; - request.m_isUserInitiated = userGesture; - request.m_requestedUrl = targetUrl; - - switch (disposition) { - case WebContentsAdapterClient::NewForegroundTabDisposition: - request.m_destination = QQuickWebEngineView::NewViewInTab; - break; - case WebContentsAdapterClient::NewBackgroundTabDisposition: - request.m_destination = QQuickWebEngineView::NewViewInBackgroundTab; - break; - case WebContentsAdapterClient::NewPopupDisposition: - request.m_destination = QQuickWebEngineView::NewViewInDialog; - break; - case WebContentsAdapterClient::NewWindowDisposition: - request.m_destination = QQuickWebEngineView::NewViewInWindow; - break; - default: - Q_UNREACHABLE(); - } - - Q_EMIT q->newViewRequested(&request); -} - -bool QQuickWebEngineViewPrivate::isBeingAdopted() -{ - return false; -} - -void QQuickWebEngineViewPrivate::close() -{ - Q_Q(QQuickWebEngineView); - emit q->windowCloseRequested(); -} - -void QQuickWebEngineViewPrivate::windowCloseRejected() -{ -#if QT_CONFIG(webengine_testsupport) - if (m_testSupport) - Q_EMIT m_testSupport->windowCloseRejected(); -#endif -} - -void QQuickWebEngineViewPrivate::requestFullScreenMode(const QUrl &origin, bool fullscreen) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineFullScreenRequest request(this, origin, fullscreen); - Q_EMIT q->fullScreenRequested(request); -} - -bool QQuickWebEngineViewPrivate::isFullScreenMode() const -{ - return m_fullscreenMode; -} - -void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) -{ - Q_Q(QQuickWebEngineView); - if (q->receivers(SIGNAL(javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString))) > 0) { - Q_EMIT q->javaScriptConsoleMessage(static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(level), message, lineNumber, sourceID); - return; - } - - static QLoggingCategory loggingCategory("js", QtWarningMsg); - const QByteArray file = sourceID.toUtf8(); - QMessageLogger logger(file.constData(), lineNumber, nullptr, loggingCategory.categoryName()); - - switch (level) { - case JavaScriptConsoleMessageLevel::Info: - if (loggingCategory.isInfoEnabled()) - logger.info().noquote() << message; - break; - case JavaScriptConsoleMessageLevel::Warning: - if (loggingCategory.isWarningEnabled()) - logger.warning().noquote() << message; - break; - case JavaScriptConsoleMessageLevel::Error: - if (loggingCategory.isCriticalEnabled()) - logger.critical().noquote() << message; - break; - } -} - -void QQuickWebEngineViewPrivate::authenticationRequired(QSharedPointer<AuthenticationDialogController> controller) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineAuthenticationDialogRequest *request = new QQuickWebEngineAuthenticationDialogRequest(controller); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->authenticationDialogRequested(request); - if (!request->isAccepted()) - ui()->showDialog(controller); -} - -void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags) -{ - Q_Q(QQuickWebEngineView); - if (!requestFlags) - return; - QQuickWebEngineView::Feature feature; - if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture) && requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture)) - feature = QQuickWebEngineView::MediaAudioVideoCapture; - else if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture)) - feature = QQuickWebEngineView::MediaAudioCapture; - else if (requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture)) - feature = QQuickWebEngineView::MediaVideoCapture; - else if (requestFlags.testFlag(WebContentsAdapterClient::MediaDesktopAudioCapture) && - requestFlags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture)) - feature = QQuickWebEngineView::DesktopAudioVideoCapture; - else // if (requestFlags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture)) - feature = QQuickWebEngineView::DesktopVideoCapture; - Q_EMIT q->featurePermissionRequested(securityOrigin, feature); -} - -void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &securityOrigin) -{ - - Q_UNUSED(securityOrigin); - - // TODO: Add mouse lock support - adapter->grantMouseLockPermission(false); -} - -void QQuickWebEngineViewPrivate::runQuotaRequest(QWebEngineQuotaRequest request) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->quotaRequested(request); -} - -void QQuickWebEngineViewPrivate::runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest request) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->registerProtocolHandlerRequested(request); -} - -QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() -{ - Q_Q(QQuickWebEngineView); - return q; -} - -ProfileAdapter *QQuickWebEngineViewPrivate::profileAdapter() -{ - return m_profile->d_ptr->profileAdapter(); -} - -WebContentsAdapter *QQuickWebEngineViewPrivate::webContentsAdapter() -{ - return adapter.data(); -} - -void QQuickWebEngineViewPrivate::printRequested() -{ - Q_Q(QQuickWebEngineView); - QTimer::singleShot(0, q, [q]() { - Q_EMIT q->printRequested(); - }); -} - -void QQuickWebEngineViewPrivate::widgetChanged(RenderWidgetHostViewQtDelegate *newWidgetBase) -{ - Q_Q(QQuickWebEngineView); - bindViewAndWidget(q, static_cast<RenderWidgetHostViewQtDelegateQuick *>(newWidgetBase)); -} - -void QQuickWebEngineViewPrivate::findTextFinished(const QWebEngineFindTextResult &result) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->findTextFinished(result); -} - -WebEngineSettings *QQuickWebEngineViewPrivate::webEngineSettings() const -{ - return m_settings->d_ptr.data(); -} - -const QObject *QQuickWebEngineViewPrivate::holdingQObject() const -{ - Q_Q(const QQuickWebEngineView); - return q; -} - -void QQuickWebEngineViewPrivate::lifecycleStateChanged(LifecycleState state) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->lifecycleStateChanged(static_cast<QQuickWebEngineView::LifecycleState>(state)); -} - -void QQuickWebEngineViewPrivate::recommendedStateChanged(LifecycleState state) -{ - Q_Q(QQuickWebEngineView); - QTimer::singleShot(0, q, [q, state]() { - Q_EMIT q->recommendedStateChanged(static_cast<QQuickWebEngineView::LifecycleState>(state)); - }); -} - -void QQuickWebEngineViewPrivate::visibleChanged(bool visible) -{ - Q_UNUSED(visible); -} - -#ifndef QT_NO_ACCESSIBILITY -QQuickWebEngineViewAccessible::QQuickWebEngineViewAccessible(QQuickWebEngineView *o) - : QAccessibleObject(o) -{} - -QAccessibleInterface *QQuickWebEngineViewAccessible::parent() const -{ - QQuickItem *parent = engineView()->parentItem(); - return QAccessible::queryAccessibleInterface(parent); -} - -int QQuickWebEngineViewAccessible::childCount() const -{ - if (engineView() && child(0)) - return 1; - return 0; -} - -QAccessibleInterface *QQuickWebEngineViewAccessible::child(int index) const -{ - if (index == 0) - return engineView()->d_func()->adapter->browserAccessible(); - return 0; -} - -int QQuickWebEngineViewAccessible::indexOfChild(const QAccessibleInterface *c) const -{ - if (c == child(0)) - return 0; - return -1; -} - -QString QQuickWebEngineViewAccessible::text(QAccessible::Text) const -{ - return QString(); -} - -QAccessible::Role QQuickWebEngineViewAccessible::role() const -{ - return QAccessible::Document; -} - -QAccessible::State QQuickWebEngineViewAccessible::state() const -{ - QAccessible::State s; - return s; -} -#endif // QT_NO_ACCESSIBILITY - -class WebContentsAdapterOwner : public QObject -{ -public: - typedef QSharedPointer<QtWebEngineCore::WebContentsAdapter> AdapterPtr; - WebContentsAdapterOwner(const AdapterPtr &ptr) - : adapter(ptr) - {} - -private: - AdapterPtr adapter; -}; - -void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContents) -{ - if (!webContents) { - qWarning("Trying to open an empty request, it was either already used or was invalidated." - "\nYou must complete the request synchronously within the newViewRequested signal handler." - " If a view hasn't been adopted before returning, the request will be invalidated."); - return; - } - - if (webContents->profileAdapter() && profileAdapter() != webContents->profileAdapter()) { - qWarning("Can not adopt content from a different WebEngineProfile."); - return; - } - - m_isBeingAdopted = true; - - // This throws away the WebContentsAdapter that has been used until now. - // All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter. - WebContentsAdapterOwner *adapterOwner = new WebContentsAdapterOwner(adapter->sharedFromThis()); - adapterOwner->deleteLater(); - - adapter = webContents->sharedFromThis(); - adapter->setClient(this); -} - -QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent) - : QQuickItem(parent) - , d_ptr(new QQuickWebEngineViewPrivate) -{ - Q_D(QQuickWebEngineView); - d->q_ptr = this; - this->setActiveFocusOnTab(true); - this->setFlags(QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsDrops); -} - -QQuickWebEngineView::~QQuickWebEngineView() -{ -} - -void QQuickWebEngineViewPrivate::ensureContentsAdapter() -{ - initializeProfile(); - if (!adapter->isInitialized()) { - if (!m_html.isEmpty()) - adapter->setContent(m_html.toUtf8(), defaultMimeType, m_url); - else if (m_url.isValid()) - adapter->load(m_url); - else - adapter->loadDefault(); - } -} - -void QQuickWebEngineViewPrivate::initializationFinished() -{ - Q_Q(QQuickWebEngineView); - - Q_ASSERT(m_profileInitialized); - if (m_backgroundColor != Qt::white) { - adapter->setBackgroundColor(m_backgroundColor); - emit q->backgroundColorChanged(); - } - - if (!qFuzzyCompare(adapter->currentZoomFactor(), m_zoomFactor)) { - adapter->setZoomFactor(m_zoomFactor); - emit q->zoomFactorChanged(m_zoomFactor); - } - -#if QT_CONFIG(webengine_webchannel) - if (m_webChannel) - adapter->setWebChannel(m_webChannel, m_webChannelWorld); -#endif - - if (devToolsView && devToolsView->d_ptr->adapter) - adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter); - - for (QQuickWebEngineScript *script : qAsConst(m_userScripts)) - script->d_func()->bind(profileAdapter()->userResourceController(), adapter.data()); - - if (q->window()) - adapter->setVisible(q->isVisible()); - - if (!m_isBeingAdopted) - return; - - // Ideally these would only be emitted if something actually changed. - emit q->titleChanged(); - emit q->urlChanged(); - emit q->iconChanged(); - QQuickWebEngineLoadRequest loadRequest(adapter->activeUrl(), QQuickWebEngineView::LoadSucceededStatus); - emit q->loadingChanged(&loadRequest); - emit q->loadProgressChanged(); - - m_isBeingAdopted = false; -} - -void QQuickWebEngineViewPrivate::setFullScreenMode(bool fullscreen) -{ - Q_Q(QQuickWebEngineView); - if (m_fullscreenMode != fullscreen) { - m_fullscreenMode = fullscreen; - adapter->changedFullScreen(); - Q_EMIT q->isFullScreenChanged(); - } -} - -void QQuickWebEngineViewPrivate::bindViewAndWidget(QQuickWebEngineView *view, - RenderWidgetHostViewQtDelegateQuick *widget) -{ - auto oldWidget = view ? view->d_func()->widget : nullptr; - auto oldView = widget ? widget->m_view : nullptr; - - // Change pointers first. - - if (widget && oldView != view) { - if (oldView) - oldView->d_func()->widget = nullptr; - widget->m_view = view; - } - - if (view && oldWidget != widget) { - if (oldWidget) - oldWidget->m_view = nullptr; - view->d_func()->widget = widget; - } - - // Then notify. - - if (widget && oldView != view && oldView) - oldView->d_func()->widgetChanged(widget, nullptr); - - if (view && oldWidget != widget) - view->d_func()->widgetChanged(oldWidget, widget); -} - -void QQuickWebEngineViewPrivate::widgetChanged(RenderWidgetHostViewQtDelegateQuick *oldWidget, - RenderWidgetHostViewQtDelegateQuick *newWidget) -{ - Q_Q(QQuickWebEngineView); - - if (oldWidget) - oldWidget->setParentItem(nullptr); - - if (newWidget) { - newWidget->setParentItem(q); - newWidget->setSize(q->boundingRect().size()); - // Focus on creation if the view accepts it - if (q->activeFocusOnPress()) - newWidget->setFocus(true); - } -} - -void QQuickWebEngineViewPrivate::updateAction(QQuickWebEngineView::WebAction action) const -{ - QQuickWebEngineAction *a = actions[action]; - if (!a) - return; - - bool enabled = true; - - switch (action) { - case QQuickWebEngineView::Back: - enabled = adapter->canGoBack(); - break; - case QQuickWebEngineView::Forward: - enabled = adapter->canGoForward(); - break; - case QQuickWebEngineView::Stop: - enabled = isLoading; - break; - case QQuickWebEngineView::Reload: - case QQuickWebEngineView::ReloadAndBypassCache: - enabled = !isLoading; - break; - case QQuickWebEngineView::ViewSource: - enabled = adapter->canViewSource(); - break; - case QQuickWebEngineView::Cut: - case QQuickWebEngineView::Copy: - case QQuickWebEngineView::Unselect: - enabled = adapter->hasFocusedFrame() && !adapter->selectedText().isEmpty(); - break; - case QQuickWebEngineView::Paste: - case QQuickWebEngineView::Undo: - case QQuickWebEngineView::Redo: - case QQuickWebEngineView::SelectAll: - case QQuickWebEngineView::PasteAndMatchStyle: - enabled = adapter->hasFocusedFrame(); - break; - default: - break; - } - - a->d_ptr->setEnabled(enabled); -} - -void QQuickWebEngineViewPrivate::updateNavigationActions() -{ - updateAction(QQuickWebEngineView::Back); - updateAction(QQuickWebEngineView::Forward); - updateAction(QQuickWebEngineView::Stop); - updateAction(QQuickWebEngineView::Reload); - updateAction(QQuickWebEngineView::ReloadAndBypassCache); - updateAction(QQuickWebEngineView::ViewSource); -} - -void QQuickWebEngineViewPrivate::updateEditActions() -{ - updateAction(QQuickWebEngineView::Cut); - updateAction(QQuickWebEngineView::Copy); - updateAction(QQuickWebEngineView::Paste); - updateAction(QQuickWebEngineView::Undo); - updateAction(QQuickWebEngineView::Redo); - updateAction(QQuickWebEngineView::SelectAll); - updateAction(QQuickWebEngineView::PasteAndMatchStyle); - updateAction(QQuickWebEngineView::Unselect); -} - -QUrl QQuickWebEngineView::url() const -{ - Q_D(const QQuickWebEngineView); - if (d->adapter->isInitialized()) - return d->adapter->activeUrl(); - else - return d->m_url; -} - -void QQuickWebEngineView::setUrl(const QUrl& url) -{ - Q_D(QQuickWebEngineView); - if (url.isEmpty()) - return; - - if (d->adapter->isInitialized()) { - d->adapter->load(url); - return; - } - - d->m_url = url; - d->m_html.clear(); -} - -QUrl QQuickWebEngineView::icon() const -{ - Q_D(const QQuickWebEngineView); - return d->iconUrl; -} - -void QQuickWebEngineView::loadHtml(const QString &html, const QUrl &baseUrl) -{ - Q_D(QQuickWebEngineView); - d->m_url = baseUrl; - d->m_html = html; - if (d->adapter->isInitialized()) { - d->adapter->setContent(html.toUtf8(), defaultMimeType, baseUrl); - return; - } -} - -void QQuickWebEngineView::goBack() -{ - Q_D(QQuickWebEngineView); - d->adapter->navigateBack(); -} - -void QQuickWebEngineView::goForward() -{ - Q_D(QQuickWebEngineView); - d->adapter->navigateForward(); -} - -void QQuickWebEngineView::reload() -{ - Q_D(QQuickWebEngineView); - d->adapter->reload(); -} - -void QQuickWebEngineView::reloadAndBypassCache() -{ - Q_D(QQuickWebEngineView); - d->adapter->reloadAndBypassCache(); -} - -void QQuickWebEngineView::stop() -{ - Q_D(QQuickWebEngineView); - d->adapter->stop(); -} - -void QQuickWebEngineView::setZoomFactor(qreal arg) -{ - Q_D(QQuickWebEngineView); - if (d->adapter->isInitialized() && !qFuzzyCompare(d->m_zoomFactor, d->adapter->currentZoomFactor())) { - d->adapter->setZoomFactor(arg); - emit zoomFactorChanged(arg); - } else { - d->m_zoomFactor = arg; - } -} - -QQuickWebEngineProfile *QQuickWebEngineView::profile() -{ - Q_D(QQuickWebEngineView); - d->initializeProfile(); - return d->m_profile; -} - -void QQuickWebEngineView::setProfile(QQuickWebEngineProfile *profile) -{ - Q_D(QQuickWebEngineView); - - if (d->m_profile == profile) - return; - - if (!d->profileInitialized()) { - d->m_profile = profile; - return; - } - - if (d->m_profile) - d->m_profile->d_ptr->removeWebContentsAdapterClient(d); - - d->m_profile = profile; - d->m_profile->d_ptr->addWebContentsAdapterClient(d); - d->m_settings->setParentSettings(profile->settings()); - - d->updateAdapter(); - Q_EMIT profileChanged(); -} - -QQuickWebEngineSettings *QQuickWebEngineView::settings() -{ - Q_D(QQuickWebEngineView); - d->initializeProfile(); - return d->m_settings.data(); -} - -QQmlListProperty<QQuickWebEngineScript> QQuickWebEngineView::userScripts() -{ - Q_D(QQuickWebEngineView); - return QQmlListProperty<QQuickWebEngineScript>(this, d, - d->userScripts_append, - d->userScripts_count, - d->userScripts_at, - d->userScripts_clear); -} - -void QQuickWebEngineViewPrivate::updateAdapter() -{ - // When the profile changes we need to create a new WebContentAdapter and reload the active URL. - bool wasInitialized = adapter->isInitialized(); - QUrl activeUrl = adapter->activeUrl(); - adapter = QSharedPointer<WebContentsAdapter>::create(); - adapter->setClient(this); - if (wasInitialized) { - if (!m_html.isEmpty()) - adapter->setContent(m_html.toUtf8(), defaultMimeType, m_url); - else if (m_url.isValid()) - adapter->load(m_url); - else if (activeUrl.isValid()) - adapter->load(activeUrl); - else - adapter->loadDefault(); - } -} - -#if QT_CONFIG(webengine_testsupport) -QQuickWebEngineTestSupport *QQuickWebEngineView::testSupport() const -{ - Q_D(const QQuickWebEngineView); - return d->m_testSupport; -} - -void QQuickWebEngineView::setTestSupport(QQuickWebEngineTestSupport *testSupport) -{ - Q_D(QQuickWebEngineView); - d->m_testSupport = testSupport; - Q_EMIT testSupportChanged(); -} -#endif - -bool QQuickWebEngineView::activeFocusOnPress() const -{ - Q_D(const QQuickWebEngineView); - return d->m_activeFocusOnPress; -} - -void QQuickWebEngineViewPrivate::didRunJavaScript(quint64 requestId, const QVariant &result) -{ - Q_Q(QQuickWebEngineView); - QJSValue callback = m_callbacks.take(requestId); - QJSValueList args; - args.append(qmlEngine(q)->toScriptValue(result)); - callback.call(args); -} - -void QQuickWebEngineViewPrivate::didPrintPage(quint64 requestId, QSharedPointer<QByteArray> result) -{ - Q_Q(QQuickWebEngineView); - QJSValue callback = m_callbacks.take(requestId); - QJSValueList args; - args.append(qmlEngine(q)->toScriptValue(*(result.data()))); - callback.call(args); -} - -void QQuickWebEngineViewPrivate::didPrintPageToPdf(const QString &filePath, bool success) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->pdfPrintingFinished(filePath, success); -} - -void QQuickWebEngineViewPrivate::updateScrollPosition(const QPointF &position) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->scrollPositionChanged(position); -} - -void QQuickWebEngineViewPrivate::updateContentsSize(const QSizeF &size) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->contentsSizeChanged(size); -} - -void QQuickWebEngineViewPrivate::renderProcessTerminated( - RenderProcessTerminationStatus terminationStatus, int exitCode) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->renderProcessTerminated(static_cast<QQuickWebEngineView::RenderProcessTerminationStatus>( - renderProcessExitStatus(terminationStatus)), exitCode); -} - -void QQuickWebEngineViewPrivate::requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) -{ - Q_Q(QQuickWebEngineView); - Q_EMIT q->geometryChangeRequested(geometry, frameGeometry); -} - -void QQuickWebEngineViewPrivate::startDragging(const content::DropData &dropData, - Qt::DropActions allowedActions, - const QPixmap &pixmap, const QPoint &offset) -{ -#if !QT_CONFIG(draganddrop) - Q_UNUSED(dropData); - Q_UNUSED(allowedActions); - Q_UNUSED(pixmap); - Q_UNUSED(offset); -#else - adapter->startDragging(q_ptr->window(), dropData, allowedActions, pixmap, offset); -#endif // QT_CONFIG(draganddrop) -} - -bool QQuickWebEngineViewPrivate::supportsDragging() const -{ - // QTBUG-57516 - // Fixme: This is just a band-aid workaround. - return QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows); -} - -bool QQuickWebEngineViewPrivate::isEnabled() const -{ - const Q_Q(QQuickWebEngineView); - return q->isEnabled(); -} - -void QQuickWebEngineViewPrivate::setToolTip(const QString &toolTipText) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineTooltipRequest *request = new QQuickWebEngineTooltipRequest(toolTipText, q); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->tooltipRequested(request); - if (!request->isAccepted()) - ui()->showToolTip(toolTipText); -} - -QtWebEngineCore::TouchHandleDrawableClient *QQuickWebEngineViewPrivate::createTouchHandle(const QMap<int, QImage> &images) -{ - return new QQuickWebEngineTouchHandle(ui(), images); -} - -void QQuickWebEngineViewPrivate::showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *menuController, const QRect &selectionBounds, const QSize &handleSize) -{ - Q_UNUSED(handleSize); - - const int kSpacingBetweenButtons = 2; - const int kMenuButtonMinWidth = 63; - const int kMenuButtonMinHeight = 38; - - int buttonCount = menuController->buttonCount(); - if (buttonCount == 1) { - menuController->runContextMenu(); - return; - } - - int width = (kSpacingBetweenButtons * (buttonCount + 1)) + (kMenuButtonMinWidth * buttonCount); - int height = kMenuButtonMinHeight + kSpacingBetweenButtons; - int x = (selectionBounds.x() + selectionBounds.x() + selectionBounds.width() - width) / 2; - int y = selectionBounds.y() - height - 2; - - QRect bounds(x, y, width, height); - ui()->showTouchSelectionMenu(menuController, bounds, kSpacingBetweenButtons); -} - -void QQuickWebEngineViewPrivate::hideTouchSelectionMenu() -{ - ui()->hideTouchSelectionMenu(); -} - -bool QQuickWebEngineView::isLoading() const -{ - Q_D(const QQuickWebEngineView); - return d->isLoading; -} - -int QQuickWebEngineView::loadProgress() const -{ - Q_D(const QQuickWebEngineView); - return d->loadProgress; -} - -QString QQuickWebEngineView::title() const -{ - Q_D(const QQuickWebEngineView); - return d->adapter->pageTitle(); -} - -bool QQuickWebEngineView::canGoBack() const -{ - Q_D(const QQuickWebEngineView); - return d->adapter->canGoBack(); -} - -bool QQuickWebEngineView::canGoForward() const -{ - Q_D(const QQuickWebEngineView); - return d->adapter->canGoForward(); -} - -void QQuickWebEngineView::runJavaScript(const QString &script, const QJSValue &callback) -{ - runJavaScript(script, QQuickWebEngineScript::MainWorld, callback); -} - -void QQuickWebEngineView::runJavaScript(const QString &script, quint32 worldId, const QJSValue &callback) -{ - Q_D(QQuickWebEngineView); - d->ensureContentsAdapter(); - if (!callback.isUndefined()) { - quint64 requestId = d_ptr->adapter->runJavaScriptCallbackResult(script, worldId); - d->m_callbacks.insert(requestId, callback); - } else - d->adapter->runJavaScript(script, worldId); -} - -qreal QQuickWebEngineView::zoomFactor() const -{ - Q_D(const QQuickWebEngineView); - if (!d->adapter->isInitialized()) - return d->m_zoomFactor; - return d->adapter->currentZoomFactor(); -} - -QColor QQuickWebEngineView::backgroundColor() const -{ - Q_D(const QQuickWebEngineView); - return d->m_backgroundColor; -} - -void QQuickWebEngineView::setBackgroundColor(const QColor &color) -{ - Q_D(QQuickWebEngineView); - if (color == d->m_backgroundColor) - return; - d->m_backgroundColor = color; - if (d->adapter->isInitialized()) { - d->adapter->setBackgroundColor(color); - emit backgroundColorChanged(); - } -} - -/*! - \property QQuickWebEngineView::audioMuted - \brief The state of whether the current page audio is muted. - \since 5.7 - - The default value is false. -*/ -bool QQuickWebEngineView::isAudioMuted() const -{ - const Q_D(QQuickWebEngineView); - return d->adapter->isAudioMuted(); -} - -void QQuickWebEngineView::setAudioMuted(bool muted) -{ - Q_D(QQuickWebEngineView); - bool wasAudioMuted = d->adapter->isAudioMuted(); - d->adapter->setAudioMuted(muted); - if (wasAudioMuted != d->adapter->isAudioMuted()) - Q_EMIT audioMutedChanged(muted); -} - -bool QQuickWebEngineView::recentlyAudible() const -{ - const Q_D(QQuickWebEngineView); - return d->adapter->recentlyAudible(); -} - -void QQuickWebEngineView::printToPdf(const QString& filePath, PrintedPageSizeId pageSizeId, PrintedPageOrientation orientation) -{ -#if QT_CONFIG(webengine_printing_and_pdf) - Q_D(QQuickWebEngineView); - QPageSize layoutSize(static_cast<QPageSize::PageSizeId>(pageSizeId)); - QPageLayout::Orientation layoutOrientation = static_cast<QPageLayout::Orientation>(orientation); - QPageLayout pageLayout(layoutSize, layoutOrientation, QMarginsF(0.0, 0.0, 0.0, 0.0)); - d->ensureContentsAdapter(); - d->adapter->printToPDF(pageLayout, filePath); -#else - Q_UNUSED(filePath); - Q_UNUSED(pageSizeId); - Q_UNUSED(orientation); -#endif -} - -void QQuickWebEngineView::printToPdf(const QJSValue &callback, PrintedPageSizeId pageSizeId, PrintedPageOrientation orientation) -{ -#if QT_CONFIG(webengine_printing_and_pdf) - Q_D(QQuickWebEngineView); - QPageSize layoutSize(static_cast<QPageSize::PageSizeId>(pageSizeId)); - QPageLayout::Orientation layoutOrientation = static_cast<QPageLayout::Orientation>(orientation); - QPageLayout pageLayout(layoutSize, layoutOrientation, QMarginsF(0.0, 0.0, 0.0, 0.0)); - - if (callback.isUndefined()) - return; - - d->ensureContentsAdapter(); - quint64 requestId = d->adapter->printToPDFCallbackResult(pageLayout); - d->m_callbacks.insert(requestId, callback); -#else - Q_UNUSED(pageSizeId); - Q_UNUSED(orientation); - - // Call back with null result. - QJSValueList args; - args.append(QJSValue(QByteArray().data())); - QJSValue callbackCopy = callback; - callbackCopy.call(args); -#endif -} - -void QQuickWebEngineView::replaceMisspelledWord(const QString &replacement) -{ - Q_D(QQuickWebEngineView); - d->adapter->replaceMisspelling(replacement); -} - -bool QQuickWebEngineView::isFullScreen() const -{ - Q_D(const QQuickWebEngineView); - return d->m_fullscreenMode; -} - -void QQuickWebEngineView::findText(const QString &subString, FindFlags options, const QJSValue &callback) -{ - Q_D(QQuickWebEngineView); - if (!d->adapter->isInitialized()) - return; - - d->adapter->findTextHelper()->startFinding(subString, options & FindCaseSensitively, options & FindBackward, callback); -} - -QQuickWebEngineHistory *QQuickWebEngineView::navigationHistory() const -{ - Q_D(const QQuickWebEngineView); - return d->m_history.data(); -} - -QQmlWebChannel *QQuickWebEngineView::webChannel() -{ -#if QT_CONFIG(webengine_webchannel) - Q_D(QQuickWebEngineView); - if (!d->m_webChannel) { - d->m_webChannel = new QQmlWebChannel(this); - } - return d->m_webChannel; -#endif - qWarning("WebEngine compiled without webchannel support"); - return nullptr; -} - -void QQuickWebEngineView::setWebChannel(QQmlWebChannel *webChannel) -{ -#if QT_CONFIG(webengine_webchannel) - Q_D(QQuickWebEngineView); - if (d->m_webChannel == webChannel) - return; - d->m_webChannel = webChannel; - if (d->profileInitialized()) - d->adapter->setWebChannel(webChannel, d->m_webChannelWorld); - Q_EMIT webChannelChanged(); -#else - Q_UNUSED(webChannel) - qWarning("WebEngine compiled without webchannel support"); -#endif -} - -uint QQuickWebEngineView::webChannelWorld() const -{ - Q_D(const QQuickWebEngineView); - return d->m_webChannelWorld; -} - -void QQuickWebEngineView::setWebChannelWorld(uint webChannelWorld) -{ -#if QT_CONFIG(webengine_webchannel) - Q_D(QQuickWebEngineView); - if (d->m_webChannelWorld == webChannelWorld) - return; - d->m_webChannelWorld = webChannelWorld; - if (d->profileInitialized()) - d->adapter->setWebChannel(d->m_webChannel, d->m_webChannelWorld); - Q_EMIT webChannelWorldChanged(webChannelWorld); -#else - Q_UNUSED(webChannelWorld) - qWarning("WebEngine compiled without webchannel support"); -#endif -} - -QQuickWebEngineView *QQuickWebEngineView::inspectedView() const -{ - Q_D(const QQuickWebEngineView); - return d->inspectedView; -} - -void QQuickWebEngineView::setInspectedView(QQuickWebEngineView *view) -{ - Q_D(QQuickWebEngineView); - if (d->inspectedView == view) - return; - QQuickWebEngineView *oldView = d->inspectedView; - d->inspectedView = nullptr; - if (oldView) - oldView->setDevToolsView(nullptr); - d->inspectedView = view; - if (view) - view->setDevToolsView(this); - Q_EMIT inspectedViewChanged(); -} - -QQuickWebEngineView *QQuickWebEngineView::devToolsView() const -{ - Q_D(const QQuickWebEngineView); - return d->devToolsView; -} - - -void QQuickWebEngineView::setDevToolsView(QQuickWebEngineView *devToolsView) -{ - Q_D(QQuickWebEngineView); - if (d->devToolsView == devToolsView) - return; - QQuickWebEngineView *oldView = d->devToolsView; - d->devToolsView = nullptr; - if (oldView) - oldView->setInspectedView(nullptr); - d->devToolsView = devToolsView; - if (devToolsView) - devToolsView->setInspectedView(this); - if (d->profileInitialized() && d->adapter->isInitialized()) { - if (devToolsView) - d->adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter); - else - d->adapter->closeDevToolsFrontend(); - } - Q_EMIT devToolsViewChanged(); -} - -void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineView::Feature feature, bool granted) -{ - if (!granted && ((feature >= MediaAudioCapture && feature <= MediaAudioVideoCapture) || - (feature >= DesktopVideoCapture && feature <= DesktopAudioVideoCapture))) { - d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaNone); - return; - } - - switch (feature) { - case MediaAudioCapture: - d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaAudioCapture); - break; - case MediaVideoCapture: - d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaVideoCapture); - break; - case MediaAudioVideoCapture: - d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaRequestFlags(WebContentsAdapterClient::MediaAudioCapture | WebContentsAdapterClient::MediaVideoCapture)); - break; - case Geolocation: - d_ptr->adapter->runGeolocationRequestCallback(securityOrigin, granted); - break; - case DesktopVideoCapture: - d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaDesktopVideoCapture); - break; - case DesktopAudioVideoCapture: - d_ptr->adapter->grantMediaAccessPermission( - securityOrigin, - WebContentsAdapterClient::MediaRequestFlags( - WebContentsAdapterClient::MediaDesktopAudioCapture | - WebContentsAdapterClient::MediaDesktopVideoCapture)); - break; - case Notifications: - d_ptr->adapter->runUserNotificationRequestCallback(securityOrigin, granted); - break; - default: - Q_UNREACHABLE(); - } -} - -void QQuickWebEngineView::setActiveFocusOnPress(bool arg) -{ - Q_D(QQuickWebEngineView); - if (d->m_activeFocusOnPress == arg) - return; - - d->m_activeFocusOnPress = arg; - emit activeFocusOnPressChanged(arg); -} - -void QQuickWebEngineView::goBackOrForward(int offset) -{ - Q_D(QQuickWebEngineView); - const int current = d->adapter->currentNavigationEntryIndex(); - const int count = d->adapter->navigationEntryCount(); - const int index = current + offset; - - if (index < 0 || index >= count) - return; - - d->adapter->navigateToIndex(index); -} - -void QQuickWebEngineView::fullScreenCancelled() -{ - Q_D(QQuickWebEngineView); - d->adapter->exitFullScreen(); -} - -void QQuickWebEngineView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - QQuickItem::geometryChanged(newGeometry, oldGeometry); - Q_D(QQuickWebEngineView); - if (d->widget) - d->widget->setSize(newGeometry.size()); -} - -void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &value) -{ - Q_D(QQuickWebEngineView); - if (d && d->profileInitialized() && d->adapter->isInitialized() - && (change == ItemSceneChange || change == ItemVisibleHasChanged)) { - if (window()) - d->adapter->setVisible(isVisible()); - } - QQuickItem::itemChange(change, value); -} - -#if QT_CONFIG(draganddrop) -static QPoint mapToScreen(const QQuickItem *item, const QPoint &clientPos) -{ - return item->window()->position() + item->mapToScene(clientPos).toPoint(); -} - -void QQuickWebEngineView::dragEnterEvent(QDragEnterEvent *e) -{ - Q_D(QQuickWebEngineView); - e->accept(); - d->adapter->enterDrag(e, mapToScreen(this, e->pos())); -} - -void QQuickWebEngineView::dragLeaveEvent(QDragLeaveEvent *e) -{ - Q_D(QQuickWebEngineView); - e->accept(); - d->adapter->leaveDrag(); -} - -void QQuickWebEngineView::dragMoveEvent(QDragMoveEvent *e) -{ - Q_D(QQuickWebEngineView); - Qt::DropAction dropAction = d->adapter->updateDragPosition(e, mapToScreen(this, e->pos())); - if (Qt::IgnoreAction == dropAction) { - e->ignore(); - } else { - e->setDropAction(dropAction); - e->accept(); - } -} - -void QQuickWebEngineView::dropEvent(QDropEvent *e) -{ - Q_D(QQuickWebEngineView); - e->accept(); - d->adapter->endDragging(e, mapToScreen(this, e->pos())); -} -#endif // QT_CONFIG(draganddrop) - -void QQuickWebEngineView::triggerWebAction(WebAction action) -{ - Q_D(QQuickWebEngineView); - switch (action) { - case Back: - d->adapter->navigateBack(); - break; - case Forward: - d->adapter->navigateForward(); - break; - case Stop: - d->adapter->stop(); - break; - case Reload: - d->adapter->reload(); - break; - case ReloadAndBypassCache: - d->adapter->reloadAndBypassCache(); - break; - case Cut: - d->adapter->cut(); - break; - case Copy: - d->adapter->copy(); - break; - case Paste: - d->adapter->paste(); - break; - case Undo: - d->adapter->undo(); - break; - case Redo: - d->adapter->redo(); - break; - case SelectAll: - d->adapter->selectAll(); - break; - case PasteAndMatchStyle: - d->adapter->pasteAndMatchStyle(); - break; - case Unselect: - d->adapter->unselect(); - break; - case OpenLinkInThisWindow: - if (d->m_contextMenuData.linkUrl().isValid()) - setUrl(d->m_contextMenuData.linkUrl()); - break; - case OpenLinkInNewWindow: - if (d->m_contextMenuData.linkUrl().isValid()) { - QQuickWebEngineNewViewRequest request; - request.m_requestedUrl = d->m_contextMenuData.linkUrl(); - request.m_isUserInitiated = true; - request.m_destination = NewViewInWindow; - Q_EMIT newViewRequested(&request); - } - break; - case OpenLinkInNewTab: - if (d->m_contextMenuData.linkUrl().isValid()) { - QQuickWebEngineNewViewRequest request; - request.m_requestedUrl = d->m_contextMenuData.linkUrl(); - request.m_isUserInitiated = true; - request.m_destination = NewViewInBackgroundTab; - Q_EMIT newViewRequested(&request); - } - break; - case CopyLinkToClipboard: - if (!d->m_contextMenuData.unfilteredLinkUrl().isEmpty()) { - QString urlString = d->m_contextMenuData.unfilteredLinkUrl().toString(QUrl::FullyEncoded); - QString title = d->m_contextMenuData.linkText().toHtmlEscaped(); - QMimeData *data = new QMimeData(); - data->setText(urlString); - QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + title + QStringLiteral("</a>"); - data->setHtml(html); - data->setUrls(QList<QUrl>() << d->m_contextMenuData.unfilteredLinkUrl()); - qApp->clipboard()->setMimeData(data); - } - break; - case DownloadLinkToDisk: - if (d->m_contextMenuData.linkUrl().isValid()) - d->adapter->download(d->m_contextMenuData.linkUrl(), d->m_contextMenuData.suggestedFileName(), - d->m_contextMenuData.referrerUrl(), d->m_contextMenuData.referrerPolicy()); - break; - case CopyImageToClipboard: - if (d->m_contextMenuData.hasImageContent() && - (d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeImage || - d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeCanvas)) - { - d->adapter->copyImageAt(d->m_contextMenuData.position()); - } - break; - case CopyImageUrlToClipboard: - if (d->m_contextMenuData.mediaUrl().isValid() && d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeImage) { - QString urlString = d->m_contextMenuData.mediaUrl().toString(QUrl::FullyEncoded); - QString title = d->m_contextMenuData.linkText(); - if (!title.isEmpty()) - title = QStringLiteral(" alt=\"%1\"").arg(title.toHtmlEscaped()); - QMimeData *data = new QMimeData(); - data->setText(urlString); - QString html = QStringLiteral("<img src=\"") + urlString + QStringLiteral("\"") + title + QStringLiteral("></img>"); - data->setHtml(html); - data->setUrls(QList<QUrl>() << d->m_contextMenuData.mediaUrl()); - qApp->clipboard()->setMimeData(data); - } - break; - case DownloadImageToDisk: - case DownloadMediaToDisk: - if (d->m_contextMenuData.mediaUrl().isValid()) - d->adapter->download(d->m_contextMenuData.mediaUrl(), d->m_contextMenuData.suggestedFileName(), - d->m_contextMenuData.referrerUrl(), d->m_contextMenuData.referrerPolicy()); - break; - case CopyMediaUrlToClipboard: - if (d->m_contextMenuData.mediaUrl().isValid() && - (d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeAudio || - d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeVideo)) - { - QString urlString = d->m_contextMenuData.mediaUrl().toString(QUrl::FullyEncoded); - QMimeData *data = new QMimeData(); - data->setText(urlString); - if (d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeAudio) - data->setHtml(QStringLiteral("<audio src=\"") + urlString + QStringLiteral("\"></audio>")); - else - data->setHtml(QStringLiteral("<video src=\"") + urlString + QStringLiteral("\"></video>")); - data->setUrls(QList<QUrl>() << d->m_contextMenuData.mediaUrl()); - qApp->clipboard()->setMimeData(data); - } - break; - case ToggleMediaControls: - if (d->m_contextMenuData.mediaUrl().isValid() && d->m_contextMenuData.mediaFlags() & WebEngineContextMenuData::MediaCanToggleControls) { - bool enable = !(d->m_contextMenuData.mediaFlags() & WebEngineContextMenuData::MediaControls); - d->adapter->executeMediaPlayerActionAt(d->m_contextMenuData.position(), WebContentsAdapter::MediaPlayerControls, enable); - } - break; - case ToggleMediaLoop: - if (d->m_contextMenuData.mediaUrl().isValid() && - (d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeAudio || - d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeVideo)) - { - bool enable = !(d->m_contextMenuData.mediaFlags() & WebEngineContextMenuData::MediaLoop); - d->adapter->executeMediaPlayerActionAt(d->m_contextMenuData.position(), WebContentsAdapter::MediaPlayerLoop, enable); - } - break; - case ToggleMediaPlayPause: - if (d->m_contextMenuData.mediaUrl().isValid() && - (d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeAudio || - d->m_contextMenuData.mediaType() == WebEngineContextMenuData::MediaTypeVideo)) - { - bool enable = (d->m_contextMenuData.mediaFlags() & WebEngineContextMenuData::MediaPaused); - d->adapter->executeMediaPlayerActionAt(d->m_contextMenuData.position(), WebContentsAdapter::MediaPlayerPlay, enable); - } - break; - case ToggleMediaMute: - if (d->m_contextMenuData.mediaUrl().isValid() && d->m_contextMenuData.mediaFlags() & WebEngineContextMenuData::MediaHasAudio) { - bool enable = !(d->m_contextMenuData.mediaFlags() & WebEngineContextMenuData::MediaMuted); - d->adapter->executeMediaPlayerActionAt(d->m_contextMenuData.position(), WebContentsAdapter::MediaPlayerMute, enable); - } - break; - case InspectElement: - d->adapter->inspectElementAt(d->m_contextMenuData.position()); - break; - case ExitFullScreen: - d->adapter->exitFullScreen(); - break; - case RequestClose: - d->adapter->requestClose(); - break; - case SavePage: - d->adapter->save(); - break; - case ViewSource: - d->adapter->viewSource(); - break; - case ToggleBold: - runJavaScript(QStringLiteral("document.execCommand('bold');"), QQuickWebEngineScript::ApplicationWorld); - break; - case ToggleItalic: - runJavaScript(QStringLiteral("document.execCommand('italic');"), QQuickWebEngineScript::ApplicationWorld); - break; - case ToggleUnderline: - runJavaScript(QStringLiteral("document.execCommand('underline');"), QQuickWebEngineScript::ApplicationWorld); - break; - case ToggleStrikethrough: - runJavaScript(QStringLiteral("document.execCommand('strikethrough');"), QQuickWebEngineScript::ApplicationWorld); - break; - case AlignLeft: - runJavaScript(QStringLiteral("document.execCommand('justifyLeft');"), QQuickWebEngineScript::ApplicationWorld); - break; - case AlignCenter: - runJavaScript(QStringLiteral("document.execCommand('justifyCenter');"), QQuickWebEngineScript::ApplicationWorld); - break; - case AlignRight: - runJavaScript(QStringLiteral("document.execCommand('justifyRight');"), QQuickWebEngineScript::ApplicationWorld); - break; - case AlignJustified: - runJavaScript(QStringLiteral("document.execCommand('justifyFull');"), QQuickWebEngineScript::ApplicationWorld); - break; - case Indent: - runJavaScript(QStringLiteral("document.execCommand('indent');"), QQuickWebEngineScript::ApplicationWorld); - break; - case Outdent: - runJavaScript(QStringLiteral("document.execCommand('outdent');"), QQuickWebEngineScript::ApplicationWorld); - break; - case InsertOrderedList: - runJavaScript(QStringLiteral("document.execCommand('insertOrderedList');"), QQuickWebEngineScript::ApplicationWorld); - break; - case InsertUnorderedList: - runJavaScript(QStringLiteral("document.execCommand('insertUnorderedList');"), QQuickWebEngineScript::ApplicationWorld); - break; - default: - Q_UNREACHABLE(); - } -} - -QQuickWebEngineAction *QQuickWebEngineView::action(WebAction action) -{ - Q_D(QQuickWebEngineView); - if (action == QQuickWebEngineView::NoWebAction) - return nullptr; - if (d->actions[action]) { - d->updateAction(action); - return d->actions[action]; - } - - QString text; - QString iconName; - - switch (action) { - case Back: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Back); - iconName = QStringLiteral("go-previous"); - break; - case Forward: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Forward); - iconName = QStringLiteral("go-next"); - break; - case Stop: - text = tr("Stop"); - iconName = QStringLiteral("process-stop"); - break; - case Reload: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Reload); - iconName = QStringLiteral("view-refresh"); - break; - case ReloadAndBypassCache: - text = tr("Reload and Bypass Cache"); - iconName = QStringLiteral("view-refresh"); - break; - case Cut: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Cut); - iconName = QStringLiteral("edit-cut"); - break; - case Copy: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Copy); - iconName = QStringLiteral("edit-copy"); - break; - case Paste: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Paste); - iconName = QStringLiteral("edit-paste"); - break; - case Undo: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Undo); - iconName = QStringLiteral("edit-undo"); - break; - case Redo: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::Redo); - iconName = QStringLiteral("edit-redo"); - break; - case SelectAll: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::SelectAll); - iconName = QStringLiteral("edit-select-all"); - break; - case PasteAndMatchStyle: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::PasteAndMatchStyle); - iconName = QStringLiteral("edit-paste"); - break; - case OpenLinkInThisWindow: - text = tr("Open link in this window"); - break; - case OpenLinkInNewWindow: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::OpenLinkInNewWindow); - break; - case OpenLinkInNewTab: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::OpenLinkInNewTab); - break; - case CopyLinkToClipboard: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyLinkToClipboard); - break; - case DownloadLinkToDisk: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::DownloadLinkToDisk); - break; - case CopyImageToClipboard: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyImageToClipboard); - break; - case CopyImageUrlToClipboard: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyImageUrlToClipboard); - break; - case DownloadImageToDisk: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::DownloadImageToDisk); - break; - case CopyMediaUrlToClipboard: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::CopyMediaUrlToClipboard); - break; - case ToggleMediaControls: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ToggleMediaControls); - break; - case ToggleMediaLoop: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ToggleMediaLoop); - break; - case ToggleMediaPlayPause: - text = tr("Toggle Play/Pause"); - iconName = QStringLiteral("media-playback-start"); - break; - case ToggleMediaMute: - text = tr("Toggle Mute"); - iconName = QStringLiteral("audio-volume-muted"); - break; - case DownloadMediaToDisk: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::DownloadMediaToDisk); - break; - case InspectElement: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::InspectElement); - break; - case ExitFullScreen: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ExitFullScreen); - iconName = QStringLiteral("view-fullscreen"); - break; - case RequestClose: - text = tr("Close Page"); - iconName = QStringLiteral("window-close"); - break; - case Unselect: - text = tr("Unselect"); - iconName = QStringLiteral("edit-select-none"); - break; - case SavePage: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::SavePage); - iconName = QStringLiteral("document-save"); - break; - case ViewSource: - text = RenderViewContextMenuQt::getMenuItemName(RenderViewContextMenuQt::ContextMenuItem::ViewSource); - break; - case ToggleBold: - text = tr("&Bold"); - iconName = QStringLiteral("format-text-bold"); - break; - case ToggleItalic: - text = tr("&Italic"); - iconName = QStringLiteral("format-text-italic"); - break; - case ToggleUnderline: - text = tr("&Underline"); - iconName = QStringLiteral("format-text-underline"); - break; - case ToggleStrikethrough: - text = tr("&Strikethrough"); - iconName = QStringLiteral("format-text-strikethrough"); - break; - case AlignLeft: - text = tr("Align &Left"); - break; - case AlignCenter: - text = tr("Align &Center"); - break; - case AlignRight: - text = tr("Align &Right"); - break; - case AlignJustified: - text = tr("Align &Justified"); - break; - case Indent: - text = tr("&Indent"); - iconName = QStringLiteral("format-indent-more"); - break; - case Outdent: - text = tr("&Outdent"); - iconName = QStringLiteral("format-indent-less"); - break; - case InsertOrderedList: - text = tr("Insert &Ordered List"); - break; - case InsertUnorderedList: - text = tr("Insert &Unordered List"); - break; - case NoWebAction: - case WebActionCount: - Q_UNREACHABLE(); - break; - } - - QQuickWebEngineAction *retVal = new QQuickWebEngineAction(action, text, iconName, false, this); - - d->actions[action] = retVal; - d->updateAction(action); - return retVal; -} - -QSizeF QQuickWebEngineView::contentsSize() const -{ - Q_D(const QQuickWebEngineView); - return d->adapter->lastContentsSize(); -} - -QPointF QQuickWebEngineView::scrollPosition() const -{ - Q_D(const QQuickWebEngineView); - return d->adapter->lastScrollOffset(); -} - -void QQuickWebEngineViewPrivate::userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineViewPrivate *d = static_cast<QQuickWebEngineViewPrivate*>(p->data); - d->m_userScripts.append(script); - // If the adapter hasn't been initialized, we'll bind the scripts in initializationFinished() - if (!d->adapter->isInitialized()) - return; - UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); - script->d_func()->bind(resourceController, d->adapter.data()); -} - -int QQuickWebEngineViewPrivate::userScripts_count(QQmlListProperty<QQuickWebEngineScript> *p) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineViewPrivate *d = static_cast<QQuickWebEngineViewPrivate*>(p->data); - return d->m_userScripts.count(); -} - -QQuickWebEngineScript *QQuickWebEngineViewPrivate::userScripts_at(QQmlListProperty<QQuickWebEngineScript> *p, int idx) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineViewPrivate *d = static_cast<QQuickWebEngineViewPrivate*>(p->data); - return d->m_userScripts.at(idx); -} - -void QQuickWebEngineViewPrivate::userScripts_clear(QQmlListProperty<QQuickWebEngineScript> *p) -{ - Q_ASSERT(p && p->data); - QQuickWebEngineViewPrivate *d = static_cast<QQuickWebEngineViewPrivate*>(p->data); - d->m_userScripts.clear(); - if (!d->adapter->isInitialized()) - return; - UserResourceControllerHost *resourceController = d->profileAdapter()->userResourceController(); - resourceController->clearAllScripts(d->adapter.data()); -} - -void QQuickWebEngineView::componentComplete() -{ - QQuickItem::componentComplete(); - Q_D(QQuickWebEngineView); - d->initializeProfile(); -#ifndef QT_NO_ACCESSIBILITY - // Enable accessibility via a dynamic QQmlProperty, instead of using private API call - // QQuickAccessibleAttached::qmlAttachedProperties(this). The qmlContext is required, otherwise - // it is not possible to reference attached properties. - QQmlContext *qmlContext = QQmlEngine::contextForObject(this); - QQmlProperty role(this, QStringLiteral("Accessible.role"), qmlContext); - role.write(QAccessible::Grouping); -#endif // QT_NO_ACCESSIBILITY - - QTimer::singleShot(0, this, &QQuickWebEngineView::lazyInitialize); -} - -void QQuickWebEngineView::lazyInitialize() -{ - Q_D(QQuickWebEngineView); - d->ensureContentsAdapter(); -} - -QQuickWebEngineView::LifecycleState QQuickWebEngineView::lifecycleState() const -{ - Q_D(const QQuickWebEngineView); - return static_cast<LifecycleState>(d->adapter->lifecycleState()); -} - -void QQuickWebEngineView::setLifecycleState(LifecycleState state) -{ - Q_D(QQuickWebEngineView); - d->adapter->setLifecycleState(static_cast<WebContentsAdapterClient::LifecycleState>(state)); -} - -QQuickWebEngineView::LifecycleState QQuickWebEngineView::recommendedState() const -{ - Q_D(const QQuickWebEngineView); - return static_cast<LifecycleState>(d->adapter->recommendedState()); -} - -QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest() - : m_viewPrivate(0) - , m_toggleOn(false) -{ -} - -QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, const QUrl &origin, bool toggleOn) - : m_viewPrivate(viewPrivate) - , m_origin(origin) - , m_toggleOn(toggleOn) -{ -} - -void QQuickWebEngineFullScreenRequest::accept() -{ - if (m_viewPrivate) - m_viewPrivate->setFullScreenMode(m_toggleOn); -} - -void QQuickWebEngineFullScreenRequest::reject() -{ - if (m_viewPrivate) - m_viewPrivate->setFullScreenMode(!m_toggleOn); -} - -QQuickContextMenuBuilder::QQuickContextMenuBuilder(const QtWebEngineCore::WebEngineContextMenuData &data, - QQuickWebEngineView *view, - QObject *menu) - : QtWebEngineCore::RenderViewContextMenuQt(data) - , m_view(view) - , m_menu(menu) -{ -} - -void QQuickContextMenuBuilder::appendExtraItems(QQmlEngine *engine) -{ - m_view->d_ptr->ui()->addMenuSeparator(m_menu); - if (QObject *menuExtras = m_view->d_ptr->contextMenuExtraItems->create(qmlContext(m_view))) { - menuExtras->setParent(m_menu); - QQmlListReference entries(m_menu, defaultPropertyName(m_menu), engine); - if (entries.isValid()) - entries.append(menuExtras); - } -} - -bool QQuickContextMenuBuilder::hasInspector() -{ - return m_view->d_ptr->adapter->hasInspector(); -} - -bool QQuickContextMenuBuilder::isFullScreenMode() -{ - return m_view->d_ptr->isFullScreenMode(); -} - -void QQuickContextMenuBuilder::addMenuItem(ContextMenuItem menuItem) -{ - QQuickWebEngineAction *action = nullptr; - - switch (menuItem) { - case ContextMenuItem::Back: - action = m_view->action(QQuickWebEngineView::Back); - break; - case ContextMenuItem::Forward: - action = m_view->action(QQuickWebEngineView::Forward); - break; - case ContextMenuItem::Reload: - action = m_view->action(QQuickWebEngineView::Reload); - break; - case ContextMenuItem::Cut: - action = m_view->action(QQuickWebEngineView::Cut); - break; - case ContextMenuItem::Copy: - action = m_view->action(QQuickWebEngineView::Copy); - break; - case ContextMenuItem::Paste: - action = m_view->action(QQuickWebEngineView::Paste); - break; - case ContextMenuItem::Undo: - action = m_view->action(QQuickWebEngineView::Undo); - break; - case ContextMenuItem::Redo: - action = m_view->action(QQuickWebEngineView::Redo); - break; - case ContextMenuItem::SelectAll: - action = m_view->action(QQuickWebEngineView::SelectAll); - break; - case ContextMenuItem::PasteAndMatchStyle: - action = m_view->action(QQuickWebEngineView::PasteAndMatchStyle); - break; - case ContextMenuItem::OpenLinkInNewWindow: - action = m_view->action(QQuickWebEngineView::OpenLinkInNewWindow); - break; - case ContextMenuItem::OpenLinkInNewTab: - action = m_view->action(QQuickWebEngineView::OpenLinkInNewTab); - break; - case ContextMenuItem::CopyLinkToClipboard: - action = m_view->action(QQuickWebEngineView::CopyLinkToClipboard); - break; - case ContextMenuItem::DownloadLinkToDisk: - action = m_view->action(QQuickWebEngineView::DownloadLinkToDisk); - break; - case ContextMenuItem::CopyImageToClipboard: - action = m_view->action(QQuickWebEngineView::CopyImageToClipboard); - break; - case ContextMenuItem::CopyImageUrlToClipboard: - action = m_view->action(QQuickWebEngineView::CopyImageUrlToClipboard); - break; - case ContextMenuItem::DownloadImageToDisk: - action = m_view->action(QQuickWebEngineView::DownloadImageToDisk); - break; - case ContextMenuItem::CopyMediaUrlToClipboard: - action = m_view->action(QQuickWebEngineView::CopyMediaUrlToClipboard); - break; - case ContextMenuItem::ToggleMediaControls: - action = m_view->action(QQuickWebEngineView::ToggleMediaControls); - break; - case ContextMenuItem::ToggleMediaLoop: - action = m_view->action(QQuickWebEngineView::ToggleMediaLoop); - break; - case ContextMenuItem::DownloadMediaToDisk: - action = m_view->action(QQuickWebEngineView::DownloadMediaToDisk); - break; - case ContextMenuItem::InspectElement: - action = m_view->action(QQuickWebEngineView::InspectElement); - break; - case ContextMenuItem::ExitFullScreen: - action = m_view->action(QQuickWebEngineView::ExitFullScreen); - break; - case ContextMenuItem::SavePage: - action = m_view->action(QQuickWebEngineView::SavePage); - break; - case ContextMenuItem::ViewSource: - action = m_view->action(QQuickWebEngineView::ViewSource); - break; - case ContextMenuItem::SpellingSuggestions: - { - QPointer<QQuickWebEngineView> thisRef(m_view); - for (int i=0; i < m_contextData.spellCheckerSuggestions().count() && i < 4; i++) { - action = new QQuickWebEngineAction(m_menu); - QString replacement = m_contextData.spellCheckerSuggestions().at(i); - QObject::connect(action, &QQuickWebEngineAction::triggered, [thisRef, replacement] { thisRef->replaceMisspelledWord(replacement); }); - m_view->d_ptr->ui()->addMenuItem(action, m_menu); - } - return; - } - case ContextMenuItem::Separator: - m_view->d_ptr->ui()->addMenuSeparator(m_menu); - return; - } - // Set enabled property directly with avoiding binding loops caused by its notifier signal. - action->d_ptr->m_enabled = isMenuItemEnabled(menuItem); - m_view->d_ptr->ui()->addMenuItem(action, m_menu); -} - -bool QQuickContextMenuBuilder::isMenuItemEnabled(ContextMenuItem menuItem) -{ - switch (menuItem) { - case ContextMenuItem::Back: - return m_view->canGoBack(); - case ContextMenuItem::Forward: - return m_view->canGoForward(); - case ContextMenuItem::Reload: - return true; - case ContextMenuItem::Cut: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanCut; - case ContextMenuItem::Copy: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanCopy; - case ContextMenuItem::Paste: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanPaste; - case ContextMenuItem::Undo: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanUndo; - case ContextMenuItem::Redo: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanRedo; - case ContextMenuItem::SelectAll: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanSelectAll; - case ContextMenuItem::PasteAndMatchStyle: - return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanPaste; - case ContextMenuItem::OpenLinkInNewWindow: - case ContextMenuItem::OpenLinkInNewTab: - case ContextMenuItem::CopyLinkToClipboard: - case ContextMenuItem::DownloadLinkToDisk: - case ContextMenuItem::CopyImageToClipboard: - case ContextMenuItem::CopyImageUrlToClipboard: - case ContextMenuItem::DownloadImageToDisk: - case ContextMenuItem::CopyMediaUrlToClipboard: - case ContextMenuItem::ToggleMediaControls: - case ContextMenuItem::ToggleMediaLoop: - case ContextMenuItem::DownloadMediaToDisk: - case ContextMenuItem::InspectElement: - case ContextMenuItem::ExitFullScreen: - case ContextMenuItem::SavePage: - return true; - case ContextMenuItem::ViewSource: - return m_view->d_ptr->adapter->canViewSource(); - case ContextMenuItem::SpellingSuggestions: - case ContextMenuItem::Separator: - return true; - } - Q_UNREACHABLE(); -} - - -QQuickWebEngineTouchHandle::QQuickWebEngineTouchHandle(QtWebEngineCore::UIDelegatesManager *ui, const QMap<int, QImage> &images) -{ - Q_ASSERT(ui); - m_item.reset(ui->createTouchHandle()); - - QQmlEngine *engine = qmlEngine(m_item.data()); - Q_ASSERT(engine); - QQuickWebEngineTouchHandleProvider *touchHandleProvider = - static_cast<QQuickWebEngineTouchHandleProvider *>(engine->imageProvider(QQuickWebEngineTouchHandleProvider::identifier())); - Q_ASSERT(touchHandleProvider); - touchHandleProvider->init(images); -} - -void QQuickWebEngineTouchHandle::setImage(int orientation) -{ - QUrl url = QQuickWebEngineTouchHandleProvider::url(orientation); - m_item->setProperty("source", url); -} - -void QQuickWebEngineTouchHandle::setBounds(const QRect &bounds) -{ - m_item->setProperty("x", bounds.x()); - m_item->setProperty("y", bounds.y()); - m_item->setProperty("width", bounds.width()); - m_item->setProperty("height", bounds.height()); -} - -void QQuickWebEngineTouchHandle::setVisible(bool visible) -{ - m_item->setProperty("visible", visible); -} - -void QQuickWebEngineTouchHandle::setOpacity(float opacity) -{ - m_item->setProperty("opacity", opacity); -} - -QT_END_NAMESPACE - diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h deleted file mode 100644 index 4a88e3c28..000000000 --- a/src/webengine/api/qquickwebengineview_p.h +++ /dev/null @@ -1,611 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEVIEW_P_H -#define QQUICKWEBENGINEVIEW_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 <QtWebEngine/private/qtwebengineglobal_p.h> -#include <QQuickItem> -#include <QtGui/qcolor.h> - -#include "qquickwebenginescript.h" - -QT_BEGIN_NAMESPACE - -class QQmlWebChannel; -class QQuickContextMenuBuilder; -class QQuickWebEngineAction; -class QQuickWebEngineAuthenticationDialogRequest; -class QQuickWebEngineCertificateError; -class QQuickWebEngineClientCertificateSelection; -class QQuickWebEngineColorDialogRequest; -class QQuickWebEngineContextMenuRequest; -class QQuickWebEngineFaviconProvider; -class QQuickWebEngineFileDialogRequest; -class QQuickWebEngineHistory; -class QQuickWebEngineJavaScriptDialogRequest; -class QQuickWebEngineLoadRequest; -class QQuickWebEngineNavigationRequest; -class QQuickWebEngineNewViewRequest; -class QQuickWebEngineProfile; -class QQuickWebEngineSettings; -class QQuickWebEngineTooltipRequest; -class QQuickWebEngineFormValidationMessageRequest; -class QQuickWebEngineViewPrivate; -class QWebEngineFindTextResult; -class QWebEngineQuotaRequest; -class QWebEngineRegisterProtocolHandlerRequest; - -#if QT_CONFIG(webengine_testsupport) -class QQuickWebEngineTestSupport; -#endif - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineFullScreenRequest { - Q_GADGET - Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) - Q_PROPERTY(bool toggleOn READ toggleOn CONSTANT FINAL) -public: - QQuickWebEngineFullScreenRequest(); - QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, const QUrl &origin, bool toggleOn); - - Q_INVOKABLE void accept(); - Q_INVOKABLE void reject(); - QUrl origin() const { return m_origin; } - bool toggleOn() const { return m_toggleOn; } - -private: - QQuickWebEngineViewPrivate *m_viewPrivate; - const QUrl m_origin; - const bool m_toggleOn; -}; - -#define LATEST_WEBENGINEVIEW_REVISION 10 - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem { - Q_OBJECT - Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged FINAL) - Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged FINAL) - Q_PROPERTY(bool loading READ isLoading NOTIFY loadingChanged FINAL) - Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged FINAL) - Q_PROPERTY(QString title READ title NOTIFY titleChanged FINAL) - Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY urlChanged FINAL) - Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY urlChanged FINAL) - Q_PROPERTY(bool isFullScreen READ isFullScreen NOTIFY isFullScreenChanged REVISION 1 FINAL) - Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged REVISION 1 FINAL) - Q_PROPERTY(QQuickWebEngineProfile *profile READ profile WRITE setProfile NOTIFY profileChanged FINAL REVISION 1) - Q_PROPERTY(QQuickWebEngineSettings *settings READ settings REVISION 1 CONSTANT FINAL) - Q_PROPERTY(QQuickWebEngineHistory *navigationHistory READ navigationHistory CONSTANT FINAL REVISION 1) - Q_PROPERTY(QQmlWebChannel *webChannel READ webChannel WRITE setWebChannel NOTIFY webChannelChanged REVISION 1 FINAL) - Q_PROPERTY(QQmlListProperty<QQuickWebEngineScript> userScripts READ userScripts FINAL REVISION 1) - Q_PROPERTY(bool activeFocusOnPress READ activeFocusOnPress WRITE setActiveFocusOnPress NOTIFY activeFocusOnPressChanged REVISION 2 FINAL) - Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged REVISION 2 FINAL) - Q_PROPERTY(QSizeF contentsSize READ contentsSize NOTIFY contentsSizeChanged FINAL REVISION 3) - Q_PROPERTY(QPointF scrollPosition READ scrollPosition NOTIFY scrollPositionChanged FINAL REVISION 3) - Q_PROPERTY(bool audioMuted READ isAudioMuted WRITE setAudioMuted NOTIFY audioMutedChanged FINAL REVISION 3) - Q_PROPERTY(bool recentlyAudible READ recentlyAudible NOTIFY recentlyAudibleChanged FINAL REVISION 3) - Q_PROPERTY(uint webChannelWorld READ webChannelWorld WRITE setWebChannelWorld NOTIFY webChannelWorldChanged REVISION 3 FINAL) - - Q_PROPERTY(QQuickWebEngineView *inspectedView READ inspectedView WRITE setInspectedView NOTIFY inspectedViewChanged REVISION 7 FINAL) - Q_PROPERTY(QQuickWebEngineView *devToolsView READ devToolsView WRITE setDevToolsView NOTIFY devToolsViewChanged REVISION 7 FINAL) -#if QT_CONFIG(webengine_testsupport) - Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL) -#endif - - Q_PROPERTY(LifecycleState lifecycleState READ lifecycleState WRITE setLifecycleState NOTIFY lifecycleStateChanged REVISION 11 FINAL) - Q_PROPERTY(LifecycleState recommendedState READ recommendedState NOTIFY recommendedStateChanged REVISION 11 FINAL) - -public: - QQuickWebEngineView(QQuickItem *parent = 0); - ~QQuickWebEngineView(); - - QUrl url() const; - void setUrl(const QUrl&); - QUrl icon() const; - bool isLoading() const; - int loadProgress() const; - QString title() const; - bool canGoBack() const; - bool canGoForward() const; - bool isFullScreen() const; - qreal zoomFactor() const; - void setZoomFactor(qreal arg); - QColor backgroundColor() const; - void setBackgroundColor(const QColor &color); - QSizeF contentsSize() const; - QPointF scrollPosition() const; - - // must match WebContentsAdapterClient::NavigationRequestAction - enum NavigationRequestAction { - AcceptRequest, - // Make room in the valid range of the enum so - // we can expose extra actions. - IgnoreRequest = 0xFF - }; - Q_ENUM(NavigationRequestAction) - - // must match WebContentsAdapterClient::NavigationType - enum NavigationType { - LinkClickedNavigation, - TypedNavigation, - FormSubmittedNavigation, - BackForwardNavigation, - ReloadNavigation, - OtherNavigation, - RedirectNavigation, - }; - Q_ENUM(NavigationType) - - enum LoadStatus { - LoadStartedStatus, - LoadStoppedStatus, - LoadSucceededStatus, - LoadFailedStatus - }; - Q_ENUM(LoadStatus) - - enum ErrorDomain { - NoErrorDomain, - InternalErrorDomain, - ConnectionErrorDomain, - CertificateErrorDomain, - HttpErrorDomain, - FtpErrorDomain, - DnsErrorDomain - }; - Q_ENUM(ErrorDomain) - - enum NewViewDestination { - NewViewInWindow, - NewViewInTab, - NewViewInDialog, - NewViewInBackgroundTab - }; - Q_ENUM(NewViewDestination) - - enum Feature { - MediaAudioCapture, - MediaVideoCapture, - MediaAudioVideoCapture, - Geolocation, - DesktopVideoCapture, - DesktopAudioVideoCapture, - Notifications, - }; - Q_ENUM(Feature) - - enum WebAction { - NoWebAction = - 1, - Back, - Forward, - Stop, - Reload, - - Cut, - Copy, - Paste, - - Undo, - Redo, - SelectAll, - ReloadAndBypassCache, - - PasteAndMatchStyle, - - OpenLinkInThisWindow, - OpenLinkInNewWindow, - OpenLinkInNewTab, - CopyLinkToClipboard, - DownloadLinkToDisk, - - CopyImageToClipboard, - CopyImageUrlToClipboard, - DownloadImageToDisk, - - CopyMediaUrlToClipboard, - ToggleMediaControls, - ToggleMediaLoop, - ToggleMediaPlayPause, - ToggleMediaMute, - DownloadMediaToDisk, - - InspectElement, - ExitFullScreen, - RequestClose, - Unselect, - SavePage, - ViewSource, - - ToggleBold, - ToggleItalic, - ToggleUnderline, - ToggleStrikethrough, - - AlignLeft, - AlignCenter, - AlignRight, - AlignJustified, - Indent, - Outdent, - - InsertOrderedList, - InsertUnorderedList, - - WebActionCount - }; - Q_ENUM(WebAction) - - // must match WebContentsAdapterClient::JavaScriptConsoleMessageLevel - enum JavaScriptConsoleMessageLevel { - InfoMessageLevel = 0, - WarningMessageLevel, - ErrorMessageLevel - }; - Q_ENUM(JavaScriptConsoleMessageLevel) - - // must match WebContentsAdapterClient::RenderProcessTerminationStatus - enum RenderProcessTerminationStatus { - NormalTerminationStatus = 0, - AbnormalTerminationStatus, - CrashedTerminationStatus, - KilledTerminationStatus - }; - Q_ENUM(RenderProcessTerminationStatus) - - enum FindFlag { - FindBackward = 1, - FindCaseSensitively = 2, - }; - Q_DECLARE_FLAGS(FindFlags, FindFlag) - Q_FLAG(FindFlags) - - // must match QPageSize::PageSizeId - enum PrintedPageSizeId { - // Existing Qt sizes - A4, - B5, - Letter, - Legal, - Executive, - A0, - A1, - A2, - A3, - A5, - A6, - A7, - A8, - A9, - B0, - B1, - B10, - B2, - B3, - B4, - B6, - B7, - B8, - B9, - C5E, - Comm10E, - DLE, - Folio, - Ledger, - Tabloid, - Custom, - - // New values derived from PPD standard - A10, - A3Extra, - A4Extra, - A4Plus, - A4Small, - A5Extra, - B5Extra, - - JisB0, - JisB1, - JisB2, - JisB3, - JisB4, - JisB5, - JisB6, - JisB7, - JisB8, - JisB9, - JisB10, - - // AnsiA = Letter, - // AnsiB = Ledger, - AnsiC, - AnsiD, - AnsiE, - LegalExtra, - LetterExtra, - LetterPlus, - LetterSmall, - TabloidExtra, - - ArchA, - ArchB, - ArchC, - ArchD, - ArchE, - - Imperial7x9, - Imperial8x10, - Imperial9x11, - Imperial9x12, - Imperial10x11, - Imperial10x13, - Imperial10x14, - Imperial12x11, - Imperial15x11, - - ExecutiveStandard, - Note, - Quarto, - Statement, - SuperA, - SuperB, - Postcard, - DoublePostcard, - Prc16K, - Prc32K, - Prc32KBig, - - FanFoldUS, - FanFoldGerman, - FanFoldGermanLegal, - - EnvelopeB4, - EnvelopeB5, - EnvelopeB6, - EnvelopeC0, - EnvelopeC1, - EnvelopeC2, - EnvelopeC3, - EnvelopeC4, - // EnvelopeC5 = C5E, - EnvelopeC6, - EnvelopeC65, - EnvelopeC7, - // EnvelopeDL = DLE, - - Envelope9, - // Envelope10 = Comm10E, - Envelope11, - Envelope12, - Envelope14, - EnvelopeMonarch, - EnvelopePersonal, - - EnvelopeChou3, - EnvelopeChou4, - EnvelopeInvite, - EnvelopeItalian, - EnvelopeKaku2, - EnvelopeKaku3, - EnvelopePrc1, - EnvelopePrc2, - EnvelopePrc3, - EnvelopePrc4, - EnvelopePrc5, - EnvelopePrc6, - EnvelopePrc7, - EnvelopePrc8, - EnvelopePrc9, - EnvelopePrc10, - EnvelopeYou4, - - // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter - LastPageSize = EnvelopeYou4, - NPageSize = LastPageSize, - NPaperSize = LastPageSize, - - // Convenience overloads for naming consistency - AnsiA = Letter, - AnsiB = Ledger, - EnvelopeC5 = C5E, - EnvelopeDL = DLE, - Envelope10 = Comm10E - }; - Q_ENUM(PrintedPageSizeId) - - // must match QPageLayout::Orientation - enum PrintedPageOrientation { - Portrait, - Landscape - }; - Q_ENUM(PrintedPageOrientation) - - // must match WebContentsAdapterClient::LifecycleState - enum class LifecycleState { - Active, - Frozen, - Discarded, - }; - Q_ENUM(LifecycleState) - - // QmlParserStatus - void componentComplete() override; - - QQuickWebEngineProfile *profile(); - void setProfile(QQuickWebEngineProfile *); - QQmlListProperty<QQuickWebEngineScript> userScripts(); - - QQuickWebEngineSettings *settings(); - QQmlWebChannel *webChannel(); - void setWebChannel(QQmlWebChannel *); - QQuickWebEngineHistory *navigationHistory() const; - uint webChannelWorld() const; - void setWebChannelWorld(uint); - Q_REVISION(8) Q_INVOKABLE QQuickWebEngineAction *action(WebAction action); - - bool isAudioMuted() const; - void setAudioMuted(bool muted); - bool recentlyAudible() const; - -#if QT_CONFIG(webengine_testsupport) - QQuickWebEngineTestSupport *testSupport() const; - void setTestSupport(QQuickWebEngineTestSupport *testSupport); -#endif - - bool activeFocusOnPress() const; - - void setInspectedView(QQuickWebEngineView *); - QQuickWebEngineView *inspectedView() const; - void setDevToolsView(QQuickWebEngineView *); - QQuickWebEngineView *devToolsView() const; - - LifecycleState lifecycleState() const; - void setLifecycleState(LifecycleState state); - - LifecycleState recommendedState() const; - -public Q_SLOTS: - void runJavaScript(const QString&, const QJSValue & = QJSValue()); - Q_REVISION(3) void runJavaScript(const QString&, quint32 worldId, const QJSValue & = QJSValue()); - void loadHtml(const QString &html, const QUrl &baseUrl = QUrl()); - void goBack(); - void goForward(); - Q_REVISION(1) void goBackOrForward(int index); - void reload(); - Q_REVISION(1) void reloadAndBypassCache(); - void stop(); - Q_REVISION(1) void findText(const QString &subString, FindFlags options = 0, const QJSValue &callback = QJSValue()); - Q_REVISION(1) void fullScreenCancelled(); - Q_REVISION(1) void grantFeaturePermission(const QUrl &securityOrigin, Feature, bool granted); - Q_REVISION(2) void setActiveFocusOnPress(bool arg); - Q_REVISION(2) void triggerWebAction(WebAction action); - Q_REVISION(3) void printToPdf(const QString &filePath, PrintedPageSizeId pageSizeId = PrintedPageSizeId::A4, PrintedPageOrientation orientation = PrintedPageOrientation::Portrait); - Q_REVISION(3) void printToPdf(const QJSValue &callback, PrintedPageSizeId pageSizeId = PrintedPageSizeId::A4, PrintedPageOrientation orientation = PrintedPageOrientation::Portrait); - Q_REVISION(4) void replaceMisspelledWord(const QString &replacement); - -private Q_SLOTS: - void lazyInitialize(); - -Q_SIGNALS: - void titleChanged(); - void urlChanged(); - void iconChanged(); - void loadingChanged(QQuickWebEngineLoadRequest *loadRequest); - void loadProgressChanged(); - void linkHovered(const QUrl &hoveredUrl); - void navigationRequested(QQuickWebEngineNavigationRequest *request); - void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID); - Q_REVISION(1) void certificateError(QQuickWebEngineCertificateError *error); - Q_REVISION(1) void fullScreenRequested(const QQuickWebEngineFullScreenRequest &request); - Q_REVISION(1) void isFullScreenChanged(); - Q_REVISION(1) void featurePermissionRequested(const QUrl &securityOrigin, Feature feature); - Q_REVISION(1) void newViewRequested(QQuickWebEngineNewViewRequest *request); - Q_REVISION(1) void zoomFactorChanged(qreal arg); - Q_REVISION(1) void profileChanged(); - Q_REVISION(1) void webChannelChanged(); - Q_REVISION(2) void activeFocusOnPressChanged(bool); - Q_REVISION(2) void backgroundColorChanged(); - Q_REVISION(2) void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode); - Q_REVISION(2) void windowCloseRequested(); - Q_REVISION(3) void contentsSizeChanged(const QSizeF& size); - Q_REVISION(3) void scrollPositionChanged(const QPointF& position); - Q_REVISION(3) void audioMutedChanged(bool muted); - Q_REVISION(3) void recentlyAudibleChanged(bool recentlyAudible); - Q_REVISION(3) void webChannelWorldChanged(uint); - Q_REVISION(4) void contextMenuRequested(QQuickWebEngineContextMenuRequest *request); - Q_REVISION(4) void authenticationDialogRequested(QQuickWebEngineAuthenticationDialogRequest *request); - Q_REVISION(4) void javaScriptDialogRequested(QQuickWebEngineJavaScriptDialogRequest *request); - Q_REVISION(4) void colorDialogRequested(QQuickWebEngineColorDialogRequest *request); - Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request); - Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request); - Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success); - Q_REVISION(7) void quotaRequested(const QWebEngineQuotaRequest &request); - Q_REVISION(7) void geometryChangeRequested(const QRect &geometry, const QRect &frameGeometry); - Q_REVISION(7) void inspectedViewChanged(); - Q_REVISION(7) void devToolsViewChanged(); - Q_REVISION(7) void registerProtocolHandlerRequested(const QWebEngineRegisterProtocolHandlerRequest &request); - Q_REVISION(8) void printRequested(); - Q_REVISION(9) void selectClientCertificate(QQuickWebEngineClientCertificateSelection *clientCertSelection); - Q_REVISION(10) void tooltipRequested(QQuickWebEngineTooltipRequest *request); - Q_REVISION(11) void lifecycleStateChanged(LifecycleState state); - Q_REVISION(11) void recommendedStateChanged(LifecycleState state); - Q_REVISION(11) void findTextFinished(const QWebEngineFindTextResult &result); - -#if QT_CONFIG(webengine_testsupport) - void testSupportChanged(); -#endif - -protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; - void itemChange(ItemChange, const ItemChangeData &) override; -#if QT_CONFIG(draganddrop) - void dragEnterEvent(QDragEnterEvent *e) override; - void dragLeaveEvent(QDragLeaveEvent *e) override; - void dragMoveEvent(QDragMoveEvent *e) override; - void dropEvent(QDropEvent *e) override; -#endif // QT_CONFIG(draganddrop) - -private: - Q_DECLARE_PRIVATE(QQuickWebEngineView) - QScopedPointer<QQuickWebEngineViewPrivate> d_ptr; - - friend class QQuickContextMenuBuilder; - friend class QQuickWebEngineNewViewRequest; - friend class QQuickWebEngineFaviconProvider; -#ifndef QT_NO_ACCESSIBILITY - friend class QQuickWebEngineViewAccessible; -#endif // QT_NO_ACCESSIBILITY -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWebEngineView) -Q_DECLARE_METATYPE(QQuickWebEngineFullScreenRequest) - -#endif // QQUICKWEBENGINEVIEW_P_H diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h deleted file mode 100644 index df6843ac3..000000000 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEBENGINEVIEW_P_P_H -#define QQUICKWEBENGINEVIEW_P_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 "qquickwebengineview_p.h" -#include "render_view_context_menu_qt.h" -#include "touch_handle_drawable_client.h" -#include "web_contents_adapter_client.h" - -#include <QPointer> -#include <QScopedPointer> -#include <QSharedData> -#include <QString> -#include <QtCore/qcompilerdetection.h> -#include <QtGui/qaccessibleobject.h> - -namespace QtWebEngineCore { -class RenderWidgetHostViewQtDelegateQuick; -class TouchHandleDrawableClient; -class TouchSelectionMenuController; -class UIDelegatesManager; -class WebContentsAdapter; -} - -QT_BEGIN_NAMESPACE -class QQuickWebEngineView; -class QQmlComponent; -class QQmlContext; -class QQuickWebEngineContextMenuRequest; -class QQuickWebEngineSettings; -class QQuickWebEngineFaviconProvider; -class QQuickWebEngineProfilePrivate; -class QQuickWebEngineTouchHandleProvider; -class QWebEngineFindTextResult; - -QQuickWebEngineView::WebAction editorActionForKeyEvent(QKeyEvent* event); - -#if QT_CONFIG(webengine_testsupport) -class QQuickWebEngineTestSupport; -#endif - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewPrivate : public QtWebEngineCore::WebContentsAdapterClient -{ -public: - Q_DECLARE_PUBLIC(QQuickWebEngineView) - QQuickWebEngineView *q_ptr; - QQuickWebEngineViewPrivate(); - ~QQuickWebEngineViewPrivate(); - void releaseProfile() override; - void initializeProfile(); - QtWebEngineCore::UIDelegatesManager *ui(); - - QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override; - QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override; - void initializationFinished() override; - void lifecycleStateChanged(LifecycleState state) override; - void recommendedStateChanged(LifecycleState state) override; - void visibleChanged(bool visible) override; - void titleChanged(const QString&) override; - void urlChanged(const QUrl&) override; - void iconChanged(const QUrl&) override; - void loadProgressChanged(int progress) override; - void didUpdateTargetURL(const QUrl&) override; - void selectionChanged() override; - void recentlyAudibleChanged(bool recentlyAudible) override; - QRectF viewportRect() const override; - QColor backgroundColor() const override; - void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override; - void loadCommitted() override; - void loadVisuallyCommitted() override; - void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override; - void focusContainer() override; - void unhandledKeyEvent(QKeyEvent *event) override; - void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) override; - bool isBeingAdopted() override; - void close() override; - void windowCloseRejected() override; - void requestFullScreenMode(const QUrl &origin, bool fullscreen) override; - bool isFullScreenMode() const override; - void contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) override; - void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) override; - void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override; - void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) override; - void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) override; - void didRunJavaScript(quint64, const QVariant&) override; - void didFetchDocumentMarkup(quint64, const QString&) override { } - void didFetchDocumentInnerText(quint64, const QString&) override { } - void didPrintPage(quint64 requestId, QSharedPointer<QByteArray>) override; - void didPrintPageToPdf(const QString &filePath, bool success) override; - bool passOnFocus(bool reverse) override; - void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) override; - void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) override; - void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override; - void runMouseLockPermissionRequest(const QUrl &securityOrigin) override; - void runQuotaRequest(QWebEngineQuotaRequest) override; - void runRegisterProtocolHandlerRequest(QWebEngineRegisterProtocolHandlerRequest) override; - QObject *accessibilityParentObject() override; - QtWebEngineCore::WebEngineSettings *webEngineSettings() const override; - void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) override; - void selectClientCert(const QSharedPointer<ClientCertSelectController> &selectController) override; - void runGeolocationPermissionRequest(QUrl const&) override; - void runUserNotificationPermissionRequest(QUrl const&) override; - void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override; - void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override; - void updateScrollPosition(const QPointF &position) override; - void updateContentsSize(const QSizeF &size) override; - void updateNavigationActions() override; - void updateEditActions() override; - void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, - const QPixmap &pixmap, const QPoint &offset) override; - bool supportsDragging() const override; - bool isEnabled() const override; - void setToolTip(const QString &toolTipText) override; - QtWebEngineCore::TouchHandleDrawableClient *createTouchHandle(const QMap<int, QImage> &images) override; - void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, const QRect &, const QSize &) override; - void hideTouchSelectionMenu() override; - const QObject *holdingQObject() const override; - ClientType clientType() override { return QtWebEngineCore::WebContentsAdapterClient::QmlClient; } - - QtWebEngineCore::ProfileAdapter *profileAdapter() override; - QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override; - void printRequested() override; - void widgetChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegate *newWidgetBase) override; - void findTextFinished(const QWebEngineFindTextResult &result) override; - - void updateAction(QQuickWebEngineView::WebAction) const; - void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents); - void setProfile(QQuickWebEngineProfile *profile); - void updateAdapter(); - void ensureContentsAdapter(); - void setFullScreenMode(bool); - - static void bindViewAndWidget(QQuickWebEngineView *view, QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *widget); - void widgetChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *oldWidget, - QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *newWidget); - - // QQmlListPropertyHelpers - static void userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script); - static int userScripts_count(QQmlListProperty<QQuickWebEngineScript> *p); - static QQuickWebEngineScript *userScripts_at(QQmlListProperty<QQuickWebEngineScript> *p, int idx); - static void userScripts_clear(QQmlListProperty<QQuickWebEngineScript> *p); - - QQuickWebEngineProfile *m_profile; - QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter; - QScopedPointer<QQuickWebEngineHistory> m_history; - QScopedPointer<QQuickWebEngineSettings> m_settings; -#if QT_CONFIG(webengine_testsupport) - QQuickWebEngineTestSupport *m_testSupport; -#endif - QQmlComponent *contextMenuExtraItems; - QtWebEngineCore::WebEngineContextMenuData m_contextMenuData; - QUrl m_url; - QString m_html; - QUrl iconUrl; - QQuickWebEngineFaviconProvider *faviconProvider; - int loadProgress; - bool m_fullscreenMode; - bool isLoading; - bool m_activeFocusOnPress; - bool m_navigationActionTriggered; - qreal devicePixelRatio; - QMap<quint64, QJSValue> m_callbacks; - QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers; - QQmlWebChannel *m_webChannel; - QPointer<QQuickWebEngineView> inspectedView; - QPointer<QQuickWebEngineView> devToolsView; - uint m_webChannelWorld; - bool m_isBeingAdopted; - mutable QQuickWebEngineAction *actions[QQuickWebEngineView::WebActionCount]; - QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *widget = nullptr; - - bool profileInitialized() const; - -private: - QScopedPointer<QtWebEngineCore::UIDelegatesManager> m_uIDelegatesManager; - QList<QQuickWebEngineScript *> m_userScripts; - QColor m_backgroundColor; - qreal m_zoomFactor; - bool m_ui2Enabled; - bool m_profileInitialized; -}; - -#ifndef QT_NO_ACCESSIBILITY -class QQuickWebEngineViewAccessible : public QAccessibleObject -{ -public: - QQuickWebEngineViewAccessible(QQuickWebEngineView *o); - QAccessibleInterface *parent() const override; - int childCount() const override; - QAccessibleInterface *child(int index) const override; - int indexOfChild(const QAccessibleInterface*) const override; - QString text(QAccessible::Text) const override; - QAccessible::Role role() const override; - QAccessible::State state() const override; - -private: - QQuickWebEngineView *engineView() const { return static_cast<QQuickWebEngineView*>(object()); } -}; -#endif // QT_NO_ACCESSIBILITY - -class QQuickContextMenuBuilder : public QtWebEngineCore::RenderViewContextMenuQt -{ -public: - QQuickContextMenuBuilder(const QtWebEngineCore::WebEngineContextMenuData &data, QQuickWebEngineView *view, QObject *menu); - void appendExtraItems(QQmlEngine *engine); - -private: - virtual bool hasInspector() override; - virtual bool isFullScreenMode() override; - - virtual void addMenuItem(ContextMenuItem menuItem) override; - virtual bool isMenuItemEnabled(ContextMenuItem menuItem) override; - - QQuickWebEngineView *m_view; - QObject *m_menu; -}; - -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTouchHandle : public QtWebEngineCore::TouchHandleDrawableClient { -public: - QQuickWebEngineTouchHandle(QtWebEngineCore::UIDelegatesManager *ui, const QMap<int, QImage> &images); - - void setImage(int orientation) override; - void setBounds(const QRect &bounds) override; - void setVisible(bool visible) override; - void setOpacity(float opacity) override; - -private: - QScopedPointer<QQuickItem> m_item; -}; - -QT_END_NAMESPACE - -#endif // QQUICKWEBENGINEVIEW_P_P_H diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp deleted file mode 100644 index a11618dba..000000000 --- a/src/webengine/api/qtwebengineglobal.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtwebengineglobal.h" - -namespace QtWebEngineCore -{ - extern void initialize(); -} - -QT_BEGIN_NAMESPACE - -namespace QtWebEngine { - -/*! - \namespace QtWebEngine - \inmodule QtWebEngine - \ingroup qtwebengine-namespaces - \keyword QtWebEngine Namespace - - \brief Helper functions for the \QWE (Qt Quick) module. - - The \l[CPP]{QtWebEngine} namespace is part of the \QWE module. -*/ - -/*! - \fn QtWebEngine::initialize() - - Sets up an OpenGL Context that can be shared between threads. This has to be done after - QGuiApplication is created, but before a Qt Quick window is created. - - This has the same effect as setting the Qt::AA_ShareOpenGLContexts - attribute with QCoreApplication::setAttribute before constructing - QGuiApplication. -*/ -void initialize() -{ - QtWebEngineCore::initialize(); -} -} // namespace QtWebEngine - -QT_END_NAMESPACE diff --git a/src/webengine/api/qtwebengineglobal.h b/src/webengine/api/qtwebengineglobal.h deleted file mode 100644 index c2b33778a..000000000 --- a/src/webengine/api/qtwebengineglobal.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTWEBENGINEGLOBAL_H -#define QTWEBENGINEGLOBAL_H - -#include <QtCore/qglobal.h> -#include <QtWebEngine/qtwebengine-config.h> - -QT_BEGIN_NAMESPACE - -#ifndef QT_STATIC -# if defined(QT_BUILD_WEBENGINE_LIB) -# define Q_WEBENGINE_EXPORT Q_DECL_EXPORT -# else -# define Q_WEBENGINE_EXPORT Q_DECL_IMPORT -# endif -#else -# define Q_WEBENGINE_EXPORT -#endif - -namespace QtWebEngine -{ - Q_WEBENGINE_EXPORT void initialize(); -} - -QT_END_NAMESPACE - -#endif // QTWEBENGINEGLOBAL_H diff --git a/src/webengine/api/qtwebengineglobal_p.h b/src/webengine/api/qtwebengineglobal_p.h deleted file mode 100644 index 2d30f75b0..000000000 --- a/src/webengine/api/qtwebengineglobal_p.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTWEBENGINEGLOBAL_P_H -#define QTWEBENGINEGLOBAL_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 <QtWebEngine/qtwebengineglobal.h> -#include <QtCore/private/qglobal_p.h> -#include <QtWebEngine/private/qtwebengine-config_p.h> - -QT_BEGIN_NAMESPACE - -#define Q_WEBENGINE_PRIVATE_EXPORT Q_WEBENGINE_EXPORT - -QT_END_NAMESPACE - -#endif // QTWEBENGINEGLOBAL_P_H diff --git a/src/webengine/configure.json b/src/webengine/configure.json deleted file mode 100644 index ebe1ddb2b..000000000 --- a/src/webengine/configure.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "module": "webengine", - "condition": "module.webenginecore && features.webengine-qml", - "depends": [ - "webenginecore-private" - ], - "commandline": { - "options": { - "webengine-qml": "boolean" - } - }, - "features": { - "webengine-qml": { - "label": "Support Qt WebEngine Qml", - "purpose": "Provides WebEngine Qml support.", - "output": [ "privateFeature" ] - }, - "webengine-ui-delegates": { - "label": "UI Delegates", - "section": "WebEngine", - "output": [ "privateFeature" ] - }, - "webengine-testsupport": { - "label": "Test Support", - "autoDetect": "features.private_tests || call.isTestsInBuildParts", - "output": [ "privateFeature" ] - } - }, - "summary": [ - { - "section": "Qt WebEngineQml", - "entries": [ - "webengine-qml", - "webengine-ui-delegates", - "webengine-testsupport" - ] - } - ] -} - diff --git a/src/webengine/doc/QtWebEngineDoc b/src/webengine/doc/QtWebEngineDoc deleted file mode 100644 index 0737885f1..000000000 --- a/src/webengine/doc/QtWebEngineDoc +++ /dev/null @@ -1,2 +0,0 @@ -#include <QtWebEngine/QtWebEngine> -#include <QtWebEngineWidgets/QtWebEngineWidgets> diff --git a/src/webengine/doc/images/qtwebengine-architecture.png b/src/webengine/doc/images/qtwebengine-architecture.png Binary files differdeleted file mode 100644 index 979a0ad3f..000000000 --- a/src/webengine/doc/images/qtwebengine-architecture.png +++ /dev/null diff --git a/src/webengine/doc/images/qtwebengine-model.png b/src/webengine/doc/images/qtwebengine-model.png Binary files differdeleted file mode 100644 index 0bbd556f1..000000000 --- a/src/webengine/doc/images/qtwebengine-model.png +++ /dev/null diff --git a/src/webengine/doc/images/qtwebengine-model.qmodel b/src/webengine/doc/images/qtwebengine-model.qmodel deleted file mode 100644 index f3d5cb52b..000000000 --- a/src/webengine/doc/images/qtwebengine-model.qmodel +++ /dev/null @@ -1,626 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<qmt> - <project> - <uid>{b4b96dcf-b444-4b48-96a0-0ced0222fbe4}</uid> - <root-package> - <instance> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{4b17cf3d-b45a-4ca8-b6c2-f0a9db0a0d9e}</uid> - </MElement> - </base-MElement> - <name>qtwebengine-model</name> - <children> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{d0623590-2a20-468b-9ec5-51987e78ae47}</uid> - <target> - <instance type="MCanvasDiagram"> - <MCanvasDiagram> - <base-MDiagram> - <MDiagram> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{d0623590-2a20-468b-9ec5-51987e78ae47}</uid> - </MElement> - </base-MElement> - <name>qtwebengine-model</name> - </MObject> - </base-MObject> - <elements> - <qlist> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{e1622bc8-530c-4d18-ba77-202bad11f1e0}</uid> - </DElement> - </base-DElement> - <object>{3507c733-97ee-4b84-835b-4d90f039ca72}</object> - <name>View</name> - <pos>x:260;y:70</pos> - <rect>x:-45;y:-30;w:90;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{0bb9e92a-910d-4a32-877b-fd7e37710f79}</uid> - </DElement> - </base-DElement> - <object>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</object> - <name>Profile</name> - <pos>x:415;y:155</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{54c2f051-8fdb-48f2-b528-2caa8fd1f854}</uid> - </DElement> - </base-DElement> - <object>{999dd0f9-53f0-47bd-90ea-714c0dea50d7}</object> - <name>History</name> - <pos>x:110;y:155</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{ae2fed61-96c0-4755-aad1-2d02fbc6e36e}</uid> - </DElement> - </base-DElement> - <object>{b2ea9c4f-8b35-46c3-b2a5-3f22d72069e7}</object> - <name>Settings</name> - <pos>x:260;y:240</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{95fafacc-66c7-42d0-b27e-e92a69964adf}</uid> - </DElement> - </base-DElement> - <object>{e3429382-8484-481e-8690-792b1c1a257e}</object> - <a>{e1622bc8-530c-4d18-ba77-202bad11f1e0}</a> - <b>{0bb9e92a-910d-4a32-877b-fd7e37710f79}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{673bc9c1-a5ff-44ba-b9a6-d17807014a8e}</uid> - </DElement> - </base-DElement> - <object>{e505b9c3-2332-4056-b3f0-dbd71a5ccbae}</object> - <a>{e1622bc8-530c-4d18-ba77-202bad11f1e0}</a> - <b>{54c2f051-8fdb-48f2-b528-2caa8fd1f854}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{78e57691-4776-4e73-b0f0-232a1e80da10}</uid> - </DElement> - </base-DElement> - <object>{9cfdd75f-182e-4511-bf4c-19f30309318e}</object> - <a>{0bb9e92a-910d-4a32-877b-fd7e37710f79}</a> - <b>{ae2fed61-96c0-4755-aad1-2d02fbc6e36e}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{e76fa55e-b2df-4713-9fab-78434c3c7ed3}</uid> - </DElement> - </base-DElement> - <object>{ff72261f-19e3-4983-b10c-856f6070637b}</object> - <name>Action</name> - <pos>x:260;y:155</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{305524c2-f2c7-44ba-b30b-51fbfdc81063}</uid> - </DElement> - </base-DElement> - <object>{911f495e-313f-4b28-95d6-440b06a05a83}</object> - <a>{e1622bc8-530c-4d18-ba77-202bad11f1e0}</a> - <b>{e76fa55e-b2df-4713-9fab-78434c3c7ed3}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{28ea46b1-ce73-432f-89a6-a97821dbac59}</uid> - </DElement> - </base-DElement> - <object>{f1e3fd14-d433-4d95-8ea4-1c4b5aaf4334}</object> - <name>Script</name> - <pos>x:415;y:240</pos> - <rect>x:-45;y:-30;w:90;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{41e806b6-c8fd-4ae5-865d-db55feeb5570}</uid> - </DElement> - </base-DElement> - <object>{96788086-5e67-482c-ac8b-0f2a7f0729ff}</object> - <name>Cookie</name> - <pos>x:555;y:240</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{99a53c8d-8dc1-4ee5-83bf-ec2ff2677817}</uid> - </DElement> - </base-DElement> - <object>{dc399de7-f3b9-4071-84af-b6e5dfa3affe}</object> - <a>{0bb9e92a-910d-4a32-877b-fd7e37710f79}</a> - <b>{28ea46b1-ce73-432f-89a6-a97821dbac59}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{f3833f3d-d01b-4c7c-bfde-91d014aff654}</uid> - </DElement> - </base-DElement> - <object>{4dc013fb-ced4-4cc0-99e3-3f4a32acebf7}</object> - <a>{0bb9e92a-910d-4a32-877b-fd7e37710f79}</a> - <b>{41e806b6-c8fd-4ae5-865d-db55feeb5570}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - </qlist> - </elements> - <last-modified>1455888691589</last-modified> - <toolbarid>General</toolbarid> - </MDiagram> - </base-MDiagram> - </MCanvasDiagram> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{3507c733-97ee-4b84-835b-4d90f039ca72}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{3507c733-97ee-4b84-835b-4d90f039ca72}</uid> - </MElement> - </base-MElement> - <name>View</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{e3429382-8484-481e-8690-792b1c1a257e}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{e3429382-8484-481e-8690-792b1c1a257e}</uid> - </MElement> - </base-MElement> - <a>{3507c733-97ee-4b84-835b-4d90f039ca72}</a> - <b>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{e505b9c3-2332-4056-b3f0-dbd71a5ccbae}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{e505b9c3-2332-4056-b3f0-dbd71a5ccbae}</uid> - </MElement> - </base-MElement> - <a>{3507c733-97ee-4b84-835b-4d90f039ca72}</a> - <b>{999dd0f9-53f0-47bd-90ea-714c0dea50d7}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{4d826dd3-e455-46f3-8dfc-bb74551f3f00}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{4d826dd3-e455-46f3-8dfc-bb74551f3f00}</uid> - </MElement> - </base-MElement> - <a>{3507c733-97ee-4b84-835b-4d90f039ca72}</a> - <b>{b2ea9c4f-8b35-46c3-b2a5-3f22d72069e7}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{911f495e-313f-4b28-95d6-440b06a05a83}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{911f495e-313f-4b28-95d6-440b06a05a83}</uid> - </MElement> - </base-MElement> - <a>{3507c733-97ee-4b84-835b-4d90f039ca72}</a> - <b>{ff72261f-19e3-4983-b10c-856f6070637b}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</uid> - </MElement> - </base-MElement> - <name>Profile</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{9cfdd75f-182e-4511-bf4c-19f30309318e}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{9cfdd75f-182e-4511-bf4c-19f30309318e}</uid> - </MElement> - </base-MElement> - <a>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</a> - <b>{b2ea9c4f-8b35-46c3-b2a5-3f22d72069e7}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{dc399de7-f3b9-4071-84af-b6e5dfa3affe}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{dc399de7-f3b9-4071-84af-b6e5dfa3affe}</uid> - </MElement> - </base-MElement> - <a>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</a> - <b>{f1e3fd14-d433-4d95-8ea4-1c4b5aaf4334}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{4dc013fb-ced4-4cc0-99e3-3f4a32acebf7}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{4dc013fb-ced4-4cc0-99e3-3f4a32acebf7}</uid> - </MElement> - </base-MElement> - <a>{ab5f0d96-cf38-430d-bef3-b7bd78952fdb}</a> - <b>{96788086-5e67-482c-ac8b-0f2a7f0729ff}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{999dd0f9-53f0-47bd-90ea-714c0dea50d7}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{999dd0f9-53f0-47bd-90ea-714c0dea50d7}</uid> - </MElement> - </base-MElement> - <name>History</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{b2ea9c4f-8b35-46c3-b2a5-3f22d72069e7}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{b2ea9c4f-8b35-46c3-b2a5-3f22d72069e7}</uid> - </MElement> - </base-MElement> - <name>Settings</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{ff72261f-19e3-4983-b10c-856f6070637b}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{ff72261f-19e3-4983-b10c-856f6070637b}</uid> - </MElement> - </base-MElement> - <name>Action</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{f1e3fd14-d433-4d95-8ea4-1c4b5aaf4334}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{f1e3fd14-d433-4d95-8ea4-1c4b5aaf4334}</uid> - </MElement> - </base-MElement> - <name>Script</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{96788086-5e67-482c-ac8b-0f2a7f0729ff}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{96788086-5e67-482c-ac8b-0f2a7f0729ff}</uid> - </MElement> - </base-MElement> - <name>Cookie</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </children> - </MObject> - </base-MObject> - </MPackage> - </instance> - </root-package> - </project> -</qmt> diff --git a/src/webengine/doc/images/qtwebengine-modules-model.qmodel b/src/webengine/doc/images/qtwebengine-modules-model.qmodel deleted file mode 100644 index c1d64b617..000000000 --- a/src/webengine/doc/images/qtwebengine-modules-model.qmodel +++ /dev/null @@ -1,500 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<qmt> - <project> - <uid>{4a2bfe98-50e2-435d-8702-93dc2ccbd56b}</uid> - <root-package> - <instance> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{11ff33c5-f533-494d-9add-55ea216b97a6}</uid> - </MElement> - </base-MElement> - <name>qtwebengine-modules-model</name> - <children> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{9e8325b8-5731-4c87-9203-fe941456ee06}</uid> - <target> - <instance type="MCanvasDiagram"> - <MCanvasDiagram> - <base-MDiagram> - <MDiagram> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{9e8325b8-5731-4c87-9203-fe941456ee06}</uid> - </MElement> - </base-MElement> - <name>qtwebengine-modules-model</name> - </MObject> - </base-MObject> - <elements> - <qlist> - <item> - <instance type="DPackage"> - <DPackage> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{aee48ad9-14be-47bb-8ebf-1a9b44f1e219}</uid> - </DElement> - </base-DElement> - <object>{4d3871a4-ad9d-4b1a-ab68-acfce8ba5f00}</object> - <name>Qt WebEngine Module</name> - <pos>x:300;y:70</pos> - <rect>x:-275;y:-145;w:550;h:290</rect> - <auto-sized>false</auto-sized> - <visual-role>0</visual-role> - <stereotype-display>0</stereotype-display> - </DObject> - </base-DObject> - </DPackage> - </instance> - </item> - <item> - <instance type="DPackage"> - <DPackage> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{b667049f-5302-4e68-8679-c26a7c4c37af}</uid> - </DElement> - </base-DElement> - <object>{71104fca-42f0-4145-bf3a-afed38493c8b}</object> - <context>Qt WebEngine Module</context> - <name>Qt WebEngine </name> - <pos>x:300;y:15</pos> - <rect>x:-75;y:-35;w:150;h:70</rect> - <auto-sized>false</auto-sized> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DPackage> - </instance> - </item> - <item> - <instance type="DPackage"> - <DPackage> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{6d84908c-9500-4b4f-95b8-b723ff8f2fc3}</uid> - </DElement> - </base-DElement> - <object>{8e8c6646-1175-4ee1-aa02-cd5669cdf92a}</object> - <context>Qt WebEngine Module</context> - <name> Qt WebEngine Widgets</name> - <pos>x:105;y:15</pos> - <rect>x:-75;y:-35;w:150;h:70</rect> - <auto-sized>false</auto-sized> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DPackage> - </instance> - </item> - <item> - <instance type="DPackage"> - <DPackage> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{d1260089-4eb6-4465-ac5f-e36ba1ef2311}</uid> - </DElement> - </base-DElement> - <object>{c0946aaa-51df-48db-9ceb-351cd32089be}</object> - <context>Qt WebEngine Module</context> - <name> Qt WebEngine Process</name> - <pos>x:495;y:15</pos> - <rect>x:-75;y:-35;w:150;h:70</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DPackage> - </instance> - </item> - <item> - <instance type="DPackage"> - <DPackage> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{7e01513b-4cfc-4154-b445-a9b341b392a3}</uid> - </DElement> - </base-DElement> - <object>{6ee7f00e-5dc3-4f45-a3ca-428390b4c74c}</object> - <context>Qt WebEngine Module</context> - <name>Qt WebEngine Core</name> - <pos>x:300;y:150</pos> - <rect>x:-270;y:-60;w:540;h:120</rect> - <auto-sized>false</auto-sized> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DPackage> - </instance> - </item> - <item> - <instance type="DPackage"> - <DPackage> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{620a2a3d-3a6c-4afc-a9ba-e2a0651b81b8}</uid> - </DElement> - </base-DElement> - <object>{ce1e329b-b2ec-465f-bbc7-3cc75160da1a}</object> - <context>Qt WebEngine Core</context> - <name>Chromium</name> - <pos>x:300;y:165</pos> - <rect>x:-260;y:-35;w:520;h:70</rect> - <auto-sized>false</auto-sized> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DPackage> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{d0b02baa-0ce3-437e-a962-0896efb0b2d0}</uid> - </DElement> - </base-DElement> - <object>{342a09ff-ab96-40d2-b9f9-300d1f2a067b}</object> - <a>{6d84908c-9500-4b4f-95b8-b723ff8f2fc3}</a> - <b>{7e01513b-4cfc-4154-b445-a9b341b392a3}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{e59a5c27-7bda-44f6-8b7d-a729c2d04ff5}</uid> - </DElement> - </base-DElement> - <object>{45bf7ccd-aafc-4ec1-a846-bb2661aa9def}</object> - <a>{b667049f-5302-4e68-8679-c26a7c4c37af}</a> - <b>{7e01513b-4cfc-4154-b445-a9b341b392a3}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{8ae66be6-ad8a-442f-a85d-58e53a684249}</uid> - </DElement> - </base-DElement> - <object>{6875416f-210d-4957-b0dc-d1a92a4238ef}</object> - <a>{d1260089-4eb6-4465-ac5f-e36ba1ef2311}</a> - <b>{7e01513b-4cfc-4154-b445-a9b341b392a3}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - </qlist> - </elements> - <last-modified>1469021602971</last-modified> - <toolbarid>General</toolbarid> - </MDiagram> - </base-MDiagram> - </MCanvasDiagram> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{4d3871a4-ad9d-4b1a-ab68-acfce8ba5f00}</uid> - <target> - <instance type="MPackage"> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{4d3871a4-ad9d-4b1a-ab68-acfce8ba5f00}</uid> - </MElement> - </base-MElement> - <name>Qt WebEngine Module</name> - <children> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{71104fca-42f0-4145-bf3a-afed38493c8b}</uid> - <target> - <instance type="MPackage"> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{71104fca-42f0-4145-bf3a-afed38493c8b}</uid> - </MElement> - </base-MElement> - <name>Qt WebEngine </name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{45bf7ccd-aafc-4ec1-a846-bb2661aa9def}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{45bf7ccd-aafc-4ec1-a846-bb2661aa9def}</uid> - </MElement> - </base-MElement> - <a>{71104fca-42f0-4145-bf3a-afed38493c8b}</a> - <b>{6ee7f00e-5dc3-4f45-a3ca-428390b4c74c}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MPackage> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{8e8c6646-1175-4ee1-aa02-cd5669cdf92a}</uid> - <target> - <instance type="MPackage"> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{8e8c6646-1175-4ee1-aa02-cd5669cdf92a}</uid> - </MElement> - </base-MElement> - <name> Qt WebEngine Widgets</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{342a09ff-ab96-40d2-b9f9-300d1f2a067b}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{342a09ff-ab96-40d2-b9f9-300d1f2a067b}</uid> - </MElement> - </base-MElement> - <a>{8e8c6646-1175-4ee1-aa02-cd5669cdf92a}</a> - <b>{6ee7f00e-5dc3-4f45-a3ca-428390b4c74c}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{483712c1-3ec0-4271-b02e-b268de07897b}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{483712c1-3ec0-4271-b02e-b268de07897b}</uid> - </MElement> - </base-MElement> - <a>{8e8c6646-1175-4ee1-aa02-cd5669cdf92a}</a> - <b>{71104fca-42f0-4145-bf3a-afed38493c8b}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MPackage> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{c0946aaa-51df-48db-9ceb-351cd32089be}</uid> - <target> - <instance type="MPackage"> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{c0946aaa-51df-48db-9ceb-351cd32089be}</uid> - </MElement> - </base-MElement> - <name> Qt WebEngine Process</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{6875416f-210d-4957-b0dc-d1a92a4238ef}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{6875416f-210d-4957-b0dc-d1a92a4238ef}</uid> - </MElement> - </base-MElement> - <a>{c0946aaa-51df-48db-9ceb-351cd32089be}</a> - <b>{6ee7f00e-5dc3-4f45-a3ca-428390b4c74c}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MPackage> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{6ee7f00e-5dc3-4f45-a3ca-428390b4c74c}</uid> - <target> - <instance type="MPackage"> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{6ee7f00e-5dc3-4f45-a3ca-428390b4c74c}</uid> - </MElement> - </base-MElement> - <name>Qt WebEngine Core</name> - <children> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{ce1e329b-b2ec-465f-bbc7-3cc75160da1a}</uid> - <target> - <instance type="MPackage"> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{ce1e329b-b2ec-465f-bbc7-3cc75160da1a}</uid> - </MElement> - </base-MElement> - <name>Chromium</name> - </MObject> - </base-MObject> - </MPackage> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </children> - </MObject> - </base-MObject> - </MPackage> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </children> - </MObject> - </base-MObject> - </MPackage> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </children> - </MObject> - </base-MObject> - </MPackage> - </instance> - </root-package> - </project> -</qmt> diff --git a/src/webengine/doc/images/qtwebenginewidgets-model.png b/src/webengine/doc/images/qtwebenginewidgets-model.png Binary files differdeleted file mode 100644 index c334b84c9..000000000 --- a/src/webengine/doc/images/qtwebenginewidgets-model.png +++ /dev/null diff --git a/src/webengine/doc/images/qtwebenginewidgets-model.qmodel b/src/webengine/doc/images/qtwebenginewidgets-model.qmodel deleted file mode 100644 index aa59f7b8f..000000000 --- a/src/webengine/doc/images/qtwebenginewidgets-model.qmodel +++ /dev/null @@ -1,789 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<qmt> - <project> - <uid>{388ed80a-d45a-4746-9b42-b201bdfbe66d}</uid> - <root-package> - <instance> - <MPackage> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{cf413898-e1a1-48a2-be84-dee757d150e1}</uid> - </MElement> - </base-MElement> - <name>qtwebenginewidgets-model</name> - <children> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{cb7c93b6-ed69-4e54-bca7-23edd2432e88}</uid> - <target> - <instance type="MCanvasDiagram"> - <MCanvasDiagram> - <base-MDiagram> - <MDiagram> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{cb7c93b6-ed69-4e54-bca7-23edd2432e88}</uid> - </MElement> - </base-MElement> - <name>qtwebenginewidgets-model</name> - </MObject> - </base-MObject> - <elements> - <qlist> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{9d9a12d1-d237-4d4f-9b55-bdbbc99bd2b1}</uid> - </DElement> - </base-DElement> - <object>{1a4983f6-27db-4f8c-90ed-f72df621c50f}</object> - <name>View</name> - <pos>x:235;y:-280</pos> - <rect>x:-45;y:-30;w:90;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{81687d47-fbb1-4843-a394-7d7e5e57a2ff}</uid> - </DElement> - </base-DElement> - <object>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</object> - <name>Page</name> - <pos>x:235;y:-195</pos> - <rect>x:-45;y:-30;w:90;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{e6d92a82-f898-448f-945e-26b508249746}</uid> - </DElement> - </base-DElement> - <object>{99e69e48-e844-4fc0-942c-aacef280c616}</object> - <name>History</name> - <pos>x:90;y:-110</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{9ba8a864-bd21-48e5-9df4-c7065d3ab474}</uid> - </DElement> - </base-DElement> - <object>{6b572233-bf3a-43a2-bfe2-e61d57a59a2e}</object> - <name>Settings</name> - <pos>x:235;y:-20</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{62872913-7080-421b-b12c-d3c094faa37d}</uid> - </DElement> - </base-DElement> - <object>{8afe2dfe-878f-4c40-9f07-c6128611f853}</object> - <name>Profile</name> - <pos>x:380;y:-110</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{54a21438-6274-4484-9225-97a47d3514ea}</uid> - </DElement> - </base-DElement> - <object>{8e94476c-6a26-4bbc-b134-54a7203a0242}</object> - <a>{9d9a12d1-d237-4d4f-9b55-bdbbc99bd2b1}</a> - <b>{81687d47-fbb1-4843-a394-7d7e5e57a2ff}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{b3f6b700-e506-471b-9341-78a57b55fb20}</uid> - </DElement> - </base-DElement> - <object>{48d2b9ae-8462-4c93-9772-77f2520e2bcb}</object> - <a>{81687d47-fbb1-4843-a394-7d7e5e57a2ff}</a> - <b>{e6d92a82-f898-448f-945e-26b508249746}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{5870be46-b8c5-480b-89d0-2ecd38fea9e1}</uid> - </DElement> - </base-DElement> - <object>{2ec57f83-da38-4ed1-970c-d416a5f76425}</object> - <a>{81687d47-fbb1-4843-a394-7d7e5e57a2ff}</a> - <b>{62872913-7080-421b-b12c-d3c094faa37d}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{9140249c-7a62-4e4d-846a-398e794e34c6}</uid> - </DElement> - </base-DElement> - <object>{9c6691bd-75e5-40af-a662-ecb04e60744e}</object> - <a>{62872913-7080-421b-b12c-d3c094faa37d}</a> - <b>{9ba8a864-bd21-48e5-9df4-c7065d3ab474}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{97fe6f5f-a947-4c62-880d-e2d9258814dd}</uid> - </DElement> - </base-DElement> - <object>{2dfae517-4615-42b9-bb33-63369291468f}</object> - <name>Script</name> - <pos>x:380;y:-20</pos> - <rect>x:-45;y:-30;w:90;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{3cb4f4a2-0a1d-4adb-8b72-c438a8102a2b}</uid> - </DElement> - </base-DElement> - <object>{8f64c8e2-637e-482e-8565-1bbdcd203709}</object> - <name>Action</name> - <pos>x:235;y:-110</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{c962daa4-09b9-411d-a0d1-d1c7b9bd1489}</uid> - </DElement> - </base-DElement> - <object>{31cff752-95b7-4994-a5fc-8794dd8a013f}</object> - <a>{62872913-7080-421b-b12c-d3c094faa37d}</a> - <b>{97fe6f5f-a947-4c62-880d-e2d9258814dd}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{a8f88107-5699-4e25-8945-1113d642fdd0}</uid> - </DElement> - </base-DElement> - <object>{acca28ee-b184-4cbe-9aaa-befeac08c3bd}</object> - <a>{81687d47-fbb1-4843-a394-7d7e5e57a2ff}</a> - <b>{3cb4f4a2-0a1d-4adb-8b72-c438a8102a2b}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - <item> - <instance type="DComponent"> - <DComponent> - <base-DObject> - <DObject> - <base-DElement> - <DElement> - <uid>{6208171a-1515-424a-bb4e-5f115b4c21fa}</uid> - </DElement> - </base-DElement> - <object>{b19ba8d3-84ca-4718-b62c-575aa5d95c95}</object> - <name>Cookie</name> - <pos>x:525;y:-20</pos> - <rect>x:-50;y:-30;w:100;h:60</rect> - <visual-role>0</visual-role> - </DObject> - </base-DObject> - </DComponent> - </instance> - </item> - <item> - <instance type="DDependency"> - <DDependency> - <base-DRelation> - <DRelation> - <base-DElement> - <DElement> - <uid>{57732b45-63fc-4d87-91fe-c9e9cbdd69ee}</uid> - </DElement> - </base-DElement> - <object>{b98164e7-ff69-40e7-ac1b-fe4985f451e7}</object> - <a>{62872913-7080-421b-b12c-d3c094faa37d}</a> - <b>{6208171a-1515-424a-bb4e-5f115b4c21fa}</b> - </DRelation> - </base-DRelation> - </DDependency> - </instance> - </item> - </qlist> - </elements> - <last-modified>1455889165432</last-modified> - <toolbarid>General</toolbarid> - </MDiagram> - </base-MDiagram> - </MCanvasDiagram> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{1a4983f6-27db-4f8c-90ed-f72df621c50f}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{1a4983f6-27db-4f8c-90ed-f72df621c50f}</uid> - </MElement> - </base-MElement> - <name>View</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{8e94476c-6a26-4bbc-b134-54a7203a0242}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{8e94476c-6a26-4bbc-b134-54a7203a0242}</uid> - </MElement> - </base-MElement> - <a>{1a4983f6-27db-4f8c-90ed-f72df621c50f}</a> - <b>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</uid> - </MElement> - </base-MElement> - <name>Page</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{48d2b9ae-8462-4c93-9772-77f2520e2bcb}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{48d2b9ae-8462-4c93-9772-77f2520e2bcb}</uid> - </MElement> - </base-MElement> - <a>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</a> - <b>{99e69e48-e844-4fc0-942c-aacef280c616}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{2ec57f83-da38-4ed1-970c-d416a5f76425}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{2ec57f83-da38-4ed1-970c-d416a5f76425}</uid> - </MElement> - </base-MElement> - <a>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</a> - <b>{8afe2dfe-878f-4c40-9f07-c6128611f853}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{30d6d5e4-eb6b-4816-817d-5a921f823dae}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{30d6d5e4-eb6b-4816-817d-5a921f823dae}</uid> - </MElement> - </base-MElement> - <a>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</a> - <b>{6b572233-bf3a-43a2-bfe2-e61d57a59a2e}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{0011e11e-283e-4ad9-94b0-749d4465eac8}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{0011e11e-283e-4ad9-94b0-749d4465eac8}</uid> - </MElement> - </base-MElement> - <a>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</a> - <b>{2dfae517-4615-42b9-bb33-63369291468f}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{c354a766-0dba-439d-9f6c-538772784181}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{c354a766-0dba-439d-9f6c-538772784181}</uid> - </MElement> - </base-MElement> - <a>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</a> - <b>{8f64c8e2-637e-482e-8565-1bbdcd203709}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{acca28ee-b184-4cbe-9aaa-befeac08c3bd}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{acca28ee-b184-4cbe-9aaa-befeac08c3bd}</uid> - </MElement> - </base-MElement> - <a>{e9446d69-de53-47ab-974e-1b8ae8b6edd7}</a> - <b>{8f64c8e2-637e-482e-8565-1bbdcd203709}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{99e69e48-e844-4fc0-942c-aacef280c616}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{99e69e48-e844-4fc0-942c-aacef280c616}</uid> - </MElement> - </base-MElement> - <name>History</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{bca413d3-d869-44ce-a68d-38e8ba6de291}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{bca413d3-d869-44ce-a68d-38e8ba6de291}</uid> - </MElement> - </base-MElement> - <a>{99e69e48-e844-4fc0-942c-aacef280c616}</a> - <b>{6b572233-bf3a-43a2-bfe2-e61d57a59a2e}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{6b572233-bf3a-43a2-bfe2-e61d57a59a2e}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{6b572233-bf3a-43a2-bfe2-e61d57a59a2e}</uid> - </MElement> - </base-MElement> - <name>Settings</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{8afe2dfe-878f-4c40-9f07-c6128611f853}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{8afe2dfe-878f-4c40-9f07-c6128611f853}</uid> - </MElement> - </base-MElement> - <name>Profile</name> - <relations> - <handles> - <handles> - <qlist> - <item> - <handle> - <uid>{9c6691bd-75e5-40af-a662-ecb04e60744e}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{9c6691bd-75e5-40af-a662-ecb04e60744e}</uid> - </MElement> - </base-MElement> - <a>{8afe2dfe-878f-4c40-9f07-c6128611f853}</a> - <b>{6b572233-bf3a-43a2-bfe2-e61d57a59a2e}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{31cff752-95b7-4994-a5fc-8794dd8a013f}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{31cff752-95b7-4994-a5fc-8794dd8a013f}</uid> - </MElement> - </base-MElement> - <a>{8afe2dfe-878f-4c40-9f07-c6128611f853}</a> - <b>{2dfae517-4615-42b9-bb33-63369291468f}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{b98164e7-ff69-40e7-ac1b-fe4985f451e7}</uid> - <target> - <instance type="MDependency"> - <MDependency> - <base-MRelation> - <MRelation> - <base-MElement> - <MElement> - <uid>{b98164e7-ff69-40e7-ac1b-fe4985f451e7}</uid> - </MElement> - </base-MElement> - <a>{8afe2dfe-878f-4c40-9f07-c6128611f853}</a> - <b>{b19ba8d3-84ca-4718-b62c-575aa5d95c95}</b> - </MRelation> - </base-MRelation> - </MDependency> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </relations> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{2dfae517-4615-42b9-bb33-63369291468f}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{2dfae517-4615-42b9-bb33-63369291468f}</uid> - </MElement> - </base-MElement> - <name>Script</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{8f64c8e2-637e-482e-8565-1bbdcd203709}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{8f64c8e2-637e-482e-8565-1bbdcd203709}</uid> - </MElement> - </base-MElement> - <name>Action</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - <item> - <handle> - <uid>{b19ba8d3-84ca-4718-b62c-575aa5d95c95}</uid> - <target> - <instance type="MComponent"> - <MComponent> - <base-MObject> - <MObject> - <base-MElement> - <MElement> - <uid>{b19ba8d3-84ca-4718-b62c-575aa5d95c95}</uid> - </MElement> - </base-MElement> - <name>Cookie</name> - </MObject> - </base-MObject> - </MComponent> - </instance> - </target> - </handle> - </item> - </qlist> - </handles> - </handles> - </children> - </MObject> - </base-MObject> - </MPackage> - </instance> - </root-package> - </project> -</qmt> diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf deleted file mode 100644 index be5db9c19..000000000 --- a/src/webengine/doc/qtwebengine.qdocconf +++ /dev/null @@ -1,90 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) -include($QT_INSTALL_DOCS/config/exampleurl-qtwebengine.qdocconf) - -project = QtWebEngine -description = Qt WebEngine Reference Documentation -version = $QT_VERSION - -qhp.projects = QtWebEngine - -qhp.QtWebEngine.file = qtwebengine.qhp -qhp.QtWebEngine.namespace = org.qt-project.qtwebengine.$QT_VERSION_TAG -qhp.QtWebEngine.virtualFolder = qtwebengine -qhp.QtWebEngine.indexTitle = Qt WebEngine -qhp.QtWebEngine.indexRoot = - -qhp.QtWebEngine.filterAttributes = qtwebengine $QT_VERSION qtrefdoc -qhp.QtWebEngine.customFilters.Qt.name = QtWebEngine $QT_VERSION -qhp.QtWebEngine.customFilters.Qt.filterAttributes = qtwebengine $QT_VERSION - -qhp.QtWebEngine.subprojects = classes qmltypes examples - -qhp.QtWebEngine.subprojects.classes.title = C++ Classes and Namespaces -qhp.QtWebEngine.subprojects.classes.indexTitle = Qt WebEngine C++ Classes and Namespaces -qhp.QtWebEngine.subprojects.classes.selectors = class group:qtwebengine-namespaces doc:headerfile -qhp.QtWebEngine.subprojects.classes.sortPages = true - -qhp.QtWebEngine.subprojects.qmltypes.title = QML Types -qhp.QtWebEngine.subprojects.qmltypes.indexTitle = Qt WebEngine QML Types -qhp.QtWebEngine.subprojects.qmltypes.selectors = qmltype -qhp.QtWebEngine.subprojects.qmltypes.sortPages = true - -qhp.QtWebEngine.subprojects.examples.title = Examples -qhp.QtWebEngine.subprojects.examples.indexTitle = Qt WebEngine Examples -qhp.QtWebEngine.subprojects.examples.selectors = doc:example -qhp.QtWebEngine.subprojects.examples.sortPages = true - -manifestmeta.highlighted.names += "QtWebEngine/WebEngine Widgets Simple Browser Example" \ - "QtWebEngine/WebEngine Quick Nano Browser" - -tagfile = ../../../doc/qtwebengine/qtwebengine.tags - -# Custom module header for clang that pulls in also QtWebEngineWidgets -moduleheader = QtWebEngineDoc - -# Additional include paths for clang -includepaths = -I . - -depends += qtcore \ - qtgui \ - qtlocation \ - qtnetwork \ - qtplatformheaders \ - qtprintsupport \ - qtpositioning \ - qtqml \ - qtquick \ - qtquickcontrols \ - qtdoc \ - qtwebchannel \ - qtwebview \ - qtwidgets - -headerdirs += .. \ - ../../core/api \ - ../../webenginewidgets/api - -sourcedirs += .. \ - ../../core/api \ - ../../core/doc \ - ../../webenginewidgets/api \ - ../../webenginewidgets/doc - -exampledirs += . \ - ../../../examples \ - snippets \ - ../../core/doc/snippets \ - ../../webenginewidgets/doc/snippets - -examples.fileextensions += *.aff *.dic *.html - -imagedirs += images - -navigation.landingpage = "Qt WebEngine" -navigation.cppclassespage = "Qt WebEngine C++ Classes and Namespaces" -navigation.qmltypespage = "Qt WebEngine QML Types" - -# \QWE macro expands to 'Qt WebEngine' without auto-linking anywhere. -macro.QWE = "Qt \\WebEngine" - -Cpp.ignoretokens += Q_WEBENGINE_EXPORT Q_WEBENGINECORE_EXPORT QWEBENGINEWIDGETS_EXPORT diff --git a/src/webengine/doc/snippets/qtwebengine_build_snippet.qdoc b/src/webengine/doc/snippets/qtwebengine_build_snippet.qdoc deleted file mode 100644 index 35bc480bb..000000000 --- a/src/webengine/doc/snippets/qtwebengine_build_snippet.qdoc +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QT += webengine -//! [0] - - -//! [1] -#include <QtWebEngine> -//! [1] diff --git a/src/webengine/doc/snippets/qtwebengine_webengineview_newviewrequested.qml b/src/webengine/doc/snippets/qtwebengine_webengineview_newviewrequested.qml deleted file mode 100644 index e7e6790f2..000000000 --- a/src/webengine/doc/snippets/qtwebengine_webengineview_newviewrequested.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.1 -import QtWebEngine 1.1 - -//! [0] -QtObject { - id: windowParent - // Create the initial browsing windows and open the startup page. - Component.onCompleted: { - var firstWindow = windowComponent.createObject(windowParent); - firstWindow.webView.loadHtml('<input type="button" value="Click!" onclick="window.open("http://qt.io")">'); - } - - property Component windowComponent: Window { - // Destroy on close to release the Window's QML resources. - // Because it was created with a parent, it won't be garbage-collected. - onClosing: destroy() - visible: true - - property WebEngineView webView: webView_ - WebEngineView { - id: webView_ - anchors.fill: parent - - // Handle the signal. Dynamically create the window and - // use its WebEngineView as the destination of our request. - onNewViewRequested: function(request) { - var newWindow = windowComponent.createObject(windowParent); - request.openIn(newWindow.webView); - } - } - } -} -//! [0] diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc deleted file mode 100644 index 55f6a68a3..000000000 --- a/src/webengine/doc/src/external-resources.qdoc +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \externalpage http://www.chromium.org - \title Chromium Project -*/ - -/*! - \externalpage https://developers.google.com/web/tools/chrome-devtools - \title Chrome DevTools -*/ - -/*! - \externalpage https://developers.google.com/web/tools/javascript/console/console-write - \title Chrome console API -*/ - -/*! - \externalpage http://ffmpeg.org/ - \title FFmpeg -*/ - -/*! - \externalpage http://www.openh264.org/ - \title OpenH264 Project Homepage -*/ - -/*! - \externalpage http://html5demos.com/drag - \title HTML5 Demos - Drag and Drop -*/ - -/*! - \externalpage http://html5demos.com/drag-anything - \title HTML5 Demos - Simple Drag and Drop -*/ - -/*! - \externalpage http://html5demos.com/dnd-upload - \title HTML5 Demos - Drag and Drop, Automatic Upload -*/ - -/*! - \externalpage http://html5demos.com/file-api - \title HTML5 Demos - File API -*/ - -/*! - \externalpage http://www.widevine.com/wv_drm.html - \title Widevine DRM -*/ - -/*! - \externalpage http://demo.castlabs.com/ - \title castLabs -*/ - -/*! - \externalpage http://ssdemo04.swankmp.net/ - \title Swank Motion Pictures, Inc. -*/ - -/*! - \externalpage https://shaka-player-demo.appspot.com/demo/ - \title Shaka Player -*/ - -/*! - \externalpage https://sourceforge.net/projects/hunspell/ - \title Hunspell Project -*/ - -/*! - \externalpage https://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1 - \title RFC 2616 section 19.5.1 -*/ - -/*! - \externalpage https://www.iana.org/assignments/uri-schemes/prov/view-source - \title view-source URI scheme -*/ - -/*! - \externalpage https://wiki.greasespot.net/Metadata_Block - \title Greasemonkey -*/ - -/*! - \externalpage https://http2.github.io/ - \title HTTP/2 -*/ - -/*! - \externalpage https://http2.akamai.com/demo - \title Akamai HTTP/2 Demo -*/ - -/*! - \externalpage https://www.chromium.org/developers/design-documents/user-scripts - \title User Scripts -*/ - -/*! - \externalpage https://wiki.greasespot.net/Metadata_Block#.40name - \title Metadata Block -*/ - -/*! - \externalpage https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler - \title registerProtocolHandler -*/ - -/*! - \externalpage https://www.w3.org/TR/notifications - \title Web Notifications API -*/ diff --git a/src/webengine/doc/src/qtwebengine-debugging.qdoc b/src/webengine/doc/src/qtwebengine-debugging.qdoc deleted file mode 100644 index 088db5f87..000000000 --- a/src/webengine/doc/src/qtwebengine-debugging.qdoc +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-debugging.html - \title Qt WebEngine Debugging and Profiling - - \section1 Console Logging - - JavaScript executed inside \QWE can use the - \l{Chrome console API} to log information to a console. The logging messages - are forwarded to Qt's logging facilities inside a \c js - \l{QLoggingCategory}{logging category}. However, only warning and fatal - messages are printed by default. To change this, you either have to set custom - rules for the \c js category, or provide custom message handlers - by reimplementing \l{QWebEnginePage::javaScriptConsoleMessage()}, or - connecting to \l{WebEngineView::javaScriptConsoleMessage()}. - - All messages can also be accessed through the \QWE developer - tools. - - \section1 Qt WebEngine Developer Tools - - The \QWE module provides web developer tools that make it easy - to inspect and debug layout and performance issues of any web content. - - The developer tools are accessed as a local web page using a Chromium or - \QWE based browser, such as the Chrome browser. - - To activate the developer tools, start an application that uses \QWE - with the command-line arguments: - - \badcode - --remote-debugging-port=<port_number> - \endcode - - Where \c <port_number> refers to a local network port. The web developer - tools can then be accessed by launching a browser at the address - \c http://localhost:<port_number>. - - Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING - can be set. It can be set as either just a port working similarly to - \c --remote-debugging-port or given both a host address and a port. The - latter can be used to control which network interface to export the - interface on, so that you can access the developer tools from a remote - device. - - For a detailed explanation of the capabilities of developer tools, see the - \l {Chrome DevTools} page. - - \section1 Using Command-Line Arguments - - You can use the following command-line arguments while debugging to provide - input for bug reports: - - \list - \li \c {--disable-gpu} disables GPU hardware acceleration. This is - useful when diagnosing OpenGL problems. - \li \c {--disable-logging} disables console logging, which might be - useful for debug builds. - \li \c {--enable-logging --log-level=0} enables console logging and sets - the logging level to 0, which means that messages of the severity - \c info and above are recorded in the log. This is the default for - debug builds. Other possible log levels are \c 1 for warnings, \c 2 - for errors, and \c 3 for fatal errors. - \li \c {--v=1} Increases the logging level beyond what \c {--log-level} - can, and enables logging debug messages up to verbosity level \c 1. - A higher number further increases verbosity, but may result in a - large number of logged messages. Default is \c 0 (no debug messages). - \li \c {--no-sandbox} disables the sandbox for the renderer and plugin - processes. Keep in mind that disabling the sandbox might present a - security risk. - \li \c {--single-process} runs the renderer and plugins in the same - process as the browser. This is useful for getting stack traces for - renderer crashes. - \endlist - - Alternatively, the environment variable QTWEBENGINE_CHROMIUM_FLAGS can be - set. For example, the following value could be set to disable logging while - debugging an application called \e mybrowser: - - \code - QTWEBENGINE_CHROMIUM_FLAGS="--disable-logging" mybrowser - \endcode -*/ diff --git a/src/webengine/doc/src/qtwebengine-deploying.qdoc b/src/webengine/doc/src/qtwebengine-deploying.qdoc deleted file mode 100644 index 7b9f3fd4a..000000000 --- a/src/webengine/doc/src/qtwebengine-deploying.qdoc +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-deploying.html - \title Deploying Qt WebEngine Applications - - The way to package and deploy applications varies between operating systems. - For Windows and \macos, \l{The Windows Deployment Tool}{windeployqt} and - \l{Deploying Applications on macOS}{macdeployqt} automate the steps to - generate a stand-alone application package. - - When manually deploying applications that depend on \QWE, all the - files that are required to run the application have to be included: - libraries, QML imports, plugins, and translations. - - For more information, see \l {Deploying Qt Applications}. - - \section1 Target Platforms - - \QWE does try to support all \l{Supported Platforms} of Qt. However, - due to different requirements of Chromium this is not always possible. Known - limitations are: - - \list - \li \QWE currently supports only Windows, Linux, and \macos. - - \li On Windows, \QWE only supports Windows Vista or newer as - target platform. Due to use of newer API in Chromium, Windows XP is - not supported. WinRT is not supported, either. - \endlist - - \section1 Deploying Applications Manually - - When manually deploying applications that depend on \QWE, the - following files might have to be deployed: - - \list - \li Libraries - \li QML imports - \li \QWE process - \li Resources - \li Translations - \li Audio and video codecs - \endlist - - \section2 Deploying Libraries - - The following libraries must be deployed with applications that depend on - \QWE: - - \list - \li QtWebEngineCore library - \li QtWebEngineWidgets or QtWebEngine libraries, depending on - application type - \endlist - - \section2 Deploying QML Imports - - If Qt Quick integration is used in the application, the QtWebEngine import - directory needs to be deployed. - - \section2 Deploying \QWE Processes - - \QWE takes advantage of the multi-process model that the Chromium - project offers. The multi-process model requires that the \QWE - Process executable be deployed alongside your application. - - The WebEngine process is executed for each QWebEngineView or WebEngineView - instance. For example, a browser application - with two tabs open should have two separate instances of the process - running. This is a common approach used by most modern web engines to - provide a stable browsing experience. - - At runtime, \QWE looks for the \c QtWebEngineProcess executable in - the directory that - QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) returns. - For Qt installations, this is \c QTDIR/libexec (Linux) or \c QTDIR\bin - (Windows). The path can be changed by defining a \c qt.conf file, for - example. Alternatively, an executable path can be set as a value of the - \c QTWEBENGINEPROCESS_PATH environment variable. On \macos, \QWE - looks for the executable in \c .app/Helpers/QtWebEngineProcess. - - \section2 Deploying Resources - - \QWE requires the following resource files: - - \list - \li \c qtwebengine_resources.pak contains the resources needed by - Chromium. - \li \c qtwebengine_devtools_resources.pak contains tools for remote - debugging. - \li \c qtwebengine_resources_100p.pak contains images suitable for low - resolution displays. - \li \c qtwebengine_resources_200p.pak contains images suitable for high - DPI displays. - \li \c icudtl.dat provides support for International Components for - Unicode (ICU). It is the Chromium version of ICU, which is not - needed if \QWE was configured to use the system ICU. - \endlist - - Resources are searched from the following locations: - - \list - \li On Linux and Windows: the \c resources directory in the directory - specified by QLibraryInfo::location(QLibraryInfo::DataPath) - \li On \macos: \c .app/Content/Resources - \endlist - - \section2 Translations - - Locale data (such as \c en-US.pak) is searched form the following locations: - - \list - \li On \macos: \c .app/Content/Resources - \li On Linux and Windows: \c qtwebengine_locales directory in the - directory specified by - QLibraryInfo::location(QLibraryInfo::TranslationsPath) - \endlist - - \section2 JavaScript Files in Qt Resource Files - - If your WebEngine application is built using the Qt Quick Compiler, and the application ships - JavaScript files inside .qrc resources, and these files are supposed to be loaded from inside - HTML pages, make sure to specify the resource files in a \c QTQUICK_COMPILER_SKIPPED_RESOURCES - qmake variable inside your project. This prevents the Qt Quick Compiler from trying to generate - C++ code for the corresponding JavaScript code, as well as removing the original JavaScript code - from the Qt resources file, which would lead to broken HTML pages. For example: - - \code - QTQUICK_COMPILER_SKIPPED_RESOURCES += resources/my_resource.qrc - \endcode - -*/ diff --git a/src/webengine/doc/src/qtwebengine-examples.qdoc b/src/webengine/doc/src/qtwebengine-examples.qdoc deleted file mode 100644 index d31895078..000000000 --- a/src/webengine/doc/src/qtwebengine-examples.qdoc +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \group webengine-examples - \title Qt WebEngine Examples - \brief Examples demonstrating the \QWE usage. - \ingroup all-examples - - These examples and demonstrations show a range of different uses for \l{Qt WebEngine}, - from displaying Web pages within a QML user interface to an implementation of - a basic function Web browser. - - For widget-based applications, Qt provides an integrated Web browser component based on - Chromium, the popular open source browser engine. -*/ diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc deleted file mode 100644 index 08c189740..000000000 --- a/src/webengine/doc/src/qtwebengine-features.qdoc +++ /dev/null @@ -1,540 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-features.html - \title Qt WebEngine Features - - \brief Summarizes \QWE features. - - \QWE supports the following features: - - \list - \li \l{Audio and Video Codecs} - \li \l{Chromium DevTools} - \li \l{Client Certificates} - \li \l{Drag and Drop} - \li \l{Fullscreen} - \li \l{HTML5 DRM} - \li \l{HTML5 Geolocation} - \li \l{HTTP/2 Protocol} - \li \l{Native Dialogs} - \li \l{Pepper Plugin API} - \li \l{PDF File Viewing} - \li \l{Print to PDF} - \li \l{Process Models} - \li \l{Spellchecker} - \li \l{Touch} - \li \l{View Source} - \li \l{WebRTC} - \li \l{Web Notifications} - \endlist - - \section1 Audio and Video Codecs - - \QWE supports the MPEG-4 Part 14 (MP4) file format only if the - required proprietary audio and video codecs, such as H.264 and MPEG layer-3 - (MP3), have been enabled. Proprietary codecs can be enabled by passing the - following option to the \c configure tool when configuring Qt: - - \code - -webengine-proprietary-codecs - \endcode - - For example, the following option could be passed when configuring Qt for - building it at the top level: - - \code - configure -webengine-proprietary-codecs - \endcode - - For more information, see \l{Qt Configure Options}. - - When using qmake to build just the \QWE module, the following - command can be used (in this example, the \QWE source code is - located in \c {C:\qt\qtwebengine}): - - \code - qmake C:\qt\qtwebengine -- -webengine-proprietary-codecs - \endcode - - \warning When distributing proprietary codec libraries, you must acquire - licenses for them. - - \l FFmpeg is a cross-platform solution to record, convert, and stream audio - and video. It can be configured for use with several codecs, which rises - licensing issues during distribution with the codec libraries. For some - codecs, open source implementations, such as \l{OpenH264 Project Homepage} - {OpenH264}, are available. - - \section1 Chromium DevTools - - The Chromium DevTools provide the ability to inspect and debug layout and - performance issues of any web content. - - This feature can be tested by launching a \QWE application with the - command line option \c {--remote-debugging-port=[your-port]} or by setting - the environment variable \c QTWEBENGINE_REMOTE_DEBUGGING, and then using a - Chromium based browser (such as \l{WebEngine Widgets Simple Browser Example} - {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect - to \c {http://localhost:[your-port]}. - - The Chromium DevTools page can also be shown within the application. To set - this up, you can call either QWebEnginePage::setInspectedPage() to the page - to be inspected, which implicitly loads the DevTools into the \c this page, - or QWebEnginePage::setDevToolsPage() to let the \c this page be inspected. - - The respective QML properties are \l{WebEngineView::devToolsView} - {WebEngineView.devToolsView} and \l{WebEngineView::inspectedView} - {WebEngineView.inspectedView}. - - For more information, see \l {Qt WebEngine Debugging and Profiling}. - - \section1 Client Certificates - - Some web servers, in particular many intranet sites, require the client to - authenticate itself with a certificate, called a \e {client certificate}. \QWE - will read the client certificates installed in the system settings in macOS and - Windows, and on Linux those installed into the NSS database. Certificates can - be installed into the NSS database using the \c pk12util tool. - - By default, \QWE will not offer any client certificates to servers, as doing - so uniquely identifies the user and might violate privacy expectations. - - To activate support for client certificates, an application needs to listen to - the QWebEnginePage::selectClientCertificate signal and select one of the offered - certificates. For applications that can navigate to untrusted web sites, it is - recommended to always give the user a choice before uniquely identifying them - to a remote server. - - \section1 Custom Schemes - - \QWE makes it possible for the application to define its own custom - URL schemes with specialized security policies and transport mechanisms. - - Custom schemes can be used to implement alternative network protocols with - all the usual web security policies, privileged internal schemes for - displaying user interface compoments or debugging information, sandboxed - schemes with extra restrictions, and so on. - - For more information, see \l QWebEngineUrlScheme and \l - QWebEngineUrlSchemeHandler. - - \section1 Drag and Drop - - \QWE supports HTML5 drag and drop. - - This feature can be tested by opening an HTML5 drag and drop demo, such as - \l{HTML5 Demos - Drag and Drop}, \l{HTML5 Demos - Simple Drag and Drop}, or - \l{HTML5 Demos - Drag and Drop, Automatic Upload}, in \l{WebEngine Widgets - Simple Browser Example}{Simple Browser} or \l{WebEngine Quick Nano Browser} - {Nano Browser}. - - Dragging files into the browser is not actually part of HTML5, but it is - supported. It can be tested by opening \l{HTML5 Demos - File API}. - - Support for this feature was added in Qt 5.7.0. - - \section1 Fullscreen - - \QWE supports viewing web content in fullscreen mode. For more - information, see \l{WebEngineSettings::fullscreenSupportEnabled} - {WebEngineSettings.fullscreenSupportEnabled}, - \l{WebEngineView::fullScreenRequested}{WebEngineView.fullScreenRequested}, - QWebEngineSettings::FullScreenSupportEnabled, and - QWebEnginePage::fullScreenRequested. - - This feature can be tested by playing a video from YouTube in \l{WebEngine - Widgets Video Player Example}{Video Player} or \l{WebEngine Quick Nano Browser} - {Nano Browser}, and clicking the full screen icon to go into fullscreen - mode. - - Support for this feature was added in Qt 5.6.0. - - \section1 HTML5 DRM - - \QWE supports viewing DRM protected videos if the \l{Widevine DRM} - plugin has been installed. - - The video format most commonly used by DRM services, H.264, requires - proprietary audio and video codecs. For more information about enabling the - codecs, see \l{Audio and Video Codecs}. - - This feature can be tested by playing a video in \l{WebEngine Widgets Simple Browser - Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser} - from \l{castLabs}, \l{Swank Motion Pictures, Inc.}, or \l{Shaka Player}. - - Support for this feature was added in Qt 5.7.0. - - \section1 HTML5 Geolocation - - \QWE supports JavaScript Geolocation API with \l {Qt Location} as a - backend. The application has to explicitly allow the feature by using - QWebEnginePage::Geolocation or \l{WebEngineView::Feature} - {WebEngineView.Feature}. - - If Qt Location has been built before \QWE then this feature can be - tested by using \l{WebEngine Widgets Maps Example}{Maps} and allowing it to - find the current position of the user. Note that on Windows an external GPS - receiver must be connected to the application. For more information, see - \l{Qt Positioning}. - - Support for this feature was added in Qt 5.5.0. - - \section1 HTTP/2 Protocol - - \QWE supports the Chromium implementation of the \l{HTTP/2} - protocol. - - This feature can be tested by opening an HTTP/2 demo, such as the - \l{Akamai HTTP/2 Demo}, in \l{WebEngine Widgets Simple Browser Example} - {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}. - - \section1 Native Dialogs - - A web page might request dialogs for the following functions: - - \list - \li Entering user credentials for HTTP and proxy authentication - \li Displaying JavaScript alerts, confirmation dialogs, and prompts - \li Picking colors - \li Selecting files - \li Displaying form validation messages - \endlist - - \QWE provides standard dialogs for these functions. In widget-based - applications, the standard dialogs are based on QDialog, whereas in Qt Quick - applications, they can be based either on Qt Quick Controls 1 or Qt Quick - Controls 2 (since Qt 5.8). The latter are used only on \c eglfs platforms. - - To explicitly force either dialogs based on Qt Quick Controls 1 or Qt Quick - Controls 2, set the \c QTWEBENGINE_DIALOG_SET environment variable to either - \c{QtQuickControls1} or \c{QtQuickControls2}. - - \QWE Widgets dialogs can be customized by reimplementing the - QWebEnginePage::chooseFiles(), QWebEnginePage::javaScriptAlert(), - QWebEnginePage::javaScriptConfirm(), and QWebEnginePage::javaScriptPrompt() - functions. - - Since Qt 5.8, Qt Quick dialogs can be customized by connecting to the - WebEngineView::authenticationDialogRequested(), - WebEngineView::javaScriptDialogRequested(), - WebEngineView::colorDialogRequested(), - WebEngineView::fileDialogRequested(), and - WebEngineView::formValidationMessageRequested() signals. For an example, - see \l{WebEngine Qt Quick Custom Dialogs Example}. - - \section1 Pepper Plugin API - - \QWE supports loading Pepper Plugin API (PPAPI) plugins if - WebEngineSettings::pluginsEnabled or QWebEngineSettings::PluginsEnabled - is set. - - Except for the Adobe Flash Player plugin, the plugins must be loaded - manually using the Chromium command line syntax with the - \c --register-pepper-plugins argument. The argument value is a list of - entries, separated by commas, that contain the file path and one or several - MIME types, separated by semicolons: - - \code - <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2> - \endcode - - For example: - - \code - --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" - \endcode - - The MIME type is important because it determines which embeds the plugin is - used for. - - Support for this feature was added in Qt 5.6.0. - - \section2 Pepper Flash Player Plugin Support - - The Pepper Flash player plugin can be loaded automatically if it is - installed in one of the following locations, depending on the platform: - - \list - \li Windows - \code - C:\Windows\SysWOW64\Macromed\Flash\pepflashplayer*.dll - C:\Windows\System32\Macromed\Flash\pepflashplayer*.dll - \endcode - \li OS X - \code - /Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin - \endcode - \li Linux - \code - /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so - /usr/lib/adobe-flashplugin/libpepflashplayer.so - /usr/lib/PepperFlash/libpepflashplayer.so - /usr/lib64/chromium/PepperFlash/libpepflashplayer.so - \endcode - \endlist - - You can also load the Pepper Flash player from a specific location by using - command line arguments: - - \code - --ppapi-flash-path=./libpepflashplayer.so - \endcode - - By default, the Flash version is set to \c{11.2.999.999}. You can use the - \c{ppapi-flash-version=} argument to set another Flash version in the - format \c{major.minor.build.revision}: - - \code - --ppapi-flash-version=16.0.0.235 - \endcode - - This feature can be tested in \l{WebEngine Widgets Simple Browser Example}{Simple Browser} - or \l{WebEngine Quick Nano Browser}{Nano Browser} if the Adobe Flash PPAPI - plugin is installed and plugins are enabled in the browser. To test the - feature, the \c https://helpx.adobe.com/flash-player.html page can be opened - in the browser. - - \section1 PDF File Viewing - - \QWE supports viewing PDF documents by navigating to them. This feature uses the Chromium - extensions API and PDF viewer plugin to display the PDF documents. - It can be tested in \l{WebEngine Widgets Simple Browser Example}{Simple Browser} or - \l{WebEngine Quick Nano Browser}{Nano Browser}. - - Loading plugins needs to be enabled using QWebEngineSettings::PluginsEnabled or - WebEngineSettings::pluginsEnabled in order to use this feature. - - This feature can be turned on (default) or off via the QWebEngineSettings::PdfViewerEnabled or - WebEngineSettings::pdfViewerEnabled setting. - - Support for this feature was added in Qt 5.13.0. - - \section1 Print to PDF - - \QWE supports printing a web page to a PDF file. For more - information, see QWebEnginePage::printToPdf() and - \l{WebEngineView::printToPdf}{WebEngineView.printToPdf}. - - This feature can be tested using \l{WebEngine Widgets Html2Pdf Example} - {Html2Pdf}. - - Support for this feature was added in Qt 5.7.0. - - \section1 Process Models - - \QWE uses multiple OS processes to isolate web sites from each other - and from the client application, improving security and robustness. The - following process models, or ways to divide web sites between OS processes, - are supported: - - \list - \li \l{Process per Site Instance} - \li \l{Process per Site} - \li \l{Single Process} - \endlist - - \section2 Process per Site Instance - - This is the default model. Pages from separate sites are put into separate - processes and separate visits to the same site are also isolated. - - Two web pages are considered as belonging to the same site if they originate - from the same registered domain name (for example, \c wikipedia.org) and - scheme (for example, \c https). This is similar to the same-origin policy - but subdomains are ignored. For example, both \c{https://en.wikipedia.org/} - and \c{https://de.wikipedia.org/} would belong to the same site. - - A site instance is a collection of web pages belonging to the same site. - When the application explicitly loads a URL into \QWE (via \l - QWebEnginePage::setUrl, for example), a new site instance is created for the - page. However, when the user clicks same-site links on the page, the - existing site instance is merely extended with more pages. - - For instance, in the \l{WebEngine Widgets Simple Browser Example}{Simple - Browser} example, when a user opens two tabs and explicitly enters - \c{https://en.wikipedia.org/} into the URL bars, both tabs will have their - own separate OS processes (because explicitly entering a URL creates a new - site instance). However, when the user then middle-clicks some same-site - links to open more tabs, these new tabs will share the same OS process - (because user interaction extends the existing site instance). - - \section2 Process per Site - - Pages from separate sites are put into separate processes. Unlike Process - per Site Instance, all visits to the same site will share an OS process. - - The benefit of this model is reduced memory consumption, because more web - pages will share processes. The drawbacks include reduced security, - robustness, and responsiveness. - - To enable this model, use the command-line argument \c{--process-per-site}. - See \l{Using Command-Line Arguments}. - - \section2 Single Process - - For debugging purposes only, a single process mode can be enabled using the - command-line argument \c{--single-process}. See \l{Using Command-Line - Arguments} and \l{Qt WebEngine Debugging and Profiling}. - - \section1 Spellchecker - - \QWE supports integrating spellchecking support into HTML forms to - enable users to submit spellchecked messages. When the user clicks on - an underlined misspelled word, the default context menu displays up to four - suggestions. Selecting one will replace the misspelled word. - - To be able to check the spelling, the spellchecker needs dictionaries. It - supports dictionaries from the \l{Hunspell project}, but they have to be - compiled into a special binary format. A Hunspell dictionary consists of two - files: - - \list - - \li A \c .dic file that is a dictionary containing words for the - language - \li An \c .aff file that defines the meaning of special flags in the - dictionary - \endlist - - These two files can be converted into the \c bdic format by using the - \c qwebengine_convert_dict tool that is shipped together with Qt. - When the \QWE spellchecker initializes, it will try to load the - \c bdict dictionaries and to check them for consistency. - - If \c QTWEBENGINE_DICTIONARIES_PATH is set, the spellchecker uses the - dictionaries in the specified directory without looking anywere else. - Otherwise, it uses the \e qtwebengine_dictionaries directory relative to the - executable if it exists. If it does not exist, it will look in \c - QT_INSTALL_PREFIX/qtwebengine_dictionaries. - - On macOS, depending on how \QWE is configured at build time, there - are two possibilities how spellchecking data is found: - - \list - \li Hunspell dictionaries (default) - .bdic dictionaries are used, just - like on other platforms - \li Native dictionaries - the macOS spellchecking APIs are used (which - means the results will depend on the installed OS dictionaries) - \endlist - - Thus, in the macOS Hunspell case, \QWE will look in the \e - qtwebengine_dictionaries subdirectory located inside the application bundle - \c Resources directory, and also in the \c Resources directory located - inside the Qt framework bundle. - - To summarize, in case of Hunspell usage, the following paths are considered: - - \list - \li \c QTWEBENGINE_DICTIONARIES_PATH, if set - \li QCoreApplication::applicationDirPath()/qtwebengine_dictionaries - or QCoreApplication::applicationDirPath()/../Contents/Resources/qtwebengine_dictionaries - (on macOS) - \li [QLibraryInfo::DataPath]/qtwebengine_dictionaries - or path/to/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries (Qt framework - bundle on macOS) - \endlist - - Spellchecking is disabled by default and can be enabled per profile by - using the QWebEngineProfile::setSpellCheckEnabled() method in widget-based - applications and the \l {QQuickWebEngineProfile::spellCheckEnabled} - {WebEngineProfile.spellCheckEnabled} property in Qt Quick applications. - - The current language used for spellchecking is defined per profile, and can - be set using the QWebEngineProfile::setSpellCheckLanguages() method or the - \l {QQuickWebEngineProfile::spellCheckLanguages} - {WebEngineProfile.spellCheckLanguages} property. - - This feature can be tested by building and running the - \l{WebEngine Widgets Spellchecker Example}{Spellchecker Example}. - - Support for this feature was added in Qt 5.8.0. - - \section1 Touch - - \QWE supports touch devices for navigating and interacting with web pages. - - Applications can prohibit the use of touch events in the following ways: - - \list - \li Passing the flag \c --touch-events=disabled on the command line will disable touch event - support in JavaScript API (meaning \c ontouchstart and related handlers will not be present - in the \c document.window object). Touch events will still be delivered to web pages. - - \li Installing an event filter object using \l {QObject::installEventFilter} on the WebEngine - view focus proxy object, and filtering out all touch events. - - \endlist - - \section1 View Source - - \QWE supports viewing the HTML source of a web page. - - This feature can be used from custom menus or assigned to custom events. - For more information, see WebEngineView::WebAction, and QWebEnginePage::WebAction. - - This feature can be tested by opening a web page in \l{WebEngine Widgets - Simple Browser Example}{Simple Browser} or \l{WebEngine Quick Nano Browser} - {Nano Browser}, and then selecting \c{Page Source} in the context menu. The - \c{Page Source} context menu entry opens the source view in a new tab. - - For opening the source view in the current tab, URLs with \l{view-source URI scheme} - are also supported. For example, you can type the following URL to the URL bar - to view the HTML source of the qt.io web page: - \code - view-source:https://www.qt.io/ - \endcode - - Auto-completion of incomplete URLs with \l{view-source URI scheme} makes the usage of - this feature more comfortable. For example, the following incomplete URL also loads - the source view of the qt.io web page: - \code - view-source:qt.io - \endcode - - Support for this feature was added in Qt 5.8.0. - - \section1 WebRTC - - WebRTC provides browsers with Real-Time Communications (RTC) capabilities - via simple APIs. For more information, see \l{WebEngineView::Feature} - {WebEngineView.Feature} and QWebEnginePage::Feature. - - This feature can be tested by setting up a webcam or microphone and then - opening \c https://test.webrtc.org/ in \l{WebEngine Widgets Simple Browser - Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}. - - \section1 Web Notifications - - Qt WebEngine supports JavaScript \l{Web Notifications API}. - The application has to explicitly allow the feature by using - QWebEnginePage::Notifications or \l{WebEngineView::Feature} - {WebEngineView.Notifications}. - - Support for this feature was added in Qt 5.13.0. -*/ diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc deleted file mode 100644 index f668cf87b..000000000 --- a/src/webengine/doc/src/qtwebengine-index.qdoc +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-index.html - \title Qt WebEngine - - \brief Provides functionality for rendering regions of dynamic web content. - - \QWE provides functionality for rendering regions of dynamic web content. - - The functionality in \QWE is divided into the following modules: - - \annotatedlist qtwebengine-modules - - \section1 Articles and Guides - - \list - \li \l{Qt WebEngine Overview} - \li \l{Qt WebEngine Features} - \li \l{Qt WebEngine Platform Notes} - \li \l{Qt WebEngine Licensing} - \li \l{Qt WebEngine Debugging and Profiling} - \li \l{Deploying Qt WebEngine Applications} - \li \l{Porting from Qt WebKit to Qt WebEngine} - \endlist - - \section1 Examples - - \list - \li \l{Qt WebEngine Examples} - \li \l{Qt WebEngine Widgets Examples} - \endlist - - \section1 API References - - \list - \li \l{Qt WebEngine C++ Classes and Namespaces} - \li \l{Qt WebEngine QML Types} - \endlist -*/ diff --git a/src/webengine/doc/src/qtwebengine-module.qdoc b/src/webengine/doc/src/qtwebengine-module.qdoc deleted file mode 100644 index 5554bd519..000000000 --- a/src/webengine/doc/src/qtwebengine-module.qdoc +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \module QtWebEngine - \title Qt WebEngine C++ Classes - \brief Exposes C++ functionality to Qt Quick. - \ingroup modules - - The \QWE module exposes C++ functionality to Qt Quick. - - To include the definitions of the module's classes, use the - following directive: - - \snippet qtwebengine_build_snippet.qdoc 1 - - \if !defined(qtforpython) - To link against the module, add the following to your qmake project file: - - \snippet qtwebengine_build_snippet.qdoc 0 - \endif -*/ diff --git a/src/webengine/doc/src/qtwebengine-modules.qdoc b/src/webengine/doc/src/qtwebengine-modules.qdoc deleted file mode 100644 index 7b8ced728..000000000 --- a/src/webengine/doc/src/qtwebengine-modules.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-modules.html - \title Qt WebEngine C++ Classes and Namespaces - \brief Provides functionality for rendering regions of dynamic web content. - - \e {Qt WebEngine} provides functionality for rendering regions of dynamic web content. - - \section1 Namespaces - \annotatedlist qtwebengine-namespaces - - \section1 Classes - - \section2 Qt WebEngineCore Module - \generatelist {classesbymodule QtWebEngineCore} - - \section2 Qt WebEngineWidgets Module - \generatelist {classesbymodule QtWebEngineWidgets} - - \section2 Qt WebEngine Module - \generatelist {classesbymodule QtWebEngine} -*/ diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc deleted file mode 100644 index 6aa1af89e..000000000 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ /dev/null @@ -1,315 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-overview.html - \title Qt WebEngine Overview - - The \QWE module provides a web browser engine that makes it easy to embed content from - the World Wide Web into your Qt application on platforms that do not have a native web engine. - - \QWE provides C++ classes and QML types for rendering HTML, XHTML, and SVG documents, - styled using Cascading Style Sheets (CSS) and scripted with JavaScript. HTML documents can be - made fully editable by the user through the use of the \c{contenteditable} attribute on HTML - elements. - - \section1 Qt WebEngine Architecture - - \image qtwebengine-architecture.png - - The functionality in \QWE is divided into the following modules: - - \list - \li \l{Qt WebEngine Widgets Module} for creating widget-based web applications - \li \l{Qt WebEngine Module} for creating Qt Quick based web applications - \li \l{Qt WebEngine Core Module} for interacting with Chromium - \endlist - - Page rendering and JavaScript execution are separated from the GUI process into the \QWE - Process. It is a library that must be shipped with the application if the Qt libraries are - bundled into the application. - - \section2 Qt WebEngine Widgets Module - - \image qtwebenginewidgets-model.png - - A \e {web engine view} is the main widget component of the \QWE module. It can be used - in various applications to load web content. Within a view, a \e {web engine page} holds a main - frame that is responsible for web content, the \e history of navigated links, and \e actions. - The view and page are quite similar, as they provide a set of common functions. - - All pages belong to a \e {web engine profile} that contains shared \e settings, \e scripts, and - \e cookies. Profiles can be used to isolate pages from each other. A typical use case is a - dedicated profile for a \e {private browsing} mode, where no information is permanently saved. - - \note The \QWE Widgets module uses the \l{Qt Quick Scene Graph}{Qt Quick scene graph} - to compose the elements of a web page into one view. This means that the UI process - requires OpenGL ES 2.0 or OpenGL 2.0 for its rendering. - - \section2 Qt WebEngine Module - - \image qtwebengine-model.png - - The \QWE QML implementation contains the same elements as the \QWE Widgets - implementation, except that there is no separately accessible web engine page. - The supported page functionality is integrated into the web engine view. - - \section2 Qt WebEngine Core Module - - The \QWE core is based on the \l {Chromium Project}. Chromium provides its own network - and painting engines and is developed tightly together with its dependent modules. - - \note \QWE is based on Chromium, but does not contain or use any services - or add-ons that might be part of the Chrome browser that is built and delivered by Google. - You can find more detailed information about the differences between Chromium and Chrome in this - \l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview} - that is part of the documentation in the \l {Chromium Project} upstream source tree. - - This version of \QWE is based on Chromium version 73.0.3683, with additional security - fixes from newer versions. - - \section2 Qt WebEngine Process - - The \QWE Process is a separate executable that is used to render web pages and - execute JavaScript. This mitigates security issues and isolates crashes caused by specific - content. - - \section1 Embedding Web Content into Widget Based Applications - - Use the QWebEngineView class to display web pages in the simplest way. Because it is a widget, - you can embed QWebEngineView into your forms and use its convenience functions to download and - display web sites. - - \code - QWebEngineView *view = new QWebEngineView(parent); - view->load(QUrl("http://www.qt.io/")); - view->show(); - \endcode - - An instance of QWebEngineView has one QWebEnginePage. QWebEnginePage can have a - QWebEngineHistory that provides access to the page's navigation history and several QAction - objects that apply actions on the web page. In addition, a QWebEnginePage has the ability to - run JavaScript code in the context of the page's main frame and to enable customization of - handlers for specific events like showing custom authentication dialogs. - - Each QWebEnginePage belongs to a QWebEngineProfile that can have a QWebEngineSettings - for specifying page settings, a QWebEngineScriptCollection for running scripts on the page, and - a QWebEngineCookieStore for accessing the HTTP cookies of Chromium. A QWebEnginePage can also - directly point to a script collection. - - For a widget based application, the web engine is automatically initialized, unless it is - placed in a plugin. In that case, it must be initialized in the application main source file - by using \l QtWebEngine::initialize, as illustrated by the following code snippet: - - \code - int main(int argc, char **argv) - { - QApplication app(argc, argv); - - QtWebEngine::initialize(); - - QMainWindow window; - window.show(); - - return app.exec(); - } - \endcode - - \section1 Embedding Web Content into Qt Quick Applications - - The WebEngineView QML type allows Qt Quick applications to render regions of dynamic web - content. A \e{WebEngineView} type may share the screen with other QML types or encompass the - full screen as specified within the Qt Quick application. - - To make sure that OpenGL context can be shared between the GUI and render processes, the web - engine must be initialized by using \l QtWebEngine::initialize in the application main source - file, as illustrated by the following code snippet: - - \code - int main(int argc, char *argv[]) - { - QGuiApplication app(argc, argv); - - QtWebEngine::initialize(); - - QQmlApplicationEngine engine; - engine.load(QUrl("qrc:/main.qml")); - - return app.exec(); - } - \endcode - - An application can load pages into the WebEngineView, using either an URL or HTML string, and - navigate within session history. By default, links to different pages load within the same - WebEngineView object, but web sites may request them to be opened as a new tab, window, or - dialog. - - The following sample QML application loads a web page using the \l{WebEngineView::}{url} - property: - - \quotefromfile webengine/minimal/main.qml - \skipto import - \printuntil /^\}/ - - \section1 Script Injection - - \QWE does not allow direct access to the document object model (DOM) of a page. - However, the DOM can be inspected and adapted by injecting scripts. - - The DOM of a page is constructed when the document is ready, typically - when the page is completely loaded. Therefore, executing scripts as soon as a document is - created is not suitable for DOM operations, where one has to wait until the DOM is ready. - - In addition, an injected script shares the same \e world as the other scripts executed on the - page, which might lead to conflicts. To avoid this, the QWebEngineScript class and the - WebEngineScript QML type provide implementations of the Chromium API for - \e{Content Script Extensions}. They specify the - script to run, the injection point, and the world where the script is run. This enables - accessing the DOM to manipulate it within a world. - - Since Qt 5.8, \QWE supports augmenting a script by using the - following \l{Metadata Block}{Greasemonkey-like attributes}: - - \list - \li \c {@exclude <regexp>} - \li \c {@include <regexp>} - \li \c {@match <regexp>} - \li \c {@name <free text>} - \li \c {@run-at [document-start|document-end|document-idle]} - \endlist - - The attributes determine if and when a \l {User Scripts}{user script} is - run. They must be placed immediately in the beginning of the script, inside - a \c ==UserScript== comment: - - \code - // ==UserScript== - // @include http://*.qt.io/* - // @exclude http://wiki.qt.io/* - // ==/UserScript== - - window.alert("Page is from qt.io, but not wiki.qt.io"); - \endcode - - If your WebEngine application is built using the Qt Quick Compiler, and the application ships - JavaScript files inside .qrc resources, consider reading the section - \l{JavaScript Files in Qt Resource Files}. - - \section1 Managing Certificates - - \QWE uses its own network stack, and therefore QSslConfiguration is not used to - open SSL connections. Instead, \QWE uses the root CA certificates from the operating - system to validate the peer's certificate. - - The \l{WebEngineCertificateError::error} and \l{QWebEngineCertificateError::Error} enumerations - provide information about the types of certificate errors that might occur. The errors can be - handled by using the WebEngineView::certificateError QML method or by reimplementing the - QWebEnginePage::certificateError function. - - \section1 Proxy Support - - \QWE uses the proxy settings from \l{Qt Network}, and forwards them to Chromium's - networking stack. If QNetworkProxy::applicationProxy is set, it will also be used for \QWE. - If QNetworkProxyFactory::usesSystemConfiguration() is enabled, the proxy settings - are automatically retrieved from the system. Settings from an installed QNetworkProxyFactory - will be ignored, though. - - In case QNetworkProxy::user() and QNetworkProxy::password() are set, these credentials - will be automatically used for proxy authentication. It is up to the user to provide valid - credentials, since there is no error handling callback. - - If no credentials are set with QNetworkProxy, but the proxy requires authentication, - QWebEnginePage::proxyAuthenticationRequired is emitted. - For Qt Quick, a dialog is shown. - - Not all properties of QNetworkProxy are supported by \QWE. That is, - QNetworkProxy::type(), QNetworkProxy::hostName() and QNetworkProxy::port() are taken into - account. All other proxy settings such as QNetworkProxy::rawHeader() are ignored. - - \section1 High DPI Support - - To support High DPI devices, it is recommended that the application attribute - Qt::AA_EnableHighDpiScaling is set to enable automatic scaling based on the - pixel density of the monitor. In \QWE applications, the scaling - affects the default zooming factor and scrollbar size. - - For example: - - \code - int main(int argc, char *argv[]) - { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication app(argc, argv); - // ... - } - \endcode - - \QWE bundles images for normal and high-dpi resolutions into - \e qtwebengine_resources_100p.pak and \e qtwebengine_resources_200p.pak - files. Depending on the target resolutions, one or both of these files need - to be deployed. - - For more information, see \l{High DPI Displays}. - - \section1 Using WebEngine Core - - \QWE Core provides an API shared by \QWE and \QWE Widgets for handling - URL requests issued for the networking stack of Chromium and for accessing its HTTP cookies. - - Implementing the QWebEngineUrlRequestInterceptor interface and installing the interceptor on a - profile enables intercepting, blocking, and modifying URL requests (QWebEngineUrlRequestInfo) - before they reach the networking stack of Chromium. - - A QWebEngineUrlSchemeHandler can be registered for a profile to add support for custom URL - schemes. Requests for the scheme are then issued to QWebEngineUrlSchemeHandler::requestStarted() - as QWebEngineUrlRequestJob objects. - - The QWebEngineCookieStore class provides functions for accessing HTTP cookies of Chromium. - The functions can be used to synchronize cookies with QNetworkAccessManager, as well as to set, - delete, and intercept cookies during navigation. - - \section1 Platform Notes - - \QWE currently supports only Windows, Linux, and \macos. Due to Chromium build - requirements it also often requires a newer compiler than the rest of Qt. See - \l{Qt WebEngine Platform Notes} for further details. - - \section1 Related Modules - - \QWE supersedes the \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit} - module, which is based on the - WebKit project, but has not been actively synchronized with the upstream WebKit code since - Qt 5.2 and has been deprecated in Qt 5.5. For tips on how to change a Qt \WebKit widgets - application to use \QWE widgets, see \l{Porting from Qt WebKit to Qt WebEngine}. - - The \l{Qt WebView} module allows to use a native web browser on platforms where one is - available. - - The \l{Qt WebChannel} module can be used to create a bi-directional communication channel - between QObject objects on the C++ side and JavaScript on the QML side. - -*/ diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc deleted file mode 100644 index 5b7d750ff..000000000 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-platform-notes.html - \title Qt WebEngine Platform Notes - - \brief Contains information about issues that are specific to the \QWE module. - - \section1 Building \QWE from Source - - Static builds are not supported. - - The requirements for building Qt 5 modules from source are listed separately for each supported - platform: - - \list - \li \l{Qt for Windows - Requirements} - \li \l{Qt for X11 Requirements} - \li \l{Qt for macOS - Building from Source} - \endlist - - In addition, the following tools are required for building the \l {Qt WebEngine} module: - - \list - \li \l {All Platforms} - \li \l {Windows} - \li \l {Linux} - \li \l {macOS} - \endlist - - The tests for skipping the \QWE build are located in the - \c qtwebengine repository, in the \c tools\qmake\mkspecs subdirectory. - They can be found by searching for \c skipBuild. - - \section2 All Platforms - - On all platforms, the following tools are required: - - \list - \li \l Python 2.7.5 or later. Python 3 is not supported. - \li Bison, Flex - \li GPerf - \endlist - - \section2 Windows - - On Windows, the following additional tools are required: - - \list - \li Visual Studio 2017 version 15.8 or later - \li Windows 10 SDK - \endlist - - \QWE can only be built on 64-bit Windows, with a x64-bit toolchain. - For building \QWE for x86 applications, you need to configure - and compile Qt with the Visual Studio 2017 x64 to x86 cross-compile - toolchain. This toolchain can be set up on the command line by running - \c{vcvarsall.bat amd64_x86}. - - \section2 Linux - - On Linux, Clang or GCC version 5 or later is required. - Supported configurations are \c linux-g++ and \c{linux-clang}. - - \QWE requires \c pkg-config to detect most of its dependencies. The - following \c pkg-config files are required: - - \list - \li \c dbus-1 - \li \c fontconfig - \endlist - - If Qt was configured for \c xcb, the following \c pkg-config files are also - required: - - \list - \li \c libdrm - \li \c xcomposite - \li \c xcursor - \li \c xi - \li \c xrandr - \li \c xscrnsaver - \li \c xtst - \endlist - - Further, development packages for \c khr and \c libcap need to be installed. - - \section2 \macos - - On \macos, the following are required: - - \list - \li \macos 10.12 or later - \li Xcode 8.3.3 or later - \li \macos 10.12 SDK or later - \endlist - - \note \QWE cannot be built for the 32-bit mode of \macos (using the - \c macx-clang-32 \c mkspec). - - \section1 Using Earlier Qt Versions to Build \QWE - - Building \QWE with earlier Qt versions (down to the last LTS - version) is supported. It means that \QWE 5.11 can be built with - Qt 5.9.x, Qt 5.10.x, and Qt 5.11. - - To use an earlier Qt version to build Qt Webengine: - - \list 1 - \li Download the qtwebengine sources. - \li From the earlier Qt version, run - \c {qmake && make (&& make install)}. - \endlist - - \section1 Mac App Store Compatibility - - Applications using \QWE are not compatible with the Mac App Store, because: - - \list - \li The Chromium part of the code uses several private API methods, which are prohibited by - the App Store. - \li Applications submitted to the App Store must be code-signed with the App Sandbox feature - enabled. The App Sandbox feature interferes with Chromium's own sandbox - initialization, which results in Chromium not being properly initialized. This also - ties in with the private API usage. Furthermore, standalone Chromium itself is not - officially tested with the App Sandbox enabled, and even if work is done to bypass - the App Store's restrictions, that would not guarantee correct behavior of the library. - - \endlist - - \section1 macOS Airplay Support on MacBooks with Dual GPUs - - To make \QWE work correctly when streaming to an AppleTV from a MacBook that supports - GPU switching, it is important to add the \c NSSupportsAutomaticGraphicsSwitching option to the - application Info.plist file, with the value set to \c YES. Otherwise rendering issues might - occur when creating new web engine view instances after Airplay is switched on or off. - - \section1 Default QSurfaceFormat OpenGL Profile Support - - If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set - before the application instance is declared, to make sure that all created OpenGL contexts use - the same OpenGL profile. - - On \macos, if the default QSurfaceFormat is set after the application instance, the application - will exit with qFatal(), and print a message that the default QSurfaceFormat should be set - before the application instance. - - \section1 Sandboxing Support - - \QWE provides out-of-the-box sandboxing support for Chromium render processes on Linux - and \macos. Sandboxing is currently not supported on Windows due to a limitation in how - the sandbox is set up and how it interacts with the host process provided by the \QWE - libraries. - - On \macos, there are no special requirements for enabling sandbox support. - - On Linux, the kernel has to support the anonymous namespaces feature (kernel version >= 3.8) - and seccomp-bpf feature (kernel version >= 3.5). Setuid sandboxes are not supported and are thus - disabled. - - To explicitly disable sandboxing, the \c QTWEBENGINE_DISABLE_SANDBOX environment variable can be - set to 1 or alternatively the \c{--no-sandbox} command line argument can be passed to the user - application executable. - - \section1 Accessibility and Performance - - \QWE enables accessibility support for web pages when the following conditions - are met: - - \list - \li Qt Core is configured and built with accessibility support enabled. - \li The QPA plugin is notified by the operating system that accessibility should be - activated. This happens for example when using a screen reader application on Windows - or VoiceOver on \macos. - \endlist - - Due to some limitations, the Linux QPA plugin almost always reports that accessibility should - be activated. On big HTML pages, this can cause a significant slowdown in rendering speed. - - Because of that, from Qt 5.9 onwards, \QWE accessibility support is disabled by default - on Linux. - It can be re-enabled by setting the \c QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY environment - variable to a non-empty value. - - \section1 Popups in Fullscreen Applications on Windows - Because of a limitation in the Windows compositor, applications that show a fullscreen web - engine view will not properly display popups or other top-level windows. The reason and - workaround for the issue can be found at \l {Fullscreen OpenGL Based Windows} and - \l {QWindowsWindowFunctions::setHasBorderInFullScreen}. - -*/ diff --git a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc deleted file mode 100644 index 540d74035..000000000 --- a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \qmlmodule QtWebEngine 1.9 - \title Qt WebEngine QML Types - \brief Provides QML types for rendering web content within a QML application. - \ingroup qtwebengine-modules - \ingroup qmlmodules - - The QML types can be imported into your application using the following import statements in - your .qml file: - - \badcode - import QtWebEngine 1.9 - \endcode - - To link against the module, add the following QT variable to your qmake .pro - file: - - \badcode - QT += webengine - \endcode -*/ diff --git a/src/webengine/doc/src/qwebengine-licensing.qdoc b/src/webengine/doc/src/qwebengine-licensing.qdoc deleted file mode 100644 index 8795ca44c..000000000 --- a/src/webengine/doc/src/qwebengine-licensing.qdoc +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\contentspage qtwebengine-licensing.html -\group qtwebengine-licensing -\title Qt WebEngine Licensing - -The Qt specific parts of the \QWE module are dual-licensed -under Commercial and GNU Lesser General Public License (LGPLv3). -In addition, the module contains code licensed under LGPLv2. - -The module includes a snapshot of Chromium. As such, users need to -respect the licenses of Chromium, and third-party code included in -Chromium. The arguably most restrictive license to be respected by -all users is LGPLv2.1. - -Third party licenses included in the sources are: -*/ - -/*! -\contentspage qtwebengine-licensing.html -\page qtwebengine-3rdparty-chromium-global.html attribution -\ingroup qtwebengine-licensing -\title Chromium License -\brief BSD - -The Google-authored portion of Chromium is released under a BSD license: - -\quotefile ../../../3rdparty/chromium/LICENSE -*/ diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc deleted file mode 100644 index 8f03774c8..000000000 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ /dev/null @@ -1,1616 +0,0 @@ -/* - * Copyright (C) 2019 The Qt Company Ltd. - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (c) 2012 Hewlett-Packard Development Company, L.P. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -// The documentation in this file was imported from QtWebKit and is thus constrained -// by its LGPL license. - -/*! - \qmltype WebEngineView - \instantiates QQuickWebEngineView - \inherits Item - \inqmlmodule QtWebEngine - \since QtWebEngine 1.0 - \brief A WebEngineView renders web content within a QML application. - - The WebEngineView type enables QML applications to render regions of dynamic web content. It - may share the screen with other QML types, such as a TabView, or fill the screen, as specified - within the QML application. - - \section2 Initializing Web Engine - - For the web engine view to be rendered, the web engine must be initialized by using - \l QtWebEngine::initialize in the application main source file, as illustrated by the - following code snippet: - - \quotefromfile webengine/minimal/main.cpp - \skipto main - \printuntil } - - \section2 Loading Web Pages - - An application can load pages into the WebEngineView, using either the \l url property or the - \l loadHtml method and navigate within the view's session history. The GET - method is always used to load URLs. - - The history is represented by a WebEngineHistory data model that is held by - the \l navigationHistory property. - - The following sample QML application loads a web page using the \c url property: - - \quotefromfile webengine/minimal/main.qml - \skipto import - \printuntil /^\}/ - - The \l loading property holds whether an HTML page is currently loading. - The \l loadingChanged() signal is emitted when loading the page begins, ends, or fails. - - The title of an HTML page can be accessed with the \l title property. Additionally, a web - page may specify an icon, which can be accessed using the \l icon property. The \l zoomFactor - property enables zooming the contents of the web page by a scale factor. - - If a certificate error is raised while loading a web page, the \l certificateError() signal is - emitted. Certificate errors are handled by using the methods of the WebEngineCertificateError - type. - - \section2 Interaction - - By default, links to different pages load within the same WebEngineView object, but web sites - may request them to be opened as a new tab, window, or dialog. The \l newViewRequested() signal - is emitted when a request to load the page in a separate web engine view is issued. The - NewViewDestination property describes how the new view should be opened. In addition, the - WebEngineNewViewRequest utility type can be used to load web pages in separate web engine views. - - The \l findText() method can be used to search for a string on a web page, using the options - described by \l FindFlags. - - The \l setActiveFocusOnPress() method can be used to create a UI element that should not get - focus on press. This can be useful in a hybrid UI. - - The \l {WebEngineSettings::focusOnNavigationEnabled} {focusOnNavigationEnabled} setting can be - used to make the view automatically receive focus when a navigation operation occurs - (like loading or reloading a page or navigating through history). - - The \l linkHovered() signal is emitted when a mouse pointer passes over a link and thus - corresponds to the \c{mouseover} DOM event. - - Actions, such as selecting and editing content, can be performed on a web page by using the - \l triggerWebAction() method. The available actions are described by the \l WebAction property. - - The \l backgroundColorChanged() signal is emitted when the web page background color changes. - - \section2 User Scripts - - During the loading of a page, so called \e {user scripts} can be injected in the JavaScript - engine at different points. The script objects attached to the web engine view are held by the - \l userScripts property and injected by using the WebEngineScript type. Scripts can also be run - by using the runJavaScript() method in the same world as other scripts that are part of the - loaded site. - - The \l webChannel property can be used to expose a WebChannel instance in the JavaScript context - of the page it is rendering as \c qt.webChannelTransport. - - \section2 Fullscreen Mode - - A web page can request through the JavaScript API to be loaded in fullscreen mode. The - \l fullScreenRequested() signal is emitted when the web page issues the request. The - FullScreenRequest utility type can be used to toggle fullscreen requests. The - \l fullScreenCancelled method can be used to notify the browser engine when the windowing - system forces the application to leave fullscreen mode. - - \section2 Profiles - - Web engine views can be isolated from each other by using the WebEngineProfile type. A profile - contains settings, scripts, and the list of visited links shared by all views that belong to the - profile. For example, a dedicated profile could be created for a \e {private browsing} mode. The - current profile for the view is held by the \l profile property and the current settings are - held by the \l settings property. The settings are specified by using the WebEngineSettings - type. - - \section2 Platform Features - - Web pages can request access to platform features, such as geolocation or audio and video - capture devices. The \l featurePermissionRequested() signal is emitted when a web page requests - to make use of a resource. The supported platform features are described by the \l Feature - property. If users grant the permission, the \l grantFeaturePermission() method is used to set - it to \e granted. - - \section2 Rendering to OpenGL Surface - - When using a QQuickRenderControl to render a Qt Quick user interface to an OpenGL surface, the - WebEngineView type is not rendered correctly. The web engine view attempts to use a global - OpenGL context created by \l QtWebEngine::initialize, but there is no public API for accessing - that context in order to share it with the \c QQuickRenderControl context. - - To have the web engine view rendered correctly, it is possible to manually create a new - offscreen context that is shared with the \c QQuickRenderControl and to call the non-public - function \c qt_gl_set_global_share_context(), rather than calling \c initialize(). - If \c initialize() is called after setting a global context, it will do nothing. -*/ - -/*! - \qmlmethod void WebEngineView::goBack() - - Go backward within the browser's session history, if possible. - This function is equivalent to the \c{window.history.back()} DOM method. - - \sa canGoBack -*/ - -/*! - \qmlmethod void WebEngineView::goForward() - - Go forward within the browser's session history, if possible. - This function is equivalent to the \c{window.history.forward()} DOM method. -*/ - -/*! - \qmlmethod void WebEngineView::goBackOrForward(int offset) - \since QtWebEngine 1.1 - - If \a offset is positive, goes forward the specified number of offset - pages in the current session history. If offset is negative, it goes - back. If the offset is invalid, the page is not changed. - - \sa goBack(), goForward() -*/ - -/*! - \qmlmethod void WebEngineView::stop() - - Stops loading the current page. -*/ - -/*! - \qmlmethod void WebEngineView::reload() - - Reloads the current page. This function is equivalent to the - \c{window.location.reload()} DOM method. - - \sa reloadAndBypassCache() -*/ - -/*! - \qmlmethod void WebEngineView::reloadAndBypassCache() - \since QtWebEngine 1.1 - - Reloads the current page, ignoring any cached content. - - \sa reload() -*/ - -/*! - \qmlproperty url WebEngineView::url - - The location of the currently displayed HTML page. This writable - property offers the main interface to load a page into a web view. - It functions the same as the \c{window.location} DOM property. - - \sa loadHtml() -*/ - -/*! - \qmlproperty url WebEngineView::icon - \readonly - - An internal URL for accessing the currently displayed web site icon, - also known as favicon or shortcut icon. The icon is already downloaded - and stored by the \QWE's favicon manager. - This read-only URL corresponds to the image used within a mobile browser - application to represent a bookmarked page on the device's home screen. - - The following snippet uses the \c{icon} property to build an \c{Image} - component: - - \qml - Image { - id: appIcon - sourceSize: Qt.size(32, 32) - source: webView.icon != "" ? webView.icon : "fallbackFavicon.png"; - // ... - } - \endqml - - Specifying the \c{sourceSize} property of the \c{Image} element informs - the \QWE's favicon provider about the requested size. The - favicon provider tries to find the best fit among the web page candidate - icons. If \c{sourceSize} property is not specified, the provider provides - the icon with the largest resolution. -*/ - -/*! - \qmlproperty int WebEngineView::loadProgress - \readonly - - The amount of data from the page that has been loaded, expressed - as an integer percentage in the range from \c{0} to \c{100}. -*/ - -/*! - \qmlproperty bool WebEngineView::canGoBack - \readonly - - Returns \c{true} if there are prior session history entries, \c{false} - otherwise. -*/ - -/*! - \qmlproperty bool WebEngineView::canGoForward - \readonly - - Returns \c{true} if there are subsequent session history entries, - \c{false} otherwise. -*/ - -/*! - \qmlproperty bool WebEngineView::loading - \readonly - - Returns \c{true} if the HTML page is currently loading, \c{false} otherwise. -*/ - -/*! - \qmlproperty string WebEngineView::title - \readonly - - The title of the currently displayed HTML page. This is a - read-only value that reflects the contents of the \c{<title>} tag. -*/ - -/*! - \qmlproperty bool WebEngineView::isFullScreen - \since QtWebEngine 1.1 - \readonly - - Returns \c{true} if the web view is in fullscreen mode, \c{false} otherwise. - - \sa fullScreenRequested(), fullScreenCancelled() -*/ - -/*! - \qmlproperty WebEngineHistory WebEngineView::navigationHistory - \since QtWebEngine 1.1 - \readonly - - The navigation history of the current view. - - \sa WebEngineHistory -*/ - -/*! - \qmlproperty QQmlWebChannel WebEngineView::webChannel - \since QtWebEngine 1.1 - - The web channel instance used by this view. - This channel is automatically using the internal QtWebEngine transport mechanism over Chromium IPC, - and exposed in the javascript context of the page it is rendering as \c qt.webChannelTransport. - This transport object is used when instantiating the JavaScript counterpart of QWebChannel using - the \l{Qt WebChannel JavaScript API}. - - \note The view does not take ownership for an assigned webChannel object. -*/ - -/*! - \qmlproperty WebEngineProfile WebEngineView::profile - \since QtWebEngine 1.1 - - The current profile used for the view. - - \sa WebEngineProfile -*/ - -/*! - \qmlproperty WebEngineSettings WebEngineView::settings - \readonly - \since QtWebEngine 1.1 - - Settings used by this view. - - \sa WebEngineSettings -*/ - - -/*! - \qmlproperty list<WebEngineScript> WebEngineView::userScripts - \readonly - \since QtWebEngine 1.1 - - List of script objects attached to the view. - - \sa WebEngineScript -*/ - -/*! - \qmlproperty real WebEngineView::zoomFactor - \since QtWebEngine 1.1 - - Zoom factor for the view. Valid values are within the range from \c{0.25} - to \c{5.0}. The default factor is \c{1.0}. -*/ - -/*! - \qmlproperty size WebEngineView::contentsSize - \since QtWebEngine 1.3 - - Size of the page contents. -*/ - -/*! - \qmlproperty point WebEngineView::scrollPosition - \since QtWebEngine 1.3 - - Scroll position of the page contents. -*/ - -/*! - \qmlproperty int WebEngineView::webChannelWorld - \since QtWebEngine 1.3 - - JavaScript world that the web channel instance used by this view is - installed in. The world must be a number between \c 0 and \c 256. -*/ - -/*! - \qmlmethod void WebEngineView::loadHtml(string html, url baseUrl) - Loads the specified \a html as the content of the web view. - - This method offers a lower-level alternative to the \c{url} property, - which references HTML pages via URL. - - External objects, such as stylesheets or images referenced in the HTML - document, should be located relative to \a baseUrl. For external objects to - be loaded, \c baseUrl cannot be empty. For example, if \a html - is retrieved from \c http://www.example.com/documents/overview.html, which - is the base URL, then an image referenced with the relative URL, \c diagram.png, - should be at \c{http://www.example.com/documents/diagram.png}. - - \sa url -*/ - -/*! - \qmlmethod void WebEngineView::runJavaScript(string script, variant callback) - Runs the specified \a script in the content of the web view. - - The \a callback parameter is optional. If a callback function is provided, - it will be invoked after the script finishes running. - - \code - runJavaScript("document.title", function(result) { console.log(result); }); - \endcode - - Only "plain data" can be returned from JavaScript as the result value. - Supported data types include all of the JSON data types as well as, for - example, \c{Date} and \c{ArrayBuffer}. Unsupported data types include, for - example, \c{Function} and \c{Promise}. - - The script will run in the same \e world as other scripts that are - part of the loaded site. - - \warning Do not execute lengthy routines in the callback function, because it might block the - rendering of the web content. - - See WebEngineView::userScripts for an alternative API to inject scripts. -*/ - -/*! - \qmlmethod void WebEngineView::findText(string subString) - \since QtWebEngine 1.1 - Finds the specified string, \a subString, in the page. - The findTextFinished() signal is emitted when a string search is completed. - - To clear the search highlight, just pass an empty string. - - \sa findTextFinished() -*/ - -/*! - \qmlmethod void WebEngineView::findText(string subString, FindFlags options) - \since QtWebEngine 1.1 - Finds the specified string, \a subString, in the page, using the given \a options. - The findTextFinished() signal is emitted when a string search is completed. - - To clear the search highlight, just pass an empty string. - - \code - findText("Qt", WebEngineView.FindBackward | WebEngineView.FindCaseSensitively); - \endcode - - \sa findTextFinished() -*/ - -/*! - \qmlmethod void WebEngineView::findText(string subString, FindFlags options, variant resultCallback) - \since QtWebEngine 1.1 - Finds the specified string, \a subString, in the page, using the given \a options. - The findTextFinished() signal is emitted when a string search is completed. - - To clear the search highlight, just pass an empty string. - - The \a resultCallback must take a boolean parameter. It will be called with - a value of true if the \a subString was found; otherwise the callback value - will be false. - - \code - findText("Qt", WebEngineView.FindCaseSensitively, function(success) { - if (success) - console.log("Qt was found!"); - }); - \endcode - - \sa findTextFinished() -*/ - -/*! - \qmlmethod void WebEngineView::grantFeaturePermission(url securityOrigin, Feature feature, bool granted) - \since QtWebEngine 1.1 - - Sets or unsets the permission, depending on \a granted, for the web site - identified by \a securityOrigin to use \a feature. - - \sa featurePermissionRequested() -*/ - - -/*! - \qmlmethod void WebEngineView::fullScreenCancelled() - \since QtWebEngine 1.1 - - Immediately sets \c{isFullScreen} property to \c{false}. It can be used to notify the - browser engine when the windowing system forces the application to leave fullscreen mode. - - \qml - ApplicationWindow { - onVisibilityChanged: { - if (webEngineView.isFullScreen && visibility != Window.FullScreen) - webEngineView.fullScreenCancelled() - } - - WebEngineView { - id: webEngineView - // ... - } - } - \endqml - - \sa isFullScreen, fullScreenRequested() -*/ - -/*! - \qmlmethod void WebEngineView::setActiveFocusOnPress(bool arg) - \since QtWebEngine 1.2 - - Sets active focus to a clicked web engine view if \a arg is \c true. By setting it to \c false, - a web engine view can be used to create a UI element that should not get focus. This can be - useful in a hybrid UI. - - \sa activeFocusOnPress, activeFocusOnPressChanged, - WebEngineSettings::focusOnNavigationEnabled -*/ - -/*! - \qmlmethod void WebEngineView::triggerWebAction(WebAction action) - \since QtWebEngine 1.2 - - Triggers the web action \a action. - - \sa WebAction -*/ - -/*! - \qmlsignal WebEngineView::featurePermissionRequested(url securityOrigin, Feature feature) - \since QtWebEngine 1.1 - - This signal is emitted when the web site identified by \a securityOrigin requests - to make use of the resource or device identified by \a feature. - - \sa grantFeaturePermission() -*/ - -/*! - \qmlsignal WebEngineView::loadingChanged(WebEngineLoadRequest loadRequest) - - This signal is emitted when a page load begins, ends, or fails. - - When handling the signal with \c onLoadingChanged, various read-only - parameters are available on the WebEngineLoadRequest specified by - \a loadRequest. - - \sa loading, LoadStatus, ErrorDomain -*/ - -/*! - \qmlsignal WebEngineView::certificateError(WebEngineCertificateError error) - \since QtWebEngine 1.1 - - This signal is emitted when an invalid certificate error, \a error, is - raised while loading a given request. - - The certificate error can be handled by using the methods of the WebEngineCertificateError - type. -*/ - -/*! - \qmlsignal WebEngineView::linkHovered(url hoveredUrl) - - Within a mouse-driven interface, this signal is emitted when a mouse - pointer passes over a link, corresponding to the \c{mouseover} DOM - event. This event may also occur in touch interfaces for \c{mouseover} - events that are not cancelled with \c{preventDefault()}. \a{hoveredUrl} - provides the link's location. -*/ - -/*! - \qmlsignal WebEngineView::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, string message, int lineNumber, string sourceID) - This signal is emitted when a JavaScript program tries to print a \a message to the web browser's console. - - For example, in case of evaluation errors the source URL may be provided in \a sourceID as well - as the \a lineNumber. - - \a level indicates the severity of the event that triggered the message, that is, whether it - was triggered by an error or a less severe event. - - If no handler is specified, the view will log the messages into a \c js - \l{QLoggingCategory}{logging category}. - - \sa{Console Logging} -*/ - -/*! - \qmlsignal WebEngineView::newViewRequested(WebEngineNewViewRequest request) - \since QtWebEngine 1.1 - - This signal is emitted when \a request is issued to load a page in a separate - web engine view. This can either be because the current page requested it explicitly - through a JavaScript call to \c window.open, or because the user clicked on a link - while holding Shift, Ctrl, or a built-in combination that triggers the page to open - in a new window. - - If this signal is not handled, the requested load will fail. - - An example implementation: - - \snippet snippets/qtwebengine_webengineview_newviewrequested.qml 0 - - \sa NewViewDestination, {WebEngine Quick Nano Browser} -*/ - -/*! - \qmlsignal WebEngineView::fullScreenRequested(FullScreenRequest request) - \since QtWebEngine 1.1 - - This signal is emitted when the web page issues the \a request for - fullscreen mode through the JavaScript API. - - \sa isFullScreen -*/ - -/*! - \qmlsignal WebEngineView::activeFocusOnPressChanged(bool activeFocusOnPress) - \since QtWebEngine 1.2 - - This signal is emitted when the value of \a activeFocusOnPress changes. - It specifies whether the view should gain active focus when pressed. - - \sa activeFocusOnPress, setActiveFocusOnPress() -*/ - -/*! - \qmlsignal WebEngineView::backgroundColorChanged() - \since QtWebEngine 1.2 - - This signal is emitted when the web engine view background color changes. -*/ - -/*! - \qmlsignal WebEngineView::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) - - \since QtWebEngine 1.2 - - This signal is emitted when the render process is terminated with a non-zero exit status. - \a terminationStatus is the termination status of the process and \a exitCode is the status code - with which the process terminated. - - \sa RenderProcessTerminationStatus -*/ - -/*! - \qmlsignal WebEngineView::windowCloseRequested() - \since QtWebEngine 1.2 - - This signal is emitted whenever the page requests the web browser window to be closed, - for example through the JavaScript \c{window.close()} call. -*/ - -/*! - \qmlproperty enumeration WebEngineView::ErrorDomain - - Describes various high-level error types: - - \value WebEngineView.NoErrorDomain - \value WebEngineView.InternalErrorDomain - Content fails to be interpreted by \QWE. - \value WebEngineView.ConnectionErrorDomain - Error results from faulty network connection. - \value WebEngineView.CertificateErrorDomain - Error related to the SSL/TLS certificate. - \value WebEngineView.HttpErrorDomain - Error related to the HTTP connection. - \value WebEngineView.FtpErrorDomain - Error related to the FTP connection. - \value WebEngineView.DnsErrorDomain - Error related to the DNS connection. -*/ - -/*! - \qmlproperty enumeration WebEngineView::JavaScriptConsoleMessageLevel - - Indicates the severity of a JavaScript console message: - - \value WebEngineView.InfoMessageLevel - Message is purely informative and can safely be ignored. - \value WebEngineView.WarningMessageLevel - Message indicates there might be a problem that may need attention. - \value WebEngineView.ErrorMessageLevel - Message indicates there has been an error. -*/ - -/*! - \qmlproperty enumeration WebEngineView::LoadStatus - - Reflects a page's load status: - - \value WebEngineView.LoadStartedStatus - Page is currently loading. - \value WebEngineView.LoadStoppedStatus - Loading the page was stopped by the stop() method or by the loader - code or network stack in Chromium. - \value WebEngineView.LoadSucceededStatus - Page has successfully loaded, and is not currently loading. - \value WebEngineView.LoadFailedStatus - Page has failed to load, and is not currently loading. -*/ - -/*! - \qmlproperty enumeration WebEngineView::NewViewDestination - - Describes how to open a new view: - - \value WebEngineView.NewViewInWindow - In a separate Window. - \value WebEngineView.NewViewInTab - In a tab of the same window. - \value WebEngineView.NewViewInDialog - In a Window without a tab bar, toolbar, or URL bar. - \value WebEngineView.NewViewInBackgroundTab - In a tab of the same window, without hiding the currently visible web engine view. - - \sa {WebEngineNewViewRequest::destination}{WebEngineNewViewRequest.destination} -*/ - -/*! - \qmlproperty enumeration WebEngineView::FindFlags - - Describes the options available to the findText() function. The options - can be OR-ed together from the following list: - - \value WebEngineView.FindBackward - Searches backwards instead of forwards. - \value WebEngineView.FindFlags FindCaseSensitively - By default findText() works case insensitive. Specifying - this option changes the behavior to a case sensitive find operation. - - \sa findText() -*/ - -/*! - \qmlproperty enumeration WebEngineView::RenderProcessTerminationStatus - \since QtWebEngine 1.2 - - Describes the status with which the render process terminated: - - \value WebEngineView.NormalTerminationStatus - The render process terminated normally. - \value WebEngineView.AbnormalTerminationStatus - The render process terminated with a non-zero exit status. - \value WebEngineView.CrashedTerminationStatus - The render process crashed, for example because of a segmentation fault. - \value WebEngineView.KilledTerminationStatus - The render process was killed, for example by \c SIGKILL or task manager kill. -*/ - -/*! - \qmlproperty enumeration WebEngineView::WebAction - \since QtWebEngine 1.2 - - Describes the types of action that can be performed on a web page: - - \value WebEngineView.NoWebAction - No action is triggered. - \value WebEngineView.Back - Navigate back in the history of navigated links. - \value WebEngineView.Forward - Navigate forward in the history of navigated links. - \value WebEngineView.Stop - Stop loading the current page. - \value WebEngineView.Reload - Reload the current page. - \value WebEngineView.ReloadAndBypassCache - Reload the current page, but do not use any local cache. - \value WebEngineView.Cut - Cut the content currently selected into the clipboard. - \value WebEngineView.Copy - Copy the content currently selected into the clipboard. - \value WebEngineView.Paste - Paste content from the clipboard. - \value WebEngineView.Undo - Undo the last editing action. - \value WebEngineView.Redo - Redo the last editing action. - \value WebEngineView.SelectAll - Select all content. - This action is only enabled when the page's content is focused. - The focus can be forced by the JavaScript \c{window.focus()} call, or the - \l{WebEngineSettings::focusOnNavigationEnabled} {focusOnNavigationEnabled} setting - should be enabled to get automatic focus. - \value WebEngineView.PasteAndMatchStyle - Paste content from the clipboard with current style. - \value WebEngineView.OpenLinkInThisWindow - Open the current link in the current window. (Added in Qt 5.6) - \value WebEngineView.OpenLinkInNewWindow - Open the current link in a new window. Requires a handler for the - \l newViewRequested() signal. (Added in Qt 5.6) - \value WebEngineView.OpenLinkInNewTab - Open the current link in a new tab. Requires a handler for the - \l newViewRequested() signal. (Added in Qt 5.6) - \value WebEngineView.CopyLinkToClipboard - Copy the current link to the clipboard. (Added in Qt 5.6) - \value WebEngineView.CopyImageToClipboard - Copy the clicked image to the clipboard. (Added in Qt 5.6) - \value WebEngineView.CopyImageUrlToClipboard - Copy the clicked image's URL to the clipboard. (Added in Qt 5.6) - \value WebEngineView.CopyMediaUrlToClipboard - Copy the hovered audio or video's URL to the clipboard. (Added in Qt 5.6) - \value WebEngineView.ToggleMediaControls - Toggle between showing and hiding the controls for the hovered audio or video element. - (Added in Qt 5.6) - \value WebEngineView.ToggleMediaLoop - Toggle whether the hovered audio or video should loop on completetion or not. - (Added in Qt 5.6) - \value WebEngineView.ToggleMediaPlayPause - Toggle the play/pause state of the hovered audio or video element. (Added in Qt 5.6) - \value WebEngineView.ToggleMediaMute - Mute or unmute the hovered audio or video element. (Added in Qt 5.6) - \value WebEngineView.DownloadLinkToDisk - Download the current link to the disk. To implement download - actions, connect to the \l {QQuickWebEngineProfile::downloadRequested} - {WebEngineProfile.downloadRequested} signal. (Added in Qt 5.6) - \value WebEngineView.DownloadImageToDisk - Download the highlighted image to the disk. (Added in Qt 5.6) - \value WebEngineView.DownloadMediaToDisk - Download the hovered audio or video to the disk. (Added in Qt 5.6) - \value WebEngineView.InspectElement - Trigger any attached Web Inspector to inspect the highlighed element. - (Added in Qt 5.6) - \value WebEngineView.ExitFullScreen - Exit the fullscreen mode. (Added in Qt 5.6) - \value WebEngineView.SavePage - Save the current web page to disk. (Added in Qt 5.7) - \value WebEngineView.ViewSource - Show the source of the current page in a new tab. Requires a handler for the - \l newViewRequested() signal. (Added in Qt 5.8) - - \value WebEngineView.ToggleBold - Toggles boldness for the selection or at the cursor position. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.ToggleItalic - Toggles italics for the selection or at the cursor position. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.ToggleUnderline - Toggles underlining of the selection or at the cursor position. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.ToggleStrikethrough - Toggles striking through the selection or at the cursor position. - Requires \c contenteditable="true". (Added in Qt 5.10) - - \value WebEngineView.AlignLeft - Aligns the lines containing the selection or the cursor to the left. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.AlignCenter - Aligns the lines containing the selection or the cursor at the center. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.AlignRight - Aligns the lines containing the selection or the cursor to the right. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.AlignJustified - Stretches the lines containing the selection or the cursor so that each - line has equal width. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.Indent - Indents the lines containing the selection or the cursor. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.Outdent - Outdents the lines containing the selection or the cursor. - Requires \c contenteditable="true". (Added in Qt 5.10) - - \value WebEngineView.InsertOrderedList - Inserts an ordered list at the current cursor position, deleting the current selection. - Requires \c contenteditable="true". (Added in Qt 5.10) - \value WebEngineView.InsertUnorderedList - Inserts an unordered list at the current cursor position, - deleting the current selection. - Requires \c contenteditable="true". (Added in Qt 5.10) - \omitvalue WebActionCount -*/ - -/*! - \qmlproperty enumeration WebEngineView::Feature - - Describes the platform feature access categories that the user may be asked to grant or deny - access to: - - \value WebEngineView.Geolocation - Location hardware or service. - \value WebEngineView.MediaAudioCapture - Audio capture devices, such as microphones. - \value WebEngineView.MediaVideoCapture - Video devices, such as cameras. - \value WebEngineView.MediaAudioVideoCapture - Both audio and video capture devices. - \value DesktopVideoCapture - Video output capture, that is, the capture of the user's display. - (Added in Qt 5.10) - \value DesktopAudioVideoCapture - Both audio and video output capture. (Added in Qt 5.10) - \value WebEnginView.Notifications - Web notifications for the end-user. - - \sa featurePermissionRequested(), grantFeaturePermission() -*/ - -/*! - \qmlproperty enumeration WebEngineView::PrintedPageSizeId - \since QtWebEngine 1.3 - - This enum type lists the available page sizes as defined in the Postscript - PPD standard. - - The enumeration values are mapped from and must match QPageSize::PageSizeId. They are also - duplicated in QPagedPaintDevice and QPrinter. - - The defined sizes are: - - \value WebEngineView.A0 841 x 1189 mm - \value WebEngineView.A1 594 x 841 mm - \value WebEngineView.A2 420 x 594 mm - \value WebEngineView.A3 297 x 420 mm - \value WebEngineView.A4 210 x 297 mm, 8.26 x 11.69 inches - \value WebEngineView.A5 148 x 210 mm - \value WebEngineView.A6 105 x 148 mm - \value WebEngineView.A7 74 x 105 mm - \value WebEngineView.A8 52 x 74 mm - \value WebEngineView.A9 37 x 52 mm - \value WebEngineView.B0 1000 x 1414 mm - \value WebEngineView.B1 707 x 1000 mm - \value WebEngineView.B2 500 x 707 mm - \value WebEngineView.B3 353 x 500 mm - \value WebEngineView.B4 250 x 353 mm - \value WebEngineView.B5 176 x 250 mm, 6.93 x 9.84 inches - \value WebEngineView.B6 125 x 176 mm - \value WebEngineView.B7 88 x 125 mm - \value WebEngineView.B8 62 x 88 mm - \value WebEngineView.B9 44 x 62 mm - \value WebEngineView.B10 31 x 44 mm - \value WebEngineView.C5E 163 x 229 mm - \value WebEngineView.Comm10E 105 x 241 mm, U.S. Common 10 Envelope - \value WebEngineView.DLE 110 x 220 mm - \value WebEngineView.Executive 7.5 x 10 inches, 190.5 x 254 mm - \value WebEngineView.Folio 210 x 330 mm - \value WebEngineView.Ledger 431.8 x 279.4 mm - \value WebEngineView.Legal 8.5 x 14 inches, 215.9 x 355.6 mm - \value WebEngineView.Letter 8.5 x 11 inches, 215.9 x 279.4 mm - \value WebEngineView.Tabloid 279.4 x 431.8 mm - \value WebEngineView.Custom Unknown, or a user defined size. - \value WebEngineView.A10 - \value WebEngineView.A3Extra - \value WebEngineView.A4Extra - \value WebEngineView.A4Plus - \value WebEngineView.A4Small - \value WebEngineView.A5Extra - \value WebEngineView.B5Extra - \value WebEngineView.JisB0 - \value WebEngineView.JisB1 - \value WebEngineView.JisB2 - \value WebEngineView.JisB3 - \value WebEngineView.JisB4 - \value WebEngineView.JisB5 - \value WebEngineView.JisB6 - \value WebEngineView.JisB7 - \value WebEngineView.JisB8 - \value WebEngineView.JisB9 - \value WebEngineView.JisB10 - \value WebEngineView.AnsiA = \c Letter - \value WebEngineView.AnsiB = \c Ledger - \value WebEngineView.AnsiC - \value WebEngineView.AnsiD - \value WebEngineView.AnsiE - \value WebEngineView.LegalExtra - \value WebEngineView.LetterExtra - \value WebEngineView.LetterPlus - \value WebEngineView.LetterSmall - \value WebEngineView.TabloidExtra - \value WebEngineView.ArchA - \value WebEngineView.ArchB - \value WebEngineView.ArchC - \value WebEngineView.ArchD - \value WebEngineView.ArchE - \value WebEngineView.Imperial7x9 - \value WebEngineView.Imperial8x10 - \value WebEngineView.Imperial9x11 - \value WebEngineView.Imperial9x12 - \value WebEngineView.Imperial10x11 - \value WebEngineView.Imperial10x13 - \value WebEngineView.Imperial10x14 - \value WebEngineView.Imperial12x11 - \value WebEngineView.Imperial15x11 - \value WebEngineView.ExecutiveStandard - \value WebEngineView.Note - \value WebEngineView.Quarto - \value WebEngineView.Statement - \value WebEngineView.SuperA - \value WebEngineView.SuperB - \value WebEngineView.Postcard - \value WebEngineView.DoublePostcard - \value WebEngineView.Prc16K - \value WebEngineView.Prc32K - \value WebEngineView.Prc32KBig - \value WebEngineView.FanFoldUS - \value WebEngineView.FanFoldGerman - \value WebEngineView.FanFoldGermanLegal - \value WebEngineView.EnvelopeB4 - \value WebEngineView.EnvelopeB5 - \value WebEngineView.EnvelopeB6 - \value WebEngineView.EnvelopeC0 - \value WebEngineView.EnvelopeC1 - \value WebEngineView.EnvelopeC2 - \value WebEngineView.EnvelopeC3 - \value WebEngineView.EnvelopeC4 - \value WebEngineView.EnvelopeC5 = \c C5E - \value WebEngineView.EnvelopeC6 - \value WebEngineView.EnvelopeC65 - \value WebEngineView.EnvelopeC7 - \value WebEngineView.EnvelopeDL = \c DLE - \value WebEngineView.Envelope9 - \value WebEngineView.Envelope10 = \c Comm10E - \value WebEngineView.Envelope11 - \value WebEngineView.Envelope12 - \value WebEngineView.Envelope14 - \value WebEngineView.EnvelopeMonarch - \value WebEngineView.EnvelopePersonal - \value WebEngineView.EnvelopeChou3 - \value WebEngineView.EnvelopeChou4 - \value WebEngineView.EnvelopeInvite - \value WebEngineView.EnvelopeItalian - \value WebEngineView.EnvelopeKaku2 - \value WebEngineView.EnvelopeKaku3 - \value WebEngineView.EnvelopePrc1 - \value WebEngineView.EnvelopePrc2 - \value WebEngineView.EnvelopePrc3 - \value WebEngineView.EnvelopePrc4 - \value WebEngineView.EnvelopePrc5 - \value WebEngineView.EnvelopePrc6 - \value WebEngineView.EnvelopePrc7 - \value WebEngineView.EnvelopePrc8 - \value WebEngineView.EnvelopePrc9 - \value WebEngineView.EnvelopePrc10 - \value WebEngineView.EnvelopeYou4 - \value WebEngineView.LastPageSize = \c EnvelopeYou4 - \omitvalue NPageSize - \omitvalue NPaperSize - - \sa WebEngineView::printToPdf() -*/ - -/*! - \qmlproperty enumeration WebEngineView::PrintedPageOrientation - \since QtWebEngine 1.3 - - Describes the orientation of a PDF document that gets created from the WebEngineView's contents. - The enumeration values are mapped from and must match QPageLayout::Orientation. - - \value WebEngineView.Portrait - The document will be created using portrait orientation. - - \value WebEngineView.Landscape - The document will be created using landscape orientation. - - \sa WebEngineView::printToPdf() -*/ - -/*! - \qmlproperty bool WebEngineView::activeFocusOnPress - \since QtWebEngine 1.2 - - Specifies whether the view should gain active focus when pressed. - The default value is \c true. -*/ - -/*! - \qmlproperty bool WebEngineView::backgroundColor - \since QtWebEngine 1.2 - - Changes the color of the WebEngineView's background, behind the document's - body. Can be set to \c "transparent" or to a translucent color to see - through the document or to match the web content in a hybrid app to prevent - the white flashes that may appear during loading. - - The default value is white. -*/ - -/*! - \qmltype FullScreenRequest - \instantiates QQuickWebEngineFullScreenRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.1 - - \brief A utility type for the WebEngineView::fullScreenRequested() signal. - - \sa WebEngineView::fullScreenRequested() -*/ - -/*! - \qmlproperty url FullScreenRequest::origin - \readonly - The URL of the web page that issued the fullscreen request. -*/ - -/*! - \qmlproperty bool FullScreenRequest::toggleOn - \readonly - - Returns \c{true} if the application should toggle fullscreen mode on, \c{false} otherwise. - - \sa accept() -*/ - -/*! - \qmlmethod void FullScreenRequest::accept() - - Call this method to accept the fullscreen request. It sets the WebEngineView::isFullScreen - property to be equal to toggleOn. - - \qml - ApplicationWindow { - id: window - WebEngineView { - onFullScreenRequested: function(request) { - if (request.toggleOn) - window.showFullScreen() - else - window.showNormal() - request.accept() - } - } - } - \endqml - - \sa toggleOn -*/ - -/*! - \qmlmethod void FullScreenRequest::reject() - Rejects a fullscreen request. -*/ - -/*! - \qmlproperty bool WebEngineView::audioMuted - \brief The state of whether the current page audio is muted. - \since QtWebEngine 1.3 - \sa recentlyAudible -*/ - -/*! - \qmlsignal WebEngineView::audioMutedChanged(bool muted) - \since QtWebEngine 1.3 - - This signal is emitted when the value of \a muted changes. The value is - specified using the \l audioMuted property. - \note Not to be confused with a specific HTML5 audio / video element being muted. - - \sa audioMuted, recentlyAudibleChanged -*/ - -/*! - \qmlproperty bool WebEngineView::recentlyAudible - \brief Returns the current page's audible state (audio was recently played, or not). - \since QtWebEngine 1.3 - \readonly - \sa audioMuted, recentlyAudibleChanged -*/ - -/*! - \qmlsignal WebEngineView::recentlyAudibleChanged(bool recentlyAudible) - \since QtWebEngine 1.3 - - This signal is emitted when the page's audible state, specified by - \a recentlyAudible, is changed, due to audio being played or stopped. - - \note The signal is also emitted when the \l audioMuted property changes. - Also if the audio is paused, this signal is emitted with an approximate \b{two-second - delay}, from the moment the audio is paused. - - This signal is also emitted for Flash plugin audio. - - If a web page contains two videos that are started in sequence, this signal - gets emitted only once, for the first video to generate sound. After both - videos are stopped, the signal is emitted upon the last sound generated. - This means that the signal is emitted both when any kind of sound is - generated and when everything is completely silent within a web page, - regardless of the number of audio streams. - - Spurious signal emissions might also happen. For example, when sound is - stopped, this signal gets emitted first with a value of \c true, and then - with a value of \c false. Further, when audio starts playing, the signal is - emitted twice with a value of \c true. - - \sa recentlyAudible -*/ - -/*! - \qmlsignal WebEngineView::pdfPrintingFinished(string filePath, bool success) - \since QtWebEngine 1.5 - - This signal is emitted when printing the web page into a PDF file has - finished. - \a filePath will contain the path the file was requested to be created - at, and \a success will be \c true if the file was successfully created and - \c false otherwise. - - \sa printToPdf() -*/ - -/*! - \qmlmethod void WebEngineView::printToPdf(const string filePath, PrintedPageSizeId pageSizeId, PrintedPageOrientation orientation) - \since QtWebEngine 1.3 - - Prints the WebEngineView's current content to a PDF document and stores it - under \a filePath. The document's size will be determined by the value of - \a pageSizeId and its orientation will be determined using \a orientation. - - This method issues an asynchronous request for printing the web page into a - PDF and returns immediately. To be informed about the result of the - request, connect to the signal pdfPrintingFinished(). - - If you leave out \a pageSizeId, it defaults to \c A4. If you leave out - \a orientation, it defaults to \c Portrait. - - \sa pdfPrintingFinished() -*/ - -/*! - \qmlmethod void WebEngineView::printToPdf(variant resultCallback, PrintedPageSizeId pageSizeId, PrintedPageOrientation orientation) - \since QtWebEngine 1.3 - - Prints the WebEngineView's current content to a PDF document and returns it in a byte array. The document's size will be determined - by the value of \a pageSizeId and its orientation will be determined using \a orientation. - - The \a resultCallback must take a string parameter. This string will contain the document's data upon successful printing and an empty - string otherwise. - - If you leave out \a pageSizeId, it defaults to \c A4. If you leave out - \a orientation, it defaults to \c Portrait. -*/ - -/*! - \qmlmethod void WebEngineView::replaceMisspelledWord(const QString &replacement) - \since QtWebEngine 1.3 - - Replace the current misspelled word with \a replacement. -*/ - -/*! - \qmlsignal WebEngineView::wasRecentlyAudibleChanged(bool wasRecentlyAudible) - \since QtWebEngine 1.3 - - This signal is emitted when the page's audible state, specified by - \a wasRecentlyAudible, is changed, due to audio being played or stopped. - - \note The signal is also emitted when calling the setAudioMuted method. - Also if the audio is paused, this signal is emitted with an approximate \b{2 second - delay}, from the moment the audio is paused. -*/ - -/*! - \qmlsignal WebEngineView::authenticationDialogRequested(AuthenticationDialogRequest request) - \since QtWebEngine 1.4 - - This signal is emitted when an authentication dialog is requested. - - The \a request can be handled by using the methods of the AuthenticationDialogRequest - type. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a - default dialog from showing up. Make sure to call either - AuthenticationDialogRequest::dialogAccept() or AuthenticationDialogRequest::dialogReject() - afterwards. -*/ - -/*! - \qmlsignal WebEngineView::javaScriptDialogRequested(JavaScriptDialogRequest request) - \since QtWebEngine 1.4 - - This signal is emitted when a JavaScript dialog is requested. - - The \a request can be handled by using the methods of the JavaScriptDialogRequest - type. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a - default dialog from showing up. Make sure to call either - JavaScriptDialogRequest::dialogAccept() or JavaScriptDialogRequest::dialogReject() - afterwards. -*/ - -/*! - \qmlsignal WebEngineView::colorDialogRequested(ColorDialogRequest request) - \since QtWebEngine 1.4 - - This signal is emitted when a color picker dialog is requested. - - The \a request can be handled by using the methods of the ColorDialogRequest - type. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a - default dialog from showing up. Make sure to call either - ColorDialogRequest::dialogAccept() or ColorDialogRequest::dialogReject() afterwards. -*/ - -/*! - \qmlsignal WebEngineView::fileDialogRequested(FileDialogRequest request) - \since QtWebEngine 1.4 - - This signal is emitted when a file picker dialog is requested. - - The \a request can be handled by using the methods of the FileDialogRequest - type. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a - default dialog from showing up. Make sure to call either FileDialogRequest::dialogAccept() - or FileDialogRequest::dialogReject() afterwards. -*/ - -/*! - \qmlsignal WebEngineView::formValidationMessageRequested(FormValidationMessageRequest request) - \since QtWebEngine 1.4 - \obsolete - - No longer used since 5.11, as Blink now renders Validation messages internally. -*/ - -/*! - \qmlsignal WebEngineView::contextMenuRequested(ContextMenuRequest request) - \since QtWebEngine 1.4 - - This signal is emitted when a context menu is requested. - - The \a request can be handled by using the properties of the ContextMenuRequest - type. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a - default context menu from showing up. -*/ - -/*! \qmlsignal WebEngineView::navigationRequested(WebEngineNavigationRequest request) - This signal is emitted when the navigation request \a request is issued. -*/ - -/*! - \qmlsignal WebEngineView::quotaRequested(QuotaRequest request) - \since QtWebEngine 1.7 - - This signal is emitted when the web page issues a \a request for a larger persistent storage - than the application's current allocation in File System API. The default quota - is 0 bytes. - - \sa QuotaRequest -*/ - -/*! - \qmltype QuotaRequest - \instantiates QWebEngineQuotaRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.7 - - \brief A utility type for the WebEngineView::quotaRequested() signal. - - \sa WebEngineView::quotaRequested() -*/ - -/*! - \qmlproperty url QuotaRequest::origin - \readonly - - The URL of the web page that issued the quota request. -*/ - -/*! - \qmlproperty qint64 QuotaRequest::requestedSize - \readonly - - Contains the size of the requested disk space in bytes. -*/ - -/*! - \qmlmethod void QuotaRequest::accept() - - Accepts the quota request. - - \qml - WebEngineView { - onQuotaRequested: function(request) { - if (request.requestedSize <= 5 * 1024 * 1024) - request.accept(); - else - request.reject(); - } - } - \endqml -*/ - -/*! - \qmlmethod void QuotaRequest::reject() - Rejects the quota request. -*/ - -/*! - \qmlsignal WebEngineView::registerProtocolHandlerRequested(RegisterProtocolHandlerRequest request) - \since QtWebEngine 1.7 - - This signal is emitted when the web page tries to register a custom protocol - by issuing a \l registerProtocolHandler \a request. - - \sa RegisterProtocolHandlerRequest -*/ - -/*! - \qmltype RegisterProtocolHandlerRequest - \instantiates QWebEngineRegisterProtocolHandlerRequest - \inqmlmodule QtWebEngine - \since QtWebEngine 1.7 - \brief The RegisterProtocolHandlerRequest type enables accepting - or rejecting requests from the \l registerProtocolHandler API. - - \sa WebEngineView::registerProtocolHandlerRequested() -*/ - -/*! - \qmlproperty url RegisterProtocolHandlerRequest::origin - \brief The URL template for the protocol handler. - - This is the second parameter from the \l registerProtocolHandler call. -*/ - -/*! - \qmlproperty string RegisterProtocolHandlerRequest::scheme - \brief The URL scheme for the protocol handler. - - This is the first parameter from the \l registerProtocolHandler call. -*/ - -/*! - \qmlmethod void RegisterProtocolHandlerRequest::accept() - \brief Accepts the request. - - Subsequent calls to accept() and reject() are ignored. -*/ - -/*! - \qmlmethod void RegisterProtocolHandlerRequest::reject() - \brief Accepts the request. - - Subsequent calls to accept() and reject() are ignored. -*/ - -/*! - \qmlsignal WebEngineView::geometryChangeRequested(rect geometry, rect frameGeometry) - \since QtWebEngine 1.7 - - This signal is emitted whenever the document wants to change the position and size of the - page to \a frameGeometry. This can happen for example through JavaScript. - - While \a frameGeometry includes, \a geometry excludes the size of frame margins. - - \note Geometry related properties of QML Window expect a size excluding the window - decoration. You have to use \a geometry to handle this signal correctly. - - \qml - onGeometryChangeRequested: { - window.x = geometry.x - window.y = geometry.y - window.width = geometry.width - window.height = geometry.height - } - \endqml -*/ - -/*! - \qmlproperty WebEngineView WebEngineView::inspectedView - \since QtWebEngine 1.7 - - The view this view is currently inspecting, if any. Setting it - will navigate to an internal URL with the developer tools of - the view set. - - It is recommended to unset this property when developer tools - are not visible; otherwise some debug information may appear - in the inspected WebEngineView. - - \sa devToolsView -*/ - -/*! - \qmlproperty WebEngineView WebEngineView::devToolsView - \since QtWebEngine 1.7 - - The view currently hosting the developer tools for this view. - Setting it to a new view will navigate that view to an internal - URL with the developer tools, and bind it to this view. - - \sa inspectedView -*/ - -/*! - \qmlmethod WebEngineAction WebEngineView::action(WebAction action) - \since 5.12 - - Returns a \l WebEngineAction for the specified \l WebAction \a action. - WebEngineView also takes care of implementing the action, - so that upon triggering the corresponding action is performed on the view. - - \code - var copyAction = webEngineView.action(WebEngineView.Copy); - \endcode - - \sa WebEngineAction -*/ - -/*! - \qmlsignal WebEngineView::printRequest - \since QtWebEngine 1.8 - - This signal is emitted when the JavaScript \c{window.print()} method is called. - Typically, the signal handler can simply call printToPdf(). - - \sa printToPdf -*/ - -/*! - \qmlsignal WebEngineView::selectClientCertificate(WebEngineClientCertificateSelection clientCertificateSelection) - \since QtWebEngine 1.9 - - This signal is emitted when a web site requests an SSL client certificate, and one or more were - found in the system's client certificate store. - - Handling the signal is asynchronous, and loading will be waiting until a certificate is selected, - or the last copy of \a clientCertificateSelection is destroyed. - - If the signal is not handled, \a clientCertificateSelection is automatically destroyed, and loading - will continue without a client certificate. - - \sa WebEngineClientCertificateSelection -*/ - -/*! - \qmlsignal WebEngineView::tooltipRequested(TooltipRequest request) - \since QtWebEngine 1.10 - - This signal is emitted when the web page wants to show a tooltip at - a specified position. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a default tooltip from showing up. - - \sa TooltipRequest -*/ - -/*! - \qmlproperty enumeration WebEngineView::LifecycleState - \since QtWebEngine 1.11 - - This enum describes the lifecycle state of the page: - - \value WebEngineView.LifecycleState.Active - Normal state. - \value WebEngineView.LifecycleState.Frozen - Low CPU usage state where most HTML task sources are suspended. - \value WebEngineView.LifecycleState.Discarded - Very low resource usage state where the entire browsing context is discarded. - - \sa lifecycleState -*/ - -/*! - \qmlproperty LifecycleState WebEngineView::lifecycleState - \since QtWebEngine 1.11 - - \brief The current lifecycle state of the page. - - The following restrictions are enforced by the setter: - - \list - \li A visible page must remain in the \c{Active} state. - \li If the page is being inspected by a \l{devToolsView} then both pages must - remain in the \c{Active} states. - \li A page in the \c{Discarded} state can only transition to the \c{Active} - state. This will cause a reload of the page. - \endlist - - These are the only hard limits on the lifecycle state, but see also - \l{recommendedState} for the recommended soft limits. - - \sa recommendedState, {WebEngine Lifecycle Example} -*/ - -/*! - \qmlproperty LifecycleState WebEngineView::recommendedState - \since QtWebEngine 1.11 - - \brief The recommended limit for the lifecycle state of the page. - - Setting the lifecycle state to a lower resource usage state than the - recommended state may cause side-effects such as stopping background audio - playback or loss of HTML form input. Setting the lifecycle state to a higher - resource state is however completely safe. - - \sa lifecycleState, {WebEngine Lifecycle Example} -*/ - -/*! - \qmltype FindTextResult - \instantiates QWebEngineFindTextResult - \inqmlmodule QtWebEngine - \since QtWebEngine 1.11 - - \brief A utility type for encapsulating the result of a string search on a page. - - \sa WebEngineView::findTextFinished() -*/ - -/*! - \qmlproperty int FindTextResult::numberOfMatches - \readonly - - \brief The number of matches found. -*/ - -/*! - \qmlproperty int FindTextResult::activeMatchOrdinal - \readonly - - \brief The index of the currently highlighted match. -*/ - -/*! - \qmlsignal WebEngineView::findTextFinished(FindTextResult result) - \since QtWebEngine 1.11 - - This signal is emitted when a string search on a page is completed. \a result is - the result of the string search. - - \sa findText(), FindTextResult -*/ diff --git a/src/webengine/module.pro b/src/webengine/module.pro deleted file mode 100644 index 49a1086b2..000000000 --- a/src/webengine/module.pro +++ /dev/null @@ -1,94 +0,0 @@ -include($$QTWEBENGINE_OUT_ROOT/src/webengine/qtwebengine-config.pri) -QT_FOR_CONFIG += webengine-private - -TARGET = QtWebEngine -MODULE = webengine - -# For our export macros -DEFINES += QT_BUILD_WEBENGINE_LIB - -QT += qml quick webenginecore -QT_PRIVATE += quick-private gui-private core-private webenginecore-private - -QMAKE_DOCS = $$PWD/doc/qtwebengine.qdocconf - -INCLUDEPATH += $$PWD api ../core ../core/api - -SOURCES = \ - api/qquickwebengineaction.cpp \ - api/qquickwebenginecertificateerror.cpp \ - api/qquickwebengineclientcertificateselection.cpp \ - api/qquickwebenginecontextmenurequest.cpp \ - api/qquickwebenginedialogrequests.cpp \ - api/qquickwebenginedownloaditem.cpp \ - api/qquickwebenginehistory.cpp \ - api/qquickwebenginefaviconprovider.cpp \ - api/qquickwebengineloadrequest.cpp \ - api/qquickwebenginenavigationrequest.cpp \ - api/qquickwebenginenewviewrequest.cpp \ - api/qquickwebengineprofile.cpp \ - api/qquickwebenginescript.cpp \ - api/qquickwebenginesettings.cpp \ - api/qquickwebenginesingleton.cpp \ - api/qquickwebenginetouchhandleprovider.cpp \ - api/qquickwebengineview.cpp \ - api/qtwebengineglobal.cpp \ - render_widget_host_view_qt_delegate_quick.cpp \ - render_widget_host_view_qt_delegate_quickwindow.cpp \ - ui_delegates_manager.cpp - -HEADERS = \ - api/qtwebengineglobal.h \ - api/qtwebengineglobal_p.h \ - api/qquickwebengineaction_p.h \ - api/qquickwebengineaction_p_p.h \ - api/qquickwebenginecertificateerror_p.h \ - api/qquickwebengineclientcertificateselection_p.h \ - api/qquickwebenginecontextmenurequest_p.h \ - api/qquickwebenginedialogrequests_p.h \ - api/qquickwebenginedownloaditem_p.h \ - api/qquickwebenginedownloaditem_p_p.h \ - api/qquickwebenginehistory_p.h \ - api/qquickwebenginefaviconprovider_p_p.h \ - api/qquickwebengineloadrequest_p.h \ - api/qquickwebenginenavigationrequest_p.h \ - api/qquickwebenginenewviewrequest_p.h \ - api/qquickwebengineprofile.h \ - api/qquickwebengineprofile_p.h \ - api/qquickwebenginescript.h \ - api/qquickwebenginescript_p.h \ - api/qquickwebenginesettings_p.h \ - api/qquickwebenginesingleton_p.h \ - api/qquickwebenginetouchhandleprovider_p_p.h \ - api/qquickwebengineview_p.h \ - api/qquickwebengineview_p_p.h \ - render_widget_host_view_qt_delegate_quick.h \ - render_widget_host_view_qt_delegate_quickwindow.h \ - ui_delegates_manager.h - -qtConfig(webengine-testsupport) { - QT_PRIVATE += testlib - SOURCES += api/qquickwebenginetestsupport.cpp - HEADERS += api/qquickwebenginetestsupport_p.h -} - -!build_pass { - python = $$pythonPathForShell() - chromium_attributions.commands = \ - cd $$shell_quote($$shell_path($$PWD/../3rdparty)) && \ - $$python chromium/tools/licenses.py \ - --file-template ../../tools/about_credits.tmpl \ - --entry-template ../../tools/about_credits_entry.tmpl credits \ - $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc)) - chromium_attributions.CONFIG += phony - - QMAKE_EXTRA_TARGETS += chromium_attributions - - prepare_docs { - prepare_docs.depends += chromium_attributions - } else { - html_docs.depends += chromium_attributions - } -} - -load(qt_module) diff --git a/src/webengine/plugin/dependencies.json b/src/webengine/plugin/dependencies.json deleted file mode 100644 index ef26b3617..000000000 --- a/src/webengine/plugin/dependencies.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "name": "QtQuick", - "type": "module", - "version": "2.8" - } -] diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp deleted file mode 100644 index e47a46a95..000000000 --- a/src/webengine/plugin/plugin.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtWebEngine/QQuickWebEngineProfile> - -#include <QtWebEngine/private/qquickwebenginecertificateerror_p.h> -#include <QtWebEngine/private/qquickwebengineclientcertificateselection_p.h> -#include <QtWebEngine/private/qquickwebenginecontextmenurequest_p.h> -#include <QtWebEngine/private/qquickwebenginedialogrequests_p.h> -#include <QtWebEngine/private/qquickwebenginedownloaditem_p.h> -#include <QtWebEngine/private/qquickwebenginehistory_p.h> -#include <QtWebEngine/private/qquickwebenginefaviconprovider_p_p.h> -#include <QtWebEngine/private/qquickwebengineloadrequest_p.h> -#include <QtWebEngine/private/qquickwebenginenavigationrequest_p.h> -#include <QtWebEngine/private/qquickwebenginenewviewrequest_p.h> -#include <QtWebEngine/private/qquickwebenginesettings_p.h> -#include <QtWebEngine/private/qquickwebenginesingleton_p.h> -#include <QtWebEngine/private/qquickwebenginetouchhandleprovider_p_p.h> -#include <QtWebEngine/private/qquickwebengineview_p.h> -#include <QtWebEngine/private/qquickwebengineaction_p.h> -#include <QtWebEngineCore/qwebenginefindtextresult.h> -#include <QtWebEngineCore/qwebenginenotification.h> -#include <QtWebEngineCore/qwebenginequotarequest.h> -#include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h> - -QT_BEGIN_NAMESPACE - -static QObject *webEngineSingletonProvider(QQmlEngine *, QJSEngine *) -{ - return new QQuickWebEngineSingleton; -} - -class QtWebEnginePlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) -public: - void initializeEngine(QQmlEngine *engine, const char *uri) override - { - Q_UNUSED(uri); - engine->addImageProvider(QQuickWebEngineFaviconProvider::identifier(), new QQuickWebEngineFaviconProvider); - engine->addImageProvider(QQuickWebEngineTouchHandleProvider::identifier(), new QQuickWebEngineTouchHandleProvider); - } - - void registerTypes(const char *uri) override - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine")); - - qmlRegisterType<QQuickWebEngineView>(uri, 1, 0, "WebEngineView"); - qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", msgUncreatableType("WebEngineLoadRequest")); - qmlRegisterUncreatableType<QQuickWebEngineNavigationRequest>(uri, 1, 0, "WebEngineNavigationRequest", msgUncreatableType("WebEngineNavigationRequest")); - - qmlRegisterType<QQuickWebEngineView, 1>(uri, 1, 1, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 2>(uri, 1, 2, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 3>(uri, 1, 3, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 4>(uri, 1, 4, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 5>(uri, 1, 5, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 6>(uri, 1, 6, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 7>(uri, 1, 7, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 8>(uri, 1, 8, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 9>(uri, 1, 9, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 10>(uri, 1, 10, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 11>(uri, 1, 11, "WebEngineView"); - qmlRegisterType<QQuickWebEngineProfile>(uri, 1, 1, "WebEngineProfile"); - qmlRegisterType<QQuickWebEngineProfile, 1>(uri, 1, 2, "WebEngineProfile"); - qmlRegisterType<QQuickWebEngineProfile, 2>(uri, 1, 3, "WebEngineProfile"); - qmlRegisterType<QQuickWebEngineProfile, 3>(uri, 1, 4, "WebEngineProfile"); - qmlRegisterType<QQuickWebEngineProfile, 4>(uri, 1, 5, "WebEngineProfile"); - qmlRegisterType<QQuickWebEngineProfile, 5>(uri, 1, 9, "WebEngineProfile"); - qmlRegisterType<QQuickWebEngineScript>(uri, 1, 1, "WebEngineScript"); - qmlRegisterUncreatableType<QQuickWebEngineCertificateError>(uri, 1, 1, "WebEngineCertificateError", msgUncreatableType("WebEngineCertificateError")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem>(uri, 1, 1, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 1>(uri, 1, 2, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 2>(uri, 1, 3, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 3>(uri, 1, 4, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 4>(uri, 1, 5, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 5>(uri, 1, 6, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 6>(uri, 1, 7, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 7>(uri, 1, 8, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 8>(uri, 1, 10, "WebEngineDownloadItem", - msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest")); - qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest, 1>(uri, 1, 5, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest")); - qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 1>(uri, 1, 2, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 2>(uri, 1, 3, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 3>(uri, 1, 4, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 4>(uri, 1, 5, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 5>(uri, 1, 6, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 6>(uri, 1, 7, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 7>(uri, 1, 8, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterUncreatableType<QQuickWebEngineSettings, 8>(uri, 1, 9, "WebEngineSettings", msgUncreatableType("WebEngineSettings")); - qmlRegisterSingletonType<QQuickWebEngineSingleton>(uri, 1, 1, "WebEngine", webEngineSingletonProvider); - qmlRegisterUncreatableType<QQuickWebEngineHistory>(uri, 1, 1, "NavigationHistory", - msgUncreatableType("NavigationHistory")); - qmlRegisterUncreatableType<QQuickWebEngineHistoryListModel>(uri, 1, 1, "NavigationHistoryListModel", - msgUncreatableType("NavigationHistory")); - qmlRegisterUncreatableType<QQuickWebEngineFullScreenRequest>(uri, 1, 1, "FullScreenRequest", - msgUncreatableType("FullScreenRequest")); - - qmlRegisterUncreatableType<QQuickWebEngineContextMenuRequest>(uri, 1, 4, "ContextMenuRequest", - msgUncreatableType("ContextMenuRequest")); - qmlRegisterUncreatableType<QQuickWebEngineContextMenuRequest, 1>(uri, 1, 7, "ContextMenuRequest", - msgUncreatableType("ContextMenuRequest")); - qmlRegisterUncreatableType<QQuickWebEngineAuthenticationDialogRequest>(uri, 1, 4, "AuthenticationDialogRequest", - msgUncreatableType("AuthenticationDialogRequest")); - qmlRegisterUncreatableType<QQuickWebEngineJavaScriptDialogRequest>(uri, 1, 4, "JavaScriptDialogRequest", - msgUncreatableType("JavaScriptDialogRequest")); - qmlRegisterUncreatableType<QQuickWebEngineColorDialogRequest>(uri, 1, 4, "ColorDialogRequest", - msgUncreatableType("ColorDialogRequest")); - qmlRegisterUncreatableType<QQuickWebEngineFileDialogRequest>(uri, 1, 4, "FileDialogRequest", - msgUncreatableType("FileDialogRequest")); - qmlRegisterUncreatableType<QQuickWebEngineFormValidationMessageRequest>(uri, 1, 4, "FormValidationMessageRequest", - msgUncreatableType("FormValidationMessageRequest")); - qRegisterMetaType<QWebEngineQuotaRequest>(); - qmlRegisterUncreatableType<QWebEngineQuotaRequest>(uri, 1, 7, "QuotaRequest", - msgUncreatableType("QuotaRequest")); - qRegisterMetaType<QWebEngineRegisterProtocolHandlerRequest>(); - qmlRegisterUncreatableType<QWebEngineRegisterProtocolHandlerRequest>(uri, 1, 7, "RegisterProtocolHandlerRequest", - msgUncreatableType("RegisterProtocolHandlerRequest")); - qmlRegisterUncreatableType<QQuickWebEngineAction>(uri, 1, 8, "WebEngineAction", msgUncreatableType("WebEngineAction")); - qmlRegisterUncreatableType<QQuickWebEngineClientCertificateSelection>(uri, 1, 9, "WebEngineClientCertificateSelection", - msgUncreatableType("WebEngineClientCertificateSelection")); - qmlRegisterUncreatableType<QQuickWebEngineClientCertificateOption>(uri, 1, 9, "WebEngineClientCertificateOption", - msgUncreatableType("WebEngineClientCertificateOption")); - qmlRegisterUncreatableType<QWebEngineNotification>(uri, 1, 9, "WebEngineNotification", msgUncreatableType("WebEngineNotification")); - qmlRegisterUncreatableType<QQuickWebEngineTooltipRequest>(uri, 1, 10, "TooltipRequest", - msgUncreatableType("TooltipRequest")); - qRegisterMetaType<QWebEngineFindTextResult>(); - qmlRegisterUncreatableType<QWebEngineFindTextResult>(uri, 1, 11, "FindTextResult", msgUncreatableType("FindTextResult")); - } - -private: - static QString msgUncreatableType(const char *className) - { - return tr("Cannot create separate instance of %1").arg(QLatin1String(className)); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/webengine/plugin/plugin.pro b/src/webengine/plugin/plugin.pro deleted file mode 100644 index 3b30bece2..000000000 --- a/src/webengine/plugin/plugin.pro +++ /dev/null @@ -1,12 +0,0 @@ -CXX_MODULE = qml -TARGET = qtwebengineplugin -TARGETPATH = QtWebEngine -IMPORT_VERSION = 1.10 - -QT += qml quick -QT_PRIVATE += core-private webenginecore-private webengine-private - -SOURCES = plugin.cpp - -QMAKE_QMLPLUGINDUMP_FLAGS = -defaultplatform -load(qml_plugin) diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes deleted file mode 100644 index 0037861e5..000000000 --- a/src/webengine/plugin/plugins.qmltypes +++ /dev/null @@ -1,1368 +0,0 @@ -import QtQuick.tooling 1.2 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -defaultplatform -dependencies dependencies.json QtWebEngine 1.9' - -Module { - dependencies: ["QtQuick 2.8"] - Component { - name: "QQuickWebEngineAction" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineAction 1.8"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "text"; type: "string"; isReadonly: true } - Property { name: "iconName"; type: "string"; isReadonly: true } - Property { name: "enabled"; type: "bool"; isReadonly: true } - Signal { name: "triggered" } - Method { name: "trigger" } - } - Component { - name: "QQuickWebEngineAuthenticationDialogRequest" - prototype: "QObject" - exports: ["QtWebEngine/AuthenticationDialogRequest 1.4"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "AuthenticationType" - values: { - "AuthenticationTypeHTTP": 0, - "AuthenticationTypeProxy": 1 - } - } - Property { name: "url"; type: "QUrl"; isReadonly: true } - Property { name: "realm"; type: "string"; isReadonly: true } - Property { name: "proxyHost"; type: "string"; isReadonly: true } - Property { name: "type"; type: "AuthenticationType"; isReadonly: true } - Property { name: "accepted"; type: "bool" } - Method { - name: "dialogAccept" - Parameter { name: "user"; type: "string" } - Parameter { name: "password"; type: "string" } - } - Method { name: "dialogReject" } - } - Component { - name: "QQuickWebEngineCertificateError" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineCertificateError 1.1"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "Error" - values: { - "SslPinnedKeyNotInCertificateChain": -150, - "CertificateCommonNameInvalid": -200, - "CertificateDateInvalid": -201, - "CertificateAuthorityInvalid": -202, - "CertificateContainsErrors": -203, - "CertificateNoRevocationMechanism": -204, - "CertificateUnableToCheckRevocation": -205, - "CertificateRevoked": -206, - "CertificateInvalid": -207, - "CertificateWeakSignatureAlgorithm": -208, - "CertificateNonUniqueName": -210, - "CertificateWeakKey": -211, - "CertificateNameConstraintViolation": -212, - "CertificateValidityTooLong": -213, - "CertificateTransparencyRequired": -214 - } - } - Property { name: "url"; type: "QUrl"; isReadonly: true } - Property { name: "error"; type: "Error"; isReadonly: true } - Property { name: "description"; type: "string"; isReadonly: true } - Property { name: "overridable"; type: "bool"; isReadonly: true } - Method { name: "defer" } - Method { name: "ignoreCertificateError" } - Method { name: "rejectCertificate" } - } - Component { - name: "QQuickWebEngineClientCertificateOption" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineClientCertificateOption 1.9"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "issuer"; type: "string"; isReadonly: true } - Property { name: "subject"; type: "string"; isReadonly: true } - Property { name: "effectiveDate"; type: "QDateTime"; isReadonly: true } - Property { name: "expiryDate"; type: "QDateTime"; isReadonly: true } - Property { name: "isSelfSigned"; type: "bool"; isReadonly: true } - Method { name: "select" } - } - Component { - name: "QQuickWebEngineClientCertificateSelection" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineClientCertificateSelection 1.9"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "host"; type: "QUrl"; isReadonly: true } - Property { - name: "certificates" - type: "QQuickWebEngineClientCertificateOption" - isList: true - isReadonly: true - } - Method { - name: "select" - Parameter { name: "idx"; type: "int" } - } - Method { - name: "select" - Parameter { - name: "certificate" - type: "const QQuickWebEngineClientCertificateOption" - isPointer: true - } - } - Method { name: "selectNone" } - } - Component { - name: "QQuickWebEngineColorDialogRequest" - prototype: "QObject" - exports: ["QtWebEngine/ColorDialogRequest 1.4"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "color"; type: "QColor"; isReadonly: true } - Property { name: "accepted"; type: "bool" } - Method { - name: "dialogAccept" - Parameter { name: "color"; type: "QColor" } - } - Method { name: "dialogReject" } - } - Component { - name: "QQuickWebEngineContextMenuRequest" - prototype: "QObject" - exports: [ - "QtWebEngine/ContextMenuRequest 1.4", - "QtWebEngine/ContextMenuRequest 1.7" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 1] - Enum { - name: "MediaType" - values: { - "MediaTypeNone": 0, - "MediaTypeImage": 1, - "MediaTypeVideo": 2, - "MediaTypeAudio": 3, - "MediaTypeCanvas": 4, - "MediaTypeFile": 5, - "MediaTypePlugin": 6 - } - } - Enum { - name: "MediaFlags" - values: { - "MediaInError": 1, - "MediaPaused": 2, - "MediaMuted": 4, - "MediaLoop": 8, - "MediaCanSave": 16, - "MediaHasAudio": 32, - "MediaCanToggleControls": 64, - "MediaControls": 128, - "MediaCanPrint": 256, - "MediaCanRotate": 512 - } - } - Enum { - name: "EditFlags" - values: { - "CanUndo": 1, - "CanRedo": 2, - "CanCut": 4, - "CanCopy": 8, - "CanPaste": 16, - "CanDelete": 32, - "CanSelectAll": 64, - "CanTranslate": 128, - "CanEditRichly": 256 - } - } - Property { name: "x"; type: "int"; isReadonly: true } - Property { name: "y"; type: "int"; isReadonly: true } - Property { name: "selectedText"; type: "string"; isReadonly: true } - Property { name: "linkText"; type: "string"; isReadonly: true } - Property { name: "linkUrl"; type: "QUrl"; isReadonly: true } - Property { name: "mediaUrl"; type: "QUrl"; isReadonly: true } - Property { name: "mediaType"; type: "MediaType"; isReadonly: true } - Property { name: "isContentEditable"; type: "bool"; isReadonly: true } - Property { name: "misspelledWord"; type: "string"; isReadonly: true } - Property { name: "spellCheckerSuggestions"; type: "QStringList"; isReadonly: true } - Property { name: "accepted"; type: "bool" } - Property { name: "mediaFlags"; revision: 1; type: "MediaFlags"; isReadonly: true } - Property { name: "editFlags"; revision: 1; type: "EditFlags"; isReadonly: true } - } - Component { - name: "QQuickWebEngineDownloadItem" - prototype: "QObject" - exports: [ - "QtWebEngine/WebEngineDownloadItem 1.1", - "QtWebEngine/WebEngineDownloadItem 1.2", - "QtWebEngine/WebEngineDownloadItem 1.3", - "QtWebEngine/WebEngineDownloadItem 1.4", - "QtWebEngine/WebEngineDownloadItem 1.5", - "QtWebEngine/WebEngineDownloadItem 1.6", - "QtWebEngine/WebEngineDownloadItem 1.7", - "QtWebEngine/WebEngineDownloadItem 1.8" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7] - Enum { - name: "DownloadState" - values: { - "DownloadRequested": 0, - "DownloadInProgress": 1, - "DownloadCompleted": 2, - "DownloadCancelled": 3, - "DownloadInterrupted": 4 - } - } - Enum { - name: "SavePageFormat" - values: { - "UnknownSaveFormat": -1, - "SingleHtmlSaveFormat": 0, - "CompleteHtmlSaveFormat": 1, - "MimeHtmlSaveFormat": 2 - } - } - Enum { - name: "DownloadInterruptReason" - values: { - "NoReason": 0, - "FileFailed": 1, - "FileAccessDenied": 2, - "FileNoSpace": 3, - "FileNameTooLong": 5, - "FileTooLarge": 6, - "FileVirusInfected": 7, - "FileTransientError": 10, - "FileBlocked": 11, - "FileSecurityCheckFailed": 12, - "FileTooShort": 13, - "FileHashMismatch": 14, - "NetworkFailed": 20, - "NetworkTimeout": 21, - "NetworkDisconnected": 22, - "NetworkServerDown": 23, - "NetworkInvalidRequest": 24, - "ServerFailed": 30, - "ServerBadContent": 33, - "ServerUnauthorized": 34, - "ServerCertProblem": 35, - "ServerForbidden": 36, - "ServerUnreachable": 37, - "UserCanceled": 40 - } - } - Enum { - name: "DownloadType" - values: { - "Attachment": 0, - "DownloadAttribute": 1, - "UserRequested": 2, - "SavePage": 3 - } - } - Property { name: "id"; type: "uint"; isReadonly: true } - Property { name: "state"; type: "DownloadState"; isReadonly: true } - Property { name: "savePageFormat"; revision: 2; type: "SavePageFormat" } - Property { name: "totalBytes"; type: "qlonglong"; isReadonly: true } - Property { name: "receivedBytes"; type: "qlonglong"; isReadonly: true } - Property { name: "mimeType"; revision: 1; type: "string"; isReadonly: true } - Property { name: "path"; type: "string" } - Property { name: "type"; revision: 3; type: "DownloadType"; isReadonly: true } - Property { - name: "interruptReason" - revision: 4 - type: "DownloadInterruptReason" - isReadonly: true - } - Property { name: "interruptReasonString"; revision: 4; type: "string"; isReadonly: true } - Property { name: "isFinished"; revision: 5; type: "bool"; isReadonly: true } - Property { name: "isPaused"; revision: 5; type: "bool"; isReadonly: true } - Property { name: "isSavePageDownload"; revision: 6; type: "bool"; isReadonly: true } - Property { - name: "view" - revision: 7 - type: "QQuickWebEngineView" - isReadonly: true - isPointer: true - } - Signal { name: "savePageFormatChanged"; revision: 2 } - Signal { name: "mimeTypeChanged"; revision: 1 } - Signal { name: "typeChanged"; revision: 3 } - Signal { name: "interruptReasonChanged"; revision: 4 } - Signal { name: "isFinishedChanged"; revision: 5 } - Signal { name: "isPausedChanged"; revision: 5 } - Method { name: "accept" } - Method { name: "cancel" } - Method { name: "pause" } - Method { name: "resume" } - } - Component { - name: "QQuickWebEngineFileDialogRequest" - prototype: "QObject" - exports: ["QtWebEngine/FileDialogRequest 1.4"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "FileMode" - values: { - "FileModeOpen": 0, - "FileModeOpenMultiple": 1, - "FileModeUploadFolder": 2, - "FileModeSave": 3 - } - } - Property { name: "defaultFileName"; type: "string"; isReadonly: true } - Property { name: "acceptedMimeTypes"; type: "QStringList"; isReadonly: true } - Property { name: "mode"; type: "FileMode"; isReadonly: true } - Property { name: "accepted"; type: "bool" } - Method { - name: "dialogAccept" - Parameter { name: "files"; type: "QStringList" } - } - Method { name: "dialogReject" } - } - Component { - name: "QQuickWebEngineFormValidationMessageRequest" - prototype: "QObject" - exports: ["QtWebEngine/FormValidationMessageRequest 1.4"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "RequestType" - values: { - "Show": 0, - "Hide": 1, - "Move": 2 - } - } - Property { name: "anchor"; type: "QRect"; isReadonly: true } - Property { name: "text"; type: "string"; isReadonly: true } - Property { name: "subText"; type: "string"; isReadonly: true } - Property { name: "type"; type: "RequestType"; isReadonly: true } - Property { name: "accepted"; type: "bool" } - } - Component { - name: "QQuickWebEngineFullScreenRequest" - exports: ["QtWebEngine/FullScreenRequest 1.1"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "toggleOn"; type: "bool"; isReadonly: true } - Method { name: "accept" } - Method { name: "reject" } - } - Component { - name: "QQuickWebEngineHistory" - defaultProperty: "data" - prototype: "QQuickItem" - exports: ["QtWebEngine/NavigationHistory 1.1"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { - name: "items" - type: "QQuickWebEngineHistoryListModel" - isReadonly: true - isPointer: true - } - Property { - name: "backItems" - type: "QQuickWebEngineHistoryListModel" - isReadonly: true - isPointer: true - } - Property { - name: "forwardItems" - type: "QQuickWebEngineHistoryListModel" - isReadonly: true - isPointer: true - } - } - Component { - name: "QQuickWebEngineHistoryListModel" - prototype: "QAbstractListModel" - exports: ["QtWebEngine/NavigationHistoryListModel 1.1"] - isCreatable: false - exportMetaObjectRevisions: [0] - } - Component { - name: "QQuickWebEngineJavaScriptDialogRequest" - prototype: "QObject" - exports: ["QtWebEngine/JavaScriptDialogRequest 1.4"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "DialogType" - values: { - "DialogTypeAlert": 0, - "DialogTypeConfirm": 1, - "DialogTypePrompt": 2, - "DialogTypeBeforeUnload": 3 - } - } - Property { name: "message"; type: "string"; isReadonly: true } - Property { name: "defaultText"; type: "string"; isReadonly: true } - Property { name: "title"; type: "string"; isReadonly: true } - Property { name: "type"; type: "DialogType"; isReadonly: true } - Property { name: "securityOrigin"; type: "QUrl"; isReadonly: true } - Property { name: "accepted"; type: "bool" } - Method { - name: "dialogAccept" - Parameter { name: "text"; type: "string" } - } - Method { name: "dialogAccept" } - Method { name: "dialogReject" } - } - Component { - name: "QQuickWebEngineLoadRequest" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineLoadRequest 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "url"; type: "QUrl"; isReadonly: true } - Property { name: "status"; type: "QQuickWebEngineView::LoadStatus"; isReadonly: true } - Property { name: "errorString"; type: "string"; isReadonly: true } - Property { name: "errorDomain"; type: "QQuickWebEngineView::ErrorDomain"; isReadonly: true } - Property { name: "errorCode"; type: "int"; isReadonly: true } - } - Component { - name: "QQuickWebEngineNavigationRequest" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineNavigationRequest 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "url"; type: "QUrl"; isReadonly: true } - Property { name: "isMainFrame"; type: "bool"; isReadonly: true } - Property { name: "action"; type: "QQuickWebEngineView::NavigationRequestAction" } - Property { - name: "navigationType" - type: "QQuickWebEngineView::NavigationType" - isReadonly: true - } - } - Component { - name: "QQuickWebEngineNewViewRequest" - prototype: "QObject" - exports: [ - "QtWebEngine/WebEngineNewViewRequest 1.1", - "QtWebEngine/WebEngineNewViewRequest 1.5" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 1] - Property { - name: "destination" - type: "QQuickWebEngineView::NewViewDestination" - isReadonly: true - } - Property { name: "requestedUrl"; revision: 1; type: "QUrl"; isReadonly: true } - Property { name: "userInitiated"; type: "bool"; isReadonly: true } - Method { - name: "openIn" - Parameter { name: "view"; type: "QQuickWebEngineView"; isPointer: true } - } - } - Component { - name: "QQuickWebEngineProfile" - prototype: "QObject" - exports: [ - "QtWebEngine/WebEngineProfile 1.1", - "QtWebEngine/WebEngineProfile 1.2", - "QtWebEngine/WebEngineProfile 1.3", - "QtWebEngine/WebEngineProfile 1.4", - "QtWebEngine/WebEngineProfile 1.5", - "QtWebEngine/WebEngineProfile 1.9" - ] - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5] - Enum { - name: "HttpCacheType" - values: { - "MemoryHttpCache": 0, - "DiskHttpCache": 1, - "NoCache": 2 - } - } - Enum { - name: "PersistentCookiesPolicy" - values: { - "NoPersistentCookies": 0, - "AllowPersistentCookies": 1, - "ForcePersistentCookies": 2 - } - } - Property { name: "storageName"; type: "string" } - Property { name: "offTheRecord"; type: "bool" } - Property { name: "persistentStoragePath"; type: "string" } - Property { name: "cachePath"; type: "string" } - Property { name: "httpUserAgent"; type: "string" } - Property { name: "httpCacheType"; type: "HttpCacheType" } - Property { name: "httpAcceptLanguage"; revision: 1; type: "string" } - Property { name: "persistentCookiesPolicy"; type: "PersistentCookiesPolicy" } - Property { name: "httpCacheMaximumSize"; type: "int" } - Property { name: "spellCheckLanguages"; revision: 3; type: "QStringList" } - Property { name: "spellCheckEnabled"; revision: 3; type: "bool" } - Property { - name: "userScripts" - revision: 4 - type: "QQuickWebEngineScript" - isList: true - isReadonly: true - } - Property { name: "useForGlobalCertificateVerification"; revision: 5; type: "bool" } - Property { name: "downloadPath"; revision: 5; type: "string" } - Signal { name: "httpAcceptLanguageChanged"; revision: 1 } - Signal { name: "spellCheckLanguagesChanged"; revision: 3 } - Signal { name: "spellCheckEnabledChanged"; revision: 3 } - Signal { name: "useForGlobalCertificateVerificationChanged"; revision: 5 } - Signal { name: "downloadPathChanged"; revision: 5 } - Signal { - name: "downloadRequested" - Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } - } - Signal { - name: "downloadFinished" - Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } - } - Signal { - name: "presentNotification" - revision: 5 - Parameter { name: "notification"; type: "QWebEngineNotification"; isPointer: true } - } - Method { name: "clearHttpCache"; revision: 2 } - } - Component { - name: "QQuickWebEngineScript" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineScript 1.1"] - exportMetaObjectRevisions: [0] - Enum { - name: "InjectionPoint" - values: { - "Deferred": 0, - "DocumentReady": 1, - "DocumentCreation": 2 - } - } - Enum { - name: "ScriptWorldId" - values: { - "MainWorld": 0, - "ApplicationWorld": 1, - "UserWorld": 2 - } - } - Property { name: "name"; type: "string" } - Property { name: "sourceUrl"; type: "QUrl" } - Property { name: "sourceCode"; type: "string" } - Property { name: "injectionPoint"; type: "InjectionPoint" } - Property { name: "worldId"; type: "ScriptWorldId" } - Property { name: "runOnSubframes"; type: "bool" } - Signal { - name: "nameChanged" - Parameter { name: "name"; type: "string" } - } - Signal { - name: "sourceUrlChanged" - Parameter { name: "url"; type: "QUrl" } - } - Signal { - name: "sourceCodeChanged" - Parameter { name: "code"; type: "string" } - } - Signal { - name: "injectionPointChanged" - Parameter { name: "injectionPoint"; type: "InjectionPoint" } - } - Signal { - name: "worldIdChanged" - Parameter { name: "scriptWorldId"; type: "ScriptWorldId" } - } - Signal { - name: "runOnSubframesChanged" - Parameter { name: "on"; type: "bool" } - } - Method { name: "toString"; type: "string" } - Method { - name: "setName" - Parameter { name: "name"; type: "string" } - } - Method { - name: "setSourceUrl" - Parameter { name: "url"; type: "QUrl" } - } - Method { - name: "setSourceCode" - Parameter { name: "code"; type: "string" } - } - Method { - name: "setInjectionPoint" - Parameter { name: "injectionPoint"; type: "InjectionPoint" } - } - Method { - name: "setWorldId" - Parameter { name: "scriptWorldId"; type: "ScriptWorldId" } - } - Method { - name: "setRunOnSubframes" - Parameter { name: "on"; type: "bool" } - } - } - Component { - name: "QQuickWebEngineSettings" - prototype: "QObject" - exports: [ - "QtWebEngine/WebEngineSettings 1.1", - "QtWebEngine/WebEngineSettings 1.2", - "QtWebEngine/WebEngineSettings 1.3", - "QtWebEngine/WebEngineSettings 1.4", - "QtWebEngine/WebEngineSettings 1.5", - "QtWebEngine/WebEngineSettings 1.6", - "QtWebEngine/WebEngineSettings 1.7", - "QtWebEngine/WebEngineSettings 1.8" - ] - isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7] - Enum { - name: "UnknownUrlSchemePolicy" - values: { - "DisallowUnknownUrlSchemes": 1, - "AllowUnknownUrlSchemesFromUserInteraction": 2, - "AllowAllUnknownUrlSchemes": 3 - } - } - Property { name: "autoLoadImages"; type: "bool" } - Property { name: "javascriptEnabled"; type: "bool" } - Property { name: "javascriptCanOpenWindows"; type: "bool" } - Property { name: "javascriptCanAccessClipboard"; type: "bool" } - Property { name: "linksIncludedInFocusChain"; type: "bool" } - Property { name: "localStorageEnabled"; type: "bool" } - Property { name: "localContentCanAccessRemoteUrls"; type: "bool" } - Property { name: "spatialNavigationEnabled"; type: "bool" } - Property { name: "localContentCanAccessFileUrls"; type: "bool" } - Property { name: "hyperlinkAuditingEnabled"; type: "bool" } - Property { name: "errorPageEnabled"; type: "bool" } - Property { name: "pluginsEnabled"; type: "bool" } - Property { name: "fullScreenSupportEnabled"; revision: 1; type: "bool" } - Property { name: "defaultTextEncoding"; type: "string" } - Property { name: "screenCaptureEnabled"; revision: 2; type: "bool" } - Property { name: "webGLEnabled"; revision: 2; type: "bool" } - Property { name: "accelerated2dCanvasEnabled"; revision: 2; type: "bool" } - Property { name: "autoLoadIconsForPage"; revision: 2; type: "bool" } - Property { name: "touchIconsEnabled"; revision: 2; type: "bool" } - Property { name: "focusOnNavigationEnabled"; revision: 3; type: "bool" } - Property { name: "printElementBackgrounds"; revision: 3; type: "bool" } - Property { name: "allowRunningInsecureContent"; revision: 3; type: "bool" } - Property { name: "allowGeolocationOnInsecureOrigins"; revision: 4; type: "bool" } - Property { name: "allowWindowActivationFromJavaScript"; revision: 5; type: "bool" } - Property { name: "showScrollBars"; revision: 5; type: "bool" } - Property { name: "unknownUrlSchemePolicy"; revision: 6; type: "UnknownUrlSchemePolicy" } - Property { name: "playbackRequiresUserGesture"; revision: 6; type: "bool" } - Property { name: "webRTCPublicInterfacesOnly"; revision: 6; type: "bool" } - Property { name: "javascriptCanPaste"; revision: 6; type: "bool" } - Property { name: "dnsPrefetchEnabled"; revision: 7; type: "bool" } - Property { name: "pdfViewerEnabled"; revision: 8; type: "bool" } - Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 } - Signal { name: "screenCaptureEnabledChanged"; revision: 2 } - Signal { name: "webGLEnabledChanged"; revision: 2 } - Signal { name: "accelerated2dCanvasEnabledChanged"; revision: 2 } - Signal { name: "autoLoadIconsForPageChanged"; revision: 2 } - Signal { name: "touchIconsEnabledChanged"; revision: 2 } - Signal { name: "focusOnNavigationEnabledChanged"; revision: 3 } - Signal { name: "printElementBackgroundsChanged"; revision: 3 } - Signal { name: "allowRunningInsecureContentChanged"; revision: 3 } - Signal { name: "allowGeolocationOnInsecureOriginsChanged"; revision: 4 } - Signal { name: "allowWindowActivationFromJavaScriptChanged"; revision: 5 } - Signal { name: "showScrollBarsChanged"; revision: 5 } - Signal { name: "unknownUrlSchemePolicyChanged"; revision: 6 } - Signal { name: "playbackRequiresUserGestureChanged"; revision: 6 } - Signal { name: "webRTCPublicInterfacesOnlyChanged"; revision: 6 } - Signal { name: "javascriptCanPasteChanged"; revision: 6 } - Signal { name: "dnsPrefetchEnabledChanged"; revision: 7 } - Signal { name: "pdfViewerEnabledChanged"; revision: 8 } - } - Component { - name: "QQuickWebEngineSingleton" - prototype: "QObject" - exports: ["QtWebEngine/WebEngine 1.1"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Property { name: "settings"; type: "QQuickWebEngineSettings"; isReadonly: true; isPointer: true } - Property { - name: "defaultProfile" - revision: 1 - type: "QQuickWebEngineProfile" - isReadonly: true - isPointer: true - } - } - Component { - name: "QQuickWebEngineView" - defaultProperty: "data" - prototype: "QQuickItem" - exports: [ - "QtWebEngine/WebEngineView 1.0", - "QtWebEngine/WebEngineView 1.1", - "QtWebEngine/WebEngineView 1.2", - "QtWebEngine/WebEngineView 1.3", - "QtWebEngine/WebEngineView 1.4", - "QtWebEngine/WebEngineView 1.5", - "QtWebEngine/WebEngineView 1.6", - "QtWebEngine/WebEngineView 1.7", - "QtWebEngine/WebEngineView 1.8", - "QtWebEngine/WebEngineView 1.9" - ] - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - Enum { - name: "NavigationRequestAction" - values: { - "AcceptRequest": 0, - "IgnoreRequest": 255 - } - } - Enum { - name: "NavigationType" - values: { - "LinkClickedNavigation": 0, - "TypedNavigation": 1, - "FormSubmittedNavigation": 2, - "BackForwardNavigation": 3, - "ReloadNavigation": 4, - "OtherNavigation": 5 - } - } - Enum { - name: "LoadStatus" - values: { - "LoadStartedStatus": 0, - "LoadStoppedStatus": 1, - "LoadSucceededStatus": 2, - "LoadFailedStatus": 3 - } - } - Enum { - name: "ErrorDomain" - values: { - "NoErrorDomain": 0, - "InternalErrorDomain": 1, - "ConnectionErrorDomain": 2, - "CertificateErrorDomain": 3, - "HttpErrorDomain": 4, - "FtpErrorDomain": 5, - "DnsErrorDomain": 6 - } - } - Enum { - name: "NewViewDestination" - values: { - "NewViewInWindow": 0, - "NewViewInTab": 1, - "NewViewInDialog": 2, - "NewViewInBackgroundTab": 3 - } - } - Enum { - name: "Feature" - values: { - "MediaAudioCapture": 0, - "MediaVideoCapture": 1, - "MediaAudioVideoCapture": 2, - "Geolocation": 3, - "DesktopVideoCapture": 4, - "DesktopAudioVideoCapture": 5, - "Notifications": 6 - } - } - Enum { - name: "WebAction" - values: { - "NoWebAction": -1, - "Back": 0, - "Forward": 1, - "Stop": 2, - "Reload": 3, - "Cut": 4, - "Copy": 5, - "Paste": 6, - "Undo": 7, - "Redo": 8, - "SelectAll": 9, - "ReloadAndBypassCache": 10, - "PasteAndMatchStyle": 11, - "OpenLinkInThisWindow": 12, - "OpenLinkInNewWindow": 13, - "OpenLinkInNewTab": 14, - "CopyLinkToClipboard": 15, - "DownloadLinkToDisk": 16, - "CopyImageToClipboard": 17, - "CopyImageUrlToClipboard": 18, - "DownloadImageToDisk": 19, - "CopyMediaUrlToClipboard": 20, - "ToggleMediaControls": 21, - "ToggleMediaLoop": 22, - "ToggleMediaPlayPause": 23, - "ToggleMediaMute": 24, - "DownloadMediaToDisk": 25, - "InspectElement": 26, - "ExitFullScreen": 27, - "RequestClose": 28, - "Unselect": 29, - "SavePage": 30, - "ViewSource": 31, - "ToggleBold": 32, - "ToggleItalic": 33, - "ToggleUnderline": 34, - "ToggleStrikethrough": 35, - "AlignLeft": 36, - "AlignCenter": 37, - "AlignRight": 38, - "AlignJustified": 39, - "Indent": 40, - "Outdent": 41, - "InsertOrderedList": 42, - "InsertUnorderedList": 43, - "WebActionCount": 44 - } - } - Enum { - name: "JavaScriptConsoleMessageLevel" - values: { - "InfoMessageLevel": 0, - "WarningMessageLevel": 1, - "ErrorMessageLevel": 2 - } - } - Enum { - name: "RenderProcessTerminationStatus" - values: { - "NormalTerminationStatus": 0, - "AbnormalTerminationStatus": 1, - "CrashedTerminationStatus": 2, - "KilledTerminationStatus": 3 - } - } - Enum { - name: "FindFlags" - values: { - "FindBackward": 1, - "FindCaseSensitively": 2 - } - } - Enum { - name: "PrintedPageSizeId" - values: { - "A4": 0, - "B5": 1, - "Letter": 2, - "Legal": 3, - "Executive": 4, - "A0": 5, - "A1": 6, - "A2": 7, - "A3": 8, - "A5": 9, - "A6": 10, - "A7": 11, - "A8": 12, - "A9": 13, - "B0": 14, - "B1": 15, - "B10": 16, - "B2": 17, - "B3": 18, - "B4": 19, - "B6": 20, - "B7": 21, - "B8": 22, - "B9": 23, - "C5E": 24, - "Comm10E": 25, - "DLE": 26, - "Folio": 27, - "Ledger": 28, - "Tabloid": 29, - "Custom": 30, - "A10": 31, - "A3Extra": 32, - "A4Extra": 33, - "A4Plus": 34, - "A4Small": 35, - "A5Extra": 36, - "B5Extra": 37, - "JisB0": 38, - "JisB1": 39, - "JisB2": 40, - "JisB3": 41, - "JisB4": 42, - "JisB5": 43, - "JisB6": 44, - "JisB7": 45, - "JisB8": 46, - "JisB9": 47, - "JisB10": 48, - "AnsiC": 49, - "AnsiD": 50, - "AnsiE": 51, - "LegalExtra": 52, - "LetterExtra": 53, - "LetterPlus": 54, - "LetterSmall": 55, - "TabloidExtra": 56, - "ArchA": 57, - "ArchB": 58, - "ArchC": 59, - "ArchD": 60, - "ArchE": 61, - "Imperial7x9": 62, - "Imperial8x10": 63, - "Imperial9x11": 64, - "Imperial9x12": 65, - "Imperial10x11": 66, - "Imperial10x13": 67, - "Imperial10x14": 68, - "Imperial12x11": 69, - "Imperial15x11": 70, - "ExecutiveStandard": 71, - "Note": 72, - "Quarto": 73, - "Statement": 74, - "SuperA": 75, - "SuperB": 76, - "Postcard": 77, - "DoublePostcard": 78, - "Prc16K": 79, - "Prc32K": 80, - "Prc32KBig": 81, - "FanFoldUS": 82, - "FanFoldGerman": 83, - "FanFoldGermanLegal": 84, - "EnvelopeB4": 85, - "EnvelopeB5": 86, - "EnvelopeB6": 87, - "EnvelopeC0": 88, - "EnvelopeC1": 89, - "EnvelopeC2": 90, - "EnvelopeC3": 91, - "EnvelopeC4": 92, - "EnvelopeC6": 93, - "EnvelopeC65": 94, - "EnvelopeC7": 95, - "Envelope9": 96, - "Envelope11": 97, - "Envelope12": 98, - "Envelope14": 99, - "EnvelopeMonarch": 100, - "EnvelopePersonal": 101, - "EnvelopeChou3": 102, - "EnvelopeChou4": 103, - "EnvelopeInvite": 104, - "EnvelopeItalian": 105, - "EnvelopeKaku2": 106, - "EnvelopeKaku3": 107, - "EnvelopePrc1": 108, - "EnvelopePrc2": 109, - "EnvelopePrc3": 110, - "EnvelopePrc4": 111, - "EnvelopePrc5": 112, - "EnvelopePrc6": 113, - "EnvelopePrc7": 114, - "EnvelopePrc8": 115, - "EnvelopePrc9": 116, - "EnvelopePrc10": 117, - "EnvelopeYou4": 118, - "LastPageSize": 118, - "NPageSize": 118, - "NPaperSize": 118, - "AnsiA": 2, - "AnsiB": 28, - "EnvelopeC5": 24, - "EnvelopeDL": 26, - "Envelope10": 25 - } - } - Enum { - name: "PrintedPageOrientation" - values: { - "Portrait": 0, - "Landscape": 1 - } - } - Property { name: "url"; type: "QUrl" } - Property { name: "icon"; type: "QUrl"; isReadonly: true } - Property { name: "loading"; type: "bool"; isReadonly: true } - Property { name: "loadProgress"; type: "int"; isReadonly: true } - Property { name: "title"; type: "string"; isReadonly: true } - Property { name: "canGoBack"; type: "bool"; isReadonly: true } - Property { name: "canGoForward"; type: "bool"; isReadonly: true } - Property { name: "isFullScreen"; revision: 1; type: "bool"; isReadonly: true } - Property { name: "zoomFactor"; revision: 1; type: "double" } - Property { name: "profile"; revision: 1; type: "QQuickWebEngineProfile"; isPointer: true } - Property { - name: "settings" - revision: 1 - type: "QQuickWebEngineSettings" - isReadonly: true - isPointer: true - } - Property { - name: "navigationHistory" - revision: 1 - type: "QQuickWebEngineHistory" - isReadonly: true - isPointer: true - } - Property { name: "webChannel"; revision: 1; type: "QQmlWebChannel"; isPointer: true } - Property { - name: "userScripts" - revision: 1 - type: "QQuickWebEngineScript" - isList: true - isReadonly: true - } - Property { name: "activeFocusOnPress"; revision: 2; type: "bool" } - Property { name: "backgroundColor"; revision: 2; type: "QColor" } - Property { name: "contentsSize"; revision: 3; type: "QSizeF"; isReadonly: true } - Property { name: "scrollPosition"; revision: 3; type: "QPointF"; isReadonly: true } - Property { name: "audioMuted"; revision: 3; type: "bool" } - Property { name: "recentlyAudible"; revision: 3; type: "bool"; isReadonly: true } - Property { name: "webChannelWorld"; revision: 3; type: "uint" } - Property { name: "inspectedView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true } - Property { name: "devToolsView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true } - Property { name: "testSupport"; type: "QQuickWebEngineTestSupport"; isPointer: true } - Signal { - name: "loadingChanged" - Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true } - } - Signal { - name: "linkHovered" - Parameter { name: "hoveredUrl"; type: "QUrl" } - } - Signal { - name: "navigationRequested" - Parameter { name: "request"; type: "QQuickWebEngineNavigationRequest"; isPointer: true } - } - Signal { - name: "javaScriptConsoleMessage" - Parameter { name: "level"; type: "JavaScriptConsoleMessageLevel" } - Parameter { name: "message"; type: "string" } - Parameter { name: "lineNumber"; type: "int" } - Parameter { name: "sourceID"; type: "string" } - } - Signal { - name: "certificateError" - revision: 1 - Parameter { name: "error"; type: "QQuickWebEngineCertificateError"; isPointer: true } - } - Signal { - name: "fullScreenRequested" - revision: 1 - Parameter { name: "request"; type: "QQuickWebEngineFullScreenRequest" } - } - Signal { name: "isFullScreenChanged"; revision: 1 } - Signal { - name: "featurePermissionRequested" - revision: 1 - Parameter { name: "securityOrigin"; type: "QUrl" } - Parameter { name: "feature"; type: "Feature" } - } - Signal { - name: "newViewRequested" - revision: 1 - Parameter { name: "request"; type: "QQuickWebEngineNewViewRequest"; isPointer: true } - } - Signal { - name: "zoomFactorChanged" - revision: 1 - Parameter { name: "arg"; type: "double" } - } - Signal { name: "profileChanged"; revision: 1 } - Signal { name: "webChannelChanged"; revision: 1 } - Signal { - name: "activeFocusOnPressChanged" - revision: 2 - Parameter { type: "bool" } - } - Signal { name: "backgroundColorChanged"; revision: 2 } - Signal { - name: "renderProcessTerminated" - revision: 2 - Parameter { name: "terminationStatus"; type: "RenderProcessTerminationStatus" } - Parameter { name: "exitCode"; type: "int" } - } - Signal { name: "windowCloseRequested"; revision: 2 } - Signal { - name: "contentsSizeChanged" - revision: 3 - Parameter { name: "size"; type: "QSizeF" } - } - Signal { - name: "scrollPositionChanged" - revision: 3 - Parameter { name: "position"; type: "QPointF" } - } - Signal { - name: "audioMutedChanged" - revision: 3 - Parameter { name: "muted"; type: "bool" } - } - Signal { - name: "recentlyAudibleChanged" - revision: 3 - Parameter { name: "recentlyAudible"; type: "bool" } - } - Signal { - name: "webChannelWorldChanged" - revision: 3 - Parameter { type: "uint" } - } - Signal { - name: "contextMenuRequested" - revision: 4 - Parameter { name: "request"; type: "QQuickWebEngineContextMenuRequest"; isPointer: true } - } - Signal { - name: "authenticationDialogRequested" - revision: 4 - Parameter { - name: "request" - type: "QQuickWebEngineAuthenticationDialogRequest" - isPointer: true - } - } - Signal { - name: "javaScriptDialogRequested" - revision: 4 - Parameter { name: "request"; type: "QQuickWebEngineJavaScriptDialogRequest"; isPointer: true } - } - Signal { - name: "colorDialogRequested" - revision: 4 - Parameter { name: "request"; type: "QQuickWebEngineColorDialogRequest"; isPointer: true } - } - Signal { - name: "fileDialogRequested" - revision: 4 - Parameter { name: "request"; type: "QQuickWebEngineFileDialogRequest"; isPointer: true } - } - Signal { - name: "formValidationMessageRequested" - revision: 4 - Parameter { - name: "request" - type: "QQuickWebEngineFormValidationMessageRequest" - isPointer: true - } - } - Signal { - name: "pdfPrintingFinished" - revision: 5 - Parameter { name: "filePath"; type: "string" } - Parameter { name: "success"; type: "bool" } - } - Signal { - name: "quotaRequested" - revision: 7 - Parameter { name: "request"; type: "QWebEngineQuotaRequest" } - } - Signal { - name: "geometryChangeRequested" - revision: 7 - Parameter { name: "geometry"; type: "QRect" } - Parameter { name: "frameGeometry"; type: "QRect" } - } - Signal { name: "inspectedViewChanged"; revision: 7 } - Signal { name: "devToolsViewChanged"; revision: 7 } - Signal { - name: "registerProtocolHandlerRequested" - revision: 7 - Parameter { name: "request"; type: "QWebEngineRegisterProtocolHandlerRequest" } - } - Signal { name: "printRequested"; revision: 8 } - Signal { - name: "selectClientCertificate" - revision: 9 - Parameter { - name: "clientCertSelection" - type: "QQuickWebEngineClientCertificateSelection" - isPointer: true - } - } - Method { - name: "runJavaScript" - Parameter { type: "string" } - Parameter { type: "QJSValue" } - } - Method { - name: "runJavaScript" - Parameter { type: "string" } - } - Method { - name: "runJavaScript" - revision: 3 - Parameter { type: "string" } - Parameter { name: "worldId"; type: "uint" } - Parameter { type: "QJSValue" } - } - Method { - name: "runJavaScript" - revision: 3 - Parameter { type: "string" } - Parameter { name: "worldId"; type: "uint" } - } - Method { - name: "loadHtml" - Parameter { name: "html"; type: "string" } - Parameter { name: "baseUrl"; type: "QUrl" } - } - Method { - name: "loadHtml" - Parameter { name: "html"; type: "string" } - } - Method { name: "goBack" } - Method { name: "goForward" } - Method { - name: "goBackOrForward" - revision: 1 - Parameter { name: "index"; type: "int" } - } - Method { name: "reload" } - Method { name: "reloadAndBypassCache"; revision: 1 } - Method { name: "stop" } - Method { - name: "findText" - revision: 1 - Parameter { name: "subString"; type: "string" } - Parameter { name: "options"; type: "FindFlags" } - Parameter { name: "callback"; type: "QJSValue" } - } - Method { - name: "findText" - revision: 1 - Parameter { name: "subString"; type: "string" } - Parameter { name: "options"; type: "FindFlags" } - } - Method { - name: "findText" - revision: 1 - Parameter { name: "subString"; type: "string" } - } - Method { name: "fullScreenCancelled"; revision: 1 } - Method { - name: "grantFeaturePermission" - revision: 1 - Parameter { name: "securityOrigin"; type: "QUrl" } - Parameter { type: "Feature" } - Parameter { name: "granted"; type: "bool" } - } - Method { - name: "setActiveFocusOnPress" - revision: 2 - Parameter { name: "arg"; type: "bool" } - } - Method { - name: "triggerWebAction" - revision: 2 - Parameter { name: "action"; type: "WebAction" } - } - Method { - name: "printToPdf" - revision: 3 - Parameter { name: "filePath"; type: "string" } - Parameter { name: "pageSizeId"; type: "PrintedPageSizeId" } - Parameter { name: "orientation"; type: "PrintedPageOrientation" } - } - Method { - name: "printToPdf" - revision: 3 - Parameter { name: "filePath"; type: "string" } - Parameter { name: "pageSizeId"; type: "PrintedPageSizeId" } - } - Method { - name: "printToPdf" - revision: 3 - Parameter { name: "filePath"; type: "string" } - } - Method { - name: "printToPdf" - revision: 3 - Parameter { name: "callback"; type: "QJSValue" } - Parameter { name: "pageSizeId"; type: "PrintedPageSizeId" } - Parameter { name: "orientation"; type: "PrintedPageOrientation" } - } - Method { - name: "printToPdf" - revision: 3 - Parameter { name: "callback"; type: "QJSValue" } - Parameter { name: "pageSizeId"; type: "PrintedPageSizeId" } - } - Method { - name: "printToPdf" - revision: 3 - Parameter { name: "callback"; type: "QJSValue" } - } - Method { - name: "replaceMisspelledWord" - revision: 4 - Parameter { name: "replacement"; type: "string" } - } - Method { - name: "action" - revision: 8 - type: "QQuickWebEngineAction*" - Parameter { name: "action"; type: "WebAction" } - } - } - Component { - name: "QWebEngineNotification" - prototype: "QObject" - exports: ["QtWebEngine/WebEngineNotification 1.9"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "Direction" - values: { - "LeftToRight": 0, - "RightToLeft": 1, - "DirectionAuto": 2 - } - } - Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "icon"; type: "QIcon"; isReadonly: true } - Property { name: "title"; type: "string"; isReadonly: true } - Property { name: "message"; type: "string"; isReadonly: true } - Property { name: "tag"; type: "string"; isReadonly: true } - Property { name: "language"; type: "string"; isReadonly: true } - Property { name: "direction"; type: "Direction"; isReadonly: true } - Signal { name: "closed" } - Method { name: "show" } - Method { name: "click" } - Method { name: "close" } - } - Component { - name: "QWebEngineQuotaRequest" - exports: ["QtWebEngine/QuotaRequest 1.7"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "requestedSize"; type: "qlonglong"; isReadonly: true } - Method { name: "accept" } - Method { name: "reject" } - } - Component { - name: "QWebEngineRegisterProtocolHandlerRequest" - exports: ["QtWebEngine/RegisterProtocolHandlerRequest 1.7"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "scheme"; type: "string"; isReadonly: true } - Method { name: "accept" } - Method { name: "reject" } - } -} diff --git a/src/webengine/plugin/qmldir b/src/webengine/plugin/qmldir deleted file mode 100644 index 8970dc9c1..000000000 --- a/src/webengine/plugin/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtWebEngine -plugin qtwebengineplugin -classname QtWebEnginePlugin -typeinfo plugins.qmltypes diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp deleted file mode 100644 index 3a103b9aa..000000000 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "render_widget_host_view_qt_delegate_quick.h" - -#include "qquickwebengineview_p.h" -#include "qquickwebengineview_p_p.h" -#include <QGuiApplication> -#include <QQuickPaintedItem> -#include <QQuickWindow> -#include <QSurfaceFormat> -#include <QVariant> -#include <QWindow> -#include <QtQuick/private/qquickwindow_p.h> - -namespace QtWebEngineCore { - -RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup) - : m_client(client) - , m_isPopup(isPopup) -{ - setFlag(ItemHasContents); - setAcceptedMouseButtons(Qt::AllButtons); - setAcceptHoverEvents(true); - if (isPopup) - return; - setFocus(true); - setActiveFocusOnTab(true); - -#if defined(Q_OS_MACOS) && !defined(QT_NO_OPENGL) - // Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL - // shared context profile, otherwise this could lead to a nasty crash. - QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); - if (globalSharedContext) { - QSurfaceFormat sharedFormat = globalSharedContext->format(); - QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat(); - - if (defaultFormat.profile() != sharedFormat.profile() - && defaultFormat.profile() == QSurfaceFormat::CoreProfile - && defaultFormat.version() >= qMakePair(3, 2)) { - qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile is not compatible with the " - "global shared context OpenGL profile. Please make sure you set a compatible " - "QSurfaceFormat before the QtGui application instance is created."); - } - } -#endif - -} - -RenderWidgetHostViewQtDelegateQuick::~RenderWidgetHostViewQtDelegateQuick() -{ - QQuickWebEngineViewPrivate::bindViewAndWidget(nullptr, this); -} - -void RenderWidgetHostViewQtDelegateQuick::initAsPopup(const QRect &r) -{ - Q_ASSERT(m_isPopup && parentItem()); - QRectF rect(parentItem()->mapRectFromScene(r)); - setX(rect.x()); - setY(rect.y()); - setWidth(rect.width()); - setHeight(rect.height()); - setVisible(true); -} - -QRectF RenderWidgetHostViewQtDelegateQuick::viewGeometry() const -{ - // Transform the entire rect to find the correct top left corner. - const QPointF p1 = mapToGlobal(mapFromScene(QPointF(0, 0))); - const QPointF p2 = mapToGlobal(mapFromScene(QPointF(width(), height()))); - QRectF geometry = QRectF(p1, p2).normalized(); - // But keep the size untransformed to behave like other QQuickItems. - geometry.setSize(size()); - return geometry; -} - -QRect RenderWidgetHostViewQtDelegateQuick::windowGeometry() const -{ - if (!window()) - return QRect(); - return window()->frameGeometry(); -} - -void RenderWidgetHostViewQtDelegateQuick::setKeyboardFocus() -{ - setFocus(true); -} - -bool RenderWidgetHostViewQtDelegateQuick::hasKeyboardFocus() -{ - return hasActiveFocus(); -} - -void RenderWidgetHostViewQtDelegateQuick::lockMouse() -{ - grabMouse(); -} - -void RenderWidgetHostViewQtDelegateQuick::unlockMouse() -{ - ungrabMouse(); -} - -void RenderWidgetHostViewQtDelegateQuick::show() -{ - setVisible(true); - m_client->notifyShown(); -} - -void RenderWidgetHostViewQtDelegateQuick::hide() -{ - setVisible(false); - m_client->notifyHidden(); -} - -bool RenderWidgetHostViewQtDelegateQuick::isVisible() const -{ - return QQuickItem::isVisible(); -} - -QWindow* RenderWidgetHostViewQtDelegateQuick::window() const -{ - return QQuickItem::window(); -} - -QSGTexture *RenderWidgetHostViewQtDelegateQuick::createTextureFromImage(const QImage &image) -{ - return QQuickItem::window()->createTextureFromImage(image, QQuickWindow::TextureCanUseAtlas); -} - -QSGLayer *RenderWidgetHostViewQtDelegateQuick::createLayer() -{ - QSGRenderContext *renderContext = QQuickWindowPrivate::get(QQuickItem::window())->context; - return renderContext->sceneGraphContext()->createLayer(renderContext); -} - -QSGImageNode *RenderWidgetHostViewQtDelegateQuick::createImageNode() -{ - return QQuickItem::window()->createImageNode(); -} - -QSGRectangleNode *RenderWidgetHostViewQtDelegateQuick::createRectangleNode() -{ - return QQuickItem::window()->createRectangleNode(); -} - -void RenderWidgetHostViewQtDelegateQuick::update() -{ - QQuickItem::update(); -} - -void RenderWidgetHostViewQtDelegateQuick::updateCursor(const QCursor &cursor) -{ - setCursor(cursor); -} - -void RenderWidgetHostViewQtDelegateQuick::resize(int width, int height) -{ - setSize(QSizeF(width, height)); -} - -void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVisible, bool passwordInput) -{ - setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput); - - if (parentItem()) - parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput); - - qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints); - if (qApp->inputMethod()->isVisible() != editorVisible) - qApp->inputMethod()->setVisible(editorVisible); -} - -bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event) -{ - if (event->type() == QEvent::ShortcutOverride) - return m_client->forwardEvent(event); - -#ifndef QT_NO_GESTURES - if (event->type() == QEvent::NativeGesture) - return m_client->forwardEvent(event); -#endif - - return QQuickItem::event(event); -} - -void RenderWidgetHostViewQtDelegateQuick::focusInEvent(QFocusEvent *event) -{ - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::focusOutEvent(QFocusEvent *event) -{ - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::mousePressEvent(QMouseEvent *event) -{ - QQuickItem *parent = parentItem(); - if (!m_isPopup && (parent && parent->property("activeFocusOnPress").toBool())) - forceActiveFocus(); - if (!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { - event->ignore(); - return; - } - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::mouseMoveEvent(QMouseEvent *event) -{ - QQuickItem *parent = parentItem(); - if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { - event->ignore(); - return; - } - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::mouseReleaseEvent(QMouseEvent *event) -{ - QQuickItem *parent = parentItem(); - if (!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { - event->ignore(); - return; - } - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::keyPressEvent(QKeyEvent *event) -{ - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::keyReleaseEvent(QKeyEvent *event) -{ - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::wheelEvent(QWheelEvent *event) -{ - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event) -{ - QQuickItem *parent = parentItem(); - if (event->type() == QEvent::TouchBegin && !m_isPopup - && (parent && parent->property("activeFocusOnPress").toBool())) - forceActiveFocus(); - if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { - event->ignore(); - return; - } - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event) -{ - QQuickItem *parent = parentItem(); - if ((!m_isPopup && parent && !parent->property("activeFocusOnPress").toBool() - && !parent->hasActiveFocus()) || event->posF() == event->oldPosF()) { - event->ignore(); - return; - } - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::hoverLeaveEvent(QHoverEvent *event) -{ - m_client->forwardEvent(event); -} - -QVariant RenderWidgetHostViewQtDelegateQuick::inputMethodQuery(Qt::InputMethodQuery query) const -{ - return m_client->inputMethodQuery(query); -} - -void RenderWidgetHostViewQtDelegateQuick::inputMethodEvent(QInputMethodEvent *event) -{ - m_client->forwardEvent(event); -} - -void RenderWidgetHostViewQtDelegateQuick::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - QQuickItem::geometryChanged(newGeometry, oldGeometry); - m_client->visualPropertiesChanged(); -} - -void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const ItemChangeData &value) -{ - QQuickItem::itemChange(change, value); - if (change == QQuickItem::ItemSceneChange) { - for (const QMetaObject::Connection &c : qAsConst(m_windowConnections)) - disconnect(c); - m_windowConnections.clear(); - if (value.window) { - m_windowConnections.append(connect(value.window, SIGNAL(xChanged(int)), SLOT(onWindowPosChanged()))); - m_windowConnections.append(connect(value.window, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged()))); - if (!m_isPopup) - m_windowConnections.append(connect(value.window, SIGNAL(closing(QQuickCloseEvent *)), SLOT(onHide()))); - } - m_client->visualPropertiesChanged(); - } else if (change == QQuickItem::ItemVisibleHasChanged) { - if (!m_isPopup && !value.boolValue) - onHide(); - } -} - -QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) -{ - return m_client->updatePaintNode(oldNode); -} - -void RenderWidgetHostViewQtDelegateQuick::onWindowPosChanged() -{ - m_client->visualPropertiesChanged(); -} - -void RenderWidgetHostViewQtDelegateQuick::onHide() -{ - QFocusEvent event(QEvent::FocusOut, Qt::OtherFocusReason); - m_client->forwardEvent(&event); -} - -bool RenderWidgetHostViewQtDelegateQuick::copySurface(const QRect &rect, const QSize &size, QImage &image) -{ - image = QQuickItem::window()->grabWindow(); - if (image.isNull()) - return false; - QRect subrect = !rect.isEmpty() ? rect : image.rect(); - image = image.copy(subrect); - image = image.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - return true; -} - -} // namespace QtWebEngineCore diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h deleted file mode 100644 index b55b2d658..000000000 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICK_H -#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICK_H - -#include "render_widget_host_view_qt_delegate.h" - -#include <QQuickItem> - -QT_BEGIN_NAMESPACE -class QQuickWebEngineView; -class QQuickWebEngineViewPrivate; -QT_END_NAMESPACE - -namespace QtWebEngineCore { - -class RenderWidgetHostViewQtDelegateQuick : public QQuickItem, public RenderWidgetHostViewQtDelegate -{ - Q_OBJECT -public: - RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup); - ~RenderWidgetHostViewQtDelegateQuick(); - - void initAsPopup(const QRect&) override; - QRectF viewGeometry() const override; - QRect windowGeometry() const override; - void setKeyboardFocus() override; - bool hasKeyboardFocus() override; - void lockMouse() override; - void unlockMouse() override; - void show() override; - void hide() override; - bool isVisible() const override; - QWindow* window() const override; - QSGTexture *createTextureFromImage(const QImage &) override; - QSGLayer *createLayer() override; - QSGImageNode *createImageNode() override; - QSGRectangleNode *createRectangleNode() override; - void update() override; - void updateCursor(const QCursor &) override; - void resize(int width, int height) override; - void move(const QPoint&) override { } - void inputMethodStateChanged(bool editorVisible, bool isPasswordInput) override; - void setInputMethodHints(Qt::InputMethodHints) override { } - // The QtQuick view doesn't have a backbuffer of its own and doesn't need this - void setClearColor(const QColor &) override { } - bool copySurface(const QRect &rect, const QSize &size, QImage &image) override; - -protected: - bool event(QEvent *event) override; - void focusInEvent(QFocusEvent *event) override; - void focusOutEvent(QFocusEvent *event) override; - void mousePressEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; - void mouseReleaseEvent(QMouseEvent *event) override; - void keyPressEvent(QKeyEvent *event) override; - void keyReleaseEvent(QKeyEvent *event) override; - void wheelEvent(QWheelEvent *event) override; - void touchEvent(QTouchEvent *event) override; - void hoverMoveEvent(QHoverEvent *event) override; - void hoverLeaveEvent(QHoverEvent *event) override; - QVariant inputMethodQuery(Qt::InputMethodQuery query) const override; - void inputMethodEvent(QInputMethodEvent *event) override; - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; - void itemChange(ItemChange change, const ItemChangeData &value) override; - QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; - -private slots: - void onWindowPosChanged(); - void onHide(); - -private: - friend QQuickWebEngineViewPrivate; - - RenderWidgetHostViewQtDelegateClient *m_client; - QList<QMetaObject::Connection> m_windowConnections; - bool m_isPopup; - QQuickWebEngineView *m_view = nullptr; -}; - -} // namespace QtWebEngineCore - -#endif diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp deleted file mode 100644 index 23b9e02c2..000000000 --- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "render_widget_host_view_qt_delegate_quickwindow.h" - -#include "qquickwebengineview_p_p.h" -#include <QQuickItem> - -namespace QtWebEngineCore { - -RenderWidgetHostViewQtDelegateQuickWindow::RenderWidgetHostViewQtDelegateQuickWindow(RenderWidgetHostViewQtDelegateQuick *realDelegate) - : m_realDelegate(realDelegate) - , m_virtualParent(nullptr) -{ - setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); -} - -RenderWidgetHostViewQtDelegateQuickWindow::~RenderWidgetHostViewQtDelegateQuickWindow() -{ -} - -void RenderWidgetHostViewQtDelegateQuickWindow::setVirtualParent(QQuickItem *virtualParent) -{ - Q_ASSERT(virtualParent); - m_virtualParent = virtualParent; -} - -static inline QRectF mapRectToGlobal(const QQuickItem *item, const QRectF &rect) -{ - const QPointF p1 = item->mapToGlobal(rect.topLeft()); - const QPointF p2 = item->mapToGlobal(rect.bottomRight()); - return QRectF(p1, p2).normalized(); -} - -static inline QRectF mapRectFromGlobal(const QQuickItem *item, const QRectF &rect) -{ - const QPointF p1 = item->mapFromGlobal(rect.topLeft()); - const QPointF p2 = item->mapFromGlobal(rect.bottomRight()); - return QRectF(p1, p2).normalized(); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::initAsPopup(const QRect &screenRect) -{ - QRectF popupRect(screenRect); - popupRect = mapRectFromGlobal(m_virtualParent, popupRect); - popupRect = m_virtualParent->mapRectToScene(popupRect); - popupRect = mapRectToGlobal(m_virtualParent, popupRect); - - m_realDelegate->initAsPopup(QRect(QPoint(0, 0), popupRect.size().toSize())); - popupRect.setSize(screenRect.size()); - setGeometry(popupRect.toAlignedRect()); - raise(); - show(); -} - -QRectF RenderWidgetHostViewQtDelegateQuickWindow::viewGeometry() const -{ - return geometry(); -} - -QRect RenderWidgetHostViewQtDelegateQuickWindow::windowGeometry() const -{ - return frameGeometry(); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::show() -{ - QQuickWindow::show(); - m_realDelegate->show(); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::hide() -{ - QQuickWindow::hide(); - m_realDelegate->hide(); -} - -bool RenderWidgetHostViewQtDelegateQuickWindow::isVisible() const -{ - return QQuickWindow::isVisible(); -} - -QWindow *RenderWidgetHostViewQtDelegateQuickWindow::window() const -{ - return const_cast<RenderWidgetHostViewQtDelegateQuickWindow*>(this); -} - -QSGTexture *RenderWidgetHostViewQtDelegateQuickWindow::createTextureFromImage(const QImage &image) -{ - return m_realDelegate->createTextureFromImage(image); -} - -QSGLayer *RenderWidgetHostViewQtDelegateQuickWindow::createLayer() -{ - return m_realDelegate->createLayer(); -} - -QSGImageNode *RenderWidgetHostViewQtDelegateQuickWindow::createImageNode() -{ - return m_realDelegate->createImageNode(); -} - -QSGRectangleNode *RenderWidgetHostViewQtDelegateQuickWindow::createRectangleNode() -{ - return m_realDelegate->createRectangleNode(); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::update() -{ - QQuickWindow::update(); - m_realDelegate->update(); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::updateCursor(const QCursor &cursor) -{ - setCursor(cursor); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::resize(int width, int height) -{ - QQuickWindow::resize(width, height); - m_realDelegate->resize(width, height); -} - -void RenderWidgetHostViewQtDelegateQuickWindow::move(const QPoint &screenPos) -{ - QRectF popupRect(screenPos, size()); - popupRect = mapRectFromGlobal(m_virtualParent, popupRect); - popupRect = m_virtualParent->mapRectToScene(popupRect); - popupRect = mapRectToGlobal(m_virtualParent, popupRect); - - QQuickWindow::setPosition(popupRect.topLeft().toPoint()); -} - -} // namespace QtWebEngineCore diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h deleted file mode 100644 index bebbfa439..000000000 --- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H -#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H - -#include "render_widget_host_view_qt_delegate.h" - -#include "render_widget_host_view_qt_delegate_quick.h" - -#include <QQuickWindow> -#include <QScopedPointer> - -namespace QtWebEngineCore { - -class RenderWidgetHostViewQtDelegateQuickWindow : public QQuickWindow , public RenderWidgetHostViewQtDelegate { - -public: - RenderWidgetHostViewQtDelegateQuickWindow(RenderWidgetHostViewQtDelegateQuick *realDelegate); - ~RenderWidgetHostViewQtDelegateQuickWindow(); - - void initAsPopup(const QRect&) override; - QRectF viewGeometry() const override; - QRect windowGeometry() const override; - void setKeyboardFocus() override {} - bool hasKeyboardFocus() override { return false; } - void lockMouse() override {} - void unlockMouse() override {} - void show() override; - void hide() override; - bool isVisible() const override; - QWindow* window() const override; - QSGTexture *createTextureFromImage(const QImage &) override; - QSGLayer *createLayer() override; - QSGImageNode *createImageNode() override; - QSGRectangleNode *createRectangleNode() override; - void update() override; - void updateCursor(const QCursor &) override; - void resize(int width, int height) override; - void move(const QPoint &screenPos) override; - void inputMethodStateChanged(bool, bool) override {} - void setInputMethodHints(Qt::InputMethodHints) override { } - void setClearColor(const QColor &) override { } - bool copySurface(const QRect &, const QSize &, QImage &) override { return false; } - - void setVirtualParent(QQuickItem *virtualParent); - -private: - QScopedPointer<RenderWidgetHostViewQtDelegateQuick> m_realDelegate; - QQuickItem *m_virtualParent; -}; - -} // namespace QtWebEngineCore - -#endif // RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICKWINDOW_H diff --git a/src/webengine/testsupport/plugin.cpp b/src/webengine/testsupport/plugin.cpp deleted file mode 100644 index 7a1e73d8b..000000000 --- a/src/webengine/testsupport/plugin.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml> - -#include <QtWebEngine/private/qquickwebenginetestsupport_p.h> - -QT_BEGIN_NAMESPACE - -class QtWebEngineTestSupportPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) -public: - virtual void registerTypes(const char *uri) - { - qWarning("\nWARNING: This project is using the testsupport QML API extensions for QtWebEngine and is therefore tied to a specific QtWebEngine release.\n" - "WARNING: The testsupport API will change from version to version, or even be removed. You have been warned!\n"); - - Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine.testsupport")); - - qmlRegisterType<QQuickWebEngineTestSupport>(uri, 1, 0, "WebEngineTestSupport"); - qmlRegisterUncreatableType<QQuickWebEngineErrorPage>(uri, 1, 0, "WebEngineErrorPage", - tr("Cannot create a separate instance of WebEngineErrorPage")); - qmlRegisterUncreatableType<QQuickWebEngineTestInputContext>(uri, 1, 0, "TestInputContext", - tr("Cannot create a separate instance of WebEngineErrorPage")); - qmlRegisterUncreatableType<QQuickWebEngineTestEvent>(uri, 1, 0, "WebEngineTestEvent", - tr("Cannot create a separate instance of WebEngineTestEvent")); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/webengine/testsupport/plugins.qmltypes b/src/webengine/testsupport/plugins.qmltypes deleted file mode 100644 index 12c763724..000000000 --- a/src/webengine/testsupport/plugins.qmltypes +++ /dev/null @@ -1,73 +0,0 @@ -import QtQuick.tooling 1.2 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtWebEngine.testsupport 1.0' - -Module { - dependencies: ["QtQuick 2.0"] - Component { name: "QPlatformInputContext"; prototype: "QObject" } - Component { - name: "QQuickWebEngineErrorPage" - prototype: "QObject" - exports: ["QtWebEngine.testsupport/WebEngineErrorPage 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Signal { - name: "loadingChanged" - Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true } - } - } - Component { - name: "QQuickWebEngineTestEvent" - prototype: "QObject" - exports: ["QtWebEngine.testsupport/WebEngineTestEvent 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Method { - name: "mouseMultiClick" - type: "bool" - Parameter { name: "item"; type: "QObject"; isPointer: true } - Parameter { name: "x"; type: "double" } - Parameter { name: "y"; type: "double" } - Parameter { name: "clickCount"; type: "int" } - } - } - Component { - name: "QQuickWebEngineTestInputContext" - prototype: "QPlatformInputContext" - exports: ["QtWebEngine.testsupport/TestInputContext 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Method { name: "create" } - Method { name: "release" } - } - Component { - name: "QQuickWebEngineTestSupport" - prototype: "QObject" - exports: ["QtWebEngine.testsupport/WebEngineTestSupport 1.0"] - exportMetaObjectRevisions: [0] - Property { - name: "errorPage" - type: "QQuickWebEngineErrorPage" - isReadonly: true - isPointer: true - } - Property { - name: "testInputContext" - type: "QQuickWebEngineTestInputContext" - isReadonly: true - isPointer: true - } - Property { - name: "testEvent" - type: "QQuickWebEngineTestEvent" - isReadonly: true - isPointer: true - } - Signal { name: "windowCloseRejected" } - Signal { name: "loadVisuallyCommitted" } - } -} diff --git a/src/webengine/testsupport/qmldir b/src/webengine/testsupport/qmldir deleted file mode 100644 index 7fff80251..000000000 --- a/src/webengine/testsupport/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtWebEngine.testsupport -plugin qtwebenginetestsupportplugin -classname QtWebEngineTestSupportPlugin -typeinfo plugins.qmltypes diff --git a/src/webengine/testsupport/testsupport.pro b/src/webengine/testsupport/testsupport.pro deleted file mode 100644 index a24796675..000000000 --- a/src/webengine/testsupport/testsupport.pro +++ /dev/null @@ -1,11 +0,0 @@ -CXX_MODULE = qml -TARGET = qtwebenginetestsupportplugin -TARGETPATH = QtWebEngine/testsupport -IMPORT_VERSION = 1.0 - -QT += qml quick -QT_PRIVATE += webengine-private gui-private - -SOURCES = plugin.cpp - -load(qml_plugin) diff --git a/src/webengine/ui/AlertDialog.qml b/src/webengine/ui/AlertDialog.qml deleted file mode 100644 index 07f2d7df5..000000000 --- a/src/webengine/ui/AlertDialog.qml +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick.Dialogs 1.2 - -MessageDialog { - icon: StandardIcon.Information -} diff --git a/src/webengine/ui/AuthenticationDialog.qml b/src/webengine/ui/AuthenticationDialog.qml deleted file mode 100644 index a7eedd14d..000000000 --- a/src/webengine/ui/AuthenticationDialog.qml +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// FIXME: authentication missing in Qt Quick Dialogs atm. Make our own for now. -import QtQuick 2.5 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.0 -import QtQuick.Window 2.2 - -Window { - signal accepted(string user, string password) - signal rejected - property alias text: message.text - - title: qsTr("Authentication Required") - flags: Qt.Dialog - modality: Qt.WindowModal - - width: minimumWidth - height: minimumHeight - minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins - minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins - - SystemPalette { id: palette; colorGroup: SystemPalette.Active } - color: palette.window - - function open() { - show(); - } - - function acceptDialog() { - accepted(userField.text, passwordField.text); - close(); - } - - ColumnLayout { - id: rootLayout - anchors.fill: parent - anchors.margins: 4 - property int doubleMargins: anchors.margins * 2 - Text { - id: message - color: palette.windowText - } - GridLayout { - columns: 2 - Label { - text: qsTr("Username:") - color: palette.windowText - } - TextField { - id: userField - focus: true - Layout.fillWidth: true - onAccepted: { - if (userField.text && passwordField.text) - acceptDialog(); - } - } - Label { - text: qsTr("Password:") - color: palette.windowText - } - TextField { - id: passwordField - Layout.fillWidth: true - echoMode: TextInput.Password - onAccepted: { - if (userField.text && passwordField.text) - acceptDialog(); - } - } - } - Item { - Layout.fillHeight: true - } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Button { - id: cancelButton - text: qsTr("&Cancel") - onClicked: { - rejected(); - close(); - } - } - Button { - text: qsTr("&Log In") - isDefault: true - onClicked: acceptDialog() - } - } - } -} diff --git a/src/webengine/ui/ColorDialog.qml b/src/webengine/ui/ColorDialog.qml deleted file mode 100644 index b74fd2cd7..000000000 --- a/src/webengine/ui/ColorDialog.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick.Dialogs 1.2 - -ColorDialog { - id: colorDialog - - signal selectedColor(var color) - - onAccepted: { - selectedColor(colorDialog.currentColor); - } -} diff --git a/src/webengine/ui/ConfirmDialog.qml b/src/webengine/ui/ConfirmDialog.qml deleted file mode 100644 index aab4db04a..000000000 --- a/src/webengine/ui/ConfirmDialog.qml +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick.Dialogs 1.1 - -MessageDialog { - icon: StandardIcon.Question - standardButtons: StandardButton.Ok | StandardButton.Cancel -} diff --git a/src/webengine/ui/FilePicker.qml b/src/webengine/ui/FilePicker.qml deleted file mode 100644 index e6af977ba..000000000 --- a/src/webengine/ui/FilePicker.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick.Dialogs 1.1 - -FileDialog { - - signal filesSelected(var fileList) - - onAccepted: { - filesSelected(fileUrls); - } -} diff --git a/src/webengine/ui/Menu.qml b/src/webengine/ui/Menu.qml deleted file mode 100644 index 36efa7680..000000000 --- a/src/webengine/ui/Menu.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 1.4 as Controls - -Controls.Menu { - id: menu - signal done() - - // Use private API for now - onAboutToHide: doneTimer.start() - - // WORKAROUND On Mac the Menu may be destroyed before the MenuItem - // is actually triggered (see qtbase commit 08cc9b9991ae9ab51) - Timer { - id: doneTimer - interval: 100 - onTriggered: menu.done() - } -} diff --git a/src/webengine/ui/MenuItem.qml b/src/webengine/ui/MenuItem.qml deleted file mode 100644 index e61f4c230..000000000 --- a/src/webengine/ui/MenuItem.qml +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 1.4 as Controls - -Controls.MenuItem { } - diff --git a/src/webengine/ui/MenuSeparator.qml b/src/webengine/ui/MenuSeparator.qml deleted file mode 100644 index 8427865cb..000000000 --- a/src/webengine/ui/MenuSeparator.qml +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 1.4 as Controls - -Controls.MenuSeparator { } diff --git a/src/webengine/ui/PromptDialog.qml b/src/webengine/ui/PromptDialog.qml deleted file mode 100644 index c4dcd6b98..000000000 --- a/src/webengine/ui/PromptDialog.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// FIXME: prompt missing in Qt Quick Dialogs atm. Make our own for now. -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.0 -import QtQuick 2.5 - -ApplicationWindow { - signal input(string text) - signal accepted - signal rejected - property alias text: message.text - property alias prompt: field.text - - width: 350 - height: 100 - flags: Qt.Dialog - - onClosing: { - rejected(); - } - - function open() { - show(); - } - - ColumnLayout { - anchors.fill: parent - anchors.margins: 4 - Text { - id: message - Layout.fillWidth: true - } - TextField { - id:field - Layout.fillWidth: true - } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Button { - text: qsTr("OK") - onClicked: { - input(field.text); - accepted(); - close(); - destroy(); - } - } - Button { - text: qsTr("Cancel") - onClicked: { - rejected(); - close(); - destroy(); - } - } - } - } - -} diff --git a/src/webengine/ui/ToolTip.qml b/src/webengine/ui/ToolTip.qml deleted file mode 100644 index 96033e8f1..000000000 --- a/src/webengine/ui/ToolTip.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 - -Item { - id: toolTipContainer - z: 9999 - width: content.width - height: content.height - visible: false - - property alias text: toolTip.text - property int delayTimerInterval: 1000 - property int hideTimerInterval: 1500 - - Timer { - id: delayTimer - interval: delayTimerInterval - onTriggered: { - toolTipContainer.visible = true - hideTimer.start() - } - } - - Timer { - id: hideTimer - interval: hideTimerInterval - onTriggered: toolTipContainer.visible = false - } - - Rectangle { - id: content - color: "#f8eabf" - border.color: "black" - anchors.centerIn: parent - width: toolTip.contentWidth + 10 - height: toolTip.contentHeight + 10 - radius: 3 - - Text { - id: toolTip - anchors {fill: parent; margins: 5} - wrapMode: Text.WrapAnywhere - } - } - - function open() { - delayTimer.start(); - } - - function hide() { - hideTimer.start(); - } -} diff --git a/src/webengine/ui/TouchHandle.qml b/src/webengine/ui/TouchHandle.qml deleted file mode 100644 index 76a93829e..000000000 --- a/src/webengine/ui/TouchHandle.qml +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 - -Image { } diff --git a/src/webengine/ui/TouchSelectionMenu.qml b/src/webengine/ui/TouchSelectionMenu.qml deleted file mode 100644 index 7cf16b554..000000000 --- a/src/webengine/ui/TouchSelectionMenu.qml +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Layouts 1.3 - -Rectangle { - id: menu - - signal cutTriggered - signal copyTriggered - signal pasteTriggered - signal contextMenuTriggered - - property bool isCutEnabled: false - property bool isCopyEnabled: false - property bool isPasteEnabled: false - - property color borderColor: "darkGray" - property color bgColor: "white" - - radius: 4 - border.color: borderColor - color: borderColor - antialiasing: true - - RowLayout { - anchors.fill: parent - spacing: parent.border.width - anchors.margins: parent.border.width - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - radius: menu.radius - color: bgColor - visible: isCutEnabled - - Text { - id: cutText - anchors.centerIn: parent - text: "Cut" - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.color = borderColor; - cutText.color = "white"; - } - onReleased: { - parent.color = bgColor; - cutText.color = "black"; - cutTriggered(); - } - } - } - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - radius: menu.radius - color: bgColor - visible: isCopyEnabled - - Text { - id: copyText - anchors.centerIn: parent - text: "Copy" - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.color = borderColor; - copyText.color = "white"; - } - onReleased: { - parent.color = bgColor; - copyText.color = "black"; - copyTriggered(); - } - } - } - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - radius: menu.radius - color: bgColor - visible: isPasteEnabled - - Text { - id: pasteText - anchors.centerIn: parent - text: "Paste" - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.color = borderColor; - pasteText.color = "white"; - } - onReleased: { - parent.color = bgColor; - pasteText.color = "black"; - pasteTriggered(); - } - } - } - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - radius: menu.radius - color: bgColor - - Text { - id: contextMenuText - anchors.centerIn: parent - text: "..." - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.color = borderColor; - contextMenuText.color = "white"; - } - onReleased: { - parent.color = bgColor; - contextMenuText.color = "black"; - contextMenuTriggered(); - } - } - } - } -} diff --git a/src/webengine/ui/qmldir b/src/webengine/ui/qmldir deleted file mode 100644 index e23b972be..000000000 --- a/src/webengine/ui/qmldir +++ /dev/null @@ -1,8 +0,0 @@ -module QtWebEngine.Controls1Delegates -AlertDialog 1.0 AlertDialog.qml -ConfirmDialog 1.0 ConfirmDialog.qml -FilePicker 1.0 FilePicker.qml -PromptDialog 1.0 PromptDialog.qml -Menu 1.0 Menu.qml -MenuItem 1.0 MenuItem.qml -MenuSeparator 1.0 MenuSeparator.qml diff --git a/src/webengine/ui/ui.pro b/src/webengine/ui/ui.pro deleted file mode 100644 index 69f754e0c..000000000 --- a/src/webengine/ui/ui.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGETPATH = QtWebEngine/Controls1Delegates - -QML_FILES += \ - # Authentication Dialog - AuthenticationDialog.qml \ - # JS Dialogs - AlertDialog.qml \ - ColorDialog.qml \ - ConfirmDialog.qml \ - FilePicker.qml \ - PromptDialog.qml \ - # Menus. Based on Qt Quick Controls - Menu.qml \ - MenuItem.qml \ - MenuSeparator.qml \ - ToolTip.qml \ - TouchHandle.qml \ - TouchSelectionMenu.qml - -load(qml_module) diff --git a/src/webengine/ui2/AlertDialog.qml b/src/webengine/ui2/AlertDialog.qml deleted file mode 100644 index 4f63c5b70..000000000 --- a/src/webengine/ui2/AlertDialog.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.0 - -Dialog { - property alias text: message.text - property bool handled: false - signal accepted() - signal rejected() - title: qsTr("Alert Dialog") - modality: Qt.NonModal - - //handle the case where users simply closes the dialog - onVisibilityChanged: { - if (visible == false && handled == false) { - handled = true; - rejected(); - } else { - handled = false; - } - } - - function acceptDialog() { - accepted(); - handled = true; - close(); - } - - contentItem: ColumnLayout { - id: rootLayout - anchors.fill: parent - anchors.margins: 4 - property int minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins - property int minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins - property int doubleMargins: anchors.margins * 2 - SystemPalette { id: palette; colorGroup: SystemPalette.Active } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Image { - source: "information.png" - } - Text { - id: message - Layout.fillWidth: true - color: palette.windowText - } - } - Item { - Layout.fillHeight: true - } - Controls.Button { - Layout.alignment: Qt.AlignHCenter - text: qsTr("OK") - onClicked: acceptDialog() - } - } -} diff --git a/src/webengine/ui2/AuthenticationDialog.qml b/src/webengine/ui2/AuthenticationDialog.qml deleted file mode 100644 index 52fcce3f1..000000000 --- a/src/webengine/ui2/AuthenticationDialog.qml +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.0 - -Dialog { - property alias text: message.text - property bool handled: false - signal accepted(string user, string password) - signal rejected() - title: qsTr("Authentication Required") - modality: Qt.NonModal - - //handle the case where users simply closes the dialog - onVisibilityChanged: { - if (visible == false && handled == false) { - handled = true; - rejected(); - } else { - handled = false; - } - } - - function acceptDialog() { - accepted(userField.text, passwordField.text); - handled = true; - close(); - } - - function rejectDialog() { - rejected(); - handled = true; - close(); - } - - contentItem: ColumnLayout { - id: rootLayout - anchors.fill: parent - anchors.margins: 4 - property int minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins - property int minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins - - property int doubleMargins: anchors.margins * 2 - - SystemPalette { id: palette; colorGroup: SystemPalette.Active } - Text { - id: message - color: palette.windowText - } - GridLayout { - columns: 2 - Controls.Label { - text: qsTr("Username:") - color: palette.windowText - } - Controls.TextField { - id: userField - focus: true - Layout.fillWidth: true - onAccepted: { - if (userField.text && passwordField.text) - acceptDialog(); - } - } - Controls.Label { - text: qsTr("Password:") - color: palette.windowText - } - Controls.TextField { - id: passwordField - Layout.fillWidth: true - echoMode: TextInput.Password - onAccepted: { - if (userField.text && passwordField.text) - acceptDialog(); - } - } - } - Item { - Layout.fillHeight: true - } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Controls.Button { - id: cancelButton - text: qsTr("Cancel") - onClicked: rejectDialog() - } - Controls.Button { - text: qsTr("Log In") - onClicked: acceptDialog() - } - } - } -} diff --git a/src/webengine/ui2/ConfirmDialog.qml b/src/webengine/ui2/ConfirmDialog.qml deleted file mode 100644 index 0649d3654..000000000 --- a/src/webengine/ui2/ConfirmDialog.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.0 - -Dialog { - property alias text: message.text - property bool handled: false - signal accepted() - signal rejected() - title: qsTr("Alert Dialog") - modality: Qt.NonModal - - //handle the case where users simply closes the dialog - onVisibilityChanged: { - if (visible == false && handled == false) { - handled = true; - rejected(); - } else { - handled = false; - } - } - - function acceptDialog() { - accepted(); - handled = true; - close(); - } - - function rejectDialog() { - rejected(); - handled = true; - close(); - } - - contentItem: ColumnLayout { - id: rootLayout - anchors.fill: parent - anchors.margins: 4 - property int minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins - property int minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins - property int doubleMargins: anchors.margins * 2 - SystemPalette { id: palette; colorGroup: SystemPalette.Active } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Image { - source: "question.png" - } - Text { - id: message - Layout.fillWidth: true - color: palette.windowText - } - } - Item { - Layout.fillHeight: true - } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Controls.Button { - text: qsTr("OK") - onClicked: acceptDialog() - } - Controls.Button { - text: qsTr("Cancel") - onClicked: rejectDialog() - } - } - } -} diff --git a/src/webengine/ui2/Menu.qml b/src/webengine/ui2/Menu.qml deleted file mode 100644 index 0e7b869f5..000000000 --- a/src/webengine/ui2/Menu.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls - -Controls.Menu { - id: menu - signal done() - - // Use private API for now - onAboutToHide: doneTimer.start() - - // WORKAROUND On Mac the Menu may be destroyed before the MenuItem - // is actually triggered (see qtbase commit 08cc9b9991ae9ab51) - Timer { - id: doneTimer - interval: 100 - onTriggered: menu.done() - } -} diff --git a/src/webengine/ui2/MenuItem.qml b/src/webengine/ui2/MenuItem.qml deleted file mode 100644 index 9bf8aac5e..000000000 --- a/src/webengine/ui2/MenuItem.qml +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls - -Controls.MenuItem { } - diff --git a/src/webengine/ui2/MenuSeparator.qml b/src/webengine/ui2/MenuSeparator.qml deleted file mode 100644 index 0c664084a..000000000 --- a/src/webengine/ui2/MenuSeparator.qml +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 - -Item { id: dummy } diff --git a/src/webengine/ui2/PromptDialog.qml b/src/webengine/ui2/PromptDialog.qml deleted file mode 100644 index 880213e36..000000000 --- a/src/webengine/ui2/PromptDialog.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 2.0 as Controls -import QtQuick.Layouts 1.0 -import QtQuick.Dialogs 1.2 - -Dialog { - property alias text: message.text - property alias prompt: field.text - property bool handled: false - signal input(string text) - signal accepted() - signal rejected() - title: qsTr("Prompt Dialog") - modality: Qt.NonModal - - //handle the case where users simply closes the dialog - onVisibilityChanged: { - if (visible == false && handled == false) { - handled = true; - rejected(); - } else { - handled = false; - } - } - - function acceptDialog() { - input(field.text); - accepted(); - handled = true; - close(); - } - - function rejectDialog() { - rejected(); - handled = true; - close(); - } - - contentItem: ColumnLayout { - id: rootLayout - anchors.fill: parent - anchors.margins: 4 - property int minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins - property int minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins - property int doubleMargins: anchors.margins * 2 - SystemPalette { id: palette; colorGroup: SystemPalette.Active } - Text { - id: message - Layout.fillWidth: true - color: palette.windowText - } - Controls.TextField { - id:field - focus: true - Layout.fillWidth: true - onAccepted: acceptDialog() - } - Item { - Layout.fillHeight: true - } - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: 8 - Controls.Button { - text: qsTr("OK") - onClicked: acceptDialog() - } - Controls.Button { - text: qsTr("Cancel") - onClicked: rejectDialog() - } - } - } - -} diff --git a/src/webengine/ui2/ToolTip.qml b/src/webengine/ui2/ToolTip.qml deleted file mode 100644 index 91645a0f4..000000000 --- a/src/webengine/ui2/ToolTip.qml +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick.Controls 2.0 - -ToolTip { - delay: 1000 - timeout: 1500 -} diff --git a/src/webengine/ui2/information.png b/src/webengine/ui2/information.png Binary files differdeleted file mode 100644 index 0a2eb87d1..000000000 --- a/src/webengine/ui2/information.png +++ /dev/null diff --git a/src/webengine/ui2/qmldir b/src/webengine/ui2/qmldir deleted file mode 100644 index 8ab0d3671..000000000 --- a/src/webengine/ui2/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -# Internal module -module QtWebEngine/Controls2Delegates diff --git a/src/webengine/ui2/question.png b/src/webengine/ui2/question.png Binary files differdeleted file mode 100644 index 2dd92fd79..000000000 --- a/src/webengine/ui2/question.png +++ /dev/null diff --git a/src/webengine/ui2/ui2.pro b/src/webengine/ui2/ui2.pro deleted file mode 100644 index 4628d40b5..000000000 --- a/src/webengine/ui2/ui2.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGETPATH = QtWebEngine/Controls2Delegates - -QML_FILES += \ - # Authentication Dialog - AuthenticationDialog.qml \ - # JS Dialogs - AlertDialog.qml \ - ConfirmDialog.qml \ - PromptDialog.qml \ - # Menus. Based on Qt Quick Controls - Menu.qml \ - MenuItem.qml \ - MenuSeparator.qml \ - ToolTip.qml \ - information.png \ - question.png - -load(qml_module) diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp deleted file mode 100644 index 19274bedf..000000000 --- a/src/webengine/ui_delegates_manager.cpp +++ /dev/null @@ -1,738 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "ui_delegates_manager.h" - -#include "api/qquickwebengineview_p.h" -#include <authentication_dialog_controller.h> -#include <color_chooser_controller.h> -#include <file_picker_controller.h> -#include <javascript_dialog_controller.h> -#include <touch_selection_menu_controller.h> -#include <web_contents_adapter_client.h> - -#include <QFileInfo> -#include <QQmlContext> -#include <QQmlEngine> -#include <QQmlProperty> -#include <QQuickWindow> -#include <QCursor> -#include <QList> -#include <QScreen> -#include <QTimer> -#include <QGuiApplication> - -// Uncomment for QML debugging -//#define UI_DELEGATES_DEBUG - -namespace QtWebEngineCore { - -#define NO_SEPARATOR -#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) -#define FILE_NAME_CASE_STATEMENT(TYPE, COMPONENT) \ - case UIDelegatesManager::TYPE:\ - return QString::fromLatin1(#TYPE ##".qml"); -#else -#define FILE_NAME_CASE_STATEMENT(TYPE, COMPONENT) \ - case UIDelegatesManager::TYPE:\ - return QStringLiteral(#TYPE".qml"); -#endif - -static QString fileNameForComponent(UIDelegatesManager::ComponentType type) -{ - switch (type) { - FOR_EACH_COMPONENT_TYPE(FILE_NAME_CASE_STATEMENT, NO_SEPARATOR) - default: - Q_UNREACHABLE(); - } - return QString(); -} - -static QPoint calculateToolTipPosition(QPoint &position, QSize &toolTip) { - QRect screen; - const QList<QScreen *> screens = QGuiApplication::screens(); - for (const QScreen *src : screens) - if (src->availableGeometry().contains(position)) - screen = src->availableGeometry(); - - position += QPoint(2, 16); - - if (position.x() + toolTip.width() > screen.x() + screen.width()) - position.rx() -= 4 + toolTip.width(); - if (position.y() + toolTip.height() > screen.y() + screen.height()) - position.ry() -= 24 + toolTip.height(); - if (position.y() < screen.y()) - position.setY(screen.y()); - if (position.x() + toolTip.width() > screen.x() + screen.width()) - position.setX(screen.x() + screen.width() - toolTip.width()); - if (position.x() < screen.x()) - position.setX(screen.x()); - if (position.y() + toolTip.height() > screen.y() + screen.height()) - position.setY(screen.y() + screen.height() - toolTip.height()); - - return position; -} - -const char *defaultPropertyName(QObject *obj) -{ - const QMetaObject *metaObject = obj->metaObject(); - - int idx = metaObject->indexOfClassInfo("DefaultProperty"); - if (-1 == idx) - return 0; - - QMetaClassInfo info = metaObject->classInfo(idx); - return info.value(); -} - -#define COMPONENT_MEMBER_INIT(TYPE, COMPONENT) \ - , COMPONENT##Component(0) - -UIDelegatesManager::UIDelegatesManager(QQuickWebEngineView *view) - : m_view(view) - , m_toolTip(nullptr) - , m_touchSelectionMenu(nullptr) - FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_INIT, NO_SEPARATOR) -{ -} - -UIDelegatesManager::~UIDelegatesManager() -{ -} - -#define COMPONENT_MEMBER_CASE_STATEMENT(TYPE, COMPONENT) \ - case TYPE: \ - component = &COMPONENT##Component; \ - break; - -bool UIDelegatesManager::initializeImportDirs(QStringList &dirs, QQmlEngine *engine) -{ - const QStringList paths = engine->importPathList(); - for (const QString &path : paths) { - QString importPath = path % QLatin1String("/QtWebEngine/Controls1Delegates/"); - - // resource paths have to be tested using the ":/" prefix - if (importPath.startsWith(QLatin1String("qrc:/"))) - importPath.remove(0, 3); - - QFileInfo fi(importPath); - if (fi.exists()) - dirs << fi.absolutePath(); - } - return !dirs.isEmpty(); -} - -bool UIDelegatesManager::ensureComponentLoaded(ComponentType type) -{ - QQmlEngine* engine = qmlEngine(m_view); - if (m_importDirs.isEmpty() && !initializeImportDirs(m_importDirs, engine)) - return false; - - QQmlComponent **component; - switch (type) { - FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_CASE_STATEMENT, NO_SEPARATOR) - default: - Q_UNREACHABLE(); - return false; - } - QString fileName(fileNameForComponent(type)); -#ifndef UI_DELEGATES_DEBUG - if (*component) - return true; -#else // Unconditionally reload the components each time. - fprintf(stderr, "%s: %s\n", Q_FUNC_INFO, qPrintable(fileName)); -#endif - if (!engine) - return false; - - for (const QString &importDir : qAsConst(m_importDirs)) { - const QString componentFilePath = importDir % QLatin1Char('/') % fileName; - - if (!QFileInfo(componentFilePath).exists()) - continue; - - // FIXME: handle async loading - *component = (new QQmlComponent(engine, - importDir.startsWith(QLatin1String(":/")) ? QUrl(QLatin1String("qrc") + componentFilePath) - : QUrl::fromLocalFile(componentFilePath), - QQmlComponent::PreferSynchronous, m_view)); - - if ((*component)->status() != QQmlComponent::Ready) { - const QList<QQmlError> errs = (*component)->errors(); - for (const QQmlError &err : errs) - qWarning("QtWebEngine: component error: %s\n", qPrintable(err.toString())); - delete *component; - *component = nullptr; - return false; - } - return true; - } - return false; -} - -#define CHECK_QML_SIGNAL_PROPERTY(prop, location) \ - if (!prop.isSignalProperty()) \ - qWarning("%s is missing %s signal property.\n", qPrintable(location.toString()), qPrintable(prop.name())); - -void UIDelegatesManager::addMenuItem(QQuickWebEngineAction *action, QObject *menu, bool checkable, bool checked) -{ - Q_ASSERT(action); - if (!ensureComponentLoaded(MenuItem)) - return; - QObject *it = menuItemComponent->beginCreate(qmlContext(m_view)); - - QQmlProperty(it, QStringLiteral("text")).write(action->text()); - QQmlProperty(it, QStringLiteral("iconName")).write(action->iconName()); - QQmlProperty(it, QStringLiteral("enabled")).write(action->isEnabled()); - QQmlProperty(it, QStringLiteral("checkable")).write(checkable); - QQmlProperty(it, QStringLiteral("checked")).write(checked); - - QQmlProperty signal(it, QStringLiteral("onTriggered")); - CHECK_QML_SIGNAL_PROPERTY(signal, menuItemComponent->url()); - const QMetaObject *actionMeta = action->metaObject(); - QObject::connect(it, signal.method(), action, actionMeta->method(actionMeta->indexOfSlot("trigger()"))); - menuItemComponent->completeCreate(); - - it->setParent(menu); - - QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(m_view)); - if (entries.isValid()) - entries.append(it); -} - -void UIDelegatesManager::addMenuSeparator(QObject *menu) -{ - if (!ensureComponentLoaded(MenuSeparator)) - return; - - QQmlContext *itemContext = qmlContext(m_view); - QObject *sep = menuSeparatorComponent->create(itemContext); - sep->setParent(menu); - - QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(m_view)); - if (entries.isValid() && entries.count() > 0) - entries.append(sep); -} - -QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title, const QPoint& pos) -{ - Q_ASSERT(parentMenu); - if (!ensureComponentLoaded(Menu)) - return nullptr; - QQmlContext *context = qmlContext(m_view); - QObject *menu = menuComponent->beginCreate(context); - // set visual parent for non-Window-based menus - if (QQuickItem *item = qobject_cast<QQuickItem*>(menu)) - item->setParentItem(m_view); - - if (!title.isEmpty()) - QQmlProperty(menu, QStringLiteral("title")).write(title); - if (!pos.isNull()) - menu->setProperty("pos", pos); - - menu->setParent(parentMenu); - - QQmlProperty doneSignal(menu, QStringLiteral("onDone")); - static int deleteLaterIndex = menu->metaObject()->indexOfSlot("deleteLater()"); - CHECK_QML_SIGNAL_PROPERTY(doneSignal, menuComponent->url()); - QObject::connect(menu, doneSignal.method(), menu, menu->metaObject()->method(deleteLaterIndex)); - - QQmlListReference entries(parentMenu, defaultPropertyName(parentMenu), qmlEngine(m_view)); - if (entries.isValid()) - entries.append(menu); - - menuComponent->completeCreate(); - return menu; -} - -#define ASSIGN_DIALOG_COMPONENT_DATA_CASE_STATEMENT(TYPE, COMPONENT) \ - case TYPE:\ - dialogComponent = COMPONENT##Component; \ - break; - - -void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> dialogController) -{ - Q_ASSERT(!dialogController.isNull()); - ComponentType dialogComponentType = Invalid; - QString title; - switch (dialogController->type()) { - case WebContentsAdapterClient::AlertDialog: - dialogComponentType = AlertDialog; - title = tr("Javascript Alert - %1").arg(m_view->url().toString()); - break; - case WebContentsAdapterClient::ConfirmDialog: - dialogComponentType = ConfirmDialog; - title = tr("Javascript Confirm - %1").arg(m_view->url().toString()); - break; - case WebContentsAdapterClient::PromptDialog: - dialogComponentType = PromptDialog; - title = tr("Javascript Prompt - %1").arg(m_view->url().toString()); - break; - case WebContentsAdapterClient::UnloadDialog: - dialogComponentType = ConfirmDialog; - title = tr("Are you sure you want to leave this page?"); - break; - case WebContentsAdapterClient::InternalAuthorizationDialog: - dialogComponentType = ConfirmDialog; - title = dialogController->title(); - break; - default: - Q_UNREACHABLE(); - } - - if (!ensureComponentLoaded(dialogComponentType)) { - // Let the controller know it couldn't be loaded - qWarning("Failed to load dialog, rejecting."); - dialogController->reject(); - return; - } - - QQmlComponent *dialogComponent = nullptr; - switch (dialogComponentType) { - FOR_EACH_COMPONENT_TYPE(ASSIGN_DIALOG_COMPONENT_DATA_CASE_STATEMENT, NO_SEPARATOR) - default: - Q_UNREACHABLE(); - } - - QQmlContext *context = qmlContext(m_view); - QObject *dialog = dialogComponent->beginCreate(context); - // set visual parent for non-Window-based dialogs - if (QQuickItem *item = qobject_cast<QQuickItem*>(dialog)) - item->setParentItem(m_view); - dialog->setParent(m_view); - QQmlProperty textProp(dialog, QStringLiteral("text")); - if (dialogController->type() == WebContentsAdapterClient::UnloadDialog) - textProp.write(tr("Changes that you made may not be saved.")); - else - textProp.write(dialogController->message()); - - QQmlProperty titleProp(dialog, QStringLiteral("title")); - titleProp.write(title); - - QQmlProperty acceptSignal(dialog, QStringLiteral("onAccepted")); - QQmlProperty rejectSignal(dialog, QStringLiteral("onRejected")); - CHECK_QML_SIGNAL_PROPERTY(acceptSignal, dialogComponent->url()); - CHECK_QML_SIGNAL_PROPERTY(rejectSignal, dialogComponent->url()); - - static int acceptIndex = dialogController->metaObject()->indexOfSlot("accept()"); - QObject::connect(dialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex)); - static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()"); - QObject::connect(dialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex)); - - if (dialogComponentType == PromptDialog) { - QQmlProperty promptProp(dialog, QStringLiteral("prompt")); - promptProp.write(dialogController->defaultPrompt()); - QQmlProperty inputSignal(dialog, QStringLiteral("onInput")); - CHECK_QML_SIGNAL_PROPERTY(inputSignal, dialogComponent->url()); - static int setTextIndex = dialogController->metaObject()->indexOfSlot("textProvided(QString)"); - QObject::connect(dialog, inputSignal.method(), dialogController.data(), dialogController->metaObject()->method(setTextIndex)); - } - - dialogComponent->completeCreate(); - - QObject::connect(dialogController.data(), &JavaScriptDialogController::dialogCloseRequested, dialog, &QObject::deleteLater); - - QMetaObject::invokeMethod(dialog, "open"); -} - -void UIDelegatesManager::showColorDialog(QSharedPointer<ColorChooserController> controller) -{ - if (!ensureComponentLoaded(ColorDialog)) { - // Let the controller know it couldn't be loaded - qWarning("Failed to load dialog, rejecting."); - controller->reject(); - return; - } - - QQmlContext *context = qmlContext(m_view); - QObject *colorDialog = colorDialogComponent->beginCreate(context); - if (QQuickItem *item = qobject_cast<QQuickItem*>(colorDialog)) - item->setParentItem(m_view); - colorDialog->setParent(m_view); - - if (controller->initialColor().isValid()) - colorDialog->setProperty("color", controller->initialColor()); - - QQmlProperty selectedColorSignal(colorDialog, QStringLiteral("onSelectedColor")); - CHECK_QML_SIGNAL_PROPERTY(selectedColorSignal, colorDialogComponent->url()); - QQmlProperty rejectedSignal(colorDialog, QStringLiteral("onRejected")); - CHECK_QML_SIGNAL_PROPERTY(rejectedSignal, colorDialogComponent->url()); - - static int acceptIndex = controller->metaObject()->indexOfSlot("accept(QVariant)"); - QObject::connect(colorDialog, selectedColorSignal.method(), controller.data(), controller->metaObject()->method(acceptIndex)); - static int rejectIndex = controller->metaObject()->indexOfSlot("reject()"); - QObject::connect(colorDialog, rejectedSignal.method(), controller.data(), controller->metaObject()->method(rejectIndex)); - - // delete later - static int deleteLaterIndex = colorDialog->metaObject()->indexOfSlot("deleteLater()"); - QObject::connect(colorDialog, selectedColorSignal.method(), colorDialog, colorDialog->metaObject()->method(deleteLaterIndex)); - QObject::connect(colorDialog, rejectedSignal.method(), colorDialog, colorDialog->metaObject()->method(deleteLaterIndex)); - - colorDialogComponent->completeCreate(); - QMetaObject::invokeMethod(colorDialog, "open"); -} - -void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogController> dialogController) -{ - Q_ASSERT(!dialogController.isNull()); - - if (!ensureComponentLoaded(AuthenticationDialog)) { - // Let the controller know it couldn't be loaded - qWarning("Failed to load authentication dialog, rejecting."); - dialogController->reject(); - return; - } - - QQmlContext *context = qmlContext(m_view); - QObject *authenticationDialog = authenticationDialogComponent->beginCreate(context); - // set visual parent for non-Window-based dialogs - if (QQuickItem *item = qobject_cast<QQuickItem*>(authenticationDialog)) - item->setParentItem(m_view); - authenticationDialog->setParent(m_view); - - QString introMessage; - if (dialogController->isProxy()) { - introMessage = tr("Connect to proxy \"%1\" using:"); - introMessage = introMessage.arg(dialogController->host().toHtmlEscaped()); - } else { - const QUrl url = dialogController->url(); - introMessage = tr("Enter username and password for \"%1\" at %2://%3"); - introMessage = introMessage.arg(dialogController->realm(), url.scheme(), url.host()); - } - QQmlProperty textProp(authenticationDialog, QStringLiteral("text")); - textProp.write(introMessage); - - QQmlProperty acceptSignal(authenticationDialog, QStringLiteral("onAccepted")); - QQmlProperty rejectSignal(authenticationDialog, QStringLiteral("onRejected")); - CHECK_QML_SIGNAL_PROPERTY(acceptSignal, authenticationDialogComponent->url()); - CHECK_QML_SIGNAL_PROPERTY(rejectSignal, authenticationDialogComponent->url()); - - static int acceptIndex = dialogController->metaObject()->indexOfSlot("accept(QString,QString)"); - static int deleteLaterIndex = authenticationDialog->metaObject()->indexOfSlot("deleteLater()"); - QObject::connect(authenticationDialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex)); - QObject::connect(authenticationDialog, acceptSignal.method(), authenticationDialog, authenticationDialog->metaObject()->method(deleteLaterIndex)); - static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()"); - QObject::connect(authenticationDialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex)); - QObject::connect(authenticationDialog, rejectSignal.method(), authenticationDialog, authenticationDialog->metaObject()->method(deleteLaterIndex)); - - authenticationDialogComponent->completeCreate(); - QMetaObject::invokeMethod(authenticationDialog, "open"); -} - -void UIDelegatesManager::showFilePicker(QSharedPointer<FilePickerController> controller) -{ - - if (!ensureComponentLoaded(FilePicker)) - return; - - QQmlContext *context = qmlContext(m_view); - QObject *filePicker = filePickerComponent->beginCreate(context); - if (QQuickItem *item = qobject_cast<QQuickItem*>(filePicker)) - item->setParentItem(m_view); - filePicker->setParent(m_view); - filePickerComponent->completeCreate(); - - // Fine-tune some properties depending on the mode. - switch (controller->mode()) { - case FilePickerController::Open: - break; - case FilePickerController::Save: - filePicker->setProperty("selectExisting", false); - break; - case FilePickerController::OpenMultiple: - filePicker->setProperty("selectMultiple", true); - break; - case FilePickerController::UploadFolder: - filePicker->setProperty("selectFolder", true); - break; - default: - Q_UNREACHABLE(); - } - - QQmlProperty filesPickedSignal(filePicker, QStringLiteral("onFilesSelected")); - CHECK_QML_SIGNAL_PROPERTY(filesPickedSignal, filePickerComponent->url()); - QQmlProperty rejectSignal(filePicker, QStringLiteral("onRejected")); - CHECK_QML_SIGNAL_PROPERTY(rejectSignal, filePickerComponent->url()); - static int acceptedIndex = controller->metaObject()->indexOfSlot("accepted(QVariant)"); - QObject::connect(filePicker, filesPickedSignal.method(), controller.data(), controller->metaObject()->method(acceptedIndex)); - static int rejectedIndex = controller->metaObject()->indexOfSlot("rejected()"); - QObject::connect(filePicker, rejectSignal.method(), controller.data(), controller->metaObject()->method(rejectedIndex)); - - // delete when done. - static int deleteLaterIndex = filePicker->metaObject()->indexOfSlot("deleteLater()"); - QObject::connect(filePicker, filesPickedSignal.method(), filePicker, filePicker->metaObject()->method(deleteLaterIndex)); - QObject::connect(filePicker, rejectSignal.method(), filePicker, filePicker->metaObject()->method(deleteLaterIndex)); - - QMetaObject::invokeMethod(filePicker, "open"); -} - -class TemporaryCursorMove -{ -public: - TemporaryCursorMove(const QQuickItem *item, const QPoint &pos) - { - if (pos.isNull() || !item->contains(pos)) - return; - const QPoint oldPos = QCursor::pos(); - const QPoint globalPos = item->mapToGlobal(QPointF(pos)).toPoint(); - if (oldPos == globalPos) - return; - m_oldCursorPos = oldPos; - QCursor::setPos(globalPos); - } - - ~TemporaryCursorMove() - { - if (!m_oldCursorPos.isNull()) - QCursor::setPos(m_oldCursorPos); - } - -private: - QPoint m_oldCursorPos; -}; - -void UIDelegatesManager::showMenu(QObject *menu) -{ - // QtQuick.Controls.Menu.popup() always shows the menu under the mouse cursor, i.e. the menu's - // position we set above is ignored. Work around the problem by moving the mouse cursor - // temporarily to the right position. - TemporaryCursorMove tcm(m_view, menu->property("pos").toPoint()); - QMetaObject::invokeMethod(menu, "popup"); -} - -void UIDelegatesManager::showToolTip(const QString &text) -{ - if (text.isEmpty()) { - m_toolTip.reset(); - return; - } - - if (!ensureComponentLoaded(ToolTip)) - return; - - if (!m_toolTip.isNull()) - return; - - QQmlContext *context = qmlContext(m_view); - m_toolTip.reset(toolTipComponent->beginCreate(context)); - if (QQuickItem *item = qobject_cast<QQuickItem *>(m_toolTip.data())) - item->setParentItem(m_view); - m_toolTip->setParent(m_view); - toolTipComponent->completeCreate(); - - QQmlProperty(m_toolTip.data(), QStringLiteral("text")).write(text); - - int height = QQmlProperty(m_toolTip.data(), QStringLiteral("height")).read().toInt(); - int width = QQmlProperty(m_toolTip.data(), QStringLiteral("width")).read().toInt(); - QSize toolTipSize(width, height); - QPoint position = m_view->cursor().pos(); - position = m_view->mapFromGlobal(calculateToolTipPosition(position, toolTipSize)).toPoint(); - - QQmlProperty(m_toolTip.data(), QStringLiteral("x")).write(position.x()); - QQmlProperty(m_toolTip.data(), QStringLiteral("y")).write(position.y()); - - QMetaObject::invokeMethod(m_toolTip.data(), "open"); -} - -QQuickItem *UIDelegatesManager::createTouchHandle() -{ - if (!ensureComponentLoaded(TouchHandle)) - return nullptr; - - QQmlContext *context = qmlContext(m_view); - QObject *touchHandle = touchHandleComponent->beginCreate(context); - QQuickItem *item = qobject_cast<QQuickItem *>(touchHandle); - Q_ASSERT(item); - item->setParentItem(m_view); - touchHandleComponent->completeCreate(); - - return item; -} - -void UIDelegatesManager::showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *menuController, const QRect &bounds, const int spacing) -{ - if (!ensureComponentLoaded(TouchSelectionMenu)) - return; - - QQmlContext *context = qmlContext(m_view); - m_touchSelectionMenu.reset(touchSelectionMenuComponent->beginCreate(context)); - if (QQuickItem *item = qobject_cast<QQuickItem *>(m_touchSelectionMenu.data())) - item->setParentItem(m_view); - m_touchSelectionMenu->setParent(m_view); - - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("width")).write(bounds.width()); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("height")).write(bounds.height()); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("x")).write(bounds.x()); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("y")).write(bounds.y()); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("border.width")).write(spacing); - - // Cut button - bool cutEnabled = menuController->isCommandEnabled(TouchSelectionMenuController::Cut); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("isCutEnabled")).write(cutEnabled); - if (cutEnabled) { - QQmlProperty cutSignal(m_touchSelectionMenu.data(), QStringLiteral("onCutTriggered")); - CHECK_QML_SIGNAL_PROPERTY(cutSignal, touchSelectionMenuComponent->url()); - int cutIndex = menuController->metaObject()->indexOfSlot("cut()"); - QObject::connect(m_touchSelectionMenu.data(), cutSignal.method(), menuController, menuController->metaObject()->method(cutIndex)); - } - - // Copy button - bool copyEnabled = menuController->isCommandEnabled(TouchSelectionMenuController::Copy); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("isCopyEnabled")).write(copyEnabled); - if (copyEnabled) { - QQmlProperty copySignal(m_touchSelectionMenu.data(), QStringLiteral("onCopyTriggered")); - CHECK_QML_SIGNAL_PROPERTY(copySignal, touchSelectionMenuComponent->url()); - int copyIndex = menuController->metaObject()->indexOfSlot("copy()"); - QObject::connect(m_touchSelectionMenu.data(), copySignal.method(), menuController, menuController->metaObject()->method(copyIndex)); - } - - // Paste button - bool pasteEnabled = menuController->isCommandEnabled(TouchSelectionMenuController::Paste); - QQmlProperty(m_touchSelectionMenu.data(), QStringLiteral("isPasteEnabled")).write(pasteEnabled); - if (pasteEnabled) { - QQmlProperty pasteSignal(m_touchSelectionMenu.data(), QStringLiteral("onPasteTriggered")); - CHECK_QML_SIGNAL_PROPERTY(pasteSignal, touchSelectionMenuComponent->url()); - int pasteIndex = menuController->metaObject()->indexOfSlot("paste()"); - QObject::connect(m_touchSelectionMenu.data(), pasteSignal.method(), menuController, menuController->metaObject()->method(pasteIndex)); - } - - // Context menu button - QQmlProperty contextMenuSignal(m_touchSelectionMenu.data(), QStringLiteral("onContextMenuTriggered")); - CHECK_QML_SIGNAL_PROPERTY(contextMenuSignal, touchSelectionMenuComponent->url()); - int contextMenuIndex = menuController->metaObject()->indexOfSlot("runContextMenu()"); - QObject::connect(m_touchSelectionMenu.data(), contextMenuSignal.method(), menuController, menuController->metaObject()->method(contextMenuIndex)); - - touchSelectionMenuComponent->completeCreate(); -} - -void UIDelegatesManager::hideTouchSelectionMenu() -{ - QTimer::singleShot(0, m_view, [this] { m_touchSelectionMenu.reset(); }); -} - -UI2DelegatesManager::UI2DelegatesManager(QQuickWebEngineView *view) : UIDelegatesManager(view) -{ - -} - -bool UI2DelegatesManager::initializeImportDirs(QStringList &dirs, QQmlEngine *engine) -{ - const QStringList paths = engine->importPathList(); - for (const QString &path : paths) { - QString controls2ImportPath = path % QLatin1String("/QtWebEngine/Controls2Delegates/"); - QString controls1ImportPath = path % QLatin1String("/QtWebEngine/Controls1Delegates/"); - - // resource paths have to be tested using the ":/" prefix - if (controls2ImportPath.startsWith(QLatin1String("qrc:/"))) { - controls2ImportPath.remove(0, 3); - controls1ImportPath.remove(0, 3); - } - - QFileInfo fi2(controls2ImportPath); - if (fi2.exists()) - dirs << fi2.absolutePath(); - - QFileInfo fi1(controls1ImportPath); - if (fi1.exists()) - dirs << fi1.absolutePath(); - } - return !dirs.isEmpty(); -} - -QObject *UI2DelegatesManager::addMenu(QObject *parentMenu, const QString &title, const QPoint &pos) -{ - Q_ASSERT(parentMenu); - if (!ensureComponentLoaded(Menu)) - return nullptr; - QQmlContext *context = qmlContext(m_view); - QObject *menu = menuComponent->beginCreate(context); - - // set visual parent for non-Window-based menus - if (QQuickItem *item = qobject_cast<QQuickItem*>(menu)) - item->setParentItem(m_view); - - if (!title.isEmpty()) - menu->setProperty("title", title); - if (!pos.isNull()) { - menu->setProperty("x", pos.x()); - menu->setProperty("y", pos.y()); - } - - menu->setParent(parentMenu); - QQmlProperty doneSignal(menu, QStringLiteral("onDone")); - CHECK_QML_SIGNAL_PROPERTY(doneSignal, menuComponent->url()) - static int deleteLaterIndex = menu->metaObject()->indexOfSlot("deleteLater()"); - QObject::connect(menu, doneSignal.method(), menu, menu->metaObject()->method(deleteLaterIndex)); - menuComponent->completeCreate(); - return menu; -} - -void UI2DelegatesManager::addMenuItem(QQuickWebEngineAction *action, QObject *menu, bool checkable, bool checked) -{ - Q_ASSERT(action); - if (!ensureComponentLoaded(MenuItem)) - return; - - QObject *it = menuItemComponent->beginCreate(qmlContext(m_view)); - - it->setProperty("text", action->text()); - it->setProperty("enabled", action->isEnabled()); - it->setProperty("checked", checked); - it->setProperty("checkable", checkable); - - QQmlProperty signal(it, QStringLiteral("onTriggered")); - CHECK_QML_SIGNAL_PROPERTY(signal, menuItemComponent->url()); - const QMetaObject *actionMeta = action->metaObject(); - QObject::connect(it, signal.method(), action, actionMeta->method(actionMeta->indexOfSlot("trigger()"))); - menuItemComponent->completeCreate(); - - it->setParent(menu); - - QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(m_view)); - if (entries.isValid()) - entries.append(it); -} - -void UI2DelegatesManager::showMenu(QObject *menu) -{ - QMetaObject::invokeMethod(menu, "open"); -} - -} // namespace QtWebEngineCore diff --git a/src/webengine/ui_delegates_manager.h b/src/webengine/ui_delegates_manager.h deleted file mode 100644 index 4b6e291b2..000000000 --- a/src/webengine/ui_delegates_manager.h +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef UI_DELEGATES_MANAGER_H -#define UI_DELEGATES_MANAGER_H - -#include "api/qquickwebengineaction_p.h" -#include "qglobal.h" -#include "web_contents_adapter.h" -#include "web_contents_adapter_client.h" - -#include <QCoreApplication> -#include <QExplicitlySharedDataPointer> -#include <QPoint> -#include <QSharedPointer> - -#define FOR_EACH_COMPONENT_TYPE(F, SEPARATOR) \ - F(Menu, menu) SEPARATOR \ - F(MenuItem, menuItem) SEPARATOR \ - F(MenuSeparator, menuSeparator) SEPARATOR \ - F(AlertDialog, alertDialog) SEPARATOR \ - F(ColorDialog, colorDialog) SEPARATOR \ - F(ConfirmDialog, confirmDialog) SEPARATOR \ - F(PromptDialog, promptDialog) SEPARATOR \ - F(FilePicker, filePicker) SEPARATOR \ - F(AuthenticationDialog, authenticationDialog) SEPARATOR \ - F(ToolTip, toolTip) SEPARATOR \ - F(TouchHandle, touchHandle) SEPARATOR \ - F(TouchSelectionMenu, touchSelectionMenu) SEPARATOR \ - -#define COMMA_SEPARATOR , -#define SEMICOLON_SEPARATOR ; -#define ENUM_DECLARATION(TYPE, COMPONENT) \ - TYPE -#define MEMBER_DECLARATION(TYPE, COMPONENT) \ - QQmlComponent *COMPONENT##Component - -QT_BEGIN_NAMESPACE -class QQmlContext; -class QQmlComponent; -class QQuickItem; -class QQuickWebEngineView; -class QQmlEngine; -QT_END_NAMESPACE - -namespace QtWebEngineCore { -class AuthenticationDialogController; -class JavaScriptDialogController; -class FilePickerController; -class TouchSelectionMenuController; - -const char *defaultPropertyName(QObject *obj); - -class UIDelegatesManager -{ - Q_DECLARE_TR_FUNCTIONS(UIDelegatesManager) -public: - enum ComponentType { - Invalid = -1, - FOR_EACH_COMPONENT_TYPE(ENUM_DECLARATION, COMMA_SEPARATOR) - ComponentTypeCount - }; - - UIDelegatesManager(QQuickWebEngineView *); - virtual ~UIDelegatesManager(); - - virtual bool initializeImportDirs(QStringList &dirs, QQmlEngine *engine); - virtual void addMenuItem(QQuickWebEngineAction *action, QObject *menu, - bool checkable = false, bool checked = true); - void addMenuSeparator(QObject *menu); - virtual QObject *addMenu(QObject *parentMenu, const QString &title, - const QPoint &pos = QPoint()); - QQmlContext *creationContextForComponent(QQmlComponent *); - void showColorDialog(QSharedPointer<ColorChooserController>); - void showDialog(QSharedPointer<JavaScriptDialogController>); - void showDialog(QSharedPointer<AuthenticationDialogController>); - void showFilePicker(QSharedPointer<FilePickerController>); - virtual void showMenu(QObject *menu); - void showToolTip(const QString &text); - QQuickItem *createTouchHandle(); - void showTouchSelectionMenu(TouchSelectionMenuController *, const QRect &, const int spacing); - void hideTouchSelectionMenu(); - -protected: - bool ensureComponentLoaded(ComponentType); - - QQuickWebEngineView *m_view; - QScopedPointer<QObject> m_toolTip; - QStringList m_importDirs; - QScopedPointer<QObject> m_touchSelectionMenu; - - FOR_EACH_COMPONENT_TYPE(MEMBER_DECLARATION, SEMICOLON_SEPARATOR) - - Q_DISABLE_COPY(UIDelegatesManager) - -}; - -// delegate manager for qtquickcontrols2 with fallback to qtquickcontrols1 - -class UI2DelegatesManager : public UIDelegatesManager -{ -public: - UI2DelegatesManager(QQuickWebEngineView *); - bool initializeImportDirs(QStringList &dirs, QQmlEngine *engine) override; - QObject *addMenu(QObject *parentMenu, const QString &title, - const QPoint &pos = QPoint()) override; - void addMenuItem(QQuickWebEngineAction *action, QObject *menu, - bool checkable = false, bool checked = false) override; - void showMenu(QObject *menu) override; - Q_DISABLE_COPY(UI2DelegatesManager) - -}; - -} // namespace QtWebEngineCore - -#endif // UI_DELEGATES_MANAGER_H diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro deleted file mode 100644 index 23668229e..000000000 --- a/src/webengine/webengine.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = subdirs - -qml_module.file = module.pro -qml_plugin.file = plugin/plugin.pro - -qml_plugin.depends = qml_module - -SUBDIRS += qml_module qml_plugin - -qtConfig(webengine-testsupport) { - testsupport_plugin.file = testsupport/testsupport.pro - testsupport_plugin.depends = qml_module - SUBDIRS += testsupport_plugin -} - -qtConfig(webengine-ui-delegates) { - SUBDIRS += ui \ - ui2 -} |