diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-14 01:01:06 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-14 11:24:11 +0100 |
commit | 8a22c92b55b5d015e372fe5be0633c3935af4218 (patch) | |
tree | 02ad52cf1e7c3ed35b10156dd250d3cc7f6b7068 /src/qmlworkerscript | |
parent | 3ca659657ccaf0d850e661c9312e0f98e153c9ff (diff) | |
parent | 3dc5b937c4e9acf83ee54e870390c22f341c29c8 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/imports/folderlistmodel/plugin.cpp
src/imports/layouts/plugin.cpp
src/imports/localstorage/plugin.cpp
src/imports/models/plugin.cpp
src/imports/particles/plugin.cpp
src/imports/qtqml/plugin.cpp
src/imports/qtquick2/plugin.cpp
src/imports/shapes/plugin.cpp
src/imports/statemachine/plugin.cpp
src/imports/testlib/main.cpp
src/imports/wavefrontmesh/plugin.cpp
src/imports/window/plugin.cpp
src/imports/workerscript/plugin.cpp
src/qml/jsruntime/qv4sequenceobject.cpp
src/qml/qml/qqmlengine.cpp
src/qmlmodels/qqmlmodelsmodule.cpp
src/qmlmodels/qqmlmodelsmodule_p.h
src/qmlworkerscript/qqmlworkerscriptmodule.cpp
src/qmlworkerscript/qqmlworkerscriptmodule_p.h
src/quick/items/qquickitemsmodule.cpp
Change-Id: I5f1fbc3d00e8f583d2c89afc5389de84d68633a7
Diffstat (limited to 'src/qmlworkerscript')
-rw-r--r-- | src/qmlworkerscript/qmlworkerscript.pro | 8 | ||||
-rw-r--r-- | src/qmlworkerscript/qqmlworkerscriptmodule.cpp | 51 | ||||
-rw-r--r-- | src/qmlworkerscript/qqmlworkerscriptmodule_p.h | 66 | ||||
-rw-r--r-- | src/qmlworkerscript/qquickworkerscript.cpp | 11 |
4 files changed, 17 insertions, 119 deletions
diff --git a/src/qmlworkerscript/qmlworkerscript.pro b/src/qmlworkerscript/qmlworkerscript.pro index 9f5e0e809a..6a996a0d80 100644 --- a/src/qmlworkerscript/qmlworkerscript.pro +++ b/src/qmlworkerscript/qmlworkerscript.pro @@ -6,17 +6,21 @@ QMAKE_DOCS = $$PWD/doc/qtqmlworkerscript.qdocconf DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FOREACH HEADERS += \ - qqmlworkerscriptmodule_p.h \ qquickworkerscript_p.h \ qtqmlworkerscriptglobal.h \ qtqmlworkerscriptglobal_p.h \ qv4serialize_p.h SOURCES += \ - qqmlworkerscriptmodule.cpp \ qquickworkerscript.cpp \ qv4serialize.cpp include(../3rdparty/masm/masm-defs.pri) +QMLTYPES_FILENAME = plugins.qmltypes +QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml/WorkerScript.2 +QML_IMPORT_NAME = QtQml.WorkerScript +IMPORT_VERSION = 2.$$QT_MINOR_VERSION +CONFIG += qmltypes install_qmltypes install_metatypes + load(qt_module) diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp b/src/qmlworkerscript/qqmlworkerscriptmodule.cpp deleted file mode 100644 index b85456a633..0000000000 --- a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml 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 "qqmlworkerscriptmodule_p.h" -#include "qquickworkerscript_p.h" - -QT_BEGIN_NAMESPACE - -void QQmlWorkerScriptModule::defineModule() -{ - const char uri[] = "QtQml.WorkerScript"; - qmlRegisterTypesAndRevisions<QQuickWorkerScript>(uri, 2); -} - -QT_END_NAMESPACE diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule_p.h b/src/qmlworkerscript/qqmlworkerscriptmodule_p.h deleted file mode 100644 index ae52d10c16..0000000000 --- a/src/qmlworkerscript/qqmlworkerscriptmodule_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml 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 QQMLWORKERSCRIPTMODULE_P_H -#define QQMLWORKERSCRIPTMODULE_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 <private/qtqmlworkerscriptglobal_p.h> - -QT_BEGIN_NAMESPACE - -class Q_QMLWORKERSCRIPT_PRIVATE_EXPORT QQmlWorkerScriptModule -{ -public: - static void defineModule(); -}; - -QT_END_NAMESPACE - -#endif // QQMLWORKERSCRIPTMODULE_P_H diff --git a/src/qmlworkerscript/qquickworkerscript.cpp b/src/qmlworkerscript/qquickworkerscript.cpp index 9e4b3e1b46..72ae6d5bd4 100644 --- a/src/qmlworkerscript/qquickworkerscript.cpp +++ b/src/qmlworkerscript/qquickworkerscript.cpp @@ -130,6 +130,7 @@ struct WorkerScript : public QV4::ExecutionEngine { QQuickWorkerScriptEnginePrivate *p = nullptr; QUrl source; QQuickWorkerScript *owner = nullptr; + QScopedPointer<QNetworkAccessManager> scriptLocalNAM; int id = -1; }; @@ -389,6 +390,16 @@ WorkerScript::WorkerScript(int id, QQuickWorkerScriptEnginePrivate *parent) QV4::ScopedValue sendMessage(scope, QV4::FunctionObject::createBuiltinFunction(this, name, QQuickWorkerScriptEnginePrivate::method_sendMessage, 1)); api->put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("sendMessage"))), sendMessage); globalObject->put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("WorkerScript"))), api); + networkAccessManager = [](QV4::ExecutionEngine *engine){ + auto *workerScript = static_cast<WorkerScript *>(engine); + if (workerScript->scriptLocalNAM) + return workerScript->scriptLocalNAM.get(); + if (auto *namFactory = workerScript->p->qmlengine->networkAccessManagerFactory()) + workerScript->scriptLocalNAM.reset(namFactory->create(workerScript->p)); + else + workerScript->scriptLocalNAM.reset(new QNetworkAccessManager(workerScript->p)); + return workerScript->scriptLocalNAM.get(); + }; } int QQuickWorkerScriptEngine::registerWorkerScript(QQuickWorkerScript *owner) |