summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-02-23 13:47:13 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-02-23 13:47:13 +0100
commitca3f0d790de4918fe8df6cacaf9b4d3a46a649cf (patch)
treee28e9446fc06b07a91b71da89c209a591bcd62e1
parentb7f35a476caac0a0f56a04347b8d347c4eacd23c (diff)
parentcb7753f3ffa85eed0fbd98cb2e4f0e453c595d6d (diff)
Merge remote-tracking branch 'origin/dev' into 5.5
-rw-r--r--config.tests/bullet/bullet.pro8
-rw-r--r--examples/examples.pro4
-rw-r--r--examples/playground-qml/AnimatedDiffuseMaterial.qml43
-rw-r--r--examples/playground-qml/MainView.qml4
-rw-r--r--examples/rollerball/AdsEffect.qml96
-rw-r--r--examples/rollerball/AdsMaterial.qml61
-rw-r--r--examples/rollerball/BallEntity.qml69
-rw-r--r--examples/rollerball/BasicCamera.qml58
-rw-r--r--examples/rollerball/BoxEntity.qml78
-rw-r--r--examples/rollerball/PlaneEntity.qml70
-rw-r--r--examples/rollerball/main.cpp77
-rw-r--r--examples/rollerball/main.qml165
-rw-r--r--examples/rollerball/rollerball.pro19
-rw-r--r--examples/rollerball/rollerball.qrc11
-rw-r--r--examples/shadow-map-qml/AdsEffect.qml38
-rw-r--r--examples/shadow-map-qml/shaders/es3/ads.frag (renamed from src/bulletphysics/bulletphysicsaspect.cpp)72
-rw-r--r--examples/shadow-map-qml/shaders/es3/ads.vert (renamed from src/openal/openalaspect.cpp)65
-rw-r--r--examples/shadow-map-qml/shaders/es3/shadowmap.frag (renamed from config.tests/bullet/main.cpp)11
-rw-r--r--examples/shadow-map-qml/shaders/es3/shadowmap.vert (renamed from src/quick3d/quick3dbulletphysics/qt3dquickbulletphysics_global.h)22
-rw-r--r--examples/shadow-map-qml/shadow-map-qml.qrc4
-rw-r--r--qt3d.pro1
-rw-r--r--src/3rdparty/threadweaver/.reviewboardrc4
-rw-r--r--src/3rdparty/threadweaver/CMakeLists.txt59
-rw-r--r--src/3rdparty/threadweaver/COPYING.LIB510
-rw-r--r--src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in7
-rw-r--r--src/3rdparty/threadweaver/Mainpage.dox269
-rw-r--r--src/3rdparty/threadweaver/README.md9
-rw-r--r--src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp51
-rw-r--r--src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h44
-rw-r--r--src/3rdparty/threadweaver/autotests/AppendCharacterJob.h121
-rw-r--r--src/3rdparty/threadweaver/autotests/CMakeLists.txt76
-rw-r--r--src/3rdparty/threadweaver/autotests/DeleteTest.cpp108
-rw-r--r--src/3rdparty/threadweaver/autotests/DeleteTest.h63
-rw-r--r--src/3rdparty/threadweaver/autotests/JobTests.cpp1059
-rw-r--r--src/3rdparty/threadweaver/autotests/JobTests.h93
-rw-r--r--src/3rdparty/threadweaver/autotests/LifecycleTests.cpp116
-rw-r--r--src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp108
-rw-r--r--src/3rdparty/threadweaver/autotests/QueueTests.cpp206
-rw-r--r--src/3rdparty/threadweaver/autotests/QueueTests.h102
-rw-r--r--src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp65
-rw-r--r--src/3rdparty/threadweaver/autotests/run-n-tests.py76
-rw-r--r--src/3rdparty/threadweaver/benchmarks/CMakeLists.txt20
-rw-r--r--src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp306
-rw-r--r--src/3rdparty/threadweaver/doxygen-footer.html10
-rw-r--r--src/3rdparty/threadweaver/internal-doxygen.cfg1212
-rw-r--r--src/3rdparty/threadweaver/src/CMakeLists.txt82
-rw-r--r--src/3rdparty/threadweaver/src/collection.cpp326
-rw-r--r--src/3rdparty/threadweaver/src/collection.h129
-rw-r--r--src/3rdparty/threadweaver/src/debuggingaids.cpp39
-rw-r--r--src/3rdparty/threadweaver/src/debuggingaids.h163
-rw-r--r--src/3rdparty/threadweaver/src/dependency.cpp68
-rw-r--r--src/3rdparty/threadweaver/src/dependency.h54
-rw-r--r--src/3rdparty/threadweaver/src/dependencypolicy.cpp208
-rw-r--r--src/3rdparty/threadweaver/src/dependencypolicy.h109
-rw-r--r--src/3rdparty/threadweaver/src/destructedstate.cpp127
-rw-r--r--src/3rdparty/threadweaver/src/destructedstate_p.h69
-rw-r--r--src/3rdparty/threadweaver/src/exception.cpp56
-rw-r--r--src/3rdparty/threadweaver/src/exception.h64
-rw-r--r--src/3rdparty/threadweaver/src/executewrapper.cpp75
-rw-r--r--src/3rdparty/threadweaver/src/executewrapper_p.h60
-rw-r--r--src/3rdparty/threadweaver/src/executor.cpp55
-rw-r--r--src/3rdparty/threadweaver/src/executor_p.h56
-rw-r--r--src/3rdparty/threadweaver/src/iddecorator.cpp233
-rw-r--r--src/3rdparty/threadweaver/src/iddecorator.h105
-rw-r--r--src/3rdparty/threadweaver/src/inconstructionstate.cpp71
-rw-r--r--src/3rdparty/threadweaver/src/inconstructionstate_p.h59
-rw-r--r--src/3rdparty/threadweaver/src/job.cpp258
-rw-r--r--src/3rdparty/threadweaver/src/job.h227
-rw-r--r--src/3rdparty/threadweaver/src/jobinterface.h94
-rw-r--r--src/3rdparty/threadweaver/src/jobpointer.h33
-rw-r--r--src/3rdparty/threadweaver/src/lambda.h56
-rw-r--r--src/3rdparty/threadweaver/src/managedjobpointer.h49
-rw-r--r--src/3rdparty/threadweaver/src/qobjectdecorator.cpp65
-rw-r--r--src/3rdparty/threadweaver/src/qobjectdecorator.h67
-rw-r--r--src/3rdparty/threadweaver/src/queue.cpp263
-rw-r--r--src/3rdparty/threadweaver/src/queue.h100
-rw-r--r--src/3rdparty/threadweaver/src/queueapi.cpp38
-rw-r--r--src/3rdparty/threadweaver/src/queueapi_p.h65
-rw-r--r--src/3rdparty/threadweaver/src/queueing.h111
-rw-r--r--src/3rdparty/threadweaver/src/queueinterface.h177
-rw-r--r--src/3rdparty/threadweaver/src/queuepolicy.h86
-rw-r--r--src/3rdparty/threadweaver/src/queuesignals.cpp39
-rw-r--r--src/3rdparty/threadweaver/src/queuesignals.h76
-rw-r--r--src/3rdparty/threadweaver/src/queuestream.cpp98
-rw-r--r--src/3rdparty/threadweaver/src/queuestream.h63
-rw-r--r--src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp108
-rw-r--r--src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h80
-rw-r--r--src/3rdparty/threadweaver/src/sequence.cpp78
-rw-r--r--src/3rdparty/threadweaver/src/sequence.h60
-rw-r--r--src/3rdparty/threadweaver/src/shuttingdownstate.cpp70
-rw-r--r--src/3rdparty/threadweaver/src/shuttingdownstate_p.h63
-rw-r--r--src/3rdparty/threadweaver/src/state.cpp88
-rw-r--r--src/3rdparty/threadweaver/src/state.h107
-rw-r--r--src/3rdparty/threadweaver/src/suspendedstate.cpp65
-rw-r--r--src/3rdparty/threadweaver/src/suspendedstate_p.h56
-rw-r--r--src/3rdparty/threadweaver/src/suspendingstate.cpp70
-rw-r--r--src/3rdparty/threadweaver/src/suspendingstate_p.h59
-rw-r--r--src/3rdparty/threadweaver/src/thread.cpp129
-rw-r--r--src/3rdparty/threadweaver/src/thread.h106
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver.cpp29
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver.h41
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver.pri69
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver_export.h6
-rw-r--r--src/3rdparty/threadweaver/src/weaver.cpp643
-rw-r--r--src/3rdparty/threadweaver/src/weaver_p.h162
-rw-r--r--src/3rdparty/threadweaver/src/weaverimplstate.cpp127
-rw-r--r--src/3rdparty/threadweaver/src/weaverimplstate_p.h85
-rw-r--r--src/3rdparty/threadweaver/src/weaverinterface_p.h56
-rw-r--r--src/3rdparty/threadweaver/src/workinghardstate.cpp82
-rw-r--r--src/3rdparty/threadweaver/src/workinghardstate_p.h58
-rw-r--r--src/3rdparty/threadweaver/threadweaver.yaml1
-rw-r--r--src/bulletphysics/bulletphysics.pri20
-rw-r--r--src/bulletphysics/bulletphysics.pro32
-rw-r--r--src/bulletphysics/qabstractcollider.cpp87
-rw-r--r--src/bulletphysics/qboxcollider.cpp150
-rw-r--r--src/bulletphysics/qboxcollider.h101
-rw-r--r--src/bulletphysics/qboxcollider_p.h67
-rw-r--r--src/bulletphysics/qrigidbody.cpp151
-rw-r--r--src/bulletphysics/qrigidbody.h104
-rw-r--r--src/bulletphysics/qrigidbody_p.h64
-rw-r--r--src/bulletphysics/qspherecollider.cpp151
-rw-r--r--src/bulletphysics/qspherecollider.h101
-rw-r--r--src/bulletphysics/qt3dbulletphysics_global.h56
-rw-r--r--src/core/core.pro6
-rw-r--r--src/core/jobs/dependencyhandler.cpp127
-rw-r--r--src/core/jobs/dependencyhandler_p.h (renamed from src/bulletphysics/qabstractcollider.h)72
-rw-r--r--src/core/jobs/jobrunner.cpp (renamed from src/bulletphysics/qspherecollider_p.h)64
-rw-r--r--src/core/jobs/jobrunner_p.h (renamed from src/openal/openalaspect.h)53
-rw-r--r--src/core/jobs/jobs.pri24
-rw-r--r--src/core/jobs/qaspectjobmanager.cpp78
-rw-r--r--src/core/jobs/qaspectjobmanager_p.h12
-rw-r--r--src/core/jobs/qthreadpooler.cpp260
-rw-r--r--src/core/jobs/qthreadpooler_p.h (renamed from src/bulletphysics/bulletphysicsaspect.h)54
-rw-r--r--src/core/jobs/qthreadpooler_p_p.h (renamed from src/bulletphysics/qabstractcollider_p.h)56
-rw-r--r--src/core/jobs/task.cpp142
-rw-r--r--src/core/jobs/task_p.h123
-rw-r--r--src/input/cameracontroller.cpp19
-rw-r--r--src/openal/openal.pri8
-rw-r--r--src/openal/openal.pro25
-rw-r--r--src/openal/qt3dopenal_global.h56
-rw-r--r--src/quick3d/imports/bulletphysics/importsbulletphysics.pro15
-rw-r--r--src/quick3d/imports/bulletphysics/qmldir3
-rw-r--r--src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.cpp55
-rw-r--r--src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.h54
-rw-r--r--src/quick3d/imports/scene3d/importsscene3d.pro2
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp15
-rw-r--r--src/quick3d/quick3dbulletphysics/items/items.pri5
-rw-r--r--src/quick3d/quick3dbulletphysics/quick3dbulletphysics.pro28
-rw-r--r--src/render/backend/qgraphicscontext.cpp2
-rw-r--r--src/render/backend/qgraphicshelperes2.cpp33
-rw-r--r--src/render/backend/qgraphicshelperes2_p.h1
-rw-r--r--src/render/backend/qgraphicshelpergl3.cpp2
-rw-r--r--src/render/backend/renderer.cpp5
-rw-r--r--src/render/frontend/qcylindermesh.cpp10
-rw-r--r--src/render/frontend/qopenglfilter.cpp5
-rw-r--r--src/render/frontend/qspheremesh.cpp10
-rw-r--r--src/render/frontend/qtorusmesh.cpp10
-rw-r--r--src/src.pro19
-rw-r--r--sync.profile3
-rw-r--r--tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp240
160 files changed, 1311 insertions, 13810 deletions
diff --git a/config.tests/bullet/bullet.pro b/config.tests/bullet/bullet.pro
deleted file mode 100644
index 593f29f35..000000000
--- a/config.tests/bullet/bullet.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-SOURCES += main.cpp
-
-LIBS += -lBulletDynamics -lBulletCollision -lLinearMath
-
-unix {
- CONFIG += link_pkgconfig
- PKGCONFIG += bullet
-}
diff --git a/examples/examples.pro b/examples/examples.pro
index 7f7e681bf..d47fd5bb8 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -34,10 +34,6 @@ SUBDIRS += \
#SUBDIRS += qt3d
#qtHaveModule(qml): SUBDIRS += quick3d
-qtHaveModule(3dbulletphysics) {
- SUBDIRS += rollerball
-}
-
# Make all other subdirs depend on exampleresources
for(subdir, SUBDIRS) {
!equals(subdir, exampleresources) {
diff --git a/examples/playground-qml/AnimatedDiffuseMaterial.qml b/examples/playground-qml/AnimatedDiffuseMaterial.qml
index c09f166bd..50605baee 100644
--- a/examples/playground-qml/AnimatedDiffuseMaterial.qml
+++ b/examples/playground-qml/AnimatedDiffuseMaterial.qml
@@ -160,40 +160,10 @@ Material {
fragmentShaderCode: loadSource("qrc:/shaders/diffuse.frag")
}
},
- // TEXTURE PASS
- RenderPass {
- annotations: Annotation {name : "Name"; value : "Texture" }
- bindings: ParameterMapping {parameterName: "texture"; shaderVariableName: "tex"; bindingType: ParameterMapping.Uniform}
- shaderProgram: ShaderProgram {
- vertexShaderCode : "
- #version 140
- in vec4 vertexPosition;
- in vec2 vertexTexCoord;
- out vec2 texCoord;
-
- uniform mat4 mvp;
-
- void main()
- {
- texCoord = vertexTexCoord;
- gl_Position = mvp * vertexPosition;
- }"
-
- fragmentShaderCode: "
- #version 140
- in vec2 texCoord;
- out vec4 fragColor;
- uniform sampler2D tex;
-
- void main()
- {
- fragColor = texture(tex, texCoord);
- }
- "
- }
- },
+ // TEXTURE PASS + UBO
RenderPass {
annotations : [Annotation {name : "Name"; value : "Texture" }]
+ bindings: ParameterMapping {parameterName: "texture"; shaderVariableName: "tex"; bindingType: ParameterMapping.Uniform}
renderStates : [BlendState {srcRGB: BlendState.One; dstRGB : BlendState.One},
BlendEquation {mode: BlendEquation.FuncAdd},
CullFace { mode : CullFace.Back },
@@ -204,9 +174,11 @@ Material {
#version 140
in vec4 vertexPosition;
in vec3 vertexNormal;
+ in vec2 vertexTexCoord;
out vec3 worldPosition;
out vec3 normal;
+ out vec2 texCoord;
uniform mat4 modelViewProjection;
uniform mat4 modelView;
@@ -214,6 +186,7 @@ Material {
void main()
{
+ texCoord = vertexTexCoord;
worldPosition = vec3(modelView * vertexPosition);
normal = normalize(modelViewNormal * vertexNormal);
gl_Position = modelViewProjection * vertexPosition;
@@ -224,6 +197,7 @@ Material {
#version 140
in vec3 worldPosition;
in vec3 normal;
+ in vec2 texCoord;
out vec4 fragColor;
struct subStruct
@@ -254,6 +228,7 @@ Material {
innerStruct u[4];
} lightSource;
+ uniform sampler2D tex;
void main()
{
@@ -281,9 +256,9 @@ Material {
fragColor = vec4(lightSource.intensity, 1.0) * (
lightSource.colorAmbient * lightSource.s.innerV +
lightSource.colorDiffuse * diffuse +
- lightSource.colorSpecular * specular);
+ lightSource.colorSpecular * specular) * 0.2 + texture(tex, texCoord);
else
- fragColor = vec4(1.0, 1.0, 1.0, 1.0) * tmp;
+ fragColor = vec4(1.0, 1.0, 1.0, 1.0);
}"
}
}
diff --git a/examples/playground-qml/MainView.qml b/examples/playground-qml/MainView.qml
index 0ad847e6a..0f115d397 100644
--- a/examples/playground-qml/MainView.qml
+++ b/examples/playground-qml/MainView.qml
@@ -67,7 +67,7 @@ Entity {
AnimatedDiffuseMaterial {
id: animatedMaterial
- texture: Texture2D { source : "assets/gltf/wine/Wood_Cherry_Original_.jpg" }
+ texture: Texture2D { TextureImage { source : "assets/gltf/wine/Wood_Cherry_Original_.jpg" } }
}
// Scene elements
@@ -76,7 +76,7 @@ Entity {
id : sceneEntity
components : SceneLoader {
id: scene
- source: ":/assets/test_scene.dae"
+ source: "qrc:/assets/test_scene.dae"
objectName: "dae_scene"
}
}
diff --git a/examples/rollerball/AdsEffect.qml b/examples/rollerball/AdsEffect.qml
deleted file mode 100644
index 737811401..000000000
--- a/examples/rollerball/AdsEffect.qml
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-Effect {
- id: root
-
- // These parameters act as default values for the effect. They take
- // priority over any parameters specified in the RenderPasses below
- // (none provided in this example). In turn these parameters can be
- // overwritten by specifying them in a Material that references this
- // effect.
- // The priority order is:
- //
- // Material -> Effect -> Technique -> RenderPass -> GLSL default values
- parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
- Parameter { name: "diffuse"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },
- Parameter { name: "specular"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
- Parameter { name: "shininess"; value: root.shininess }
- ]
-
- techniques: [
- Technique {
- openGLFilter {
- api: OpenGLFilter.Desktop
- profile: OpenGLFilter.Core
- majorVersion: 3
- minorVersion: 1
- }
-
- annotations : [ Annotation { name : "renderingStyle"; value : "forward" } ]
-
- parameters: [
- Parameter { name: "lightPosition"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d( 1.0, 1.0, 1.0 ) }
- ]
-
- renderPasses: [
- RenderPass {
-
- // The bindings property allows us to map from names of parameters (uniforms or vertex attributes)
- // within a shader to more friendly names in QML. By default the parameter names are exposed from
- // the shader so we only need to add add mappings where the names differ. E.g. here we map from the
- // ka uniform name in the shader to a property called ambient
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
- ]
-
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/shaders/phong.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/phong.frag")
- }
- }
- ]
- }
- ]
-}
diff --git a/examples/rollerball/AdsMaterial.qml b/examples/rollerball/AdsMaterial.qml
deleted file mode 100644
index 4f1b0a7ef..000000000
--- a/examples/rollerball/AdsMaterial.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
- property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )
- property real shininess: 150.0
-
- parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
- Parameter { name: "specular"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess }
- ]
-}
diff --git a/examples/rollerball/BallEntity.qml b/examples/rollerball/BallEntity.qml
deleted file mode 100644
index fc1985cc5..000000000
--- a/examples/rollerball/BallEntity.qml
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
-Entity {
- id: root
-
- property real x: 0.0
- property real y: 1.0
- property real z: 0.0
- property real scale: 1.0
- property Material material
-
- components: [ transform, mesh, root.material ]
-
- Transform {
- id: transform
- Translate { dx: root.x; dy: root.y; dz: root.z }
- Scale { scale: root.scale }
- }
-
- SphereMesh {
- id: mesh
- rings: 50
- slices: 100
- }
-}
diff --git a/examples/rollerball/BasicCamera.qml b/examples/rollerball/BasicCamera.qml
deleted file mode 100644
index db465a05f..000000000
--- a/examples/rollerball/BasicCamera.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
-Camera {
- id: mainCamera
- objectName: "mainCamera"
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 22.5
- aspectRatio: _window.width / _window.height
- onAspectRatioChanged: console.log( "aspectRatio = " + aspectRatio )
- nearPlane: 0.01
- farPlane: 1000.0
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
-}
diff --git a/examples/rollerball/BoxEntity.qml b/examples/rollerball/BoxEntity.qml
deleted file mode 100644
index ac183f837..000000000
--- a/examples/rollerball/BoxEntity.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
-Entity {
- id: root
-
- property alias width: mesh.xExtent
- property alias height: mesh.yExtent
- property alias depth: mesh.zExtent
-
- property alias x: translateTransform.dx
- property alias y: translateTransform.dy
- property alias z: translateTransform.dz
- property alias angle: rotateTransform.angle
- property alias axis: rotateTransform.axis
- property alias scale: scaleTransform.scale
-
- property Material material
-
- components: [ transform, mesh, root.material ]
-
- Transform {
- id: transform
- Scale { id: scaleTransform }
- Rotate { id: rotateTransform }
- Translate { id: translateTransform }
- }
-
- CuboidMesh {
- id: mesh
- yzMeshResolution: Qt.size(2, 2)
- xzMeshResolution: Qt.size(2, 2)
- xyMeshResolution: Qt.size(2, 2)
- }
-}
diff --git a/examples/rollerball/PlaneEntity.qml b/examples/rollerball/PlaneEntity.qml
deleted file mode 100644
index a1d5ce81e..000000000
--- a/examples/rollerball/PlaneEntity.qml
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1 as QQ2
-
-Entity {
- id: root
-
- property real x: 0.0
- property real y: 0.0
- property real z: 0.0
- property real scale: 1.0
- property Material material
-
- components: [ transform, mesh, root.material ]
-
- Transform {
- id: transform
- Translate { dx: root.x; dy: root.y; dz: root.z }
- Scale { scale: root.scale }
- }
-
- PlaneMesh {
- id: mesh
- width: 1.0
- height: 1.0
- meshResolution: Qt.size(2, 2)
- }
-}
diff --git a/examples/rollerball/main.cpp b/examples/rollerball/main.cpp
deleted file mode 100644
index de19070d6..000000000
--- a/examples/rollerball/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <Qt3DCore/window.h>
-#include <Qt3DRenderer/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DBulletPhysics/bulletphysicsaspect.h>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <exampleresources.h>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- initializeAssetResources("../exampleresources/example-assets.qrb");
-
- Qt3D::Window view;
- Qt3D::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3D::QInputAspect());
- engine.aspectEngine()->registerAspect(new Qt3D::BulletPhysicsAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.aspectEngine()->initialize();
-
- // Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
-
- // There should be some synchronising mechanism to make sure
- // the source is set after all aspects have been completely initialized
- // Otherwise we might encounter cases where an Aspect's QML elements have
- // not yet been registered
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/rollerball/main.qml b/examples/rollerball/main.qml
deleted file mode 100644
index 85ec2c89f..000000000
--- a/examples/rollerball/main.qml
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
- objectName: "root"
-
- // Use the renderer configuration specified in ForwardRenderer.qml
- // and render from the mainCamera
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- id: renderer
- camera: mainCamera
- clearColor: "black"
- }
- }
- ]
-
- BasicCamera {
- id: mainCamera
- position: Qt.vector3d( 0.0, 20.0, 70.0 )
- }
-
- Configuration {
- controlledCamera: mainCamera
- }
-
- AdsEffect {
- id: adsEffect
- }
-
- PlaneEntity {
- id: floor
- scale: 50
- material: AdsMaterial {
- effect: adsEffect
- ambient: Qt.rgba( 1.0, 1.0, 1.0, 1.0 )
- diffuse: Qt.rgba( 1.0, 1.0, 1.0, 1.0 )
- }
- }
-
- AdsMaterial {
- id: wallMaterial
- effect: adsEffect
- ambient: Qt.rgba( 0.1, 0.0, 0.1, 1.0 )
- diffuse: Qt.rgba( 1.0, 0.0, 1.0, 1.0 )
- }
-
- BoxEntity {
- id: eastWall
- width: 3
- height: 4
- depth: floor.scale + 2 * width
- x: (floor.scale + width) / 2.0
- y: height / 2
- material: wallMaterial
- }
-
- BoxEntity {
- id: westWall
- width: 3
- height: 4
- depth: floor.scale + 2 * width
- x: -(floor.scale + width) / 2.0
- y: height / 2
- material: wallMaterial
- }
-
- BoxEntity {
- id: northWall
- width: 3
- height: 4
- depth: floor.scale
- z: (floor.scale + width) / 2.0
- y: height / 2
- angle: 90
- material: wallMaterial
- }
-
- BoxEntity {
- id: southWall
- width: 3
- height: 4
- depth: floor.scale
- z: -(floor.scale + width) / 2.0
- y: height / 2
- angle: 90
- material: wallMaterial
- }
-
- AdsMaterial {
- id: redMaterial
- effect: adsEffect
- ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )
- diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )
- }
-
- AdsMaterial {
- id: greenMaterial
- effect: adsEffect
- ambient: Qt.rgba( 0.0, 0.2, 0.0, 1.0 )
- diffuse: Qt.rgba( 0.0, 0.8, 0.0, 1.0 )
- }
-
- AdsMaterial {
- id: blueMaterial
- effect: adsEffect
- ambient: Qt.rgba( 0.0, 0.0, 0.2, 1.0 )
- diffuse: Qt.rgba( 0.0, 0.0, 0.8, 1.0 )
- }
-
- BallEntity {
- id: redBall
- material: redMaterial
- x: -5
- }
-
- BallEntity {
- id: greenBall
- material: greenMaterial
- }
-
- BallEntity {
- id: blueBall
- material: blueMaterial
- x: 5
- }
-}
diff --git a/examples/rollerball/rollerball.pro b/examples/rollerball/rollerball.pro
deleted file mode 100644
index 601b3811f..000000000
--- a/examples/rollerball/rollerball.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-
-QT += 3dcore 3drenderer 3dinput 3dbulletphysics 3dquick qml quick
-
-include("../exampleresources/exampleresources.pri")
-
-HEADERS += \
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- AdsEffect.qml \
- Renderable.qml \
- SimpleEffect.qml
-
-RESOURCES += \
- rollerball.qrc
diff --git a/examples/rollerball/rollerball.qrc b/examples/rollerball/rollerball.qrc
deleted file mode 100644
index ce83428c2..000000000
--- a/examples/rollerball/rollerball.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>AdsEffect.qml</file>
- <file>BasicCamera.qml</file>
- <file>AdsMaterial.qml</file>
- <file>BallEntity.qml</file>
- <file>PlaneEntity.qml</file>
- <file>BoxEntity.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/shadow-map-qml/AdsEffect.qml b/examples/shadow-map-qml/AdsEffect.qml
index 7df656168..1ddc58f3b 100644
--- a/examples/shadow-map-qml/AdsEffect.qml
+++ b/examples/shadow-map-qml/AdsEffect.qml
@@ -105,6 +105,44 @@ Effect {
// no special render state set => use the default set of states
}
]
+ },
+ Technique {
+ openGLFilter {
+ api: OpenGLFilter.ES
+ majorVersion: 3
+ minorVersion: 0
+ }
+
+ renderPasses: [
+ RenderPass {
+ annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/shaders/es3/shadowmap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es3/shadowmap.frag")
+ }
+
+ renderStates: [
+ PolygonOffset { factor: 4; units: 4 },
+ DepthTest { func: DepthTest.Less }
+ ]
+ },
+
+ RenderPass {
+ annotations: [ Annotation { name : "pass"; value : "forward" } ]
+
+ bindings: [
+ ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
+ ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
+ ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
+ ]
+
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/shaders/es3/ads.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es3/ads.frag")
+ }
+ }
+ ]
}
]
}
diff --git a/src/bulletphysics/bulletphysicsaspect.cpp b/examples/shadow-map-qml/shaders/es3/ads.frag
index df280a3c8..30977cf1e 100644
--- a/src/bulletphysics/bulletphysicsaspect.cpp
+++ b/examples/shadow-map-qml/shaders/es3/ads.frag
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -34,54 +34,62 @@
**
****************************************************************************/
-#include "bulletphysicsaspect.h"
+#version 300 es
-#include <Qt3DCore/qaspectfactory.h>
+precision highp float;
-QT_BEGIN_NAMESPACE
+uniform mat4 viewMatrix;
-namespace Qt3D {
+uniform vec3 lightPosition;
+uniform vec3 lightIntensity;
-BulletPhysicsAspect::BulletPhysicsAspect(QObject *parent)
- : QAbstractAspect(QAbstractAspect::AspectAudio, parent)
-{
-}
+uniform vec3 ka; // Ambient reflectivity
+uniform vec3 kd; // Diffuse reflectivity
+uniform vec3 ks; // Specular reflectivity
+uniform float shininess; // Specular shininess factor
-void BulletPhysicsAspect::sceneNodeAdded(QSceneChangePtr &)
-{
+uniform sampler2DShadow shadowMapTexture;
-}
+in vec4 positionInLightSpace;
-void BulletPhysicsAspect::sceneNodeRemoved(QSceneChangePtr &)
-{
+in vec3 position;
+in vec3 normal;
-}
+out vec4 fragColor;
-QVector<QAspectJobPtr> BulletPhysicsAspect::jobsToExecute(qint64 time)
+vec3 dsModel(const in vec3 pos, const in vec3 n)
{
- Q_UNUSED(time);
- QVector<QAspectJobPtr> jobs;
+ // Calculate the vector from the light to the fragment
+ vec3 s = normalize(vec3(viewMatrix * vec4(lightPosition, 1.0)) - pos);
- return jobs;
-}
+ // Calculate the vector from the fragment to the eye position
+ // (origin since this is in "eye" or "camera" space)
+ vec3 v = normalize(-pos);
-void BulletPhysicsAspect::setRootEntity(QEntity *rootObject)
-{
- Q_UNUSED(rootObject);
-}
+ // Reflect the light beam using the normal at this fragment
+ vec3 r = reflect(-s, n);
-void BulletPhysicsAspect::onInitialize(const QVariantMap &data)
-{
+ // Calculate the diffuse component
+ float diffuse = max(dot(s, n), 0.0);
+
+ // Calculate the specular component
+ float specular = 0.0;
+ if (dot(s, n) > 0.0)
+ specular = pow(max(dot(r, v), 0.0), shininess);
+ // Combine the diffuse and specular contributions (ambient is taken into account by the caller)
+ return lightIntensity * (kd * diffuse + ks * specular);
}
-void BulletPhysicsAspect::onCleanup()
+void main()
{
+ float shadowMapSample = textureProj(shadowMapTexture, positionInLightSpace);
-}
-
-} // Qt3D
+ vec3 ambient = lightIntensity * ka;
-QT_END_NAMESPACE
+ vec3 result = ambient;
+ if (shadowMapSample > 0.0)
+ result += dsModel(position, normalize(normal));
-QT3D_REGISTER_NAMESPACED_ASPECT("bulletphysics", QT_PREPEND_NAMESPACE(Qt3D), BulletPhysicsAspect)
+ fragColor = vec4(result, 1.0);
+}
diff --git a/src/openal/openalaspect.cpp b/examples/shadow-map-qml/shaders/es3/ads.vert
index c15de54d8..c304fbaad 100644
--- a/src/openal/openalaspect.cpp
+++ b/examples/shadow-map-qml/shaders/es3/ads.vert
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -34,54 +34,33 @@
**
****************************************************************************/
-#include "openalaspect.h"
+#version 300 es
-#include <Qt3DCore/qaspectfactory.h>
+in vec3 vertexPosition;
+in vec3 vertexNormal;
-QT_BEGIN_NAMESPACE
+out vec4 positionInLightSpace;
+out vec3 position;
+out vec3 normal;
-namespace Qt3D {
+uniform mat4 lightViewProjection;
+uniform mat4 modelMatrix;
+uniform mat4 modelView;
+uniform mat3 modelViewNormal;
+uniform mat4 mvp;
-OpenALAspect::OpenALAspect(QObject *parent)
- : QAbstractAspect(QAbstractAspect::AspectAudio, parent)
-{
-}
-
-void OpenALAspect::sceneNodeAdded(QSceneChangePtr &)
-{
-
-}
-
-void OpenALAspect::sceneNodeRemoved(QSceneChangePtr &)
-{
-
-}
-
-QVector<QAspectJobPtr> OpenALAspect::jobsToExecute(qint64 time)
-{
- Q_UNUSED(time);
- QVector<QAspectJobPtr> jobs;
-
- return jobs;
-}
-
-void OpenALAspect::setRootEntity(QEntity *)
-{
-
-}
-
-void OpenALAspect::onInitialize(const QVariantMap &)
+void main()
{
+ // positionInLightSpace = lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
+ const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0,
+ 0.0, 0.5, 0.0, 0.0,
+ 0.0, 0.0, 0.5, 0.0,
+ 0.5, 0.5, 0.5, 1.0);
-}
+ positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
-void OpenALAspect::onCleanup()
-{
+ normal = normalize(modelViewNormal * vertexNormal);
+ position = vec3(modelView * vec4(vertexPosition, 1.0));
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
}
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-QT3D_REGISTER_NAMESPACED_ASPECT("openal", QT_PREPEND_NAMESPACE(Qt3D), OpenALAspect)
diff --git a/config.tests/bullet/main.cpp b/examples/shadow-map-qml/shaders/es3/shadowmap.frag
index 569017e60..22fe0431b 100644
--- a/config.tests/bullet/main.cpp
+++ b/examples/shadow-map-qml/shaders/es3/shadowmap.frag
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -34,11 +34,10 @@
**
****************************************************************************/
-#include <btBulletDynamicsCommon.h>
+#version 300 es
-int main(int argc, char** argv)
+precision highp float;
+
+void main()
{
- btSequentialImpulseConstraintSolver *solver = new btSequentialImpulseConstraintSolver;
- delete solver;
- return 0;
}
diff --git a/src/quick3d/quick3dbulletphysics/qt3dquickbulletphysics_global.h b/examples/shadow-map-qml/shaders/es3/shadowmap.vert
index 94f2bd6e8..1fe6b3724 100644
--- a/src/quick3d/quick3dbulletphysics/qt3dquickbulletphysics_global.h
+++ b/examples/shadow-map-qml/shaders/es3/shadowmap.vert
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -34,19 +34,13 @@
**
****************************************************************************/
-#ifndef QT3DQUICKBULLETPHYSICS_GLOBAL_H
-#define QT3DQUICKBULLETPHYSICS_GLOBAL_H
+#version 300 es
-#include <QtCore/qglobal.h>
+in vec3 vertexPosition;
-QT_BEGIN_NAMESPACE
+uniform mat4 mvp;
-#if defined(QT3DQUICKBULLETPHYSICS_LIBRARY)
-# define QT3DQUICKBULLETPHYSICSSHARED_EXPORT Q_DECL_EXPORT
-#else
-# define QT3DQUICKBULLETPHYSICSSHARED_EXPORT Q_DECL_IMPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QT3DQUICKBULLETPHYSICS_GLOBAL_H
+void main()
+{
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
diff --git a/examples/shadow-map-qml/shadow-map-qml.qrc b/examples/shadow-map-qml/shadow-map-qml.qrc
index 821f84483..9aa6e2c73 100644
--- a/examples/shadow-map-qml/shadow-map-qml.qrc
+++ b/examples/shadow-map-qml/shadow-map-qml.qrc
@@ -14,6 +14,10 @@
<file>shaders/ads.vert</file>
<file>shaders/shadowmap.frag</file>
<file>shaders/shadowmap.vert</file>
+ <file>shaders/es3/ads.frag</file>
+ <file>shaders/es3/ads.vert</file>
+ <file>shaders/es3/shadowmap.frag</file>
+ <file>shaders/es3/shadowmap.vert</file>
</qresource>
</RCC>
diff --git a/qt3d.pro b/qt3d.pro
index 6562a9c29..4a57898b6 100644
--- a/qt3d.pro
+++ b/qt3d.pro
@@ -1,7 +1,6 @@
#requires(qtHaveModule(opengl))
load(configure)
-qtCompileTest(bullet)
qtCompileTest(assimp)
load(qt_parts)
diff --git a/src/3rdparty/threadweaver/.reviewboardrc b/src/3rdparty/threadweaver/.reviewboardrc
deleted file mode 100644
index 9822617dc..000000000
--- a/src/3rdparty/threadweaver/.reviewboardrc
+++ /dev/null
@@ -1,4 +0,0 @@
-REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
-REPOSITORY = 'git://anongit.kde.org/threadweaver'
-BRANCH = 'master'
-TARGET_GROUPS = 'kdeframeworks'
diff --git a/src/3rdparty/threadweaver/CMakeLists.txt b/src/3rdparty/threadweaver/CMakeLists.txt
deleted file mode 100644
index 8aee9378b..000000000
--- a/src/3rdparty/threadweaver/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-
-project(ThreadWeaver)
-
-find_package(ECM 0.0.9 REQUIRED NO_MODULE)
-
-set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
-
-
-include(KDEInstallDirs)
-include(KDEFrameworkCompilerSettings)
-include(KDECMakeSettings)
-
-set(REQUIRED_QT_VERSION 5.2.0)
-find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
-
-include(FeatureSummary)
-include(GenerateExportHeader)
-
-include(ECMSetupVersion)
-include(ECMGenerateHeaders)
-
-# -- Maintained by scripty
-set(KF5_VERSION "5.0.0")
-
-ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX THREADWEAVER
- VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/threadweaver_version.h"
- PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfigVersion.cmake")
-# --
-
-add_subdirectory(src)
-add_subdirectory(autotests)
-add_subdirectory(benchmarks)
-
-# create a Config.cmake and a ConfigVersion.cmake file and install them
-set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5ThreadWeaver")
-
-include(CMakePackageConfigHelpers)
-
-configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5ThreadWeaverConfig.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfig.cmake"
- INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
- )
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/threadweaver_version.h
- DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel )
-
-install(FILES
- "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfig.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfigVersion.cmake"
- DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
- COMPONENT Devel
-)
-
-install(EXPORT KF5ThreadWeaverTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ThreadWeaverTargets.cmake NAMESPACE KF5:: )
-
-if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
-endif()
diff --git a/src/3rdparty/threadweaver/COPYING.LIB b/src/3rdparty/threadweaver/COPYING.LIB
deleted file mode 100644
index 2d2d780e6..000000000
--- a/src/3rdparty/threadweaver/COPYING.LIB
+++ /dev/null
@@ -1,510 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in b/src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in
deleted file mode 100644
index 12b8f6ee7..000000000
--- a/src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in
+++ /dev/null
@@ -1,7 +0,0 @@
-@PACKAGE_INIT@
-
-find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
-
-
-include("${CMAKE_CURRENT_LIST_DIR}/KF5ThreadWeaverTargets.cmake")
-
diff --git a/src/3rdparty/threadweaver/Mainpage.dox b/src/3rdparty/threadweaver/Mainpage.dox
deleted file mode 100644
index ed4e7b9bf..000000000
--- a/src/3rdparty/threadweaver/Mainpage.dox
+++ /dev/null
@@ -1,269 +0,0 @@
-/** \mainpage ThreadWeaver
-
-<p><b>
-Overview |
-\ref UseCases |
-\ref Why |
-\ref MainComponents "Main Components"
-</b></p>
-
-ThreadWeaver is a helper for multithreaded programming. It uses a job-based
-interface to queue tasks and execute them in an efficient way.
-
-You simply divide the workload into jobs, state the dependencies between the jobs
-and ThreadWeaver will work out the most efficient way of dividing the work between
-threads within a set of resource limits.
-
-For more information, see \ref UseCases, \ref Why and \ref MainComponents.
-
-\section Tests Example Code
-<p>Example code is available in the
-<a href="http://lxr.kde.org/source/kde/kdelibs/threadweaver/Examples/">Examples</a>
-directory. The Construction
-program shows how to use ThreadWeaver in imperative (not event oriented)
-programs. The Jobs program provides a GUI example and displays the
-interaction with the weaver state and it's signals. The Simple
-Multithreaded Image Viewer (SMIV) example shows the use of job
-dependencies.</p>
-
-\authors
-Mirko Boehm
-
-\maintainers
-Mirko Boehm
-
-\licenses
-\lgpl
-
-
-*/
-
-/** \page UseCases Use Cases
-
-<p><b>
-\ref index "Overview" |
-Use Cases |
-\ref Why |
-\ref MainComponents "Main Components"
-</b></p>
-
-<p>ThreadWeaver provides a solution to a number (but not all)
-multithreading problems. Let's have a look:</p>
-
-<ul> <li>How do you implement a single operation that takes a lot of CPU
-power, but is hard to handle in chunks (Example: scale an image) when
-you want your GUI to remain responsive? Encapsulate the operation in a
-class object derived from Job instead of a method and put it in the
-static instance (Weaver::instance). Connect to the Job's done() signal
-to receive a notification when it is completed.</li>
-
-<li>How do you implement a CPU intensive operation while time-critical
-operations are executed (load and decode an MP3 while another one is fed
-to the audio device): Implement both the file loading operation and the
-play operation in a job and queue both at the same time. There is also a
-synchronous sleep method in the Job class if a job needs to be delayed
-for a number of milliseconds after it is taken over by a thread.</li>
-
-<li>How do you implement many small operations where the cost of each
-individual one is hard to estimate (loading two hundred icons from an
-NFS drive): Create a common or a number of specialized job
-classes. Queue all of them. Either connect to the individual done signal
-to process every item when it has been finished or connect to
-Weaver::jobsDone() to receive a notification when all of the jobs are
-done.</li>
-
-<li>How do you implement an operation with complex control flow and
-dependencies in the execution order (load, parse and display an HTML
-document with embedded media): Create jobs for the individual steps you
-need to perform. Try to split the whole operation in as many
-independent, parallelizable parts as possible. Now declare the execution
-dependencies. A job will only be executed when all jobs it depends on
-are finished. This way every individual operation will be executed as
-soon as it becomes possible. Connect to the final jobs done() signal to
-be notified when all parts of the whole operations have been
-executed. If necessary (if there is more than one final object), create a
-dummy job object that depends on all of them to have one central end
-point of execution.</li> </ul>
-
-<p>As you can see, ThreadWeaver can provide solutions for simple, but
-also for complex cases. For an example on how job dependencies can be
-modeled and used to create elegant, streamlined solutions for control
-flow modeling, see the Simple Multithreaded Image Viewer (SMIV) example
-in the Tests directory.</p>
-
-<p>ThreadWeaver focuses on operations that can be implemented in
-Jobs. To create solutions where a thread is supposed to constantly run
-to perform an ongoing operation that, for example, spans the whole
-application live, it has to be verified that it is the right
-approach. It is possible to add very long or neverending operations to
-the queue, but it will constantly bind a thread to that operation. It
-might still make sense to use ThreadWeaver, as the creation, handling
-and destruction of the threads is already taken care of, but the minimum
-inventory size (thread count) should be increased accordingly to provide
-for enough threads to process the other jobs.</p>
-
-*/
-
-/** \page Why Why Multithreading?
-
-<p><b>
-\ref index "Overview" |
-\ref UseCases |
-Why Multithreading? |
-\ref MainComponents "Main Components"
-</b></p>
-
-<p>In the past, multithreading has been considered a powerful tool that
-is hard to handle (some call it the work of the devil). While there may
-be some truth to this, newer tools have made the job of the software
-developer much easier when creating parallel implementations of
-algorithms. At the same time, the necessity to use multiple threads to
-create performant applications has become more and more
-clear. Technologies like Hyperthreading and multiple core processors can
-only be used if processors have to schedule processing power to
-multiple, concurrently running processes or threads.</p>
-
-<p>Event driven programs especially bear the issue of latency, which is
-more important for the user's impression of application performance than
-other factors. But the responsiveness of the user interface relies
-mainly on the ability of the application to process events, an ability
-that is much limited in case the application is executing processing
-power expensive, lengthy operations. This leads, for example, to delayed
-or sluggish processing of necessary paint events. Even if this does not
-at all influence the total time necessary to perform the operation the
-user requested, is is annoying and not state of the art. </p>
-
-<p>There are different approaches to solve this issue. The crudest one
-may be to process single or multiple events while performing a lengthy
-operation, which may or may not work sufficiently, but is at least sure
-to ruin all efforts of Separation of Concerns. Concerns can simply not
-be separated if the developer has to intermingle instructions with event
-handling where he does not even know about the kind of events that are
-processed. </p>
-
-<p>Another approach is to use event-controlled asynchronous
-operations. This is sufficient in most cases, but still causes a number
-of issues. Any operation that carries the possibility of taking a long
-time or blocking may still stop event processing for a while. Such risks
-are hard to assess, and especially hard to test in laboratory
-environments where networks are fast and reliable and the system I/O
-load is generally low. Network operations may fail. Hard disks may be
-suspended. The I/O subsystem may be so busy that transfering 2 kByte may
-take a couple of seconds. </p>
-
-<p>Processing events in objects that are executed in other threads is
-another approach. It has it's own issues that come with parallel
-programming, but it makes sure the main event loop returns as soon as
-possible. Usually this approach is combined with a state pattern to
-synchronize the GUI with the threaded event processing. </p>
-
-<p>Which one of these approaches is suitable for a specific case has to
-be assessed by the application developers. There is no silver
-bullet. All have specific strengths, weaknesses and issues. The
-ThreadWeaver library provides the means to implement multithreaded job
-oriented solutions. </p>
-
-<p>To create performant applications, the application designers have to
-leverage the functionality provided by the hardware platform as good as
-possible. While code optimizations only lead to so much improvement,
-application performance is usually determined by network and I/O
-throughput. The CPU time needed is usually negligible. At the same time,
-the different hardware subsystems usually are independent in modern
-architectures. Network, I/O and memory interfaces can transfer data all
-at the same time, and the CPU is able to process instructions while all
-these subsystems are busy. The modern computer is not a traditional
-uniprocessor (think of GPUs, too). This makes it necessary to use all
-these parallel subsystems at the same time as much as possible to
-actually use the possibilities modern hardware provides, which is very
-hard to achieve in a single thread.</p>
-
-<p>Another very important issue is application processing
-flow. Especially GUI applications to not follow the traditional
-imperative programming pattern. Execution flow is more network-like,
-with chunks of code that depend on others to finish processing before
-they can touch their data. Tools to represent those
-networks to set up your applications order of execution are rare, and
-usually leave it to the developers to code the execution order of the
-instructions. This solutions are usually not flexible and do not adapt
-to the actual usage of the CPU nodes and computer
-subsystems. ThreadWeaver provides means to represent code execution
-dependencies and relies on the operating systems scheduler to actually
-distribute the work load. The result is an implementation that is very
-close to the original application semantics, and usually improved
-performance and scalability in different real-life scenarios. </p>
-
-<p>The more tasks are handled in parallel, the more memory is
-necessary. There is a permanent CPU - memory tradeoff which limits the
-number of parallel operations to the extend where memory that needs to
-be swapped in and out slows down the operations. Therefore memory usage
-needs to be equalized to allow the processors to operate without being
-slowed down. This means parallel operations need to be scheduled to a
-limit to balance CPU and memory usage. ThreadWeaver provides the means
-for that. </p>
-
-<p>In general, ThreadWeaver tries to make to task of creating
-multithreaded, performant applications as simple as
-possible. Programmers should be relieved of synchronization, execution
-dependendancy and load balancing issues as much as possible. The API
-tends to be clean, extensible and easy to understand. </p>
-
-*/
-
-/** \page MainComponents Main Components of ThreadWeaver
-
-<p><b>
-\ref index "Overview" |
-\ref UseCases |
-\ref Why |
-Main Components
-</b></p>
-
-<p>ThreadWeaver is a Job queue. It executes jobs in threads it
-internally manages. The minimum and maximum number of threads provided
-by a Weaver is set by the user. Jobs are regular QObjects, which allows
-users to connect to the done() signal to be notified when the Job has
-been executed. The Weaver class provides objects that handle a number of
-threads called the inventory. Users usually acquire a reference to a
-WeaverInterface object. </p>
-
-<p>Jobs may depend on other jobs. A job will only execute if all jobs it
-depends on are already finished. In this, dependencies reorder job
-execution. If no dependencies are declared, jobs are executed in
-queueing order. Multiple dependencies are possible, which allows the
-creation of complex flow graphs that are automatically executed by the
-Weaver. It is important, though, to avoid circular dependencies. Two
-jobs that depend on each other in both directions will simply never be
-executed, since the dependencies will never resolve.</p>
-
-<p>Threads are created on demand and do not exit until the containing
-weaver is deleted. Threads have an eager policy in trying to execute
-jobs out of the queue. The managing Weaver blocks them if no jobs are
-availabe.</p>
-
-<p>WeaverObservers are used to receive more informative events about the
-thread states and job execution. They can be used to provide progress or
-debugging information or to implement GUIs to show the thread
-activity. Observers can be attached to Weavers and will disconnect
-automatically when they are deleted.</p>
-
-\section Job Execution
-
-<p>In general, jobs are executed in the order they are queued, if they
-have no unresolved dependencies. This behaviour can be used to balance
-I/O, network and CPU load. The SMIV example shows how this can be done.
-</p>
-
-\section Emitting Signals from Jobs
-<p>To notify the application's GUI of progress or other events, it may
-be desirable to emit signals from the Job objects that can be connected
-to the main thread. Since the job will be executed in another thread,
-such signals are delivered asynchronously.</p>
-
-<p>The Job class in the ThreadWeaver library itself contains such a
-helper class that can be used as a reference for this approach.</p>
-
-*/
-
-// DOXYGEN_SET_PROJECT_NAME = ThreadWeaver
-// DOXYGEN_EXCLUDE = Examples Experimental Tests Docs Scripts WeaverGui
-// vim:ts=4:sw=4:expandtab:filetype=doxygen
diff --git a/src/3rdparty/threadweaver/README.md b/src/3rdparty/threadweaver/README.md
deleted file mode 100644
index 3805fddc0..000000000
--- a/src/3rdparty/threadweaver/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-
-## Introduction
-
-## Links
-
-- Mailing list: <https://mail.kde.org/mailman/listinfo/kde-frameworks-devel>
-- IRC channel: #kde-devel on Freenode
-- Git repository: <https://projects.kde.org/projects/frameworks/threadweaver/repository>
diff --git a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp b/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp
deleted file mode 100644
index 53b299598..000000000
--- a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- C++ -*-
-
- Helper class for unit tests.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "AppendCharacterAndVerifyJob.h"
-
-AppendCharacterAndVerifyJob::AppendCharacterAndVerifyJob()
- : AppendCharacterJob()
-{
-}
-
-void AppendCharacterAndVerifyJob::setValues(QChar c, QString *stringref, const QString &expected)
-{
- AppendCharacterJob::setValues(c, stringref);
- m_expected = expected;
-}
-
-void AppendCharacterAndVerifyJob::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
-{
- using namespace ThreadWeaver;
- QMutexLocker locker(&s_GlobalMutex);
- stringRef()->append(character());
- if (m_expected.mid(0, stringRef()->length()) != *stringRef()) {
- debug(3, "It broke!");
- }
- debug(3, "AppendCharacterJob::run: %c appended, result is %s.\n",
- character().toLatin1(), qPrintable(*stringRef()));
-}
diff --git a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h b/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h
deleted file mode 100644
index 5e7bddf8a..000000000
--- a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- C++ -*-
-
- Helper class for unit tests.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef APPENDCHARACTERANDVERIFYJOB_H
-#define APPENDCHARACTERANDVERIFYJOB_H
-
-#include <AppendCharacterJob.h>
-
-class AppendCharacterAndVerifyJob : public AppendCharacterJob
-{
-public:
- AppendCharacterAndVerifyJob();
- void setValues(QChar character, QString *stringref, const QString &expected);
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *);
-
-private:
- QString m_expected;
-};
-
-#endif // APPENDCHARACTERANDVERIFYJOB_H
diff --git a/src/3rdparty/threadweaver/autotests/AppendCharacterJob.h b/src/3rdparty/threadweaver/autotests/AppendCharacterJob.h
deleted file mode 100644
index cfc625b15..000000000
--- a/src/3rdparty/threadweaver/autotests/AppendCharacterJob.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- C++ -*-
-
- Helper class for unit tests.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef APPENDCHARACTER_JOB
-#define APPENDCHARACTER_JOB
-
-#include <QtCore/QObject>
-#include <QtCore/QMutex>
-
-#include <ThreadWeaver/JobPointer>
-#include <ThreadWeaver/Job>
-#include <ThreadWeaver/DebuggingAids>
-
-// define in test binary:
-
-extern QMutex s_GlobalMutex;
-
-class AppendCharacterJob : public ThreadWeaver::Job
-{
-public:
- AppendCharacterJob(QChar c = QChar(), QString *stringref = 0)
- : ThreadWeaver::Job()
- {
- setValues(c, stringref);
- }
-
- void setValues(QChar c, QString *stringref)
- {
- m_c = c;
- m_stringref = stringref;
- }
-
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
- {
- QMutexLocker locker(&s_GlobalMutex);
- m_stringref->append(m_c);
- using namespace ThreadWeaver;
- debug(3, "AppendCharacterJob::run: %c appended, result is %s.\n",
- m_c.toLatin1(), qPrintable(*m_stringref));
- }
-
- QChar character() const
- {
- return m_c;
- }
-
-protected:
- QString *stringRef() const
- {
- return m_stringref;
- }
-
-private:
- QChar m_c;
- QString *m_stringref;
-};
-
-class FailingAppendCharacterJob : public AppendCharacterJob
-{
-public:
- FailingAppendCharacterJob(QChar c = QChar(), QString *stringref = 0)
- : AppendCharacterJob(c, stringref)
- {
- }
-
- bool success() const
- {
- return false;
- }
-};
-
-class BusyJob : public ThreadWeaver::Job
-{
-public:
- BusyJob()
- : ThreadWeaver::Job()
- {
- }
-
- ~BusyJob()
- {
-// using namespace ThreadWeaver;
-// debug(0, "~BusyJob\n");
- }
-
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
- {
-// debug(0, "BusyJob: entered run()\n");
- for (int i = 0; i < 100; ++i) {
- int k = (i << 3) + (i >> 4);
- Q_UNUSED(k);
- }
- }
-};
-
-#endif
-
diff --git a/src/3rdparty/threadweaver/autotests/CMakeLists.txt b/src/3rdparty/threadweaver/autotests/CMakeLists.txt
deleted file mode 100644
index 4cdaddfbe..000000000
--- a/src/3rdparty/threadweaver/autotests/CMakeLists.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-find_package(Qt5Test 5.2.0 REQUIRED NO_MODULE)
-
-remove_definitions(-DQT_NO_CAST_FROM_ASCII)
-add_definitions(-fexceptions)
-
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../src/ThreadWeaver/
-)
-
-include(ECMMarkAsTest)
-
-########### next target ###############
-
-set(JobTests_SRCS JobTests.cpp AppendCharacterAndVerifyJob.cpp)
-
-add_executable(ThreadWeaverJobTests ${JobTests_SRCS})
-add_test(ThreadWeaverJobTests ThreadWeaverJobTests)
-ecm_mark_as_test(ThreadWeaverJobTests)
-
-target_link_libraries(ThreadWeaverJobTests Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverJobTests PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(QueueTests_SRCS QueueTests.cpp)
-
-add_executable(ThreadWeaverQueueTests ${QueueTests_SRCS})
-add_test(ThreadWeaverQueueTests ThreadWeaverQueueTests)
-ecm_mark_as_test(ThreadWeaverQueueTests)
-
-target_link_libraries(ThreadWeaverQueueTests Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverQueueTests PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(DeleteTest_SRCS DeleteTest.cpp)
-
-add_executable(ThreadWeaverDeleteTest ${DeleteTest_SRCS})
-add_test(ThreadWeaverDeleteTest ThreadWeaverDeleteTest)
-ecm_mark_as_test(ThreadWeaverDeleteTest)
-
-target_link_libraries(ThreadWeaverDeleteTest Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverDeleteTest PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(LifecycleTest_SRCS LifecycleTests.cpp)
-
-add_executable(ThreadWeaverLifecycleTest ${LifecycleTest_SRCS})
-add_test(ThreadWeaverLifecycleTest ThreadWeaverLifecycleTest)
-ecm_mark_as_test(ThreadWeaverLifecycleTest)
-
-target_link_libraries(ThreadWeaverLifecycleTest Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverLifecycleTest PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(ShutdownOnQApplicationQuitTest_SRCS ShutdownOnQApplicationQuitTests.cpp)
-
-add_executable(ThreadWeaverShutdownOnQApplicationQuitTest ${ShutdownOnQApplicationQuitTest_SRCS})
-add_test(ThreadWeaverShutdownOnQApplicationQuitTest ThreadWeaverShutdownOnQApplicationQuitTest)
-ecm_mark_as_test(ThreadWeaverShutdownOnQApplicationQuitTest)
-
-target_link_libraries(ThreadWeaverShutdownOnQApplicationQuitTest Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverShutdownOnQApplicationQuitTest PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(QueueFactoryTest_SRCS QueueFactoryTests.cpp)
-
-add_executable(ThreadWeaverQueueFactoryTest ${QueueFactoryTest_SRCS})
-add_test(ThreadWeaverQueueFactoryTest ThreadWeaverQueueFactoryTest)
-ecm_mark_as_test(ThreadWeaverQueueFactoryTest)
-
-target_link_libraries(ThreadWeaverQueueFactoryTest Qt5::Test KF5::ThreadWeaver)
-Set_target_properties(ThreadWeaverQueueFactoryTest PROPERTIES MACOSX_BUNDLE FALSE)
diff --git a/src/3rdparty/threadweaver/autotests/DeleteTest.cpp b/src/3rdparty/threadweaver/autotests/DeleteTest.cpp
deleted file mode 100644
index 6b5103aaa..000000000
--- a/src/3rdparty/threadweaver/autotests/DeleteTest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for the memory management in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <QEventLoop>
-
-#include "DeleteTest.h"
-
-#include <ThreadWeaver/JobPointer>
-#include <ThreadWeaver/QObjectDecorator>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/DebuggingAids>
-
-#include "AppendCharacterJob.h"
-
-class InstanceCountingSequence : public Sequence
-{
-public:
- explicit InstanceCountingSequence()
- : Sequence()
- {
- instances_.fetchAndAddAcquire(1);
- }
-
- ~InstanceCountingSequence()
- {
- instances_.fetchAndAddAcquire(-1);
- }
-
- static int instances()
- {
- return instances_.loadAcquire();
- }
-
-private:
- static QAtomicInt instances_;
-};
-
-QAtomicInt InstanceCountingSequence::instances_;
-
-DeleteTest::DeleteTest()
-{
- ThreadWeaver::setDebugLevel(true, 1);
- ThreadWeaver::Queue::instance()->setMaximumNumberOfThreads(4);
-}
-
-void DeleteTest::DeleteSequenceTest()
-{
- const int NumberOfSequences = 100;
- ThreadWeaver::Queue::instance()->suspend();
- for (int i = 0; i < NumberOfSequences; ++i) {
- QJobPointer seq(new QObjectDecorator(new InstanceCountingSequence));
- seq->sequence()->addJob(JobPointer(new BusyJob));
- seq->sequence()->addJob(JobPointer(new BusyJob));
- QVERIFY(connect(seq.data(), SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(deleteSequence(ThreadWeaver::JobPointer))));
-
- ThreadWeaver::Queue::instance()->enqueue(seq);
- m_finishCount.fetchAndAddRelease(1);
- }
- QCOMPARE(m_finishCount.loadAcquire(), NumberOfSequences);
- QEventLoop loop;
- QVERIFY(connect(this, SIGNAL(deleteSequenceTestCompleted()), &loop, SLOT(quit()), Qt::QueuedConnection));
- ThreadWeaver::Queue::instance()->resume();
- ThreadWeaver::Queue::instance()->finish();
- loop.exec();
- QCOMPARE(m_finishCount.loadAcquire(), 0);
- // The used Weaver instance needs to be shut down. The threads may still hold a reference to the previous job while
- // waiting for the next one or blocking because the queue is empty. If all threads have exited, no references to any jobs are
- // held anymore.
- ThreadWeaver::Queue::instance()->shutDown();
- QCOMPARE(InstanceCountingSequence::instances(), 0);
-}
-
-void DeleteTest::deleteSequence(ThreadWeaver::JobPointer)
-{
- if (m_finishCount.fetchAndAddRelease(-1) == 1) { // if it *was* 1...
- emit deleteSequenceTestCompleted();
- }
-}
-
-QMutex s_GlobalMutex;
-
-QTEST_MAIN(DeleteTest)
-
diff --git a/src/3rdparty/threadweaver/autotests/DeleteTest.h b/src/3rdparty/threadweaver/autotests/DeleteTest.h
deleted file mode 100644
index fe006014c..000000000
--- a/src/3rdparty/threadweaver/autotests/DeleteTest.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for the memory management in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef DELETETEST_H
-#define DELETETEST_H
-
-#include <QtCore/QObject>
-#include <QtTest/QtTest>
-#include <QAtomicInt>
-
-#include <ThreadWeaver/JobPointer>
-
-namespace ThreadWeaver
-{
-class Job;
-}
-
-using namespace ThreadWeaver;
-
-class DeleteTest : public QObject
-{
- Q_OBJECT
-public:
- DeleteTest();
-
-private Q_SLOTS:
- void DeleteSequenceTest();
-
-public Q_SLOTS: // not a test!
- void deleteSequence(ThreadWeaver::JobPointer job);
-
-Q_SIGNALS:
- void deleteSequenceTestCompleted();
-
-private:
- QAtomicInt m_finishCount;
-};
-
-#endif
diff --git a/src/3rdparty/threadweaver/autotests/JobTests.cpp b/src/3rdparty/threadweaver/autotests/JobTests.cpp
deleted file mode 100644
index 785776b17..000000000
--- a/src/3rdparty/threadweaver/autotests/JobTests.cpp
+++ /dev/null
@@ -1,1059 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for job processing in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "JobTests.h"
-
-#include <cstdlib>
-
-#include <QtCore/QMutex>
-#include <QtTest/QtTest>
-#include <QSignalSpy>
-
-#include <ThreadWeaver/Queueing>
-#include <ThreadWeaver/QueueStream>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/Lambda>
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/Thread>
-#include <ThreadWeaver/DebuggingAids>
-#include <ThreadWeaver/Collection>
-#include <ThreadWeaver/ResourceRestrictionPolicy>
-#include <ThreadWeaver/Dependency>
-#include <ThreadWeaver/DependencyPolicy>
-#include <ThreadWeaver/QObjectDecorator>
-#include <ThreadWeaver/Exception>
-
-#include "AppendCharacterJob.h"
-#include "AppendCharacterAndVerifyJob.h"
-
-QMutex s_GlobalMutex;
-
-using namespace ThreadWeaver;
-
-//Ensure that after the object is created, the weaver is idle and resumed.
-//Upon destruction, ensure the weaver is idle and suspended.
-class WaitForIdleAndFinished
-{
-public:
- explicit WaitForIdleAndFinished(Queue *weaver)
- : weaver_(weaver)
- {
- Q_ASSERT(weaver);
- weaver_->finish();
- Q_ASSERT(weaver_->isIdle());
- weaver_->resume();
- }
-
- ~WaitForIdleAndFinished()
- {
- weaver_->resume();
- weaver_->dequeue();
- weaver_->finish();
- weaver_->suspend();
- Q_ASSERT(weaver_->isIdle());
- }
-private:
- Queue *weaver_;
-};
-
-void JobTests::initTestCase()
-{
- setDebugLevel(true, 1);
-}
-
-// Call finish() before leaving a test or use a WaitForIdleAndFinished object to make sure the queue is empty
-// and in an idle state.
-
-void JobTests::WeaverLazyThreadCreationTest()
-{
- Queue weaver;
- QString sequence;
-
- WaitForIdleAndFinished w(&weaver);
- Q_ASSERT(weaver.isIdle());
- QCOMPARE(weaver.currentNumberOfThreads(), 0);
- weaver.stream() << new AppendCharacterJob(QChar('a'), &sequence);
- weaver.finish();
- QCOMPARE(weaver.currentNumberOfThreads(), 1);
- Q_ASSERT(weaver.isIdle());
-}
-
-void JobTests::SimpleJobTest()
-{
- QString sequence;
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << new AppendCharacterJob(QChar('1'), &sequence);
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("1"));
-}
-
-void JobTests::SimpleJobCollectionTest()
-{
- QString sequence;
- Collection jobCollection;
- jobCollection << new AppendCharacterJob(QChar('a'), &sequence)
- << new AppendCharacterJob(QChar('b'), &sequence)
- << new AppendCharacterJob(QChar('c'), &sequence);
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << jobCollection;
-
- Queue::instance()->finish();
-
- QVERIFY(sequence.length() == 3);
- QVERIFY(sequence.count('a') == 1);
- QVERIFY(sequence.count('b') == 1);
- QVERIFY(sequence.count('c') == 1);
-}
-
-void JobTests::EmptyJobCollectionTest()
-{
- Collection collection;
-
- WaitForIdleAndFinished w(Queue::instance());
- Q_ASSERT(Queue::instance()->isIdle());
- stream() << collection;
- Queue::instance()->finish();
- QVERIFY(collection.isFinished());
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::CollectionQueueingTest()
-{
- QString output;
- Collection jobCollection;
- jobCollection << new AppendCharacterJob(QChar('a'), &output)
- << new AppendCharacterJob(QChar('b'), &output)
- << new AppendCharacterJob(QChar('c'), &output);
-
- Queue weaver;
- WaitForIdleAndFinished w(&weaver);
- weaver.suspend();
- weaver.stream() << jobCollection;
- QCOMPARE(weaver.queueLength(), 1); //collection queues itself, and it's elements upon execution of self
- weaver.resume();
- weaver.finish();
- QCOMPARE(output.length(), 3);
- QVERIFY(Queue::instance()->isIdle());
-}
-
-namespace
-{
-using namespace ThreadWeaver;
-
-QString SequenceTemplate = "abcdefghijklmnopqrstuvwxyz";
-
-class GeneratingCollection : public Collection
-{
-public:
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- std::for_each(SequenceTemplate.cbegin(), SequenceTemplate.cend(),
- [this](QChar it)
- {
- *this << new AppendCharacterJob(it, &sequence_);
- });
- }
- QString sequence_;
-};
-
-class GeneratingSequence : public Sequence
-{
-public:
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- std::for_each(SequenceTemplate.cbegin(), SequenceTemplate.cend(),
- [this](QChar it)
- {
- *this << new AppendCharacterJob(it, &sequence_);
- });
- }
- QString sequence_;
-};
-
-}
-
-void JobTests::GeneratingCollectionTest()
-{
- using namespace ThreadWeaver;
-
- GeneratingCollection collection;
- WaitForIdleAndFinished w(Queue::instance());
- stream() << make_job_raw(&collection);
- Queue::instance()->finish();
- QCOMPARE(collection.sequence_.count(), SequenceTemplate.length());
-}
-
-void JobTests::ShortJobSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Sequence> jobSequence(new Sequence());
- jobSequence->addJob(jobA);
- jobSequence->addJob(jobB);
- jobSequence->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->enqueue(jobSequence);
- // Job::DumpJobDependencies();
- Queue::instance()->finish();
- QCOMPARE(sequence, QLatin1String("abc"));
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::EmptyJobSequenceTest()
-{
- using namespace ThreadWeaver;
- QObjectDecorator sequence(new Sequence());
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- Q_ASSERT(Queue::instance()->isIdle());
- QSignalSpy doneSignalSpy(&sequence, SIGNAL(done(ThreadWeaver::JobPointer)));
- QCOMPARE(doneSignalSpy.count(), 0);
- enqueue_raw(&sequence);
- Queue::instance()->finish();
- QVERIFY(sequence.isFinished());
- QVERIFY(Queue::instance()->isIdle());
- QCOMPARE(doneSignalSpy.count(), 1);
-}
-
-void JobTests::GeneratingSequenceTest()
-{
- using namespace ThreadWeaver;
-
- GeneratingSequence sequence;
- WaitForIdleAndFinished w(Queue::instance());
- stream() << make_job_raw(&sequence);
- Queue::instance()->finish();
- QCOMPARE(sequence.sequence_, SequenceTemplate);
-}
-
-/** This test verifies that the done signal for a collection is only sent after all element of the collection have completed. */
-void JobTests::IncompleteCollectionTest()
-{
- using namespace ThreadWeaver;
-
- QString result;
- QObjectDecorator jobA(new AppendCharacterJob(QChar('a'), &result));
- AppendCharacterJob jobB(QChar('b'), &result); //jobB does not get added to the sequence and queued
- QObjectDecorator col(new Collection());
- *col.collection() << jobA;
-
- WaitForIdleAndFinished w(Queue::instance());
- DependencyPolicy::instance().addDependency(Dependency(&jobA, &jobB));
- QSignalSpy collectionDoneSignalSpy(&col, SIGNAL(done(ThreadWeaver::JobPointer)));
- QSignalSpy jobADoneSignalSpy(&jobA, SIGNAL(done(ThreadWeaver::JobPointer)));
- QCOMPARE(collectionDoneSignalSpy.count(), 0);
- QCOMPARE(jobADoneSignalSpy.count(), 0);
- enqueue_raw(&col);
- Queue::instance()->resume();
- QCoreApplication::processEvents();
- QCOMPARE(collectionDoneSignalSpy.count(), 0);
- QCOMPARE(jobADoneSignalSpy.count(), 0);
- DependencyPolicy::instance().removeDependency(Dependency(&jobA, &jobB));
- Queue::instance()->finish();
- QCoreApplication::processEvents();
- QVERIFY(col.collection()->isFinished());
- QVERIFY(Queue::instance()->isIdle());
- QCOMPARE(collectionDoneSignalSpy.count(), 1);
- QCOMPARE(jobADoneSignalSpy.count(), 1);
-}
-
-/** This test verifies that started() is emitted for a collection at the time the first of any elements of the collection gets
- * executed. */
-void JobTests::EmitStartedOnFirstElementTest()
-{
- using namespace ThreadWeaver;
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- QString result;
-
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &result));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &result));
- QObjectDecorator collection(new Collection());
- Collection *decorated = dynamic_cast<Collection *>(collection.job());
- QVERIFY(decorated != 0);
- decorated->addJob(jobA);
- decorated->addJob(jobB);
-
- enqueue(make_job_raw(&collection));
- QSignalSpy collectionStartedSignalSpy(&collection, SIGNAL(started(ThreadWeaver::JobPointer)));
- QSignalSpy collectionDoneSignalSpy(&collection, SIGNAL(done(ThreadWeaver::JobPointer)));
- Queue::instance()->resume();
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QVERIFY(collection.isFinished());
- QCOMPARE(result.length(), 2);
- for (int i = 0; i < 100; ++i) {
- if (collectionStartedSignalSpy.count() != 0 && collectionDoneSignalSpy.count() != 0) {
- break;
- }
- QTest::qWait(1);
- debug(2, "JobTests::EmitStartedOnFirstElementTest: waiting (%i)\n", i);
- qApp->processEvents();
- }
- QCOMPARE(collectionStartedSignalSpy.count(), 1);
- QCOMPARE(collectionDoneSignalSpy.count(), 1);
- QVERIFY(Queue::instance()->isIdle());
-}
-
-/* This test verifies that all elements of a collection are only executed after all dependencies for the collection
- * itself have been resolved.
- * Previous tests have already verified that collections without dependencies get executed right away. */
-void JobTests::CollectionDependenciesTest()
-{
- using namespace ThreadWeaver;
-
- QString result;
- // set up a collection that depends on jobC which does not get queued
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &result));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &result));
- QObjectDecorator col(new Collection());
- QSignalSpy collectionStartedSignalSpy(&col, SIGNAL(started(ThreadWeaver::JobPointer)));
- col.collection()->addJob(jobA);
- col.collection()->addJob(jobB);
- QEventLoop loop;
- connect(&col, SIGNAL(started(ThreadWeaver::JobPointer)), &loop, SLOT(quit()));
-
- QSharedPointer<AppendCharacterJob> jobC(new AppendCharacterJob(QChar('c'), &result));
- DependencyPolicy::instance().addDependency(Dependency(&col, jobC));
-
- // queue collection, but not jobC, the collection should not be executed
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- Queue::instance()->suspend();
- enqueue_raw(&col);
- Queue::instance()->resume();
- QCoreApplication::processEvents();
- QTest::qWait(100);
- //FIXME verify: dfaure needed this here: QTRY_COMPARE(collectionStartedSignalSpy.count(), 0);
- QCOMPARE(collectionStartedSignalSpy.count(), 0);
- // enqueue jobC, first jobC then the collection should be executed
- Queue::instance()->enqueue(jobC);
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QVERIFY(col.isFinished());
- QVERIFY(result.startsWith(jobC->character()));
- //QSKIP("This test is too fragile"); // PENDING(Mirko): fix
- //QTRY_COMPARE(collectionStartedSignalSpy.count(), 1);
- loop.exec();
- qApp->processEvents();
- QCOMPARE(collectionStartedSignalSpy.count(), 1);
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::QueueAndDequeueCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Collection> collection(new Collection());
- collection->addJob(jobA);
- collection->addJob(jobB);
- collection->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
-
- Queue::instance()->enqueue(collection);
- Queue::instance()->dequeue(collection);
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::QueueAndDequeueSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Sequence> jobSequence(new Sequence());
- jobSequence->addJob(jobA);
- jobSequence->addJob(jobB);
- jobSequence->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
-
- Queue::instance()->enqueue(jobSequence);
- Queue::instance()->dequeue(jobSequence);
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::BlockingExecuteTest()
-{
- QString sequence;
- AppendCharacterJob job(QChar('a'), &sequence);
- job.blockingExecute();
- QCOMPARE(sequence, QString("a"));
-}
-
-void JobTests::RecursiveSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Sequence> jobSequence1(new Sequence());
- jobSequence1->addJob(jobA);
- jobSequence1->addJob(jobB);
- jobSequence1->addJob(jobC);
- QSharedPointer<Sequence> jobSequence2(new Sequence());
- jobSequence2->addJob(jobD);
- jobSequence2->addJob(jobE);
- jobSequence2->addJob(jobF);
- QSharedPointer<Sequence> jobSequence3(new Sequence());
- jobSequence3->addJob(jobG);
- jobSequence3->addJob(jobH);
- jobSequence3->addJob(jobI);
- jobSequence3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Sequence> jobSequence4(new Sequence());
- jobSequence4->addJob(jobSequence1);
- jobSequence4->addJob(jobSequence2);
- jobSequence4->addJob(jobSequence3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(jobSequence4);
-// DependencyPolicy::instance().dumpJobDependencies();
- Queue::instance()->resume();
- Queue::instance()->finish();
- QCOMPARE(sequence, QLatin1String("abcdefghij"));
-}
-
-void JobTests::RecursiveQueueAndDequeueCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Collection> collection1(new Collection());
- collection1->addJob(jobA);
- collection1->addJob(jobB);
- collection1->addJob(jobC);
- QSharedPointer<Collection> collection2(new Collection());
- collection2->addJob(jobD);
- collection2->addJob(jobE);
- collection2->addJob(jobF);
- QSharedPointer<Collection> collection3(new Collection());
- collection3->addJob(jobG);
- collection3->addJob(jobH);
- collection3->addJob(jobI);
- collection3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Collection> collection4(new Collection());
- collection4->addJob(collection1);
- collection4->addJob(collection2);
- collection4->addJob(collection3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(collection4);
- Queue::instance()->dequeue(collection4);
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
-}
-
-void JobTests::RecursiveQueueAndDequeueSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Sequence> jobSequence1(new Sequence());
- jobSequence1->addJob(jobA);
- jobSequence1->addJob(jobB);
- jobSequence1->addJob(jobC);
- QSharedPointer<Sequence> jobSequence2(new Sequence());
- jobSequence2->addJob(jobD);
- jobSequence2->addJob(jobE);
- jobSequence2->addJob(jobF);
- QSharedPointer<Sequence> jobSequence3(new Sequence());
- jobSequence3->addJob(jobG);
- jobSequence3->addJob(jobH);
- jobSequence3->addJob(jobI);
- jobSequence3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Sequence> jobSequence4(new Sequence());
- jobSequence4->addJob(jobSequence1);
- jobSequence4->addJob(jobSequence2);
- jobSequence4->addJob(jobSequence3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(jobSequence4);
- Queue::instance()->dequeue(jobSequence4);
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
-}
-
-void JobTests::QueueAndDequeueAllCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Collection> collection(new Collection());
- collection->addJob(jobA);
- collection->addJob(jobB);
- collection->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->enqueue(collection);
- //collection cannot have been started, so only one job is queued at the moment:
- QCOMPARE(Queue::instance()->queueLength(), 1);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::QueueAndDequeueAllSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Sequence> jobSequence(new Sequence());
- jobSequence->addJob(jobA);
- jobSequence->addJob(jobB);
- jobSequence->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
-
- Queue::instance()->enqueue(jobSequence);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::RecursiveQueueAndDequeueAllCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Collection> collection1(new Collection());
- collection1->addJob(jobA);
- collection1->addJob(jobB);
- collection1->addJob(jobC);
- QSharedPointer<Collection> collection2(new Collection());
- collection2->addJob(jobD);
- collection2->addJob(jobE);
- collection2->addJob(jobF);
- QSharedPointer<Collection> collection3(new Collection());
- collection3->addJob(jobG);
- collection3->addJob(jobH);
- collection3->addJob(jobI);
- collection3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Collection> collection4(new Collection());
- collection4->addJob(collection1);
- collection4->addJob(collection2);
- collection4->addJob(collection3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(collection4);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
- Queue::instance()->finish();
-
-}
-
-void JobTests::RecursiveQueueAndDequeueAllSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Sequence> jobSequence1(new Sequence());
- jobSequence1->addJob(jobA);
- jobSequence1->addJob(jobB);
- jobSequence1->addJob(jobC);
- QSharedPointer<Sequence> jobSequence2(new Sequence());
- jobSequence2->addJob(jobD);
- jobSequence2->addJob(jobE);
- jobSequence2->addJob(jobF);
- QSharedPointer<Sequence> jobSequence3(new Sequence());
- jobSequence3->addJob(jobG);
- jobSequence3->addJob(jobH);
- jobSequence3->addJob(jobI);
- jobSequence3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Sequence> jobSequence4(new Sequence());
- jobSequence4->addJob(jobSequence1);
- jobSequence4->addJob(jobSequence2);
- jobSequence4->addJob(jobSequence3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(jobSequence4);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
- Queue::instance()->finish();
-}
-
-// This test is not the most efficient, as the mutex locking takes most of
-// the execution time. Anyway, it will fail if the jobs are not executed
-// in the right order, and the order is randomized.
-void JobTests::MassiveJobSequenceTest()
-{
- const int NoOfChars = 1024;
- const char *Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- const int SizeOfAlphabet = strlen(Alphabet);
- AppendCharacterAndVerifyJob jobs[NoOfChars];
- Sequence jobSequence;
- QString sequence;
- QString in;
-
- srand(1);
- in.reserve(NoOfChars);
- sequence.reserve(NoOfChars);
- for (int i = 0; i < NoOfChars; ++i) {
- const int position = static_cast<int>(SizeOfAlphabet * ((1.0 * rand()) / RAND_MAX));
- Q_ASSERT(0 <= position && position < SizeOfAlphabet);
- QChar c(Alphabet[position]);
- in.append(c);
- }
-
- for (int i = 0; i < NoOfChars; ++i) {
- jobs[i].setValues(in.at(i), &sequence, in);
- jobSequence << jobs[i];
- }
-
- WaitForIdleAndFinished w(Queue::instance());
- QVERIFY(Queue::instance()->isIdle());
- enqueue_raw(&jobSequence);
- Queue::instance()->finish();
- QVERIFY(Queue::instance()->isIdle());
- QCOMPARE(sequence, in);
-}
-
-void JobTests::SimpleRecursiveSequencesTest()
-{
- QString sequence;
- AppendCharacterJob jobB(QChar('b'), &sequence);
- Sequence jobSequence1;
- jobSequence1 << jobB;
-
- AppendCharacterJob jobC(QChar('c'), &sequence);
- AppendCharacterJob jobA(QChar('a'), &sequence);
- Sequence jobSequence2;
- jobSequence2 << jobA;
- jobSequence2 << jobSequence1;
- jobSequence2 << jobC;
-
- WaitForIdleAndFinished w(Queue::instance());
- enqueue_raw(&jobSequence2);
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("abc"));
-}
-
-void JobTests::SequenceOfSequencesTest()
-{
- QString sequence;
- AppendCharacterJob jobA(QChar('a'), &sequence);
- AppendCharacterJob jobB(QChar('b'), &sequence);
- AppendCharacterJob jobC(QChar('c'), &sequence);
- AppendCharacterJob jobD(QChar('d'), &sequence);
- AppendCharacterJob jobE(QChar('e'), &sequence);
- AppendCharacterJob jobF(QChar('f'), &sequence);
- AppendCharacterJob jobG(QChar('g'), &sequence);
- AppendCharacterJob jobH(QChar('h'), &sequence);
- AppendCharacterJob jobI(QChar('i'), &sequence);
- AppendCharacterJob jobJ(QChar('j'), &sequence);
- Sequence jobSequence1;
- jobSequence1 << jobA << jobB << jobC;
- Sequence jobSequence2;
- jobSequence2 << jobD << jobE << jobF;
- Sequence jobSequence3;
- jobSequence3 << jobG << jobH << jobI << jobJ;
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- Sequence jobSequence4;
- jobSequence4 << jobSequence1 << jobSequence2 << jobSequence3;
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << jobSequence4;
- // Job::DumpJobDependencies();
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("abcdefghij"));
-}
-
-void JobTests::QueueAndStopTest()
-{
- QString sequence;
- AppendCharacterJob a('a', &sequence);
- AppendCharacterJob b('b', &sequence);
- AppendCharacterJob c('c', &sequence);
- FailingAppendCharacterJob d('d', &sequence);
- AppendCharacterJob e('e', &sequence);
- AppendCharacterJob f('f', &sequence);
- AppendCharacterJob g('g', &sequence);
- Sequence jobSequence;
- jobSequence << a << b << c << d << e << f << g;
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << jobSequence;
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("abcd"));
-}
-
-void JobTests::ResourceRestrictionPolicyBasicsTest()
-{
- // this test tests that with resource restrictions assigned, jobs
- // still get executed as expected
- QString sequence;
- ResourceRestrictionPolicy restriction(2);
- AppendCharacterJob a('a', &sequence);
- AppendCharacterJob b('b', &sequence);
- AppendCharacterJob c('c', &sequence);
- AppendCharacterJob d('d', &sequence);
- AppendCharacterJob e('e', &sequence);
- AppendCharacterJob f('f', &sequence);
- AppendCharacterJob g('g', &sequence);
- Collection collection;
- collection << a << b << c << d << e << f << g;
- a.assignQueuePolicy(&restriction);
- b.assignQueuePolicy(&restriction);
- c.assignQueuePolicy(&restriction);
- d.assignQueuePolicy(&restriction);
- e.assignQueuePolicy(&restriction);
- f.assignQueuePolicy(&restriction);
- g.assignQueuePolicy(&restriction);
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << collection;
- Queue::instance()->finish();
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::jobStarted(JobPointer)
-{
- // qDebug() << "jobStarted";
- QVERIFY(thread() == QThread::currentThread());
-}
-
-void JobTests::jobDone(JobPointer)
-{
- // qDebug() << "jobDone";
- QVERIFY(thread() == QThread::currentThread());
-}
-
-void JobTests::JobSignalsAreEmittedAsynchronouslyTest()
-{
- using namespace ThreadWeaver;
-
- char bits[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' };
- const int NumberOfBits = sizeof bits / sizeof bits[0];
- QString sequence;
- QObjectDecorator collection(new Collection, this);
-
- QVERIFY(connect(&collection, SIGNAL(started(ThreadWeaver::JobPointer)), SLOT(jobStarted(ThreadWeaver::JobPointer))));
- QVERIFY(connect(&collection, SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(jobDone(ThreadWeaver::JobPointer))));
- for (int counter = 0; counter < NumberOfBits; ++counter) {
- QJobPointer job(new QObjectDecorator(new AppendCharacterJob(bits[counter], &sequence)));
- QVERIFY(connect(job.data(), SIGNAL(started(ThreadWeaver::JobPointer)), SLOT(jobStarted(ThreadWeaver::JobPointer))));
- QVERIFY(connect(job.data(), SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(jobDone(ThreadWeaver::JobPointer))));
- collection.collection()->addJob(job);
- }
-
- WaitForIdleAndFinished w(Queue::instance());
- enqueue_raw(&collection);
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QVERIFY(sequence.length() == NumberOfBits);
-}
-
-QAtomicInt deliveryTestCounter;
-
-void JobTests::deliveryTestJobDone(JobPointer)
-{
- deliveryTestCounter.fetchAndAddRelease(-1);
-}
-
-void noOp() {}
-
-void JobTests::JobSignalsDeliveryTest()
-{
- //This test was added to investigate segmentation faults during signal delivery from jobs to the main thread.
- //Relies on processEvents() processing all pending events, as the specification says.
- using namespace ThreadWeaver;
-
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
- WaitForIdleAndFinished w(Queue::instance());
- for (int count = 0; count < 100; ++count) {
- QJobPointer job(new QObjectDecorator(new Lambda<void(*)()>(noOp)));
- QVERIFY(connect(job.data(), SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(deliveryTestJobDone(ThreadWeaver::JobPointer))));
- deliveryTestCounter.fetchAndAddRelease(1);
- Queue::instance()->enqueue(job);
- }
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QCoreApplication::processEvents();
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
-}
-
-void decrementCounter()
-{
- deliveryTestCounter.fetchAndAddRelease(-1);
-}
-
-void JobTests::JobPointerExecutionTest()
-{
- //This test was added to investigate segmentation faults during signal delivery from jobs to the main thread.
- //Relies on processEvents() processing all pending events, as the specification says.
- using namespace ThreadWeaver;
-
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
- WaitForIdleAndFinished w(Queue::instance());
- for (int count = 0; count < 100; ++count) {
- JobPointer job(new Lambda<void(*)()>(decrementCounter));
- deliveryTestCounter.fetchAndAddRelease(1);
- Queue::instance()->enqueue(job);
- }
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QCoreApplication::processEvents();
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
-}
-
-void JobTests::DequeueSuspendedSequenceTest()
-{
- using namespace ThreadWeaver;
-
- Sequence sequence;
- Queue weaver;
- weaver.suspend();
- enqueue_raw(&weaver, &sequence);
- weaver.dequeue();
- // don't crash
-}
-
-void JobTests::IdDecoratorDecoratesTest()
-{
- using namespace ThreadWeaver;
- QString sequence;
- JobPointer job(new IdDecorator(new AppendCharacterJob('a', &sequence)));
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->enqueue(job);
- Queue::instance()->finish();
- QCOMPARE(sequence, QString::fromLatin1("a"));
-}
-
-void JobTests::IdDecoratorAutoDeleteTest()
-{
- using namespace ThreadWeaver;
- IdDecorator id(0);
- QCOMPARE(id.autoDelete(), true); // autoDelete is on by default
- id.setAutoDelete(false);
- QCOMPARE(id.autoDelete(), false);
- id.setAutoDelete(true);
- QCOMPARE(id.autoDelete(), true);
- // now do not crash, even though id decorates a null pointer
-}
-
-void JobTests::IdDecoratorSingleAllocationTest()
-{
- using namespace ThreadWeaver;
-
- struct DecoratedJob : public IdDecorator {
- QString sequence;
- AppendCharacterJob job;
- DecoratedJob() : IdDecorator(&job, false), job('a', &sequence) {}
- };
-
- WaitForIdleAndFinished w(Queue::instance());
- DecoratedJob job;
- enqueue_raw(&job);
- Queue::instance()->finish();
- QCOMPARE(job.sequence, QString::fromLatin1("a"));
-}
-
-struct InstanceCountedJob : public Job {
- static QAtomicInt counter;
-
- void run(JobPointer, Thread *)
- {
- }
-
- InstanceCountedJob()
- {
- counter.fetchAndAddRelease(1);
- }
-
- ~InstanceCountedJob()
- {
- counter.fetchAndAddRelease(-1);
- }
-};
-
-QAtomicInt InstanceCountedJob::counter;
-
-/** @brief Verify that neither the queue nor the thread keep a reference to the job after completing it.
- *
- * This is necessary because user-allocated objects like queue policies may be registered with the jobs. If the jobs stick around
- * until the thread or queue are deleted, the user-allocatd objects may have gone out of scope or been deleted already, causing
- * potential errors. From ThreadWeaver's point of view, a job seizes to exist once the processing thread asks for the next job. */
-void JobTests::JobsAreDestroyedAfterFinishTest()
-{
- using namespace ThreadWeaver;
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- Queue::instance()->suspend();
- JobPointer job(new InstanceCountedJob);
- Queue::instance()->enqueue(job);
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- Queue::instance()->resume();
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- Queue::instance()->finish();
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- QCoreApplication::processEvents();
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- job.clear();
- // if this succeeds, job is the only shared pointer pointing to the created InstanceCountedJob object:
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 0);
-}
-
-void JobTests::JobExitStatusByExceptionTest()
-{
- using namespace ThreadWeaver;
-
- struct FailingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- throw JobFailed();
- }
- };
-
- FailingJob failing;
- failing.blockingExecute();
- QCOMPARE(failing.status(), Job::Status_Failed);
-
- struct AbortingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- throw JobAborted();
- }
- };
-
- AbortingJob aborting;
- aborting.blockingExecute();
- QCOMPARE(aborting.status(), Job::Status_Aborted);
-
- struct SuccessfulJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- // do nothing
- }
- };
- SuccessfulJob successful;
- successful.blockingExecute();
- QCOMPARE(successful.status(), Job::Status_Success);
-}
-
-void JobTests::JobManualExitStatusTest()
-{
- using namespace ThreadWeaver;
-
- struct FailingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- setStatus(Job::Status_Failed);
- }
- };
-
- FailingJob failing;
- failing.blockingExecute();
- QCOMPARE(failing.status(), Job::Status_Failed);
-
- struct AbortingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- setStatus(Job::Status_Aborted);
- }
- };
-
- AbortingJob aborting;
- aborting.blockingExecute();
- QCOMPARE(aborting.status(), Job::Status_Aborted);
-
- struct SuccessfulJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- // do nothing
- }
- };
- SuccessfulJob successful;
- successful.blockingExecute();
- QCOMPARE(successful.status(), Job::Status_Success);
-}
-
-void JobTests::QueueStreamLifecycletest()
-{
- QString sequence;
- using namespace ThreadWeaver;
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- stream() << make_job(new AppendCharacterJob('a', &sequence)) // enqueues JobPointer
- << new AppendCharacterJob('b', &sequence) // enqueues JobInterface*
- << make_job(new AppendCharacterJob('c', &sequence));
- Queue::instance()->finish();
- QCOMPARE(sequence.count(), 3);
-}
-
-QTEST_MAIN(JobTests)
-
diff --git a/src/3rdparty/threadweaver/autotests/JobTests.h b/src/3rdparty/threadweaver/autotests/JobTests.h
deleted file mode 100644
index 71fc839d9..000000000
--- a/src/3rdparty/threadweaver/autotests/JobTests.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for job processing in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JOBTESTS_H
-#define JOBTESTS_H
-
-#include <QtCore/QObject>
-#include <ThreadWeaver/JobPointer>
-
-namespace ThreadWeaver
-{
-class Job;
-}
-
-using ThreadWeaver::Job;
-
-class JobTests : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void initTestCase();
- void WeaverLazyThreadCreationTest();
- void SimpleJobTest();
- void SimpleJobCollectionTest();
- void EmptyJobCollectionTest();
- void CollectionQueueingTest();
- void GeneratingCollectionTest();
- void ShortJobSequenceTest();
- void EmptyJobSequenceTest();
- void GeneratingSequenceTest();
- void IncompleteCollectionTest();
- void EmitStartedOnFirstElementTest();
- void CollectionDependenciesTest();
- void QueueAndDequeueCollectionTest();
- void QueueAndDequeueSequenceTest();
- void BlockingExecuteTest();
- void RecursiveSequenceTest();
- void RecursiveQueueAndDequeueCollectionTest();
- void RecursiveQueueAndDequeueSequenceTest();
- void QueueAndDequeueAllCollectionTest();
- void QueueAndDequeueAllSequenceTest();
- void RecursiveQueueAndDequeueAllCollectionTest();
- void RecursiveQueueAndDequeueAllSequenceTest();
- void MassiveJobSequenceTest();
- void SimpleRecursiveSequencesTest();
- void SequenceOfSequencesTest();
- void QueueAndStopTest();
- void ResourceRestrictionPolicyBasicsTest();
- void JobSignalsAreEmittedAsynchronouslyTest();
- void JobSignalsDeliveryTest();
- void JobPointerExecutionTest();
- void DequeueSuspendedSequenceTest();
- void IdDecoratorDecoratesTest();
- void IdDecoratorAutoDeleteTest();
- void IdDecoratorSingleAllocationTest();
- void JobsAreDestroyedAfterFinishTest();
- void JobExitStatusByExceptionTest();
- void JobManualExitStatusTest();
- void QueueStreamLifecycletest();
-
-public Q_SLOTS: // slots used during tests that are not test cases
- void jobStarted(ThreadWeaver::JobPointer);
- void jobDone(ThreadWeaver::JobPointer);
-
- void deliveryTestJobDone(ThreadWeaver::JobPointer);
-};
-
-#endif
diff --git a/src/3rdparty/threadweaver/autotests/LifecycleTests.cpp b/src/3rdparty/threadweaver/autotests/LifecycleTests.cpp
deleted file mode 100644
index aca8713b8..000000000
--- a/src/3rdparty/threadweaver/autotests/LifecycleTests.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for JobPointer behaviour in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <QString>
-#include <QtTest>
-
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/JobPointer>
-#include <ThreadWeaver/Job>
-
-class NotifyOnDeletejob : public ThreadWeaver::Job
-{
-public:
- explicit NotifyOnDeletejob(bool &exists)
- : ThreadWeaver::Job()
- , m_exists(exists)
- {
- exists = true;
- }
-
- ~NotifyOnDeletejob()
- {
- m_exists = false;
- }
-
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *) {}
-
-private:
- bool &m_exists;
-};
-
-class LifecycleTests : public QObject
-{
- Q_OBJECT
-
-public:
- LifecycleTests();
-
-private Q_SLOTS:
- void testJobAutoDeletionBasics();
- void testJobAutoDeletion();
-};
-
-LifecycleTests::LifecycleTests()
-{
-}
-
-void LifecycleTests::testJobAutoDeletionBasics()
-{
- bool job1Exists = false;
- bool job2Exists = false;
- ThreadWeaver::JobPointer job2(new NotifyOnDeletejob(job2Exists));
- Q_UNUSED(job2);
- QCOMPARE(true, job2Exists);
- {
- ThreadWeaver::JobPointer job1(new NotifyOnDeletejob(job1Exists));
- Q_UNUSED(job1);
- QCOMPARE(job1Exists, true);
- }
- QCOMPARE(job1Exists, false);
- QCOMPARE(job2Exists, true);
-}
-
-void LifecycleTests::testJobAutoDeletion()
-{
- bool job1Exists = false;
- bool job2Exists = false;
- {
- ThreadWeaver::JobPointer job1(new NotifyOnDeletejob(job1Exists));
- QCOMPARE(job1Exists, true);
- int argc = 0;
- QCoreApplication app(argc, (char **)0); Q_UNUSED(app);
- QVERIFY(ThreadWeaver::Queue::instance());
- ThreadWeaver::Queue::instance()->suspend();
- ThreadWeaver::Queue::instance()->enqueue(job1);
- ThreadWeaver::Queue::instance()->enqueue(ThreadWeaver::JobPointer(new NotifyOnDeletejob(job2Exists)));
- QCOMPARE(job2Exists, true);
- ThreadWeaver::Queue::instance()->resume();
- ThreadWeaver::Queue::instance()->finish();
- QVERIFY(ThreadWeaver::Queue::instance()->isIdle());
- ThreadWeaver::Queue::instance()->suspend();
- QEXPECT_FAIL("", "TODO this *should* work!", Continue);
- QCOMPARE(job2Exists, false);
- QCOMPARE(job1Exists, true);
- }
- QVERIFY(ThreadWeaver::Queue::instance() == 0);
- QCOMPARE(job2Exists, false);
- QCOMPARE(job1Exists, false);
-}
-
-QTEST_APPLESS_MAIN(LifecycleTests)
-
-#include "LifecycleTests.moc"
diff --git a/src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp b/src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp
deleted file mode 100644
index 7528e0cf4..000000000
--- a/src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for global queue customizations in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <QString>
-#include <QtTest>
-
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/QueueSignals>
-#include <ThreadWeaver/Queue>
-#include <weaver_p.h>
-#include <ThreadWeaver/IdDecorator>
-
-using namespace ThreadWeaver;
-QAtomicInt counter;
-
-class CountingJobDecorator : public IdDecorator
-{
-public:
- explicit CountingJobDecorator(const JobPointer &job)
- : IdDecorator(job.data(), false)
- , original_(job)
- {}
-
- void run(JobPointer self, Thread *thread) Q_DECL_OVERRIDE {
- counter.fetchAndAddRelease(1);
- IdDecorator::run(self, thread);
- counter.fetchAndAddAcquire(1);
- }
-
- JobPointer original_;
-};
-
-class JobCountingWeaver : public Weaver
-{
- Q_OBJECT
-public:
- explicit JobCountingWeaver(QObject *parent = 0) : Weaver(parent) {}
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE {
- QVector<JobPointer> decorated;
- std::transform(jobs.begin(), jobs.end(), std::back_inserter(decorated),
- [](const JobPointer & job)
- {
- return JobPointer(new CountingJobDecorator(job));
- });
- Weaver::enqueue(decorated);
- }
-};
-
-class CountingGlobalQueueFactory : public Queue::GlobalQueueFactory
-{
- Queue *create(QObject *parent = 0) Q_DECL_OVERRIDE {
- return new Queue(new JobCountingWeaver, parent);
- }
-};
-
-int argc = 0;
-
-class QueueFactoryTests : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
- void testQueueFactory()
- {
- counter.storeRelease(0);
- QCoreApplication app(argc, (char **)0);
- Queue queue(new JobCountingWeaver(this));
- queue.enqueue(make_job([]() {})); // nop
- queue.finish();
- QCOMPARE(counter.loadAcquire(), 2);
- }
-
- void testGlobalQueueFactory()
- {
- Queue::setGlobalQueueFactory(new CountingGlobalQueueFactory());
- QCoreApplication app(argc, (char **)0);
- counter.storeRelease(0);
- Queue::instance()->enqueue(make_job([]() {})); // nop
- Queue::instance()->finish();
- QCOMPARE(counter.loadAcquire(), 2);
- }
-};
-
-QTEST_APPLESS_MAIN(QueueFactoryTests)
-
-#include "QueueFactoryTests.moc"
diff --git a/src/3rdparty/threadweaver/autotests/QueueTests.cpp b/src/3rdparty/threadweaver/autotests/QueueTests.cpp
deleted file mode 100644
index a758d660f..000000000
--- a/src/3rdparty/threadweaver/autotests/QueueTests.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-#include "QueueTests.h"
-
-#include <QtCore/QChar>
-
-#include <QtCore/QObject>
-#include <QtCore/QThread>
-#include <QtCore/QDebug>
-#include <QtTest/QtTest>
-
-#include "AppendCharacterJob.h"
-
-#include <ThreadWeaver/Queueing>
-/* -*- C++ -*-
-
- This file contains a testsuite for the queueing behaviour in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <ThreadWeaver/Job>
-#include <ThreadWeaver/State>
-#include <ThreadWeaver/QueuePolicy>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/Collection>
-#include <ThreadWeaver/DebuggingAids>
-#include <ThreadWeaver/DependencyPolicy>
-#include <ThreadWeaver/ResourceRestrictionPolicy>
-
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/Thread>
-#include <ThreadWeaver/QObjectDecorator>
-
-QMutex s_GlobalMutex;
-
-LowPriorityAppendCharacterJob::LowPriorityAppendCharacterJob(QChar c, QString *stringref)
- : AppendCharacterJob(c, stringref)
-{}
-
-int LowPriorityAppendCharacterJob ::priority() const
-{
- return -1;
-}
-
-HighPriorityAppendCharacterJob::HighPriorityAppendCharacterJob(QChar c, QString *stringref)
- : AppendCharacterJob(c, stringref)
-{}
-
-int HighPriorityAppendCharacterJob::priority() const
-{
- return 1;
-}
-
-SecondThreadThatQueues::SecondThreadThatQueues()
- : QThread()
-{
-}
-
-void SecondThreadThatQueues::run()
-{
- QString sequence;
- AppendCharacterJob a('a', &sequence);
-
- ThreadWeaver::enqueue_raw(&a);
- ThreadWeaver::Queue::instance()->finish();
- QCOMPARE(sequence, QString("a"));
-}
-
-QueueTests::QueueTests(QObject *parent)
- : QObject(parent)
- , autoDeleteJob(0)
-{
-}
-
-void QueueTests::initTestCase()
-{
- ThreadWeaver::setDebugLevel(true, 1);
-}
-
-void QueueTests::SimpleQueuePrioritiesTest()
-{
- using namespace ThreadWeaver;
-
- Queue weaver;
- weaver.setMaximumNumberOfThreads(1); // just one thread
- QString sequence;
- LowPriorityAppendCharacterJob jobA(QChar('a'), &sequence);
- AppendCharacterJob jobB(QChar('b'), &sequence);
- HighPriorityAppendCharacterJob jobC(QChar('c'), &sequence);
-
- // queue low priority, then normal priority, then high priority
- // if priorities are processed correctly, the jobs will be executed in reverse order
-
- weaver.suspend();
-
- enqueue_raw(&weaver, &jobA);
- enqueue_raw(&weaver, &jobB);
- enqueue_raw(&weaver, &jobC);
-
- weaver.resume();
- weaver.finish();
-
- QCOMPARE(sequence, QString("cba"));
-}
-
-void QueueTests::WeaverInitializationTest()
-{
- // this one mostly tests the sanity of the startup behaviour
- ThreadWeaver::Queue weaver;
- QCOMPARE(weaver.currentNumberOfThreads(), 0);
- QVERIFY(weaver.isEmpty());
- QVERIFY(weaver.isIdle());
- QVERIFY(weaver.queueLength() == 0);
- weaver.finish();
-}
-
-void QueueTests::QueueFromSecondThreadTest()
-{
- ThreadWeaver::Queue::instance(); //create global instance in the main thread
- SecondThreadThatQueues thread;
- thread.start();
- thread.wait();
- QVERIFY(ThreadWeaver::Queue::instance()->isIdle());
-}
-
-void QueueTests::deleteJob(ThreadWeaver::JobPointer job)
-{
- // test that signals are properly emitted (asynchronously, that is):
- QVERIFY(thread() == QThread::currentThread());
- QVERIFY(job == autoDeleteJob);
- delete autoDeleteJob; autoDeleteJob = 0;
-}
-
-void QueueTests::DeleteDoneJobsFromSequenceTest()
-{
- using namespace ThreadWeaver;
- QString sequence;
- autoDeleteJob = new QObjectDecorator(new AppendCharacterJob(QChar('a'), &sequence));
- AppendCharacterJob b(QChar('b'), &sequence);
- AppendCharacterJob c(QChar('c'), &sequence);
- Collection collection;
- collection << make_job_raw(autoDeleteJob) << b << c;
- QVERIFY(autoDeleteJob != 0);
- QVERIFY(connect(autoDeleteJob, SIGNAL(done(ThreadWeaver::JobPointer)),
- SLOT(deleteJob(ThreadWeaver::JobPointer))));
- stream() << collection;
- QTest::qWait(100); // return to event queue to make sure signals are delivered
- Queue::instance()->finish();
- QTest::qWait(100); // return to event queue to make sure signals are delivered
- // no need to delete a, that should be done in deleteJob
- QVERIFY(autoDeleteJob == 0);
-}
-
-void QueueTests::deleteCollection(ThreadWeaver::JobPointer collection)
-{
- QVERIFY(thread() == QThread::currentThread());
- QVERIFY(collection == autoDeleteCollection);
- delete autoDeleteCollection; autoDeleteCollection = 0;
-}
-
-void QueueTests::DeleteCollectionOnDoneTest()
-{
- using namespace ThreadWeaver;
- QString sequence;
- autoDeleteCollection = new QObjectDecorator(new Collection);
- QVERIFY(connect(autoDeleteCollection, SIGNAL(done(ThreadWeaver::JobPointer)),
- SLOT(deleteCollection(ThreadWeaver::JobPointer))));
-
- AppendCharacterJob a(QChar('a'), &sequence);
- AppendCharacterJob b(QChar('b'), &sequence);
- *autoDeleteCollection->collection() << a << b;
-
- enqueue_raw(autoDeleteCollection);
- // return to event queue to make sure signals are delivered
- // (otherwise, no slot calls would happen before the end of this function)
- // I assume the amount of time that we wait does not matter
- QTest::qWait(10);
- Queue::instance()->finish();
- // return to event queue to make sure signals are delivered
- QTest::qWait(10);
- // no need to delete a, that should be done in deleteJob
- QVERIFY(sequence.length() == 2);
- QVERIFY(autoDeleteCollection == 0);
-}
-
-QTEST_MAIN(QueueTests)
-
diff --git a/src/3rdparty/threadweaver/autotests/QueueTests.h b/src/3rdparty/threadweaver/autotests/QueueTests.h
deleted file mode 100644
index f66c07afc..000000000
--- a/src/3rdparty/threadweaver/autotests/QueueTests.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for the queueing behaviour in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef QUEUETESTS_H
-#define QUEUETESTS_H
-
-#include <QtCore/QThread>
-
-#include "AppendCharacterJob.h"
-
-class LowPriorityAppendCharacterJob : public AppendCharacterJob
-{
-public:
- LowPriorityAppendCharacterJob(QChar character = QChar(), QString *stringref = 0);
-
- int priority() const;
-};
-
-class HighPriorityAppendCharacterJob : public AppendCharacterJob
-{
-public:
- HighPriorityAppendCharacterJob(QChar character = QChar(), QString *stringref = 0);
-
- int priority() const;
-};
-
-namespace ThreadWeaver
-{
-class Job;
-class Collection;
-class QObjectDecorator;
-}
-
-using ThreadWeaver::Job;
-
-class SecondThreadThatQueues : public QThread
-{
- Q_OBJECT
-
-public:
- SecondThreadThatQueues();
-
-protected:
- void run();
-};
-
-class QueueTests : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QueueTests(QObject *parent = 0);
-
-public Q_SLOTS:
- // this slot (which is not a test) is part of
- // DeleteDoneJobsFromSequenceTest
- void deleteJob(ThreadWeaver::JobPointer);
- // this slot is part of DeleteCollectionOnDoneTest
- void deleteCollection(ThreadWeaver::JobPointer);
-
-private:
- // this is also part of DeleteDoneJobsFromSequenceTest
- ThreadWeaver::QObjectDecorator *autoDeleteJob;
- // this is part of DeleteCollectionOnDoneTest
- ThreadWeaver::QObjectDecorator *autoDeleteCollection;
-
-private Q_SLOTS:
-
- void initTestCase();
-
- void SimpleQueuePrioritiesTest();
- void WeaverInitializationTest();
- void QueueFromSecondThreadTest();
- void DeleteDoneJobsFromSequenceTest();
- void DeleteCollectionOnDoneTest();
-};
-
-#endif
diff --git a/src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp b/src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp
deleted file mode 100644
index 832626f0a..000000000
--- a/src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for global queue instantiation in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <QString>
-#include <QtTest>
-
-#include <ThreadWeaver/ThreadWeaver>
-
-// The tests checks if the global ThreadWeaver instance is properly
-// destroyed along with QCoreApplication. After that all the puppies
-// are sad and the kittens cry, and the test exits.
-class ShutdownOnQApplicationQuitTests : public QObject
-{
- Q_OBJECT
-
-public:
- ShutdownOnQApplicationQuitTests();
-
-private Q_SLOTS:
- void testShutdownOnQApplicationQuit();
-};
-
-ShutdownOnQApplicationQuitTests::ShutdownOnQApplicationQuitTests()
-{
-}
-
-void ShutdownOnQApplicationQuitTests::testShutdownOnQApplicationQuit()
-{
- {
- int argc = 0;
- QCoreApplication app(argc, (char **)0);
- QVERIFY(ThreadWeaver::Queue::instance() != 0);
- ThreadWeaver::Queue::instance()->suspend();
- ThreadWeaver::Queue::instance()->resume();
- QTest::qWait(10);
- }
- QVERIFY(ThreadWeaver::Queue::instance() == 0);
-}
-
-QTEST_APPLESS_MAIN(ShutdownOnQApplicationQuitTests)
-
-#include "ShutdownOnQApplicationQuitTests.moc"
diff --git a/src/3rdparty/threadweaver/autotests/run-n-tests.py b/src/3rdparty/threadweaver/autotests/run-n-tests.py
deleted file mode 100644
index 55fe98fe9..000000000
--- a/src/3rdparty/threadweaver/autotests/run-n-tests.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-#
-# Helper script to run unit tests repeatedly.
-#
-# Author: Mirko Boehm
-# Copyright: (C) 2005-2013 Mirko Boehm
-# Contact: mirko@kde.org
-# http://www.kde.org
-# http://creative-destruction.me $
-#
-# 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 library 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 library; see the file COPYING.LIB. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-import re
-import os
-import sys
-import time
-import platform
-
-def RunTests( Number ):
- # use Linux as the default:
- SuccessCount = 0
- Platform = platform.platform()
-# Command = "./ThreadWeaverJobTests EmitStartedOnFirstElementTest"
-# Command = "./ThreadWeaverJobTests CollectionDependenciesTest"
-# Command = "./ThreadWeaverJobTests JobSignalsDeliveryTest"
-# Command = "./ThreadWeaverJobTests"
- Command = "make test"
-# if re.search( "Darwin", Platform ):
-# Command = "DYLD_LIBRARY_PATH=../Weaver:../Experimental ./JobTests.app/Contents/MacOs/JobTests >/dev/null"
- for count in range( Number ):
- retValue = os.system ( Command)
- resultString = " (FAILED)"
- if retValue == 0:
- resultString = " (succeeded)"
- SuccessCount = SuccessCount + 1
- else:
- sys.exit(1)
- print "Test run #" + str(count + 1) + resultString
- return SuccessCount
-
-Number = 10
-
-try:
- Number = int ( sys.argv[1] )
-except:
- print "No number given, using default of ", Number
-
-FailedCount = 0
-SuccessCount = 0
-
-t1 = time.time()
-SuccessCount = RunTests ( Number )
-t2 = time.time()
-
-
-elapsed = ((t2 - t1) / 60.0, t2 - t1, (t2 - t1) * 1000.0)
-
-print "RunTests: " + str(Number) + " test runs (" + str(SuccessCount) + " successful, " + str(Number - SuccessCount) + " failed)"
-print "RunTests: %0.3fms (%0.3fs)" % ( elapsed[2], elapsed[1] )
-print "Averages: %0.3fms per test run (%0.3fs)" % ( elapsed[2] / Number, elapsed[1] / Number )
-
-
-
diff --git a/src/3rdparty/threadweaver/benchmarks/CMakeLists.txt b/src/3rdparty/threadweaver/benchmarks/CMakeLists.txt
deleted file mode 100644
index 374ce5a4e..000000000
--- a/src/3rdparty/threadweaver/benchmarks/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-find_package(Qt5Test 5.2.0 REQUIRED NO_MODULE)
-
-if(NOT MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-endif()
-
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../src/ThreadWeaver/
-)
-
-remove_definitions(-DQT_NO_CAST_FROM_ASCII)
-
-########### next target ###############
-
-set(QueueBenchmarks_SRCS QueueBenchmarks.cpp)
-
-add_executable(ThreadWeaverQueueBenchmarks ${QueueBenchmarks_SRCS})
-# add_test(ThreadWeaverQueueBenchmarks ThreadWeaverQueueBenchmarks)
-
-target_link_libraries(ThreadWeaverQueueBenchmarks Qt5::Test KF5::ThreadWeaver)
diff --git a/src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp b/src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp
deleted file mode 100644
index 70fb3407a..000000000
--- a/src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a benchmark for job processing in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <numeric>
-
-#include <QtDebug>
-#include <QString>
-#include <QtTest>
-#include <QCoreApplication>
-#include <QList>
-
-#include <ThreadWeaver/Queueing>
-#include <ThreadWeaver/Job>
-#include <ThreadWeaver/Collection>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/ThreadWeaver>
-
-class AccumulateJob : public ThreadWeaver::Job
-{
-public:
- explicit AccumulateJob()
- : m_count(0)
- , m_result(0)
- {
- }
- AccumulateJob(const AccumulateJob &a)
- : ThreadWeaver::Job()
- , m_count(a.m_count)
- , m_result(a.m_result)
- {
- }
-
- void setCount(quint64 count)
- {
- m_count = count;
- }
-
- quint64 result() const
- {
- return m_result;
- }
-
- void executeRun()
- {
- run(ThreadWeaver::JobPointer(), 0);
- }
-
-protected:
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
- {
- std::vector<quint64> numbers(m_count);
- std::generate(numbers.begin(), numbers.end(), []() -> quint64 { static quint64 i = 0; return i++; });
- m_result = std::accumulate(numbers.begin(), numbers.end(), 0);
- }
-
-private:
- quint64 m_count;
- quint64 m_result;
-};
-
-class QueueBenchmarksTest : public QObject
-{
- Q_OBJECT
-
-public:
- QueueBenchmarksTest();
-
-private Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
- void BaselineBenchmark();
- void BaselineBenchmark_data();
- void BaselineAsJobsBenchmark();
- void BaselineAsJobsBenchmark_data();
- void IndividualJobsBenchmark();
- void IndividualJobsBenchmark_data();
- void CollectionsBenchmark();
- void CollectionsBenchmark_data();
- void SequencesBenchmark();
- void SequencesBenchmark_data();
-
-private:
- void defaultBenchmarkData(bool singleThreaded);
-};
-
-QueueBenchmarksTest::QueueBenchmarksTest()
-{
-}
-
-void QueueBenchmarksTest::initTestCase()
-{
-}
-
-void QueueBenchmarksTest::cleanupTestCase()
-{
-}
-
-/** @brief BaselineBenchmark simply performs the same operations in a loop.
- *
- * The result amounts to what time the jobs used in the benchmark need to execute without queueing or thread
- * synchronization overhead. */
-void QueueBenchmarksTest::BaselineBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
- Q_UNUSED(t); // in this case
-
- QVector<AccumulateJob> jobs(n);
- for (int i = 0; i < n; ++i) {
- jobs[i].setCount(m);
- }
-
- //executeLocal needs to emit similar signals as execute(), to be comparable to the threaded variants.
- //BaselineAsJobsBenchmark does that. Compare BaselineAsJobsBenchmark and BaselineBenchmark to evaluate the overhead of executing
- //an operation in a job.
- QBENCHMARK {
- for (int i = 0; i < n; ++i)
- {
- jobs[i].executeRun();
- }
- }
-}
-
-void QueueBenchmarksTest::BaselineBenchmark_data()
-{
- defaultBenchmarkData(true);
-}
-
-void QueueBenchmarksTest::BaselineAsJobsBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
- Q_UNUSED(t); // in this case
-
- QVector<AccumulateJob> jobs(n);
- for (int i = 0; i < n; ++i) {
- jobs[i].setCount(m);
- }
-
- QBENCHMARK {
- for (int i = 0; i < n; ++i)
- {
- jobs[i].blockingExecute();
- }
- }
-}
-
-void QueueBenchmarksTest::BaselineAsJobsBenchmark_data()
-{
- defaultBenchmarkData(true);
-}
-
-void QueueBenchmarksTest::IndividualJobsBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
-
- ThreadWeaver::Queue weaver;
- weaver.setMaximumNumberOfThreads(t);
- weaver.suspend();
- QVector<AccumulateJob> jobs(n);
- for (int i = 0; i < n; ++i) {
- jobs[i].setCount(m);
- ThreadWeaver::enqueue_raw(&weaver, &jobs[i]);
- }
-
- QBENCHMARK_ONCE {
- weaver.resume();
- weaver.finish();
- }
-}
-
-void QueueBenchmarksTest::IndividualJobsBenchmark_data()
-{
- defaultBenchmarkData(false);
-}
-
-void QueueBenchmarksTest::CollectionsBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
-
- ThreadWeaver::Queue weaver;
- weaver.setMaximumNumberOfThreads(t);
- weaver.suspend();
- QVector<AccumulateJob> jobs(n);
-
- //FIXME currently, memory management of the job sequences (they are deleted when they go out of scope)
- //is measured as part of the benchmark
- qDebug() << b << "blocks" << c << "operations, queueing...";
- //queue the jobs blockwise as collections
- for (int block = 0; block < b; ++block) {
- ThreadWeaver::Collection *collection = new ThreadWeaver::Collection();
- for (int operation = 0; operation < c; ++operation) {
- const int index = block * b + operation;
- jobs[index].setCount(m);
- *collection << jobs[index];
- }
- weaver.stream() << collection;
- }
-
- qDebug() << b << "blocks" << c << "operations, executing...";
- QBENCHMARK_ONCE {
- weaver.resume();
- weaver.finish();
- }
-}
-
-void QueueBenchmarksTest::CollectionsBenchmark_data()
-{
- defaultBenchmarkData(false);
-}
-
-void QueueBenchmarksTest::SequencesBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
-
- ThreadWeaver::Queue weaver;
- weaver.setMaximumNumberOfThreads(t);
- weaver.suspend();
- QVector<AccumulateJob> jobs(n);
-
- qDebug() << b << "blocks" << c << "operations, queueing...";
- //queue the jobs blockwise as collections
- for (int block = 0; block < b; ++block) {
- ThreadWeaver::Sequence *sequence = new ThreadWeaver::Sequence();
- for (int operation = 0; operation < c; ++operation) {
- const int index = block * b + operation;
- jobs[index].setCount(m);
- *sequence << jobs[index];
- }
- weaver.stream() << sequence;
- }
-
- qDebug() << b << "blocks" << c << "operations, executing...";
- QBENCHMARK_ONCE {
- weaver.resume();
- weaver.finish();
- }
-}
-
-void QueueBenchmarksTest::SequencesBenchmark_data()
-{
- defaultBenchmarkData(false);
-}
-
-void QueueBenchmarksTest::defaultBenchmarkData(bool singleThreaded)
-{
- QTest::addColumn<int>("m"); // number of quint64's to accumulate
- QTest::addColumn<int>("c"); // operations per block
- QTest::addColumn<int>("b"); // number of blocks, number of jobs is b*c
- QTest::addColumn<int>("t"); // number of worker threads
-
- const QList<int> threads = singleThreaded ? QList<int>() << 1 : QList<int>() << 1 << 2 << 4 << 8 << 16 << 32 << 64 << 128;
- const QList<int> ms = QList<int>() << 1 << 10 << 100 << 1000 << 10000 << 100000;
- Q_FOREACH (int m, ms) {
- Q_FOREACH (int t, threads) {
- const QString name = QString::fromLatin1("%1 threads, %2 values").arg(t).arg(m);
- // newRow expects const char*, but then qstrdup's it in the QTestData constructor. Eeeew.
- QTest::newRow(qPrintable(name)) << m << 256 << 256 << t;
- }
- }
-}
-
-QTEST_MAIN(QueueBenchmarksTest)
-
-#include "QueueBenchmarks.moc"
diff --git a/src/3rdparty/threadweaver/doxygen-footer.html b/src/3rdparty/threadweaver/doxygen-footer.html
deleted file mode 100644
index 7a2ff0940..000000000
--- a/src/3rdparty/threadweaver/doxygen-footer.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<hr>
-<table width="100%">
- <tr>
- <td style="text-align: center;">ThreadWeaver is (C) 2004 - 2013
- <a href="mailto:Mirko Boehm <mirko@kde.org>">Mirko B&ouml;hm
- </a>
- </td>
- </tr>
-</table>
-
diff --git a/src/3rdparty/threadweaver/internal-doxygen.cfg b/src/3rdparty/threadweaver/internal-doxygen.cfg
deleted file mode 100644
index e1dd01561..000000000
--- a/src/3rdparty/threadweaver/internal-doxygen.cfg
+++ /dev/null
@@ -1,1212 +0,0 @@
-# Doxyfile 1.4.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = ThreadWeaver
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 5.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./doxydocs/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = YES
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = YES
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation.
-
-SHOW_DIRECTORIES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the progam writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = src/Weaver
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = examples
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS = moc_*.cpp
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH = Tests
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER = doxygen-footer.html
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = YES
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/src/3rdparty/threadweaver/src/CMakeLists.txt b/src/3rdparty/threadweaver/src/CMakeLists.txt
deleted file mode 100644
index c571b12df..000000000
--- a/src/3rdparty/threadweaver/src/CMakeLists.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-########### next target ###############
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE_ENABLE_EXCEPTIONS}")
-
-set(ThreadWeaver_LIB_SRCS
- queuesignals.cpp
- queuestream.cpp
- queueapi.cpp
- exception.cpp
- queue.cpp
- weaver.cpp
- debuggingaids.cpp
- thread.cpp
- job.cpp
- iddecorator.cpp
- qobjectdecorator.cpp
- executor.cpp
- executewrapper.cpp
- state.cpp
- weaverimplstate.cpp
- inconstructionstate.cpp
- workinghardstate.cpp
- suspendingstate.cpp
- suspendedstate.cpp
- shuttingdownstate.cpp
- destructedstate.cpp
- collection.cpp
- sequence.cpp
- dependencypolicy.cpp
- dependency.cpp
- resourcerestrictionpolicy.cpp
-)
-
-add_library(KF5ThreadWeaver ${ThreadWeaver_LIB_SRCS})
-generate_export_header(KF5ThreadWeaver BASE_NAME ThreadWeaver)
-add_library(KF5::ThreadWeaver ALIAS KF5ThreadWeaver)
-target_link_libraries(KF5ThreadWeaver PUBLIC Qt5::Core)
-target_include_directories(KF5ThreadWeaver PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
-target_include_directories(KF5ThreadWeaver INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/ThreadWeaver>")
-
-set_target_properties(KF5ThreadWeaver PROPERTIES
- VERSION ${THREADWEAVER_VERSION_STRING}
- SOVERSION ${THREADWEAVER_SOVERSION}
- EXPORT_NAME ThreadWeaver
-)
-install(TARGETS KF5ThreadWeaver EXPORT KF5ThreadWeaverTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
-
-ecm_generate_headers(
- ThreadWeaver
- QueueStream
- Queueing
- Exception
- QueueInterface
- Queue
- DebuggingAids
- Thread
- JobInterface
- Job
- IdDecorator
- QObjectDecorator
- Lambda
- State
- Collection
- Sequence
- Dependency
- DependencyPolicy
- ResourceRestrictionPolicy
- QueueSignals
- QueuePolicy
- JobPointer
- ManagedJobPointer
-
- MODULE_NAME ThreadWeaver
- PREFIX ThreadWeaver
- REQUIRED_HEADERS ThreadWeaver_HEADERS
-)
-install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ThreadWeaver DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
-
-install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/threadweaver_export.h
- ${ThreadWeaver_HEADERS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/ThreadWeaver/threadweaver COMPONENT Devel
-)
diff --git a/src/3rdparty/threadweaver/src/collection.cpp b/src/3rdparty/threadweaver/src/collection.cpp
deleted file mode 100644
index b49cf8a5a..000000000
--- a/src/3rdparty/threadweaver/src/collection.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the Collection class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "collection.h"
-
-#include "queueapi_p.h"
-#include "debuggingaids.h"
-#include "managedjobpointer.h"
-#include "queueing.h"
-
-#include <QtCore/QList>
-#include <QtCore/QObject>
-#include <QtCore/QPointer>
-
-#include "dependencypolicy.h"
-#include "executewrapper_p.h"
-#include "thread.h"
-
-namespace ThreadWeaver
-{
-
-class CollectionExecuteWrapper : public ExecuteWrapper
-{
-public:
- CollectionExecuteWrapper()
- : collection(0)
- {}
-
- void setCollection(Collection *collection_)
- {
- collection = collection_;
- }
-
- void begin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE {
- ExecuteWrapper::begin(job, thread);
- Q_ASSERT(collection);
- collection->elementStarted(job, thread);
- }
-
- void end(JobPointer job, Thread *thread) Q_DECL_OVERRIDE {
- Q_ASSERT(collection);
- collection->elementFinished(job, thread);
- ExecuteWrapper::end(job, thread);
- }
-
- void cleanup(JobPointer job, Thread *) Q_DECL_OVERRIDE {
- //Once job is unwrapped from us, this object is dangling. Job::executor points to the next higher up execute wrapper.
- //It is thus safe to "delete this". By no means add any later steps after delete!
- delete unwrap(job);
- }
-
-private:
- ThreadWeaver::Collection *collection;
-};
-
-class CollectionSelfExecuteWrapper : public ThreadWeaver::ExecuteWrapper
-{
-public:
- void begin(JobPointer, Thread *) Q_DECL_OVERRIDE {
- }
-
- void end(JobPointer, Thread *) Q_DECL_OVERRIDE {
- }
-};
-
-class Collection::Private
-{
-public:
- Private()
- : api(0)
- , jobCounter(0)
- , selfIsExecuting(false)
- {
- }
-
- ~Private()
- {
- }
-
- /* The elements of the collection. */
- QVector<JobPointer> elements;
-
- /* The Weaver interface this collection is queued in. */
- QueueAPI *api;
-
- /* Counter for the finished jobs.
- Set to the number of elements when started.
- When zero, all elements are done.
- */
- QAtomicInt jobCounter;
- QAtomicInt jobsStarted;
- CollectionSelfExecuteWrapper selfExecuteWrapper;
- JobPointer self;
- bool selfIsExecuting;
-};
-
-Collection::Collection()
- : d(new Private)
-{
- d->selfExecuteWrapper.wrap(setExecutor(&d->selfExecuteWrapper));
- CollectionExecuteWrapper *wrapper = new CollectionExecuteWrapper();
- wrapper->setCollection(this);
- wrapper->wrap(setExecutor(wrapper));
-}
-
-Collection::~Collection()
-{
- {
- // dequeue all remaining jobs:
- QMutexLocker l(mutex()); Q_UNUSED(l);
- if (d->api != 0) { // still queued
- dequeueElements(false);
- }
- }
- delete d;
-}
-
-void Collection::addJob(JobPointer job)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- REQUIRE(d->api == 0 || d->selfIsExecuting == true); // not queued yet or still running
- REQUIRE(job != 0);
-
- CollectionExecuteWrapper *wrapper = new CollectionExecuteWrapper();
- wrapper->setCollection(this);
- wrapper->wrap(job->setExecutor(wrapper));
- d->elements.append(job);
-}
-
-void Collection::stop(JobPointer job)
-{
- Q_UNUSED(job);
- QMutexLocker l(mutex()); Q_UNUSED(l);
- if (d->api != 0) {
- debug(4, "Collection::stop: dequeueing %p.\n", (void *)this);
- if (!d->api->dequeue(ManagedJobPointer<Collection>(this))) {
- dequeueElements(false);
- }
- }
-}
-
-void Collection::aboutToBeQueued_locked(QueueAPI *api)
-{
- Q_ASSERT(!mutex()->tryLock());
- Q_ASSERT(d->api == 0); // never queue twice
- d->api = api;
- Job::aboutToBeQueued_locked(api);
-}
-
-void Collection::aboutToBeDequeued_locked(QueueAPI *api)
-{
- Q_ASSERT(!mutex()->tryLock());
- Q_ASSERT(api && d->api == api);
- dequeueElements(true);
- d->api = 0;
- Job::aboutToBeDequeued_locked(api);
-}
-
-void Collection::execute(JobPointer job, Thread *thread)
-{
- {
- QMutexLocker l(mutex()); Q_UNUSED(l);
- Q_ASSERT(d->self.isNull());
- Q_ASSERT(d->api != 0);
- d->self = job;
- d->selfIsExecuting = true; // reset in elementFinished
- }
- Job::execute(job, thread);
-}
-
-void Collection::run(JobPointer, Thread *)
-{
- //empty
-}
-
-void Collection::enqueueElements()
-{
- Q_ASSERT(!mutex()->tryLock());
- d->jobCounter.fetchAndStoreOrdered(d->elements.count() + 1); //including self
- d->api->enqueue(d->elements);
-}
-
-void Collection::elementStarted(JobPointer job, Thread *thread)
-{
- Q_UNUSED(job) // except in Q_ASSERT
-#ifndef NDEBUG // to avoid the mutex in release mode
- Q_ASSERT(!d->self.isNull());
- QMutexLocker l(mutex()); Q_UNUSED(l);
- Q_ASSERT(job.data() == d->self || std::find(d->elements.begin(), d->elements.end(), job) != d->elements.end());
-#endif
- if (d->jobsStarted.fetchAndAddOrdered(1) == 0) {
- //emit started() signal on beginning of first job execution
- executor()->defaultBegin(d->self, thread);
- }
-}
-
-void Collection::elementFinished(JobPointer job, Thread *thread)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- Q_ASSERT(!d->self.isNull());
- Q_UNUSED(job) // except in Q_ASSERT
- //FIXME test this assert with a decorated collection!
- Q_ASSERT(job.data() == d->self || std::find(d->elements.begin(), d->elements.end(), job) != d->elements.end());
- if (d->selfIsExecuting) {
- // the element that is finished is the collection itself
- // the collection is always executed first
- // queue the collection elements:
- enqueueElements();
- d->selfIsExecuting = false;
- }
- const int jobsStarted = d->jobsStarted.loadAcquire();
- Q_ASSERT(jobsStarted >= 0); Q_UNUSED(jobsStarted);
- const int remainingJobs = d->jobCounter.fetchAndAddOrdered(-1) - 1;
- Q_ASSERT(remainingJobs >= 0);
- if (remainingJobs == 0) {
- // all elements can only be done if self has been executed:
- // there is a small chance that (this) has been dequeued in the
- // meantime, in this case, there is nothing left to clean up
- finalCleanup();
- executor()->defaultEnd(d->self, thread);
- l.unlock();
- d->self.clear();
- }
-}
-
-JobPointer Collection::self() const
-{
- return d->self;
-}
-
-JobPointer Collection::jobAt(int i)
-{
- Q_ASSERT(!mutex()->tryLock());
- Q_ASSERT(i >= 0 && i < d->elements.size());
- return d->elements.at(i);
-}
-
-int Collection::jobListLength() const
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- return jobListLength_locked();
-}
-
-int Collection::jobListLength_locked() const
-{
- return d->elements.size();
-}
-
-void Collection::finalCleanup()
-{
- Q_ASSERT(!self().isNull());
- Q_ASSERT(!mutex()->tryLock());
- freeQueuePolicyResources(self());
- setStatus(Status_Success);
- d->api = 0;
-}
-
-Collection &Collection::operator<<(JobInterface *job)
-{
- addJob(make_job(job));
- return *this;
-}
-
-Collection &Collection::operator<<(const JobPointer &job)
-{
- addJob(job);
- return *this;
-}
-
-Collection &Collection::operator<<(JobInterface &job)
-{
- addJob(make_job_raw(&job));
- return *this;
-}
-
-void Collection::dequeueElements(bool queueApiIsLocked)
-{
- // dequeue everything:
- Q_ASSERT(!mutex()->tryLock());
- if (d->api == 0) {
- return; //not queued
- }
-
- for (int index = 0; index < d->elements.size(); ++index) {
- debug(4, "Collection::dequeueElements: dequeueing %p.\n", (void *)d->elements.at(index).data());
- if (queueApiIsLocked) {
- d->api->dequeue_p(d->elements.at(index));
- } else {
- d->api->dequeue(d->elements.at(index));
- }
- }
-
- const int jobCount = d->jobCounter.fetchAndStoreAcquire(0);
- if (jobCount != 0) {
- // if jobCounter is not zero, then we where waiting for the
- // last job to finish before we would have freed our queue
- // policies. In this case we have to do it here:
- finalCleanup();
- }
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/collection.h b/src/3rdparty/threadweaver/src/collection.h
deleted file mode 100644
index 69fd425e6..000000000
--- a/src/3rdparty/threadweaver/src/collection.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the Collection class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JOBCOLLECTION_H
-#define JOBCOLLECTION_H
-
-#include "job.h"
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class Thread;
-class CollectionExecuteWrapper;
-
-/** A Collection is a vector of Jobs that will be queued together.
- * In a Collection, the order of execution of the elements is not specified.
- *
- * It is intended that the collection is set up first and then
- * queued. After queuing, no further jobs should be added to the collection.
- *
- * Collection emits a done(JobPointer) signal when all of the jobs in the collection
- * have completed.
- */
-class THREADWEAVER_EXPORT Collection : public Job
-{
-public:
- Collection();
- ~Collection();
- /** Append a job to the collection.
- *
- * To use Collection, create the Job objects first, add them to the collection, and then queue it. After
- * the collection has been queued, no further Jobs are supposed to be added.
- *
- * @note Once the job has been added, execute wrappers can no more be set on it */
- virtual void addJob(JobPointer);
-
- /** Stop processing, dequeue all remaining Jobs.
- * job is supposed to be an element of the collection.
- */
- //FIXME remove job argument?
- void stop(ThreadWeaver::JobPointer job);
-
- /** Return the number of jobs in the joblist. */
- int jobListLength() const;
-
- /** @brief Add the job to this collection by pointer. */
- Collection &operator<<(ThreadWeaver::JobInterface *job);
-
- /** @brief Add the job to this collection. */
- Collection &operator<<(const ThreadWeaver::JobPointer &job);
- Collection &operator<<(JobInterface &job);
-
-protected:
- /** Overload to queue the collection. */
- void aboutToBeQueued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Overload to dequeue the collection. */
- void aboutToBeDequeued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Return a ref-erence to the job in the job list at position i. */
- JobPointer jobAt(int i);
-
- /** Return the number of jobs in the joblist.
- * Assumes that the mutex is being held.
- */
- virtual int jobListLength_locked() const;
-
- /** Perform the task usually done when one individual job is
- * finished, but in our case only when the whole collection
- * is finished or partly dequeued.
- */
- void finalCleanup();
-
-protected:
- friend class CollectionExecuteWrapper;
- virtual void elementStarted(JobPointer job, Thread *thread);
- virtual void elementFinished(JobPointer job, Thread *thread);
-
- //FIXME needed when using BlockExecutionPolicy?
- JobPointer self() const;
-
-protected:
- /** Overload the execute method. */
- void execute(JobPointer job, Thread *) Q_DECL_OVERRIDE;
-
- /** Overload run().
- * We have to. */
- void run(JobPointer self, Thread *thread) Q_DECL_OVERRIDE;
-
- /** @brief Enqueue the elements of the collection. */
- virtual void enqueueElements();
-
-private:
- /** Dequeue all elements of the collection.
- * Note: This will not dequeue the collection itself.
- */
- void dequeueElements(bool queueApiIsLocked);
-
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/debuggingaids.cpp b/src/3rdparty/threadweaver/src/debuggingaids.cpp
deleted file mode 100644
index 18e89bd6c..000000000
--- a/src/3rdparty/threadweaver/src/debuggingaids.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- C++ -*-
-
- This file implements debugging aids for multithreaded applications.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "debuggingaids.h"
-
-#include <QtCore/QMutex>
-
-#include <threadweaver_export.h>
-
-/** A global mutex for the ThreadWeaver objects.
- Generally, you should not use it in your own code. */
-THREADWEAVER_EXPORT QMutex ThreadWeaver::GlobalMutex;
-THREADWEAVER_EXPORT bool ThreadWeaver::Debug = true;
-THREADWEAVER_EXPORT int ThreadWeaver::DebugLevel = 01;
diff --git a/src/3rdparty/threadweaver/src/debuggingaids.h b/src/3rdparty/threadweaver/src/debuggingaids.h
deleted file mode 100644
index 2f0d41c3d..000000000
--- a/src/3rdparty/threadweaver/src/debuggingaids.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* -*- C++ -*-
-
- This file declares debugging aids for multithreaded applications.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-//krazy:excludeall=inline
-
-#ifndef DEBUGGINGAIDS_H
-#define DEBUGGINGAIDS_H
-
-#include <QtCore/QtGlobal>
-
-extern "C"
-{
-#include <stdarg.h>
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-}
-
-#include <QtCore/QMutex>
-#include <QtCore/QString>
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-extern THREADWEAVER_EXPORT bool Debug;
-extern THREADWEAVER_EXPORT int DebugLevel;
-extern THREADWEAVER_EXPORT QMutex GlobalMutex;
-
-/** Set the debug log level.
-@see debug
-*/
-extern inline void setDebugLevel(bool debug, int level);
-
-/** This method prints a text message on the screen, if debugging is
-enabled. Otherwise, it does nothing. The message is thread safe,
-therefore providing that the messages appear in the order they where
-issued by the different threads.
-All messages are suppressed when Debug is false. All messages with a
-lower importance (higher number) than DebugLevel will be suppressed,
-too. Debug level 0 messages will always be printed as long as
-Debug is true.
- We use our own debugging method, since debugging threads is a more
- complicated experience than debugging single threaded
- contexts. This might change in future in the way that debug
- prints its messages to another logging facility provided by
- the platform.
-Use setDebugLevel () to integrate adapt debug () to your platform.
-*/
-inline void debug(int severity, const char *cformat, ...)
-#ifdef __GNUC__
-__attribute__((format(printf, 2, 3)))
-#endif
-;
-
-/** Prints the message to the console if condition is true. */
-inline void debug(bool condition, int severity, const char *cformat, ...)
-#ifdef __GNUC__
-__attribute__((format(printf, 3, 4)))
-#endif
-;
-
-/** PROTECT executes x with GlobalMutex locked.
- Mostly used for debugging, as in P_ASSERT. */
-#ifdef PROTECT
-#undef PROTECT
-#endif
-#define PROTECT(x) do { QMutexLocker l(&ThreadWeaver::GlobalMutex); (x); } while (0)
-
-/** P_ASSERT ensures that error messages occur in the correct order. */
-#ifdef P_ASSERT
-#undef P_ASSERT
-#endif
-
-#define P_ASSERT(x) do { QMutexLocker l(&ThreadWeaver::GlobalMutex); Q_ASSERT(x); } while (0)
-
-inline void setDebugLevel(bool debug, int level)
-{
- Debug = debug;
- DebugLevel = level;
-}
-
-#ifndef QT_NO_DEBUG
-inline void debug(int severity, const char *cformat, ...)
-{
- if (Debug == true && (severity <= DebugLevel || severity == 0)) {
- QString text;
-
- va_list ap;
- va_start(ap, cformat);
- PROTECT(vprintf(cformat, ap));
- va_end(ap);
- }
-}
-
-inline void debug(bool condition, int severity, const char *cformat, ...)
-{
- if (condition && Debug == true && (severity <= DebugLevel || severity == 0)) {
- QString text;
-
- va_list ap;
- va_start(ap, cformat);
- PROTECT(vprintf(cformat, ap));
- va_end(ap);
- }
-}
-#else
-inline void debug(int, const char *, ...) {}
-inline void debug(bool, int, const char *, ...) {}
-#endif
-
-inline bool invariant()
-{
- return true;
-}
-
-#define INVARIANT Q_ASSERT_X (invariant(), __FILE__, "class invariant failed" );
-
-#define REQUIRE(x) \
- INVARIANT \
- Q_ASSERT_X (x, Q_FUNC_INFO, "unfulfilled requirement " #x );
-
-#define ENSURE(x) \
- INVARIANT \
- Q_ASSERT_X (x, Q_FUNC_INFO, "broken guarantee " #x );
-
-#ifdef QT_NO_DEBUG
-#define DEBUGONLY(x)
-#else
-#define DEBUGONLY(x) x
-#endif
-
-}
-
-#endif // DEBUGGINGAIDS_H
diff --git a/src/3rdparty/threadweaver/src/dependency.cpp b/src/3rdparty/threadweaver/src/dependency.cpp
deleted file mode 100644
index 99d0649c0..000000000
--- a/src/3rdparty/threadweaver/src/dependency.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- C++ -*-
-
- A dependency between jobs.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "dependency.h"
-#include "jobinterface.h"
-#include "managedjobpointer.h"
-
-namespace ThreadWeaver
-{
-
-Dependency::Dependency(const JobPointer &dependent, const JobPointer &dependee)
- : m_dependent(dependent)
- , m_dependee(dependee)
-{
-}
-
-Dependency::Dependency(JobInterface *dependent, JobInterface *dependee)
- : m_dependent(ManagedJobPointer<JobInterface>(dependent))
- , m_dependee(ManagedJobPointer<JobInterface>(dependee))
-{
-}
-
-Dependency::Dependency(const JobPointer &dependent, JobInterface *dependee)
- : m_dependent(dependent)
- , m_dependee(ManagedJobPointer<JobInterface>(dependee))
-{
-}
-
-Dependency::Dependency(JobInterface *dependent, const JobPointer &dependee)
- : m_dependent(ManagedJobPointer<JobInterface>(dependent))
- , m_dependee(dependee)
-{
-}
-
-JobPointer Dependency::dependent() const
-{
- return m_dependent;
-}
-
-JobPointer Dependency::dependee() const
-{
- return m_dependee;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/dependency.h b/src/3rdparty/threadweaver/src/dependency.h
deleted file mode 100644
index 0a475949d..000000000
--- a/src/3rdparty/threadweaver/src/dependency.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- C++ -*-
-
- A dependency between jobs.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef DEPENDENCY_H
-#define DEPENDENCY_H
-
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-
-class THREADWEAVER_EXPORT Dependency
-{
-public:
- explicit Dependency(const JobPointer &dependent, const JobPointer &dependee);
- explicit Dependency(JobInterface *dependent, JobInterface *dependee);
- explicit Dependency(const JobPointer &dependent, JobInterface *dependee);
- explicit Dependency(JobInterface *dependent, const JobPointer &dependee);
-
- JobPointer dependent() const;
- JobPointer dependee() const;
-private:
- const JobPointer m_dependent;
- const JobPointer m_dependee;
-};
-
-}
-
-#endif // DEPENDENCY_H
diff --git a/src/3rdparty/threadweaver/src/dependencypolicy.cpp b/src/3rdparty/threadweaver/src/dependencypolicy.cpp
deleted file mode 100644
index 22c093a78..000000000
--- a/src/3rdparty/threadweaver/src/dependencypolicy.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the DependencyPolicy class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "dependencypolicy.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QMutex>
-#include <QtCore/QDebug>
-
-#include "job.h"
-#include "debuggingaids.h"
-#include "managedjobpointer.h"
-
-#include "dependency.h"
-
-using namespace ThreadWeaver;
-
-typedef QMultiMap<JobPointer, JobPointer> JobMultiMap;
-
-class DependencyPolicy::Private
-{
-public:
- /** A container to keep track of Job dependencies.
- * For each dependency A->B, which means Job B depends on Job A and may only be executed after A has been
- * finished, an entry will be added with key A and value B. When A is finished, the entry will be removed.
- */
- JobMultiMap &dependencies()
- {
- return depMap_;
- }
-
- QMutex *mutex()
- {
- return &mutex_;
- }
-
- JobMultiMap depMap_;
- QMutex mutex_;
-};
-
-DependencyPolicy::DependencyPolicy()
- : QueuePolicy()
- , d(new Private())
-{
-}
-
-DependencyPolicy::~DependencyPolicy()
-{
- delete d;
-}
-
-void DependencyPolicy::addDependency(JobPointer jobA, JobPointer jobB)
-{
- // jobA depends on jobB
- REQUIRE(jobA != 0 && jobB != 0 && jobA != jobB);
-
- jobA->assignQueuePolicy(this);
- jobB->assignQueuePolicy(this);
- QMutexLocker l(d->mutex());
- d->dependencies().insert(jobA, jobB);
-
- ENSURE(d->dependencies().contains(jobA));
-}
-
-void DependencyPolicy::addDependency(const Dependency &dep)
-{
- addDependency(dep.dependent(), dep.dependee());
-}
-
-bool DependencyPolicy::removeDependency(JobPointer jobA, JobPointer jobB)
-{
- REQUIRE(jobA != 0 && jobB != 0);
- bool result = false;
- QMutexLocker l(d->mutex());
-
- // there may be only one (!) occurrence of [this, dep]:
- QMutableMapIterator<JobPointer, JobPointer> it(d->dependencies());
- while (it.hasNext()) {
- it.next();
- if (it.key() == jobA && it.value() == jobB) {
- it.remove();
- result = true;
- break;
- }
- }
-
- ENSURE(! d->dependencies().keys(jobB).contains(jobA));
- return result;
-}
-
-bool DependencyPolicy::removeDependency(const Dependency &dep)
-{
- return removeDependency(dep.dependent(), dep.dependee());
-}
-
-void DependencyPolicy::resolveDependencies(JobPointer job)
-{
- if (job->success()) {
- QMutexLocker l(d->mutex());
- QMutableMapIterator<JobPointer, JobPointer> it(d->dependencies());
- // there has to be a better way to do this: (?)
- while (it.hasNext()) { // we remove all entries where jobs depend on *this* :
- it.next();
- if (it.value() == job) {
- it.remove();
- }
- }
- }
-}
-
-//QList<JobPointer> DependencyPolicy::getDependencies(JobPointer job) const
-//{
-// REQUIRE (job != 0);
-// QList<JobInterface*> result;
-// JobMultiMap::const_iterator it;
-// QMutexLocker l( & d->mutex() );
-
-// for ( it = d->dependencies().constBegin(); it != d->dependencies().constEnd(); ++it )
-// {
-// if ( it.key() == job )
-// {
-// result.append( it.value() );
-// }
-// }
-// return result;
-//}
-
-bool DependencyPolicy::hasUnresolvedDependencies(JobPointer job) const
-{
- REQUIRE(job != 0);
- QMutexLocker l(d->mutex());
- return d->dependencies().contains(job);
-}
-
-DependencyPolicy &DependencyPolicy::instance()
-{
- static DependencyPolicy policy;
- return policy;
-}
-
-bool DependencyPolicy::canRun(JobPointer job)
-{
- REQUIRE(job != 0);
- return !hasUnresolvedDependencies(job);
-}
-
-void DependencyPolicy::free(JobPointer job)
-{
- REQUIRE(job != 0);
- REQUIRE(job->status() > Job::Status_Running);
- if (job->success()) {
- resolveDependencies(job);
- debug(3, "DependencyPolicy::free: dependencies resolved for job %p.\n", (void *)job.data());
- } else {
- debug(3, "DependencyPolicy::free: not resolving dependencies for %p (execution not successful).\n",
- (void *)job.data());
- }
- ENSURE((!hasUnresolvedDependencies(job) && job->success()) || !job->success());
-}
-
-void DependencyPolicy::release(JobPointer job)
-{
- REQUIRE(job != 0); Q_UNUSED(job)
-}
-
-void DependencyPolicy::destructed(JobInterface *job)
-{
- REQUIRE(job != 0);
- resolveDependencies(ManagedJobPointer<JobInterface>(job));
-}
-
-//void DependencyPolicy::dumpJobDependencies()
-//{
-// QMutexLocker l( & d->mutex() );
-
-// debug ( 0, "Job Dependencies (left depends on right side):\n" );
-// for ( JobMultiMap::const_iterator it = d->dependencies().constBegin(); it != d->dependencies().constEnd(); ++it )
-// {
-// debug( 0, " : %p <-- %p\n", (void*)it.key(), (void*)it.value());
-// }
-// debug ( 0, "-----------------\n" );
-//}
-
diff --git a/src/3rdparty/threadweaver/src/dependencypolicy.h b/src/3rdparty/threadweaver/src/dependencypolicy.h
deleted file mode 100644
index 91190ccaf..000000000
--- a/src/3rdparty/threadweaver/src/dependencypolicy.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the DependencyPolicy class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#ifndef DEPENDENCYPOLICY_H
-#define DEPENDENCYPOLICY_H
-
-#include <QtGlobal>
-
-//template <typename T> class QList;
-
-#include "queuepolicy.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-class Dependency;
-
-/** @brief DependencyPolicy implements execution-time dependencies dependencies between Jobs.
- *
- * To declare that Job B can only be executed when Job A is finished, call addDependency.
- *
- * Be aware of circular dependencies. All dependencies on a Job will be removed if the Job object is destructed.
- * Sequence uses dependencies to implement the ordered execution of the sequence elements.
- */
-class THREADWEAVER_EXPORT DependencyPolicy : public QueuePolicy
-{
-public:
- /** Destructor. */
- ~DependencyPolicy();
-
- /** @brief Add jobB as a dependency of jobA.
- * jobA will only be executed after jobB has been successfully processed.
- * @param jobA the depending job
- * @param jobB the job jobA depends on
- */
- void addDependency(JobPointer jobA, JobPointer jobB);
- void addDependency(const Dependency &dep);
-
- /** @brief Remove a dependency.
- * The dependency of jobA on jobB is removed. If no dependencies are left for jobA, canRun will return true.
- * Returns false if the given object is not dependency of this job.
- * @param jobA the depending job
- * @param jobB the job jobA depends on
- * @return true if dependency existed, false otherwise
- */
- bool removeDependency(JobPointer jobA, JobPointer jobB);
- bool removeDependency(const Dependency &dep);
-
- /** @brief Resolve all dependencies for a job.
- * This method is called after the Job has been finished, or when it is deleted without being executed (performed by the
- * destructor). The method will remove all entries stating that another Job depends on this one.
- */
- void resolveDependencies(JobPointer);
-
- //FIXME remove
-// /** @brief Retrieve a list of dependencies of this job. */
-// QList<JobPointer> getDependencies(JobPointer) const;
-
- static DependencyPolicy &instance();
-
- bool canRun(JobPointer) Q_DECL_OVERRIDE;
-
- void free(JobPointer) Q_DECL_OVERRIDE;
-
- void release(JobPointer) Q_DECL_OVERRIDE;
-
- void destructed(JobInterface *job) Q_DECL_OVERRIDE;
-
-protected:
- /** @brief Query whether the job has an unresolved dependency.
- * In case it does, the policy will return false from canRun().
- */
- bool hasUnresolvedDependencies(JobPointer) const;
-
-private:
- DependencyPolicy();
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/destructedstate.cpp b/src/3rdparty/threadweaver/src/destructedstate.cpp
deleted file mode 100644
index e269b6d77..000000000
--- a/src/3rdparty/threadweaver/src/destructedstate.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the DestructedState class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: DestructedState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "destructedstate_p.h"
-
-namespace ThreadWeaver
-{
-
-DestructedState::DestructedState(QueueSignals *)
- : WeaverImplState(0) // make sure we cannot use weaver, ever :-)
-{
-}
-
-void DestructedState::shutDown()
-{
-}
-
-Weaver *DestructedState::weaver()
-{
- return 0;
-}
-
-const Weaver *DestructedState::weaver() const
-{
- return 0;
-}
-
-void DestructedState::setMaximumNumberOfThreads(int)
-{
-}
-
-int DestructedState::maximumNumberOfThreads() const
-{
- return 0;
-}
-
-int DestructedState::currentNumberOfThreads() const
-{
- return 0;
-}
-
-void DestructedState::enqueue(const QVector<JobPointer> &)
-{
-}
-
-bool DestructedState::dequeue(const JobPointer &)
-{
- return false;
-}
-
-void DestructedState::dequeue()
-{
-}
-
-void DestructedState::finish()
-{
-}
-
-bool DestructedState::isEmpty() const
-{
- return true;
-}
-
-bool DestructedState::isIdle() const
-{
- return true;
-}
-
-int DestructedState::queueLength() const
-{
- return 0;
-}
-
-void DestructedState::requestAbort()
-{
-}
-
-void DestructedState::suspend()
-{
-}
-
-void DestructedState::resume()
-{
-}
-
-JobPointer DestructedState::applyForWork(Thread *, bool wasBusy)
-{
- Q_UNUSED(wasBusy) // except in Q_ASSERT
- Q_ASSERT(wasBusy == false);
- return JobPointer();
-}
-
-void DestructedState::waitForAvailableJob(Thread *)
-{
-}
-
-StateId DestructedState::stateId() const
-{
- return Destructed;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/destructedstate_p.h b/src/3rdparty/threadweaver/src/destructedstate_p.h
deleted file mode 100644
index 278fbf5b6..000000000
--- a/src/3rdparty/threadweaver/src/destructedstate_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the DestructedState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DestructedState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef DestructedState_H
-#define DestructedState_H
-
-#include "weaverimplstate_p.h"
-
-namespace ThreadWeaver
-{
-
-class QueueSignals;
-
-/** DestructedState is only active after the thread have been destroyed by
- * the destructor, but before superclass destructors have finished.
- */
-class DestructedState : public WeaverImplState
-{
-public:
- explicit DestructedState(QueueSignals *weaver);
- void shutDown() Q_DECL_OVERRIDE;
- Weaver *weaver() Q_DECL_OVERRIDE;
- const Weaver *weaver() const Q_DECL_OVERRIDE;
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
- void enqueue(const QVector<JobPointer> &job) Q_DECL_OVERRIDE;
- bool dequeue(const JobPointer &job) Q_DECL_OVERRIDE;
- void dequeue() Q_DECL_OVERRIDE;
- void finish() Q_DECL_OVERRIDE;
- bool isEmpty() const Q_DECL_OVERRIDE;
- bool isIdle() const Q_DECL_OVERRIDE;
- int queueLength() const Q_DECL_OVERRIDE;
- void requestAbort() Q_DECL_OVERRIDE;
- void suspend() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // DestructedState_H
diff --git a/src/3rdparty/threadweaver/src/exception.cpp b/src/3rdparty/threadweaver/src/exception.cpp
deleted file mode 100644
index 41ffdcc23..000000000
--- a/src/3rdparty/threadweaver/src/exception.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- Base class for exceptions in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-
-#include "exception.h"
-
-namespace ThreadWeaver
-{
-
-Exception::Exception(const QString &message)
- : std::runtime_error(message.toStdString())
- , m_message(message)
-{
-}
-
-Exception::~Exception() throw() {}
-
-QString Exception::message() const
-{
- return m_message;
-}
-
-JobAborted::JobAborted(const QString &message)
- : Exception(message)
-{
-}
-
-JobFailed::JobFailed(const QString &message)
- : Exception(message)
-{
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/exception.h b/src/3rdparty/threadweaver/src/exception.h
deleted file mode 100644
index b3ee3ce2c..000000000
--- a/src/3rdparty/threadweaver/src/exception.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- C++ -*-
-
- Base class for exceptions in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef EXCEPTION_H
-#define EXCEPTION_H
-
-#include <stdexcept>
-
-#include <QString>
-
-#include <threadweaver_export.h>
-
-namespace ThreadWeaver
-{
-
-class THREADWEAVER_EXPORT Exception : public std::runtime_error
-{
-public:
- explicit Exception(const QString &message = QString());
- ~Exception() throw();
- QString message() const;
-
-private:
- QString m_message;
-};
-
-class THREADWEAVER_EXPORT JobAborted : public Exception
-{
-public:
- explicit JobAborted(const QString &message = QString());
-};
-
-class THREADWEAVER_EXPORT JobFailed : public Exception
-{
-public:
- explicit JobFailed(const QString &message = QString());
-};
-
-}
-
-#endif // EXCEPTION_H
diff --git a/src/3rdparty/threadweaver/src/executewrapper.cpp b/src/3rdparty/threadweaver/src/executewrapper.cpp
deleted file mode 100644
index ce5e41e21..000000000
--- a/src/3rdparty/threadweaver/src/executewrapper.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "executewrapper_p.h"
-
-namespace ThreadWeaver
-{
-
-ExecuteWrapper::ExecuteWrapper()
-{
-}
-
-Executor *ExecuteWrapper::wrap(Executor *previous)
-{
- return wrapped.fetchAndStoreOrdered(previous);
-}
-
-Executor *ExecuteWrapper::unwrap(JobPointer job)
-{
- Executor *executor = job->setExecutor(wrapped.fetchAndAddOrdered(0));
- Q_ASSERT_X(executor == this, Q_FUNC_INFO, "ExecuteWrapper can only unwrap itself!");
- wrapped.fetchAndStoreOrdered(0);
- return executor;
-}
-
-void ExecuteWrapper::begin(JobPointer job, Thread *thread)
-{
- Q_ASSERT(wrapped.loadAcquire() != 0);
- wrapped.loadAcquire()->begin(job, thread);
-}
-
-void ExecuteWrapper::execute(JobPointer job, Thread *thread)
-{
- executeWrapped(job, thread);
-}
-
-void ExecuteWrapper::executeWrapped(JobPointer job, Thread *thread)
-{
- Executor *executor = wrapped.loadAcquire();
- Q_ASSERT_X(executor != 0, Q_FUNC_INFO, "Wrapped Executor cannot be zero!");
- executor->execute(job, thread);
-}
-
-void ExecuteWrapper::end(JobPointer job, Thread *thread)
-{
- Q_ASSERT(wrapped.loadAcquire() != 0);
- wrapped.loadAcquire()->end(job, thread);
-}
-
-}
-
-#include "executewrapper_p.h"
diff --git a/src/3rdparty/threadweaver/src/executewrapper_p.h b/src/3rdparty/threadweaver/src/executewrapper_p.h
deleted file mode 100644
index 36480e540..000000000
--- a/src/3rdparty/threadweaver/src/executewrapper_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef EXECUTEWRAPPER_H
-#define EXECUTEWRAPPER_H
-
-#include <QAtomicPointer>
-
-#include "job.h"
-#include "executor_p.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-//FIXME Pimpl, make part of the API, document
-//Find a way to avoid new/delete operation, this is rather performance sensitive area
-class ExecuteWrapper : public Executor
-{
-public:
- ExecuteWrapper();
- Executor *wrap(Executor *previous);
- Executor *unwrap(JobPointer job);
- void begin(JobPointer job, Thread *) Q_DECL_OVERRIDE;
- void execute(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void executeWrapped(JobPointer job, Thread *thread);
- void end(JobPointer job, Thread *) Q_DECL_OVERRIDE;
-
-private:
- QAtomicPointer<Executor> wrapped;
-};
-
-}
-
-#endif // EXECUTEWRAPPER_H
diff --git a/src/3rdparty/threadweaver/src/executor.cpp b/src/3rdparty/threadweaver/src/executor.cpp
deleted file mode 100644
index 8203c779e..000000000
--- a/src/3rdparty/threadweaver/src/executor.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "executor_p.h"
-
-namespace ThreadWeaver
-{
-
-Executor::~Executor()
-{
-}
-
-void Executor::defaultBegin(JobPointer job, Thread *thread)
-{
- job->defaultBegin(job, thread);
-}
-
-void Executor::defaultEnd(JobPointer job, Thread *thread)
-{
- job->defaultEnd(job, thread);
-}
-
-void Executor::cleanup(JobPointer, Thread *)
-{
-}
-
-void Executor::run(JobPointer job, Thread *thread)
-{
- job->run(job, thread);
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/executor_p.h b/src/3rdparty/threadweaver/src/executor_p.h
deleted file mode 100644
index d9f440f5e..000000000
--- a/src/3rdparty/threadweaver/src/executor_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef EXECUTOR_H
-#define EXECUTOR_H
-
-#include "job.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-//FIXME Pimpl, make part of the API, document
-//TODO can JobPointer references be used?
-class Executor
-{
-public:
- virtual ~Executor();
- virtual void begin(JobPointer, Thread *) = 0;
- void defaultBegin(JobPointer job, Thread *thread);
- virtual void execute(JobPointer, Thread *) = 0;
- virtual void end(JobPointer, Thread *) = 0;
- void defaultEnd(JobPointer job, Thread *thread);
- virtual void cleanup(JobPointer, Thread *);
-
- void run(JobPointer job, Thread *thread);
-};
-
-}
-
-#endif // EXECUTOR_H
diff --git a/src/3rdparty/threadweaver/src/iddecorator.cpp b/src/3rdparty/threadweaver/src/iddecorator.cpp
deleted file mode 100644
index 12194af0d..000000000
--- a/src/3rdparty/threadweaver/src/iddecorator.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- C++ -*-
-
- Base class for job decorators in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "collection.h"
-#include "sequence.h"
-#include "managedjobpointer.h"
-
-#include "iddecorator.h"
-
-namespace ThreadWeaver
-{
-
-const int IdDecorator_AutoDelete = 1;
-
-// Pssst: IdDecorator uses the d pointer to hold decoratee. It also uses d2 as a bitfield to store the
-// autoDelete setting. The goal is not to require a dynamic allocation on creation.
-IdDecorator::IdDecorator(JobInterface *decoratee, bool autoDelete)
- : d1(reinterpret_cast<Private1 *>(decoratee))
- , d2(0)
-{
- setAutoDelete(autoDelete);
-}
-
-IdDecorator::~IdDecorator()
-{
- // Do not assert here. IdDecorator can decorate a null pointer. Only assert if a method is called on a decorared
- // null pointer.
- if (autoDelete()) {
- delete job();
- }
-}
-
-QMutex *IdDecorator::mutex() const
-{
- Q_ASSERT(d1);
- return job()->mutex();
-}
-
-void IdDecorator::run(JobPointer self, Thread *thread)
-{
- Q_ASSERT(d1);
- job()->run(self, thread);
-}
-
-void IdDecorator::defaultBegin(JobPointer self, Thread *thread)
-{
- Q_ASSERT(d1);
- job()->defaultBegin(self, thread);
-}
-
-void IdDecorator::defaultEnd(JobPointer self, Thread *thread)
-{
- Q_ASSERT(d1);
- job()->defaultEnd(self, thread);
-}
-
-void IdDecorator::freeQueuePolicyResources(JobPointer j)
-{
- Q_ASSERT(d1);
- job()->freeQueuePolicyResources(j);
-}
-
-void IdDecorator::removeQueuePolicy(QueuePolicy *policy)
-{
- Q_ASSERT(d1);
- job()->removeQueuePolicy(policy);
-}
-
-QList<QueuePolicy *> IdDecorator::queuePolicies() const
-{
- Q_ASSERT(d1);
- return job()->queuePolicies();
-}
-
-void IdDecorator::assignQueuePolicy(QueuePolicy *policy)
-{
- Q_ASSERT(d1);
- job()->assignQueuePolicy(policy);
-}
-
-bool IdDecorator::isFinished() const
-{
- Q_ASSERT(d1);
- return job()->isFinished();
-}
-
-void IdDecorator::aboutToBeQueued(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeQueued(api);
-}
-
-void IdDecorator::aboutToBeQueued_locked(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeQueued_locked(api);
-}
-
-void IdDecorator::aboutToBeDequeued(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeDequeued(api);
-}
-
-void IdDecorator::aboutToBeDequeued_locked(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeDequeued_locked(api);
-}
-
-void IdDecorator::requestAbort()
-{
- Q_ASSERT(d1);
- job()->requestAbort();
-}
-
-bool IdDecorator::success() const
-{
- Q_ASSERT(d1);
- return job()->success();
-}
-
-int IdDecorator::priority() const
-{
- Q_ASSERT(d1);
- return job()->priority();
-}
-
-void IdDecorator::setStatus(JobInterface::Status status)
-{
- Q_ASSERT(d1);
- job()->setStatus(status);
-}
-
-JobInterface::Status IdDecorator::status() const
-{
- Q_ASSERT(d1);
- return job()->status();
-}
-
-Executor *IdDecorator::executor() const
-{
- Q_ASSERT(d1);
- return job()->executor();
-}
-
-Executor *IdDecorator::setExecutor(Executor *executor)
-{
- Q_ASSERT(d1);
- return job()->setExecutor(executor);
-}
-
-void IdDecorator::execute(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread)
-{
- Q_ASSERT(d1);
- job()->execute(self, thread);
-}
-
-void IdDecorator::blockingExecute()
-{
- Q_ASSERT(d1);
- job()->blockingExecute();
-}
-
-const ThreadWeaver::JobInterface *IdDecorator::job() const
-{
- return reinterpret_cast<JobInterface *>(d1);
-}
-
-JobInterface *IdDecorator::job()
-{
- return reinterpret_cast<JobInterface *>(d1);
-}
-
-void IdDecorator::setAutoDelete(bool onOff)
-{
-
- if (onOff) {
- d2 = reinterpret_cast<IdDecorator::Private2 *>(IdDecorator_AutoDelete);
- } else {
- d2 = 0;
- }
-}
-
-bool IdDecorator::autoDelete() const
-{
- return d2 == reinterpret_cast<IdDecorator::Private2 *>(IdDecorator_AutoDelete);
-}
-
-const ThreadWeaver::Collection *IdDecorator::collection() const
-{
- return dynamic_cast<const Collection *>(job());
-}
-
-Collection *IdDecorator::collection()
-{
- return dynamic_cast<Collection *>(job());
-}
-
-const Sequence *IdDecorator::sequence() const
-{
- return dynamic_cast<const Sequence *>(job());
-}
-
-Sequence *IdDecorator::sequence()
-{
- return dynamic_cast<Sequence *>(job());
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/iddecorator.h b/src/3rdparty/threadweaver/src/iddecorator.h
deleted file mode 100644
index b65908fbd..000000000
--- a/src/3rdparty/threadweaver/src/iddecorator.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- C++ -*-
-
- Base class for job decorators in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef THREADWEAVER_IDDECORATOR_H
-#define THREADWEAVER_IDDECORATOR_H
-
-#include <QObject>
-
-#include "threadweaver_export.h"
-#include "jobinterface.h"
-
-namespace ThreadWeaver
-{
-
-class Collection;
-class Sequence;
-
-/** @brief IdDecorator decorates a job without changing it's behaviour.
- *
- * It is supposed to be used as the base class for actual decorators that do change the behaviour of jobs. */
-class THREADWEAVER_EXPORT IdDecorator : public JobInterface
-{
-public:
- explicit IdDecorator(JobInterface *job, bool autoDelete = true);
- ~IdDecorator();
- /** Retrieve the decorated job. */
- const JobInterface *job() const;
- /** Retrieve the decorated job. */
- JobInterface *job();
- /** Auto-delete the decoratee or not. */
- void setAutoDelete(bool onOff);
- /** Will the decoratee be auto-deleted? */
- bool autoDelete() const;
- /** Retrieve the decorated job as a Collection.
- * If the decorated Job is not a Collection, 0 is returned. */
- const Collection *collection() const;
- /** Retrieve the decorated job as a Collection.
- * If the decorated Job is not a Collection, 0 is returned. */
- Collection *collection();
- /** Retrieve the decorated job as a Sequence.
- * If the decorated Job is not a Sequence, 0 is returned. */
- const Sequence *sequence() const;
- /** Retrieve the decorated job as a Sequence.
- * If the decorated Job is not a Sequence, 0 is returned. */
- Sequence *sequence();
-
- void execute(JobPointer job, Thread *) Q_DECL_OVERRIDE;
- void blockingExecute() Q_DECL_OVERRIDE;
- Executor *setExecutor(Executor *executor) Q_DECL_OVERRIDE;
- Executor *executor() const Q_DECL_OVERRIDE;
- int priority() const Q_DECL_OVERRIDE;
- void setStatus(Status) Q_DECL_OVERRIDE;
- Status status() const Q_DECL_OVERRIDE;
- bool success() const Q_DECL_OVERRIDE;
- void requestAbort() Q_DECL_OVERRIDE;
- void aboutToBeQueued(QueueAPI *api) Q_DECL_OVERRIDE;
- void aboutToBeQueued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
- void aboutToBeDequeued(QueueAPI *api) Q_DECL_OVERRIDE;
- void aboutToBeDequeued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
- bool isFinished() const Q_DECL_OVERRIDE;
- void assignQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
- void removeQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
- QList<QueuePolicy *> queuePolicies() const Q_DECL_OVERRIDE;
-
-protected:
- void freeQueuePolicyResources(JobPointer) Q_DECL_OVERRIDE;
- void run(JobPointer self, Thread *thread) Q_DECL_OVERRIDE;
- void defaultBegin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void defaultEnd(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-
- QMutex *mutex() const Q_DECL_OVERRIDE;
-
-private:
- class Private1;
- Private1 *const d1;
- class Private2;
- Private2 *d2;
-};
-
-}
-
-#endif // THREADWEAVER_IDDECORATOR_H
diff --git a/src/3rdparty/threadweaver/src/inconstructionstate.cpp b/src/3rdparty/threadweaver/src/inconstructionstate.cpp
deleted file mode 100644
index 757ac5b7b..000000000
--- a/src/3rdparty/threadweaver/src/inconstructionstate.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the InConstructionState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: InConstructionState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "inconstructionstate_p.h"
-
-#include "weaver_p.h"
-#include "threadweaver.h"
-
-namespace ThreadWeaver
-{
-
-InConstructionState::InConstructionState(QueueSignals *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void InConstructionState::suspend()
-{
- // this request is not handled in InConstruction state
-}
-
-void InConstructionState::resume()
-{
- // this request is not handled in InConstruction state
-}
-
-JobPointer InConstructionState::applyForWork(Thread *th, bool wasBusy)
-{
- Q_ASSERT(wasBusy == false);
- // As long as we are in the construction state, no jobs will be given
- // to the worker threads. The threads will be suspended. They will
- // return from the blocked state when jobs are queued. By then, we
- // should not be in InConstruction state anymore, and we hand the job
- // application over to the then active state.
- while (weaver()->state()->stateId() == InConstruction) {
- weaver()->waitForAvailableJob(th);
- }
- return weaver()->applyForWork(th, wasBusy);
-}
-
-StateId InConstructionState::stateId() const
-{
- return InConstruction;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/inconstructionstate_p.h b/src/3rdparty/threadweaver/src/inconstructionstate_p.h
deleted file mode 100644
index bceab67d6..000000000
--- a/src/3rdparty/threadweaver/src/inconstructionstate_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the InConstructionState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: InConstructionState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef InConstructionState_H
-#define InConstructionState_H
-
-#include "weaverimplstate_p.h"
-
-namespace ThreadWeaver
-{
-
-class Weaver;
-class Queue;
-
-/** InConstructionState handles the calls to the Weaver
- object until the constructor has finished.
- */
-class InConstructionState : public WeaverImplState
-{
-public:
- explicit InConstructionState(QueueSignals *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // InConstructionState_H
diff --git a/src/3rdparty/threadweaver/src/job.cpp b/src/3rdparty/threadweaver/src/job.cpp
deleted file mode 100644
index 1068ec7fe..000000000
--- a/src/3rdparty/threadweaver/src/job.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the Job class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: Job.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "job.h"
-
-#include <QtCore/QList>
-#include <QtCore/QMutex>
-#include "debuggingaids.h"
-#include "thread.h"
-#include <QAtomicPointer>
-#include <QAtomicInt>
-
-#include "queuepolicy.h"
-#include "dependencypolicy.h"
-#include "executor_p.h"
-#include "executewrapper_p.h"
-#include "managedjobpointer.h"
-#include "exception.h"
-
-namespace
-{
-
-class DefaultExecutor : public ThreadWeaver::Executor
-{
-public:
- void begin(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *thread)
- {
- defaultBegin(job, thread);
- }
-
- void execute(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE {
- run(job, thread);
- }
-
- void end(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *thread)
- {
- defaultEnd(job, thread);
- }
-};
-
-class DebugExecuteWrapper : public ThreadWeaver::ExecuteWrapper
-{
-public:
- void execute(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *th) Q_DECL_OVERRIDE {
- Q_ASSERT_X(job, Q_FUNC_INFO, "job may not be zero!");
- ThreadWeaver::debug(3, "DefaultExecuteWrapper::execute: executing job %p in thread %i.\n", job.data(), th ? th->id() : 0);
- executeWrapped(job, th);
- ThreadWeaver::debug(3, "Job::execute: finished execution of job in thread %i.\n", th ? th->id() : 0);
- }
-};
-
-static DefaultExecutor defaultExecutor;
-}
-
-namespace ThreadWeaver
-{
-
-class Job::Private
-{
-public:
- Private()
- : mutex(QMutex::NonRecursive)
- , status(Job::Status_NoStatus)
- , executor(&defaultExecutor)
- {}
-
- ~Private()
- {}
-
- /* The list of QueuePolicies assigned to this Job. */
- QList<QueuePolicy *> queuePolicies;
-
- mutable QMutex mutex;
- /* @brief The status of the Job. */
- QAtomicInt status;
-
- /** The Executor that will execute this Job. */
- QAtomicPointer<Executor> executor;
-
- //FIXME What is the correct KDE frameworks no debug switch?
-#if !defined(NDEBUG)
- /** DebugExecuteWrapper for logging of Job execution. */
- DebugExecuteWrapper debugExecuteWrapper;
-#endif
-};
-
-Job::Job()
- : d(new Private())
-{
-#if !defined(NDEBUG)
- d->debugExecuteWrapper.wrap(setExecutor(&d->debugExecuteWrapper));
-#endif
- d->status.storeRelease(Status_New);
-}
-
-Job::~Job()
-{
- for (int index = 0; index < d->queuePolicies.size(); ++index) {
- d->queuePolicies.at(index)->destructed(this);
- }
- delete d;
-}
-
-void Job::execute(JobPointer self, Thread *th)
-{
- Executor *executor = d->executor.loadAcquire();
- Q_ASSERT(executor); //may never be unset!
- Q_ASSERT(self);
- executor->begin(self, th);
- self->setStatus(Status_Running);
- try {
- executor->execute(self, th);
- if (self->status() == Status_Running) {
- self->setStatus(Status_Success);
- }
- } catch (JobAborted &) {
- self->setStatus(Status_Aborted);
- } catch (JobFailed &) {
- self->setStatus(Status_Failed);
- } catch (...) {
- debug(0, "Uncaught exception in Job %p, aborting.", self.data());
- throw;
- }
- Q_ASSERT(self->status() > Status_Running);
- executor->end(self, th);
- executor->cleanup(self, th);
-}
-
-void Job::blockingExecute()
-{
- execute(ManagedJobPointer<Job>(this), 0);
-}
-Executor *Job::setExecutor(Executor *executor)
-{
- return d->executor.fetchAndStoreOrdered(executor == 0 ? &defaultExecutor : executor);
-}
-
-Executor *Job::executor() const
-{
- return d->executor.fetchAndAddOrdered(0);
-}
-
-int Job::priority() const
-{
- return 0;
-}
-
-void Job::setStatus(JobInterface::Status status)
-{
- d->status.storeRelease(status);
-}
-
-JobInterface::Status Job::status() const
-{
- // since status is set only through setStatus, this should be safe:
- return static_cast<Status>(d->status.loadAcquire());
-}
-
-bool Job::success() const
-{
- return d->status.loadAcquire() == Status_Success;
-}
-
-void Job::freeQueuePolicyResources(JobPointer job)
-{
- for (int index = 0; index < d->queuePolicies.size(); ++index) {
- d->queuePolicies.at(index)->free(job);
- }
-}
-
-void Job::defaultBegin(JobPointer, Thread *)
-{
-}
-
-void Job::defaultEnd(JobPointer job, Thread *)
-{
- freeQueuePolicyResources(job);
-}
-
-void Job::aboutToBeQueued(QueueAPI *api)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- aboutToBeQueued_locked(api);
-}
-
-void Job::aboutToBeQueued_locked(QueueAPI *)
-{
-}
-
-void Job::aboutToBeDequeued(QueueAPI *api)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- aboutToBeDequeued_locked(api);
-}
-
-void Job::aboutToBeDequeued_locked(QueueAPI *)
-{
-}
-
-void Job::assignQueuePolicy(QueuePolicy *policy)
-{
- if (! d->queuePolicies.contains(policy)) {
- d->queuePolicies.append(policy);
- }
-}
-
-void Job::removeQueuePolicy(QueuePolicy *policy)
-{
- int index = d->queuePolicies.indexOf(policy);
- if (index != -1) {
- d->queuePolicies.removeAt(index);
- }
-}
-
-QList<QueuePolicy *> Job::queuePolicies() const
-{
- return d->queuePolicies;
-}
-
-bool Job::isFinished() const
-{
- const Status s = status();
- return s == Status_Success || s == Status_Failed || s == Status_Aborted;
-}
-
-QMutex *Job::mutex() const
-{
- return &d->mutex;
-}
-
-}
-
-#include "managedjobpointer.h"
diff --git a/src/3rdparty/threadweaver/src/job.h b/src/3rdparty/threadweaver/src/job.h
deleted file mode 100644
index 3a50af580..000000000
--- a/src/3rdparty/threadweaver/src/job.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- C++ -*-
-
-This file declares the Job class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: Job.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef THREADWEAVER_JOB_H
-#define THREADWEAVER_JOB_H
-
-#include "threadweaver_export.h"
-#include "jobinterface.h"
-#include "jobpointer.h"
-
-QT_BEGIN_NAMESPACE
-class QMutex;
-class QWaitCondition;
-QT_END_NAMESPACE
-
-namespace ThreadWeaver
-{
-
-class Thread;
-class QueuePolicy;
-class QueueAPI;
-class Executor;
-
-/** @brief A Job is a simple abstraction of an action that is to be executed in a thread context.
- *
- * It is essential for the ThreadWeaver library that as a kind of convention, the different creators of Job objects do not touch
- * the protected data members of the Job until somehow notified by the Job.
- *
- * Jobs may not be executed twice. Create two different objects to perform two consecutive or parallel runs.
- * (Note: this rule is being reconsidered.)
- *
- * Jobs may declare dependencies. If Job B depends on Job A, B may not be executed before A is finished. To learn about
- * dependencies, see DependencyPolicy.
- *
- * Job objects do not inherit QObject. To connect to signals when jobs are started or finished, see QObjectDecorator.
- */
-class THREADWEAVER_EXPORT Job : public JobInterface
-{
-public:
- /** Construct a Job. */
- Job();
-
- /** Destructor. */
- virtual ~Job();
-
- /** Perform the job. The thread in which this job is executed is given as a parameter.
- *
- * Do not overload this method to create your own Job implementation, overload run().
- * Whenever the currently executed job is communicated to the outside world, use the supplied job pointer
- * to keep the reference count correct.
- *
- * job is the Job that the queue is executing. It is not necessarily equal to this. For example, Jobs that are
- * decorated expose the decorator's address, not the address of the decorated object.
- */
- virtual void execute(JobPointer job, Thread *) Q_DECL_OVERRIDE;
-
- /** Perform the job synchroneously in the current thread. */
- void blockingExecute() Q_DECL_OVERRIDE;
-
- /** Set the Executor object that is supposed to run the job.
- *
- * Returns the previously set executor. The executor can never be unset. If zero is passed in as the new executor, the Job
- * will internally reset to a default executor that only invokes run().
- */
- Executor *setExecutor(Executor *executor) Q_DECL_OVERRIDE;
-
- /** Returns the executor currently set on the Job. */
- Executor *executor() const Q_DECL_OVERRIDE;
-
- /** The queueing priority of the job.
- * Jobs will be sorted by their queueing priority when enqueued. A higher queueing priority will place the job in front of all
- * lower-priority jobs in the queue.
- *
- * Note: A higher or lower priority does not influence queue policies. For example, a high-priority job that has an unresolved
- * dependency will not be executed, which means an available lower-priority job will take precedence.
- *
- * The default implementation returns zero. Only if this method is overloaded for some job classes, priorities will influence
- * the execution order of jobs. */
- int priority() const Q_DECL_OVERRIDE;
-
- /** @brief Set the status of the Job.
- *
- * Do not call this method unless you know what you are doing, please :-) */
- void setStatus(Status) Q_DECL_OVERRIDE;
-
- /** @brief The status of the job.
- *
- * The status will be changed to Status_Success if the run() method exits normally.
- */
- Status status() const Q_DECL_OVERRIDE;
-
- /** Return whether the Job finished successfully or not.
- * The default implementation simply returns true. Overload in derived classes if the derived Job class can fail.
- *
- * If a job fails (success() returns false), it will *NOT* resolve its dependencies when it finishes. This will make sure that
- * Jobs that depend on the failed job will not be started.
- *
- * There is an important gotcha: When a Job object it deleted, it will always resolve its dependencies. If dependent jobs should
- * not be executed after a failure, it is important to dequeue those before deleting the failed Job. A Sequence may be
- * helpful for that purpose.
- */
- bool success() const Q_DECL_OVERRIDE;
-
- /** Abort the execution of the job.
- *
- * Call this method to ask the Job to abort if it is currently executed. Please note that the default implementation of
- * the method does nothing (!). This is due to the fact that there is no generic method to abort a processing Job. Not even a
- * default boolean flag makes sense, as Job could, for example, be in an event loop and will need to create an exit event. You
- * have to reimplement the method to actually initiate an abort action.
- *
- * The method is not pure virtual because users are not supposed to be forced to always implement requestAbort(). Also, this
- * method is supposed to return immediately, not after the abort has completed. It requests the abort, the Job has to act on
- * the request. */
- void requestAbort() Q_DECL_OVERRIDE {}
-
- /** The job is about to be added to the weaver's job queue.
- *
- * The job will be added right after this method finished. The default implementation does nothing. Use this method to, for
- * example, queue sub-operations as jobs before the job itself is queued.
- *
- * Note: When this method is called, the associated Weaver object's thread holds a lock on the weaver's queue. Therefore, it
- * is save to assume that recursive queueing is atomic from the queues perspective.
- *
- * @param api the QueueAPI object the job will be queued in */
- void aboutToBeQueued(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Called from aboutToBeQueued() while the mutex is being held. */
- void aboutToBeQueued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** This Job is about the be dequeued from the weaver's job queue.
- *
- * The job will be removed from the queue right after this method returns. Use this method to dequeue, if necessary,
- * sub-operations (jobs) that this job has enqueued.
- *
- * Note: When this method is called, the associated Weaver object's thread does hold a lock on the weaver's queue.
- * Note: The default implementation does nothing.
- *
- * @param weaver the Weaver object from which the job will be dequeued */
- void aboutToBeDequeued(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Called from aboutToBeDequeued() while the mutex is being held. */
- void aboutToBeDequeued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Returns true if the jobs's execute method finished. */
- bool isFinished() const Q_DECL_OVERRIDE;
-
- /** Assign a queue policy.
- *
- * Queue Policies customize the queueing (running) behaviour of sets of jobs. Examples for queue policies are dependencies
- * and resource restrictions. Every queue policy object can only be assigned once to a job, multiple assignments will be
- * IGNORED. */
- void assignQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
-
- /** Remove a queue policy from this job. */
- void removeQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
-
- /** @brief Return the queue policies assigned to this Job. */
- QList<QueuePolicy *> queuePolicies() const;
-
-private:
- class Private;
- Private *d;
-
-protected:
- /** Free the queue policies acquired before this job has been executed. */
- void freeQueuePolicyResources(JobPointer) Q_DECL_OVERRIDE;
-
- friend class Executor;
- /** The method that actually performs the job.
- *
- * It is called from execute(). This method is the one to overload it with the job's task.
- *
- * The Job will be executed in the specified thread. thread may be zero, indicating that the job is being executed some
- * other way (for example, synchroneously by some other job). self specifies the job as the queue sees it. Whenever publishing
- * information about the job to the outside world, for example by emitting signals, use self, not this. self is the reference
- * counted object handled by the queue. Using it as signal parameters will amongst other things prevent thejob from being
- * memory managed and deleted.
- */
- virtual void run(JobPointer self, Thread *thread) = 0;
-
- /** @brief Perform standard tasks before starting the execution of a job.
- *
- * The default implementation is empty.
- * job is the Job that the queue is executing. It is not necessarily equal to this. For example, Jobs that are
- * decorated expose the decorator's address, not the address of the decorated object. */
- void defaultBegin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-
- /** @brief Perform standard task after the execution of a job.
- *
- * The default implementation is empty.
- * job is the Job that the queue is executing. It is not necessarily equal to this. For example, Jobs that are
- * decorated expose the decorator's address, not the address of the decorated object. */
- void defaultEnd(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-
- /** The mutex used to protect this job. */
- QMutex *mutex() const Q_DECL_OVERRIDE;
-
-};
-
-}
-
-#endif // THREADWEAVER_JOB_H
diff --git a/src/3rdparty/threadweaver/src/jobinterface.h b/src/3rdparty/threadweaver/src/jobinterface.h
deleted file mode 100644
index 2a78182d0..000000000
--- a/src/3rdparty/threadweaver/src/jobinterface.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- C++ -*-
-
- Interface for jobs in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JOBINTERFACE_H
-#define JOBINTERFACE_H
-
-#include <QSharedPointer>
-
-#include "threadweaver_export.h"
-#include "jobpointer.h"
-
-QT_BEGIN_NAMESPACE
-class QMutex;
-QT_END_NAMESPACE
-
-namespace ThreadWeaver
-{
-
-class Thread;
-class Executor;
-class QueueAPI;
-class QueuePolicy;
-
-class JobInterface;
-typedef QSharedPointer<JobInterface> JobPointer;
-
-class THREADWEAVER_EXPORT JobInterface
-{
-public:
- enum Status {
- Status_NoStatus = 0,
- Status_New,
- Status_Queued,
- Status_Running,
- Status_Success,
- Status_Failed,
- Status_Aborted,
- Status_NumberOfStatuses,
- };
-
- virtual ~JobInterface() {}
- virtual void execute(JobPointer job, Thread *) = 0;
- virtual void blockingExecute() = 0;
- virtual Executor *setExecutor(Executor *executor) = 0;
- virtual Executor *executor() const = 0;
- virtual int priority() const = 0;
- virtual Status status() const = 0;
- virtual void setStatus(Status) = 0;
- virtual bool success() const = 0;
- virtual void requestAbort() = 0;
- virtual void aboutToBeQueued(QueueAPI *api) = 0;
- virtual void aboutToBeQueued_locked(QueueAPI *api) = 0;
- virtual void aboutToBeDequeued(QueueAPI *api) = 0;
- virtual void aboutToBeDequeued_locked(QueueAPI *api) = 0;
- virtual bool isFinished() const = 0;
- virtual void assignQueuePolicy(QueuePolicy *) = 0;
- virtual void removeQueuePolicy(QueuePolicy *) = 0;
- virtual QList<QueuePolicy *> queuePolicies() const = 0;
- virtual void freeQueuePolicyResources(JobPointer) = 0;
- virtual void run(JobPointer self, Thread *thread) = 0;
- friend class Executor;
- virtual void defaultBegin(JobPointer job, Thread *thread) = 0;
- virtual void defaultEnd(JobPointer job, Thread *thread) = 0;
- virtual QMutex *mutex() const = 0;
-};
-
-}
-
-Q_DECLARE_METATYPE(ThreadWeaver::JobPointer)
-
-#endif // JOBINTERFACE_H
diff --git a/src/3rdparty/threadweaver/src/jobpointer.h b/src/3rdparty/threadweaver/src/jobpointer.h
deleted file mode 100644
index 91093dc69..000000000
--- a/src/3rdparty/threadweaver/src/jobpointer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- C++ -*-
-
- Shared pointer based jobs in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef THREADWEAVER_JOBPOINTER_H
-#define THREADWEAVER_JOBPOINTER_H
-
-// JobPointer is declared together with JobInterface
-#include "jobinterface.h"
-
-#endif // THREADWEAVER_JOBPOINTER_H
diff --git a/src/3rdparty/threadweaver/src/lambda.h b/src/3rdparty/threadweaver/src/lambda.h
deleted file mode 100644
index 092ffc1bf..000000000
--- a/src/3rdparty/threadweaver/src/lambda.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- Wrap functors in jobs in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef LAMBDA_H
-#define LAMBDA_H
-
-#include "job.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief Lambda is a template that takes any type on which operator() is available, and executes it in run(). */
-template <typename T>
-class Lambda : public Job
-{
-public:
- explicit Lambda(T t_)
- : t(t_)
- {}
-
-protected:
- void run(JobPointer, Thread *) Q_DECL_FINAL {
- t();
- }
-
-private:
- T t;
-};
-
-}
-
-#endif // LAMBDA_H
diff --git a/src/3rdparty/threadweaver/src/managedjobpointer.h b/src/3rdparty/threadweaver/src/managedjobpointer.h
deleted file mode 100644
index c42006e52..000000000
--- a/src/3rdparty/threadweaver/src/managedjobpointer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- C++ -*-
-
- Shared pointer based jobs that are managed by the caller in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef MANAGEDJOBPOINTER_H
-#define MANAGEDJOBPOINTER_H
-
-#include <QSharedPointer>
-
-#include "jobinterface.h"
-
-namespace ThreadWeaver
-{
-
-inline void doNotDeleteJob(JobInterface *) {}
-
-template<typename T>
-class ManagedJobPointer : public QSharedPointer<T>
-{
-public:
- ManagedJobPointer(T *job)
- : QSharedPointer<T>(job, doNotDeleteJob) {}
-};
-
-}
-
-#endif // MANAGEDJOBPOINTER_H
diff --git a/src/3rdparty/threadweaver/src/qobjectdecorator.cpp b/src/3rdparty/threadweaver/src/qobjectdecorator.cpp
deleted file mode 100644
index 44118277d..000000000
--- a/src/3rdparty/threadweaver/src/qobjectdecorator.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
- A decorator to make jobs into QObjects in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "qobjectdecorator.h"
-#include "collection.h"
-#include "sequence.h"
-#include "managedjobpointer.h"
-
-namespace ThreadWeaver
-{
-
-QObjectDecorator::QObjectDecorator(JobInterface *decoratee, QObject *parent)
- : QObject(parent)
- , IdDecorator(decoratee)
-{
-}
-
-QObjectDecorator::QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent)
- : QObject(parent)
- , IdDecorator(decoratee, autoDelete)
-{
-}
-
-void QObjectDecorator::defaultBegin(JobPointer self, Thread *thread)
-{
- Q_ASSERT(job());
- Q_EMIT started(self);
- job()->defaultBegin(self, thread);
-}
-
-void QObjectDecorator::defaultEnd(JobPointer self, Thread *thread)
-{
- Q_ASSERT(job());
- job()->defaultEnd(self, thread);
- if (!self->success()) {
- Q_EMIT failed(self);
- }
- Q_EMIT done(self);
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/qobjectdecorator.h b/src/3rdparty/threadweaver/src/qobjectdecorator.h
deleted file mode 100644
index d8a8a11b9..000000000
--- a/src/3rdparty/threadweaver/src/qobjectdecorator.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- C++ -*-
-
- A decorator to make jobs into QObjects in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef THREADWEAVER_QOBJECTDECORATOR_H
-#define THREADWEAVER_QOBJECTDECORATOR_H
-
-#include <QtCore/QObject>
-
-#include "threadweaver_export.h"
-#include "iddecorator.h"
-
-namespace ThreadWeaver
-{
-
-class Collection;
-class Sequence;
-
-class THREADWEAVER_EXPORT QObjectDecorator : public QObject, public IdDecorator
-{
- Q_OBJECT
-public:
- explicit QObjectDecorator(JobInterface *decoratee, QObject *parent = 0);
- explicit QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent = 0);
-
-Q_SIGNALS:
- /** This signal is emitted when this job is being processed by a thread. */
- void started(ThreadWeaver::JobPointer);
- /** This signal is emitted when the job has been finished (no matter if it succeeded or not). */
- void done(ThreadWeaver::JobPointer);
- /** This job has failed.
- *
- * This signal is emitted when success() returns false after the job is executed. */
- void failed(ThreadWeaver::JobPointer);
-
-protected:
- void defaultBegin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void defaultEnd(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-};
-
-typedef QSharedPointer<QObjectDecorator> QJobPointer;
-
-}
-
-#endif // THREADWEAVER_QOBJECTDECORATOR_H
diff --git a/src/3rdparty/threadweaver/src/queue.cpp b/src/3rdparty/threadweaver/src/queue.cpp
deleted file mode 100644
index fb71b8126..000000000
--- a/src/3rdparty/threadweaver/src/queue.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- C++ -*-
-
- The Queue class in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QMutex>
-#include <QtCore/QVector>
-
-#include "queue.h"
-#include "weaver_p.h"
-
-using namespace ThreadWeaver;
-
-namespace
-{
-static Queue::GlobalQueueFactory *globalQueueFactory;
-}
-
-class Queue::Private
-{
-public:
- Private(Queue *q, QueueSignals *queue)
- : implementation(queue)
- {
- Q_ASSERT_X(qApp != 0, Q_FUNC_INFO, "Cannot create global ThreadWeaver instance before QApplication!");
- Q_ASSERT(queue);
- queue->setParent(q);
- q->connect(implementation, SIGNAL(finished()), SIGNAL(finished()));
- q->connect(implementation, SIGNAL(suspended()), SIGNAL(suspended()));
- q->connect(implementation, SIGNAL(jobDone(ThreadWeaver::JobPointer)), SIGNAL(jobDone(ThreadWeaver::JobPointer)));
- }
-
- QueueSignals *implementation;
- void init(QueueSignals *implementation);
-};
-
-/** @brief Construct a Queue. */
-Queue::Queue(QObject *parent)
- : QueueSignals(parent)
- , d(new Private(this, new Weaver))
-{
-}
-
-/** @brief Construct a Queue, specifying the QueueSignals implementation to use.
- *
- * The QueueSignals instance is usually a Weaver object, which may be customized for specific
- * application needs. The Weaver instance will take ownership of the implementation object and
- * deletes it when destructed.
- * @see Weaver
- * @see GlobalQueueFactory
- */
-Queue::Queue(QueueSignals *implementation, QObject *parent)
- : QueueSignals(parent)
- , d(new Private(this, implementation))
-{
-}
-
-/** @brief Destruct the Queue object.
- *
- * If the queue is not already in Destructed state, the destructor will call shutDown() to make sure
- * enqueued jobs are completed and the queue is idle.
- * The queue implementation will be destroyed.
- * @see shutDown()
- * @see ThreadWeaver::Destructed
- */
-Queue::~Queue()
-{
- if (d->implementation->state()->stateId() != Destructed) {
- d->implementation->shutDown();
- }
- delete d->implementation;
- delete d;
-}
-
-/** @brief Create a QueueStream to enqueue jobs into this queue. */
-QueueStream Queue::stream()
-{
- return QueueStream(this);
-}
-
-void Queue::shutDown()
-{
- d->implementation->shutDown();
-}
-
-/** @brief Set the factory object that will create the global queue.
- *
- * Once set, the global queue factory will be deleted when the global ThreadWeaver pool is deleted.
- * The factory object needs to be set before the global ThreadWeaver pool is instantiated. Call this
- * method before Q(Core)Application is constructed. */
-void Queue::setGlobalQueueFactory(Queue::GlobalQueueFactory *factory)
-{
- if (globalQueueFactory) {
- delete globalQueueFactory;
- }
- globalQueueFactory = factory;
-}
-
-const State *Queue::state() const
-{
- return d->implementation->state();
-}
-
-namespace
-{
-
-class StaticThreadWeaverInstanceGuard : public QObject
-{
- Q_OBJECT
-public:
- explicit StaticThreadWeaverInstanceGuard(QAtomicPointer<Queue> &instance, QCoreApplication *app)
- : QObject(app)
- , instance_(instance)
- {
- Q_ASSERT_X(app != 0, Q_FUNC_INFO, "Calling ThreadWeaver::Weaver::instance() requires a QCoreApplication!");
- QObject *impl = instance.load()->findChild<QueueSignals*>();
- Q_ASSERT(impl);
- impl->setObjectName(QStringLiteral("GlobalQueue"));
- qAddPostRoutine(shutDownGlobalQueue);
- }
-
- ~StaticThreadWeaverInstanceGuard()
- {
- instance_.fetchAndStoreOrdered(0);
- delete globalQueueFactory;
- globalQueueFactory = 0;
- }
-private:
- static void shutDownGlobalQueue()
- {
- Queue::instance()->shutDown();
- Q_ASSERT(Queue::instance()->state()->stateId() == Destructed);
- }
-
- QAtomicPointer<Queue> &instance_;
-};
-
-}
-
-/** @brief Access the application-global Queue.
- *
- * In some cases, the global queue is sufficient for the applications purpose. The global queue will only be
- * created if this method is actually called in the lifetime of the application.
- *
- * The Q(Core)Application object must exist when instance() is called for the first time.
- * The global queue will be destroyed when Q(Core)Application is destructed. After that, the instance() method
- * returns zero.
- */
-Queue *Queue::instance()
-{
- static QAtomicPointer<Queue> s_instance(globalQueueFactory
- ? globalQueueFactory->create(qApp)
- : new Queue(qApp));
- //Order is of importance here:
- //When s_instanceGuard is destructed (first, before s_instance), it sets the value of s_instance to zero. Next, qApp will delete
- //the object s_instance pointed to.
- static StaticThreadWeaverInstanceGuard *s_instanceGuard = new StaticThreadWeaverInstanceGuard(s_instance, qApp);
- Q_UNUSED(s_instanceGuard);
- Q_ASSERT_X(s_instance.load() == 0 || s_instance.load()->thread() == QCoreApplication::instance()->thread(),
- Q_FUNC_INFO,
- "The global ThreadWeaver queue needs to be instantiated (accessed first) from the main thread!");
- return s_instance.loadAcquire();
-}
-
-void Queue::enqueue(const QVector<JobPointer> &jobs)
-{
- d->implementation->enqueue(jobs);
-}
-
-void Queue::enqueue(const JobPointer &job)
-{
- enqueue(QVector<JobPointer>() << job);
-}
-
-bool Queue::dequeue(const JobPointer &job)
-{
- return d->implementation->dequeue(job);
-}
-
-void Queue::dequeue()
-{
- return d->implementation->dequeue();
-}
-
-void Queue::finish()
-{
- return d->implementation->finish();
-}
-
-void Queue::suspend()
-{
- return d->implementation->suspend();
-}
-
-void Queue::resume()
-{
- return d->implementation->resume();
-}
-
-bool Queue::isEmpty() const
-{
- return d->implementation->isEmpty();
-}
-
-bool Queue::isIdle() const
-{
- return d->implementation->isIdle();
-}
-
-int Queue::queueLength() const
-{
- return d->implementation->queueLength();
-}
-
-void Queue::setMaximumNumberOfThreads(int cap)
-{
- d->implementation->setMaximumNumberOfThreads(cap);
-}
-
-int Queue::currentNumberOfThreads() const
-{
- return d->implementation->currentNumberOfThreads();
-}
-
-int Queue::maximumNumberOfThreads() const
-{
- return d->implementation->maximumNumberOfThreads();
-}
-
-void Queue::requestAbort()
-{
- d->implementation->requestAbort();
-}
-
-void Queue::reschedule()
-{
- d->implementation->reschedule();
-}
-
-#include "queue.moc"
diff --git a/src/3rdparty/threadweaver/src/queue.h b/src/3rdparty/threadweaver/src/queue.h
deleted file mode 100644
index 43ad21117..000000000
--- a/src/3rdparty/threadweaver/src/queue.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- C++ -*-
-
- The Queue class in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUE_H
-#define THREADWEAVER_QUEUE_H
-
-#include <QtCore/QObject>
-
-#include "queuesignals.h"
-#include "queuestream.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class State;
-
-/** @brief Queue implements a ThreadWeaver job queue.
- *
- * Queues process jobs enqueued in them by automatically assigning them to worker threads they manage.
- * Applications using ThreadWeaver can make use of a global Queue which is instantiated on demand, or
- * create multiple queues as needed. A job assigned to a queue will be processed by that specific queue.
- *
- * Worker threads are created by the queues as needed. To create a customized global queue,
- * see GlobalQueueFactory.
- *
- * @see GlobalQueueFactory
- * @see Queue::enqueue()
- * @see Queue::instance()
- */
-class THREADWEAVER_EXPORT Queue : public QueueSignals
-{
- Q_OBJECT
-public:
- explicit Queue(QObject *parent = 0);
- explicit Queue(QueueSignals *implementation, QObject *parent = 0);
- virtual ~Queue();
-
- QueueStream stream();
-
- const State *state() const;
-
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
-
- static ThreadWeaver::Queue *instance();
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE;
- void enqueue(const JobPointer &job);
- bool dequeue(const JobPointer &) Q_DECL_OVERRIDE;
- void dequeue() Q_DECL_OVERRIDE;
- void finish() Q_DECL_OVERRIDE;
- void suspend() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
- bool isEmpty() const Q_DECL_OVERRIDE;
- bool isIdle() const Q_DECL_OVERRIDE;
- int queueLength() const Q_DECL_OVERRIDE;
- void requestAbort() Q_DECL_OVERRIDE;
- void reschedule() Q_DECL_OVERRIDE;
- void shutDown() Q_DECL_OVERRIDE;
-
- /** @brief Interface for the global queue factory. */
- struct GlobalQueueFactory {
- virtual ~GlobalQueueFactory() {}
- virtual Queue *create(QObject *parent) = 0;
-
- };
- static void setGlobalQueueFactory(GlobalQueueFactory *factory);
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif // THREADWEAVER_QUEUE_H
diff --git a/src/3rdparty/threadweaver/src/queueapi.cpp b/src/3rdparty/threadweaver/src/queueapi.cpp
deleted file mode 100644
index f38a11142..000000000
--- a/src/3rdparty/threadweaver/src/queueapi.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- C++ -*-
-
- The detailed API for Weavers in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "queueapi_p.h"
-
-namespace ThreadWeaver
-{
-
-QueueAPI::QueueAPI(QObject *parent) :
- QueueSignals(parent)
-{
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/queueapi_p.h b/src/3rdparty/threadweaver/src/queueapi_p.h
deleted file mode 100644
index 5e0813568..000000000
--- a/src/3rdparty/threadweaver/src/queueapi_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
- The detailed API for Weavers in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef QUEUEAPI_H
-#define QUEUEAPI_H
-
-#include "queuesignals.h"
-#include "weaverinterface_p.h"
-#include "state.h"
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class QueueAPI : public QueueSignals, public WeaverInterface
-{
- Q_OBJECT
-
-public:
- explicit QueueAPI(QObject *parent = 0);
-
- virtual void shutDown_p() = 0;
- virtual const State *state() const = 0;
- virtual State *state() = 0;
- virtual void setMaximumNumberOfThreads_p(int cap) = 0;
- virtual int maximumNumberOfThreads_p() const = 0;
- virtual int currentNumberOfThreads_p() const = 0;
- virtual bool dequeue_p(JobPointer) = 0;
- virtual void dequeue_p() = 0;
- virtual void finish_p() = 0;
- virtual void suspend_p() = 0;
- virtual void resume_p() = 0;
- virtual bool isEmpty_p() const = 0;
- virtual bool isIdle_p() const = 0;
- virtual int queueLength_p() const = 0;
- virtual void requestAbort_p() = 0;
-};
-
-}
-
-#endif // QUEUEAPI_H
diff --git a/src/3rdparty/threadweaver/src/queueing.h b/src/3rdparty/threadweaver/src/queueing.h
deleted file mode 100644
index 84ee40211..000000000
--- a/src/3rdparty/threadweaver/src/queueing.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUEING_H
-#define THREADWEAVER_QUEUEING_H
-
-#include "jobpointer.h"
-#include "managedjobpointer.h"
-#include "jobinterface.h"
-#include "collection.h"
-#include "lambda.h"
-#include "qobjectdecorator.h"
-#include "queue.h"
-
-namespace ThreadWeaver
-{
-
-// make a job that calls a functor, anything that responds to operator()
-template<typename T>
-QSharedPointer<Lambda<T> > make_job(T t)
-{
- QSharedPointer<Lambda<T> > ret(new Lambda<T>(t));
- return ret;
-}
-
-// make a job pointer holding a pointer to a Job(Interface)
-template<typename T>
-inline QSharedPointer<T> make_job(T *job)
-{
- JobInterface *test = static_cast<JobInterface *>(job); Q_UNUSED(test);
- return QSharedPointer<T>(job);
-}
-
-// make a job pointer holding anything resembling JobInterface
-inline JobPointer make_job_raw(JobInterface *job)
-{
- return ManagedJobPointer<JobInterface>(job);
-}
-
-// enqueue any functor type to the specified queue:
-template<typename T>
-JobPointer enqueue(Queue *weaver, T t)
-{
- JobPointer ret = make_job(t);
- weaver->enqueue(ret);
- return ret;
-}
-
-template<typename T>
-QSharedPointer<T> enqueue(Queue *weaver, T *t)
-{
- JobInterface *test = static_cast<JobInterface *>(t); Q_UNUSED(test);
- QSharedPointer<T> ret(make_job(t));
- weaver->enqueue(ret);
- return ret;
-}
-
-// specialise for JobPointer:
-template<>
-inline JobPointer enqueue<JobPointer>(Queue *weaver, JobPointer job)
-{
- weaver->enqueue(job);
- return job;
-}
-
-// convenience overload: enqueue the functor to the global queue:
-template<typename T>
-JobPointer enqueue(T t)
-{
- return enqueue(Queue::instance(), t);
-}
-
-// enqueue a raw pointer with no memory management
-inline JobPointer enqueue_raw(Queue *weaver, JobInterface *job)
-{
- return enqueue(weaver, make_job_raw(job));
-}
-
-// overload to enqueue to the global pool
-inline JobPointer enqueue_raw(JobInterface *job)
-{
- return enqueue(Queue::instance(), make_job_raw(job));
-}
-
-}
-
-#endif // THREADWEAVER_QUEUEING_H
diff --git a/src/3rdparty/threadweaver/src/queueinterface.h b/src/3rdparty/threadweaver/src/queueinterface.h
deleted file mode 100644
index 04e39e929..000000000
--- a/src/3rdparty/threadweaver/src/queueinterface.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the QueueInterface class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef WeaverInterface_H
-#define WeaverInterface_H
-
-#include <QtCore/QObject>
-#include <QVector>
-
-#include "threadweaver_export.h"
-#include "jobpointer.h"
-#include "jobinterface.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class State;
-class WeaverObserver;
-
-/** WeaverInterface provides a common interface for weaver implementations.
-
-In most cases, it is sufficient for an application to hold exactly one
-ThreadWeaver job queue. To execute jobs in a specific order, use job
-dependencies. To limit the number of jobs of a certain type that can
-be executed at the same time, use resource restrictions. To handle
-special requirements of the application when it comes to the order of
-execution of jobs, implement a special queue policy and apply it to
-the jobs.
-
-Users of the ThreadWeaver API are encouraged to program to this
-interface, instead of the implementation. This way, implementation
-changes will not affect user programs.
-
-This interface can be used for example to implement adapters and
-decorators. The member documentation is provided in the Weaver and
-WeaverImpl classes.
-*/
-
-class THREADWEAVER_EXPORT QueueInterface
-{
-public:
- virtual ~QueueInterface() {}
- /** Return the state of the weaver object. */
- virtual const State *state() const = 0;
-
- /** Shut down the queue.
- * Tells all threads to exit, and changes to Destructed state.
- * It is safe to destroy the queue once this method returns.
- */
- virtual void shutDown() = 0;
-
- /** Set the maximum number of threads this Weaver object may start. */
- virtual void setMaximumNumberOfThreads(int cap) = 0;
-
- /** Get the maximum number of threads this Weaver may start. */
- virtual int maximumNumberOfThreads() const = 0;
-
- /** Returns the current number of threads in the inventory. */
- virtual int currentNumberOfThreads() const = 0;
-
- /** Queue a vector of jobs.
-
- It depends on the state if execution of the job will be attempted
- immediately. In suspended state, jobs can be added to the queue,
- but the threads remain suspended. In WorkongHard state, an idle
- thread may immediately execute the job, or it might be queued if
- all threads are busy.
-
- JobPointer is a shared pointer. This means the object pointed to will be deleted if this object
- is the last remaining reference to it. Keep a JobPointer to the job to avoid automatic deletion.
- */
- virtual void enqueue(const QVector<JobPointer> &jobs) = 0;
-
- /** Remove a job from the queue.
- *
- * If the job was queued but not started so far, it is removed from the queue.
- *
- * You can always call dequeue, it will return true if the job was dequeued. However if the job is not in the queue anymore,
- * it is already being executed, it is too late to dequeue, and dequeue will return false. The return value is thread-safe - if
- * true is returned, the job was still waiting, and has been dequeued. If not, the job was not waiting in the queue.
- *
- * Modifying queued jobs is best done on a suspended queue. Often, for example at the end of an application, it is sufficient
- * to dequeue all jobs (which leaves only the ones mid-air in threads), call finish (that will wait for all the mid air jobs to
- * complete), and then exit. Without dequeue(), all jobs in the queue would be executed during finish().
- * @see requestAbort for aborting jobs during execution
- * @return true if the job was waiting and has been dequeued
- * @return false if the job was not found waiting in the queue
- */
- virtual bool dequeue(const JobPointer &job) = 0;
-
- /** Remove all queued jobs.
- *
- * All waiting jobs will be dequeued. The semantics are the same as for dequeue(JobInterface).
- *
- * @see dequeue(JobInterface)
- */
- virtual void dequeue() = 0;
- /** Finish all queued operations, then return.
-
- This method is used in imperative (not event driven) programs that
- cannot react on events to have the controlling (main) thread wait
- wait for the jobs to finish. The call will block the calling
- thread and return when all queued jobs have been processed.
-
- Warning: This will suspend your thread!
- Warning: If one of your jobs enters an infinite loop, this
- will never return! */
- virtual void finish() = 0;
- /** Suspend job execution.
- When suspending, all threads are allowed to finish the
- currently assigned job but will not receive a new
- assignment.
- When all threads are done processing the assigned job, the
- signal suspended will() be emitted.
- If you call suspend() and there are no jobs left to
- be done, you will immediately receive the suspended()
- signal. */
- virtual void suspend() = 0;
- /** Resume job queueing.
- @see suspend
- */
- virtual void resume() = 0;
- /** Is the queue empty?
- The queue is empty if no more jobs are queued. */
- virtual bool isEmpty() const = 0;
- /** Is the weaver idle?
- The weaver is idle if no jobs are queued and no jobs are processed
- by the threads. */
- virtual bool isIdle() const = 0;
- /** Returns the number of pending jobs.
- This will return the number of queued jobs. Jobs that are
- currently being executed are not part of the queue. All jobs in
- the queue are waiting to be executed.
- */
- virtual int queueLength() const = 0;
-
- /** Request aborts of the currently executed jobs.
- It is important to understand that aborts are requested, but
- cannot be guaranteed, as not all Job classes support it. It is up
- to the application to decide if and how job aborts are
- necessary. */
- virtual void requestAbort() = 0;
-
- /** @brief Reschedule the jobs in the queue.
- * This method triggers a scheduling attempt to perform jobs. It will schedule enqueued jobs to be executed by idle threads.
- * It should only be necessary to call it if the canRun() status of a job changed spontaneously due to external reasons. */
- virtual void reschedule() = 0;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/queuepolicy.h b/src/3rdparty/threadweaver/src/queuepolicy.h
deleted file mode 100644
index 2848a8086..000000000
--- a/src/3rdparty/threadweaver/src/queuepolicy.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the QueuePolicy class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004, 2005, 2006 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://www.hackerbuero.org $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#ifndef QUEUEPOLICY_H
-#define QUEUEPOLICY_H
-
-#include "jobpointer.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-
-/** @brief QueuePolicy is an interface for customizations of the queueing behaviour of jobs.
- *
- * A job can have a number of queue policies assigned. In that case, the job is only
- * executed when the method canRun() of all assigned policies return true. For every call to
- * canRun() that returns true, it is guaranteed that the method free() or the method release()
- * is called. Calling free() means the job has been executed, while calling release() means
- * the job was not executed for external reasons, and will be tried later on.
- *
- * As an example, dependencies can be implemented using a QueuePolicy: canRun() returns true
- * when the job has no unresolved dependencies. free() and release() are empty.
- *
- * A job can have multiple queue policies assigned, and will only be executed if all of them
- * return true from canRun() within the same execution attempt. Jobs only keep a reference to the
- * QueuePolicy. Therefore, the same policy object can be assigned to multiple jobs and this way
- * control the way all those jobs are exeuted. Jobs never assume ownership of their assigned queue
- * policies.
- */
-class THREADWEAVER_EXPORT QueuePolicy
-{
-public:
- virtual ~QueuePolicy() {}
-
- /** @brief canRun() is called before the job is executed.
- * The job will only be executed if canRun() returns true.
- */
- virtual bool canRun(JobPointer) = 0;
-
- /** @brief free() is called after the job has been executed.
- * It is guaranteed that free is called only after canRun()
- * returned true at an earlier time.
- */
- virtual void free(JobPointer) = 0;
-
- /** @brief release() is called if canRun() returned true, but the job has not been executed for external reasons.
- *
- * For example, a second QueuePolicy could have returned false from canRun() for the same job.
- */
- virtual void release(JobPointer) = 0;
-
- /** @brief destructing() is called when a Job that has this queue policy assigned gets destructed.
- */
- virtual void destructed(JobInterface *job) = 0;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/queuesignals.cpp b/src/3rdparty/threadweaver/src/queuesignals.cpp
deleted file mode 100644
index 7ba4ac44c..000000000
--- a/src/3rdparty/threadweaver/src/queuesignals.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "queuesignals.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief Construct a QueueSignals object, passing the QObject parent. */
-QueueSignals::QueueSignals(QObject *parent)
- : QObject(parent)
-{
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/queuesignals.h b/src/3rdparty/threadweaver/src/queuesignals.h
deleted file mode 100644
index ec111306d..000000000
--- a/src/3rdparty/threadweaver/src/queuesignals.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUESIGNALS_H
-#define THREADWEAVER_QUEUESIGNALS_H
-
-#include <QtCore/QObject>
-#include "queueinterface.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief QueueSignals declares the Qt signals shared by the Queue and Weaver classes. */
-class QueueSignals : public QObject, public QueueInterface
-{
- Q_OBJECT
-public:
- explicit QueueSignals(QObject *parent = 0);
-
-Q_SIGNALS:
- /** @brief Emitted when the Queue has completed all jobs currently queued.
- *
- * The Queue emits finished() when the the job queue is empty, and the last job currently processed by a worker threads was
- * completed. Beware that if multiple jobs are enqueued repeatedly one by one, this signal might be emitted multiple times, because the
- * queued jobs where processed before new ones could be queued. To avoid this, queue all relevant jobs in a single operation,
- * using for example a QueueStream or a Collection.
- */
- void finished();
-
- /** @brief The Queue has been suspended.
- *
- * When the Queue is suspended, worker threads will not be assigned new jobs to process. Jobs waiting in the queue will not be
- * started until processing is resumed. When suspend() is called, the worker threads will continue to process the job currently
- * assigned to them. When the last thread finishes it's current assignment, suspended() is emitted.
- *
- * @see suspend()
- */
- void suspended();
-
- /** @brief A Job has been completed.
- *
- * This signal is emitted when a job is finished by a worker thread.
- */
- void jobDone(ThreadWeaver::JobPointer);
-
- /** @brief Emitted when the processing state of the Queue has changed. */
- void stateChanged(ThreadWeaver::State*);
-};
-
-}
-
-#endif // THREADWEAVER_QUEUESIGNALS_H
diff --git a/src/3rdparty/threadweaver/src/queuestream.cpp b/src/3rdparty/threadweaver/src/queuestream.cpp
deleted file mode 100644
index 735955e6e..000000000
--- a/src/3rdparty/threadweaver/src/queuestream.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <QVector>
-
-#include "queuestream.h"
-#include "queue.h"
-#include "queueing.h"
-
-namespace ThreadWeaver
-{
-
-class QueueStream::Private
-{
-public:
- Private(Queue *w) : weaver(w) {}
- Queue *weaver;
- QVector<JobPointer> jobs;
-};
-
-QueueStream::QueueStream(Queue *queue)
- : d(new Private(queue))
-{
- Q_ASSERT(queue);
-}
-
-QueueStream::~QueueStream()
-{
- flush();
- delete d;
-}
-
-void ThreadWeaver::QueueStream::add(const ThreadWeaver::JobPointer &job)
-{
- d->jobs.append(job);
-}
-
-void QueueStream::flush()
-{
- if (d->jobs.isEmpty()) {
- return;
- }
- Q_ASSERT(d->weaver);
- d->weaver->enqueue(d->jobs);
- d->jobs.clear();
-}
-
-QueueStream &QueueStream::operator<<(const JobPointer &job)
-{
- add(job);
- return *this;
-}
-
-QueueStream &QueueStream::operator<<(JobInterface *job)
-{
- add(make_job(job));
- return *this;
-}
-
-QueueStream &QueueStream::operator<<(Job &job)
-{
- add(make_job_raw(&job));
- return *this;
-}
-
-/** @brief Return a stream the enqueues jobs in the ThreadWeaver global queue.
- * Using this is synonymous to Weaver::instance()::stream(). */
-QueueStream stream()
-{
- return QueueStream(Queue::instance());
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/queuestream.h b/src/3rdparty/threadweaver/src/queuestream.h
deleted file mode 100644
index e57a1f210..000000000
--- a/src/3rdparty/threadweaver/src/queuestream.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef QUEUESTREAM_H
-#define QUEUESTREAM_H
-
-#include "jobinterface.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-class Queue;
-class Job;
-
-/** @brief QueueStream implements a stream based API to access ThreadWeaver queues. */
-class THREADWEAVER_EXPORT QueueStream
-{
-public:
- explicit QueueStream(Queue *queue);
- ~QueueStream();
- void add(const JobPointer &job);
- void flush();
-
- QueueStream &operator<<(const JobPointer &job);
- QueueStream &operator<<(JobInterface *job);
- //FIXME try with QObjectDecorator (JobInterface&)
- QueueStream &operator<<(Job &job);
-
-private:
- class Private;
- Private *const d;
-};
-
-QueueStream THREADWEAVER_EXPORT stream();
-
-}
-
-#endif // QUEUESTREAM_H
diff --git a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp b/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp
deleted file mode 100644
index bfa21d568..000000000
--- a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the ResourceRestrictionPolicy class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: Job.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#include "resourcerestrictionpolicy.h"
-
-#include <QtCore/QList>
-#include <QtCore/QMutex>
-
-#include "debuggingaids.h"
-#include "managedjobpointer.h"
-
-using namespace ThreadWeaver;
-
-class ResourceRestrictionPolicy::Private
-{
-public:
- Private(int theCap)
- : cap(theCap)
- {}
- QMutex *mutex()
- {
- return &mutex_;
- }
-
- int cap;
- QList<JobPointer> customers;
- QMutex mutex_;
-};
-
-ResourceRestrictionPolicy::ResourceRestrictionPolicy(int cap)
- : QueuePolicy()
- , d(new Private(cap))
-{
-}
-
-ResourceRestrictionPolicy::~ResourceRestrictionPolicy()
-{
- delete d;
-}
-
-void ResourceRestrictionPolicy::setCap(int cap)
-{
- QMutexLocker l(d->mutex());
- d->cap = cap;
-}
-
-int ResourceRestrictionPolicy::cap() const
-{
- QMutexLocker l(d->mutex());
- return d->cap;
-}
-
-bool ResourceRestrictionPolicy::canRun(JobPointer job)
-{
- QMutexLocker l(d->mutex());
- if (d->customers.size() < d->cap) {
- d->customers.append(job);
- return true;
- } else {
- return false;
- }
-}
-
-void ResourceRestrictionPolicy::free(JobPointer job)
-{
- QMutexLocker l(d->mutex());
- int position = d->customers.indexOf(job);
-
- if (position != -1) {
- debug(4, "ResourceRestrictionPolicy::free: job %p done.\n", (void *)job.data());
- d->customers.removeAt(position);
- }
-}
-
-void ResourceRestrictionPolicy::release(JobPointer job)
-{
- free(job);
-}
-
-void ResourceRestrictionPolicy::destructed(JobInterface *job)
-{
- free(ManagedJobPointer<JobInterface>(job));
-}
diff --git a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h b/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h
deleted file mode 100644
index fe54ef5a9..000000000
--- a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- C++ -*-
-
-This file declares the ResourceRestrictionPolicy class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: Job.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef RESOURCE_RESTRICTION_POLICY_H
-#define RESOURCE_RESTRICTION_POLICY_H
-
-#include <QtGlobal>
-
-#include "jobpointer.h"
-#include "queuepolicy.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-
-/** @brief ResourceRestrictionPolicy is used to limit the number of concurrent accesses to the same resource.
- *
- * If a set of Jobs accesses a resource that can be overloaded, this may degrade application performance. For
- * example, loading too many files from the hard disc at the same time may lead to longer load times.
- * ResourceRestrictionPolicy can be used to cap the number of accesses. Resource restriction policies are
- * shared between the affected jobs. All jobs that share a resurce restriction policy have to acquire
- * permission from the policy before they can run. In this way, resource restrictions can be compared to
- * semaphores, only that they require no locking at the thread level.
- * The SMIV example uses a resource restriction to limit the number of images files that are loaded from
- * the disk at the same time.
- */
-
-class THREADWEAVER_EXPORT ResourceRestrictionPolicy : public QueuePolicy
-{
-public:
- explicit ResourceRestrictionPolicy(int cap = 0);
- ~ResourceRestrictionPolicy();
-
- /** @brief Cap the number of simultaniously executing jobs.
- * Capping the amount of jobs will make sure that at max the number of jobs executing at any time is
- * limited to the capped amount. Note that immediately after setting the amount of running jobs may be
- * higher than the set amount. This setting only limits the starting of new jobs.
- * @param newCap the new cap to limit the amount of parallel jobs.
- */
- void setCap(int newCap);
- int cap() const;
- bool canRun(JobPointer) Q_DECL_OVERRIDE;
- void free(JobPointer) Q_DECL_OVERRIDE;
- void release(JobPointer) Q_DECL_OVERRIDE;
- void destructed(JobInterface *job) Q_DECL_OVERRIDE;
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif // RESOURCE_RESTRICTION_POLICY_H
diff --git a/src/3rdparty/threadweaver/src/sequence.cpp b/src/3rdparty/threadweaver/src/sequence.cpp
deleted file mode 100644
index d88a47f78..000000000
--- a/src/3rdparty/threadweaver/src/sequence.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the Sequence class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "sequence.h"
-#include "managedjobpointer.h"
-#include "queueapi_p.h"
-#include "debuggingaids.h"
-#include "dependencypolicy.h"
-
-namespace ThreadWeaver
-{
-
-Sequence::Sequence()
- : d(0)
-{
-}
-
-void Sequence::enqueueElements()
-{
- Q_ASSERT(!mutex()->tryLock());
- const int jobs = jobListLength_locked();
- if (jobs > 0) {
- DependencyPolicy::instance().addDependency(jobAt(0), self());
- // set up the dependencies:
- for (int i = 1; i < jobs; ++i) {
- JobPointer jobA = jobAt(i);
- JobPointer jobB = jobAt(i - 1);
- P_ASSERT(jobA != 0);
- P_ASSERT(jobB != 0);
- DependencyPolicy::instance().addDependency(jobA, jobB);
- }
- }
- Collection::enqueueElements();
-}
-
-void Sequence::elementFinished(JobPointer job, Thread *thread)
-{
- REQUIRE(job != 0);
-
- JobPointer s(self());
- Q_ASSERT(!s.isNull());
- Collection::elementFinished(job, thread);
- if (!job->success()) {
- stop(job);
- }
- QMutexLocker l(mutex()); Q_UNUSED(l);
- if (jobListLength_locked() > 0) {
- DependencyPolicy::instance().removeDependency(jobAt(0), s);
- }
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/sequence.h b/src/3rdparty/threadweaver/src/sequence.h
deleted file mode 100644
index 35b2f5607..000000000
--- a/src/3rdparty/threadweaver/src/sequence.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the Sequence class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#ifndef JOBSEQUENCE_H
-#define JOBSEQUENCE_H
-
-#include "collection.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief A Sequence is a vector of Jobs that will be executed in a sequence.
- *
- * It is implemented by automatically creating the necessary dependencies between the Jobs in the sequence.
- *
- * Sequence provides a handy cleanup and unwind mechanism: the stop() slot. If it is called, the processing
- * of the sequence will stop, and all its remaining Jobs will be dequeued.
- * A Sequence is the first element of itself. */
-class THREADWEAVER_EXPORT Sequence : public Collection
-{
-public:
- explicit Sequence();
-
-protected:
- void elementFinished(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void enqueueElements() Q_DECL_OVERRIDE;
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/shuttingdownstate.cpp b/src/3rdparty/threadweaver/src/shuttingdownstate.cpp
deleted file mode 100644
index 361a4abdc..000000000
--- a/src/3rdparty/threadweaver/src/shuttingdownstate.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the ShuttingDownState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: ShuttingDownState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "shuttingdownstate_p.h"
-
-namespace ThreadWeaver
-{
-
-ShuttingDownState::ShuttingDownState(QueueSignals *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void ShuttingDownState::shutDown()
-{
-}
-
-void ShuttingDownState::suspend()
-{
- // ignored: when shutting down, we do not return to the suspended state
-}
-
-void ShuttingDownState::resume()
-{
- // ignored: when shutting down, we do not return from the suspended state
-}
-
-JobPointer ShuttingDownState::applyForWork(Thread *, bool wasBusy)
-{
- Q_UNUSED(wasBusy) // except in Q_ASSERT
- Q_ASSERT(wasBusy == false);
- return JobPointer(); // tell threads to exit
-}
-
-void ShuttingDownState::waitForAvailableJob(Thread *)
-{
- // immidiately return here
-}
-
-StateId ShuttingDownState::stateId() const
-{
- return ShuttingDown;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/shuttingdownstate_p.h b/src/3rdparty/threadweaver/src/shuttingdownstate_p.h
deleted file mode 100644
index a00bb67b0..000000000
--- a/src/3rdparty/threadweaver/src/shuttingdownstate_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the ShuttingDownState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: ShuttingDownState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef ShuttingDownState_H
-#define ShuttingDownState_H
-
-#include "weaverimplstate_p.h"
-
-namespace ThreadWeaver
-{
-
-class Queue;
-
-/** ShuttingDownState is enabled when the Weaver destructor is entered. It
- * prevents threads from still accessing queue management methods, and new jobs being queued.
- */
-class ShuttingDownState : public WeaverImplState
-{
-public:
- explicit ShuttingDownState(QueueSignals *weaver);
-
- /** Shut down the queue. */
- void shutDown() Q_DECL_OVERRIDE;
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** Wait (by suspending the calling thread) until a job becomes available. */
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // ShuttingDownState_H
diff --git a/src/3rdparty/threadweaver/src/state.cpp b/src/3rdparty/threadweaver/src/state.cpp
deleted file mode 100644
index 8642be70c..000000000
--- a/src/3rdparty/threadweaver/src/state.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the state handling in ThreadWeaver.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: State.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "state.h"
-
-#include <QtCore/QString>
-
-namespace ThreadWeaver
-{
-
-const char *StateNames[NoOfStates] = {
- "InConstruction",
- "WorkingHard",
- "Suspending",
- "Suspended",
- "ShuttingDown",
- "Destructed"
-};
-
-class State::Private
-{
-public:
- Private(QueueInterface *theWeaver)
- : weaver(theWeaver)
- {
- Q_ASSERT_X(sizeof StateNames / sizeof StateNames[0] == NoOfStates, "State::Private ctor",
- "Make sure to keep StateId and StateNames in sync!");
- }
-
- /** The Weaver we relate to. */
- QueueInterface *const weaver;
-};
-
-State::State(QueueSignals *weaver)
- : d(new Private(weaver))
-{
-}
-
-State::~State()
-{
- delete d;
-}
-
-QString State::stateName() const
-{
- return QLatin1String(StateNames[stateId()]);
-}
-
-void State::activated()
-{
-}
-
-QueueInterface *State::weaver()
-{
- return d->weaver;
-}
-
-const QueueInterface *State::weaver() const
-{
- return d->weaver;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/state.h b/src/3rdparty/threadweaver/src/state.h
deleted file mode 100644
index 942035a19..000000000
--- a/src/3rdparty/threadweaver/src/state.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the state handling in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: State.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef THREADWEAVER_STATE_H
-#define THREADWEAVER_STATE_H
-
-#include <QString>
-
-#include "queueinterface.h"
-#include "weaverinterface_p.h"
-#include "queuesignals.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-/** All weaver objects maintain a state of operation which can be
- * queried by the application. See the threadweaver documentation on
- * how the different states are related.
- */
-
-enum StateId {
- /** The object is in the state of construction and has not yet
- * started to process jobs. */
- InConstruction = 0,
- /** Jobs are being processed. */
- WorkingHard,
- /** Job processing is suspended, but some jobs which where already
- * in progress are not finished yet. */
- Suspending,
- /** Job processing is suspended, and no jobs are being
- * processed. */
- Suspended,
- /** The object is being destructed. Jobs might still be processed,
- * the destructor will wait for all threads to exit and then
- * end. */
- ShuttingDown,
- /** The object is being destructed, and all threads have
- * exited. No jobs are handled anymore. */
- Destructed,
- /** Not a state, but a sentinel for the number of defined states. */
- NoOfStates
-};
-
-/** We use a State pattern to handle the system state in ThreadWeaver. */
-class THREADWEAVER_EXPORT State : public QueueInterface, public WeaverInterface
-{
-public:
- /** Default constructor. */
- explicit State(QueueSignals *weaver);
-
- /** Destructor. */
- virtual ~State();
-
- /** The ID of the current state.
- * @see StateNames, StateID
- */
- QString stateName() const;
-
- /** The state Id. */
- virtual StateId stateId() const = 0;
-
- /** The state has been changed so that this object is responsible for
- * state handling. */
- virtual void activated();
-
-protected:
- /** The Weaver interface this state handles. */
- virtual QueueInterface *weaver();
- virtual const QueueInterface *weaver() const;
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif // THREADWEAVER_STATE_H
diff --git a/src/3rdparty/threadweaver/src/suspendedstate.cpp b/src/3rdparty/threadweaver/src/suspendedstate.cpp
deleted file mode 100644
index e7cb1e7a6..000000000
--- a/src/3rdparty/threadweaver/src/suspendedstate.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the SuspendedState class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: SuspendedState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "suspendedstate_p.h"
-
-#include "threadweaver.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-SuspendedState::SuspendedState(Weaver *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void SuspendedState::suspend()
-{
- // this request is not handled in Suspended state
-}
-
-void SuspendedState::resume()
-{
- weaver()->setState(WorkingHard);
-}
-
-JobPointer SuspendedState::applyForWork(Thread *th, bool wasBusy)
-{
- // suspend all threads in case they wake up:
- Q_ASSERT(wasBusy == 0);
- weaver()->waitForAvailableJob(th);
- return weaver()->applyForWork(th, wasBusy);
-}
-
-StateId SuspendedState::stateId() const
-{
- return Suspended;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/suspendedstate_p.h b/src/3rdparty/threadweaver/src/suspendedstate_p.h
deleted file mode 100644
index 2f8177a1f..000000000
--- a/src/3rdparty/threadweaver/src/suspendedstate_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the SuspendedState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: SuspendedState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef SuspendedState_H
-#define SuspendedState_H
-
-#include "weaverimplstate_p.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-/** In SuspendedState, jobs are queued, but will not be executed. All
- * thread remains blocked. */
-class SuspendedState : public WeaverImplState
-{
-public:
- explicit SuspendedState(Weaver *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // SuspendedState_H
diff --git a/src/3rdparty/threadweaver/src/suspendingstate.cpp b/src/3rdparty/threadweaver/src/suspendingstate.cpp
deleted file mode 100644
index 635401f2d..000000000
--- a/src/3rdparty/threadweaver/src/suspendingstate.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the SuspendingState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: SuspendingState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "suspendingstate_p.h"
-
-#include "state.h"
-#include "weaver_p.h"
-#include "threadweaver.h"
-
-namespace ThreadWeaver
-{
-
-SuspendingState::SuspendingState(Weaver *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void SuspendingState::suspend()
-{
- // this request is not handled in Suspending state (we are already suspending...)
-}
-
-void SuspendingState::resume()
-{
- weaver()->setState(WorkingHard);
-}
-
-void SuspendingState::activated()
-{
- weaver()->reschedule();
-}
-
-JobPointer SuspendingState::applyForWork(Thread *th, bool wasBusy)
-{
- weaver()->takeFirstAvailableJobOrSuspendOrWait(th, wasBusy, true, true);
- weaver()->waitForAvailableJob(th);
- return weaver()->applyForWork(th, false);
-}
-
-StateId SuspendingState::stateId() const
-{
- return Suspending;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/suspendingstate_p.h b/src/3rdparty/threadweaver/src/suspendingstate_p.h
deleted file mode 100644
index d30e0ebea..000000000
--- a/src/3rdparty/threadweaver/src/suspendingstate_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the SuspendingState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: SuspendingState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef SuspendingState_H
-#define SuspendingState_H
-
-#include "weaverimplstate_p.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-/** SuspendingState is the state after suspend() has been called, but
- * before all threads finished executing the current job and blocked.
- */
-class SuspendingState : public WeaverImplState
-{
-public:
- explicit SuspendingState(Weaver *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** Overload. */
- void activated() Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // SuspendingState_H
diff --git a/src/3rdparty/threadweaver/src/thread.cpp b/src/3rdparty/threadweaver/src/thread.cpp
deleted file mode 100644
index 461c84209..000000000
--- a/src/3rdparty/threadweaver/src/thread.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the Thread class.
-
- Thread is not a part of the public interface of the ThreadWeaver library.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: Thread.cpp 25 2005-08-14 12:41:38Z mirko $
-*/
-
-#include "thread.h"
-
-#include <QtCore/QMutex>
-#include <QtCore/QDebug>
-#include <QPointer>
-#include <QtCore/QCoreApplication>
-
-#include "threadweaver.h"
-#include "weaver_p.h"
-#include "job.h"
-#include "debuggingaids.h"
-
-using namespace ThreadWeaver;
-
-class Thread::Private
-{
-public:
- explicit Private(Weaver *theParent)
- : parent(theParent)
- , id(makeId())
- , job(0)
- {
- Q_ASSERT(parent);
- }
-
- Weaver *parent;
- const unsigned int id;
- JobPointer job;
- QMutex mutex;
-
- static unsigned int makeId()
- {
- static QAtomicInt s_id(1);
- return s_id.fetchAndAddRelease(1);
- }
-};
-
-Thread::Thread(Weaver *parent)
- : QThread() // no parent, because the QObject hierarchy of this thread
- // does not have a parent (see QObject::pushToThread)
- , d(new Private(parent))
-{
- const QString queueName = parent->objectName().isEmpty()
- ? QString::fromLatin1("Queue(0x%1)").arg(quintptr(parent), 0, 16, QChar::fromLatin1('0'))
- : parent->objectName();
- setObjectName(QString::fromLatin1("%1[%2]").arg(queueName).arg(QString::number(id()), 2, QChar::fromLatin1('0')));
-}
-
-Thread::~Thread()
-{
- delete d;
-}
-
-unsigned int Thread::id()
-{
- return d->id; //id is const
-}
-
-void Thread::run()
-{
- Q_ASSERT(d->parent);
- Q_ASSERT(QCoreApplication::instance() != 0);
- d->parent->threadEnteredRun(this);
-
- emit started(this);
- debug(3, "Thread::run [%u]: running.\n", id());
-
- bool wasBusy = false;
- while (true) {
- debug(3, "Thread::run [%u]: trying to execute the next job.\n", id());
-
- // the assignment is intentional: newJob needs to go out of scope at the end of the if statement
- if (JobPointer newJob = d->parent->applyForWork(this, wasBusy)) {
- QMutexLocker l(&d->mutex); Q_UNUSED(l);
- d->job = newJob;
- } else {
- break;
- }
-
- wasBusy = true;
-
- emit jobStarted(d->job, this);
- d->job->execute(d->job, this);
- emit jobDone(d->job);
-
- QMutexLocker l(&d->mutex); Q_UNUSED(l);
- d->job.clear();
- }
- debug(3, "Thread::run [%u]: exiting.\n", id());
-}
-
-void Thread::requestAbort()
-{
- QMutexLocker l(&d->mutex); Q_UNUSED(l);
- if (d->job) {
- d->job->requestAbort();
- }
-}
-
diff --git a/src/3rdparty/threadweaver/src/thread.h b/src/3rdparty/threadweaver/src/thread.h
deleted file mode 100644
index 7d53348fe..000000000
--- a/src/3rdparty/threadweaver/src/thread.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the Thread class.
-
- Thread is not a part of the public interface of the ThreadWeaver library.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: Thread.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef THREADWEAVER_THREAD_H
-#define THREADWEAVER_THREAD_H
-
-#include <QtCore/QMutex>
-#include <QtCore/QThread>
-
-#include "threadweaver_export.h"
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Weaver;
-
-/** The class Thread is used to represent the worker threads in
- the weaver's inventory. It is not meant to be overloaded. */
-class THREADWEAVER_EXPORT Thread : public QThread
-{
- Q_OBJECT
-
-public:
- /** Create a thread.
- These thread objects are only used inside the Weaver parent
- object.
-
- @param parent the parent Weaver
- */
- explicit Thread(Weaver *parent = 0);
-
- /** The destructor. */
- ~Thread();
-
- /** Overload to execute the assigned jobs.
- Whenever the thread is idle, it will ask its Weaver parent for a
- Job to do. The Weaver will either return a Job or a Nil
- pointer. When a Nil pointer is returned, it tells the thread to
- exit.
- */
- void run() Q_DECL_OVERRIDE;
-
- /** Returns the thread id.
- This id marks the respective Thread object, and must
- therefore not be confused with, e.g., the pthread thread
- ID.
-
- Generally, the way threads are implemented is not
- specified. id() is the only way to uniquely identify a
- thread within ThreadWeaver.
- */
- unsigned int id();
-
- /** Request the abortion of the current job.
- If there is no current job, this method will do nothing, but can
- safely be called.
- It forwards the request to the current Job.
- */
- void requestAbort();
-
-Q_SIGNALS:
- /** The thread has been started. */
- void started(ThreadWeaver::Thread *);
- /** The thread started to process a job. */
- void jobStarted(ThreadWeaver::JobPointer, ThreadWeaver::Thread *);
- /** The thread finished to execute a job. */
- void jobDone(ThreadWeaver::JobPointer);
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
-
diff --git a/src/3rdparty/threadweaver/src/threadweaver.cpp b/src/3rdparty/threadweaver/src/threadweaver.cpp
deleted file mode 100644
index a02dcd313..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the Weaver class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "threadweaver.h"
-
diff --git a/src/3rdparty/threadweaver/src/threadweaver.h b/src/3rdparty/threadweaver/src/threadweaver.h
deleted file mode 100644
index 3f926ab1d..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the public interfaces of the Weaver and the Job class.
- It should be the only include file necessary to use the ThreadWeaver
- library.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-#ifndef THREADWEAVER_H
-#define THREADWEAVER_H
-
-#include "queue.h"
-#include "queueing.h"
-#include "jobinterface.h"
-#include "jobpointer.h"
-#include "job.h"
-#include "collection.h"
-#include "sequence.h"
-#include "queueing.h"
-
-#endif // THREADWEAVER_H
diff --git a/src/3rdparty/threadweaver/src/threadweaver.pri b/src/3rdparty/threadweaver/src/threadweaver.pri
deleted file mode 100644
index 3f4fffc6c..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver.pri
+++ /dev/null
@@ -1,69 +0,0 @@
-CONFIG += exceptions
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/collection.h \
- $$PWD/debuggingaids.h \
- $$PWD/dependency.h \
- $$PWD/dependencypolicy.h \
- $$PWD/destructedstate_p.h \
- $$PWD/exception.h \
- $$PWD/executewrapper_p.h \
- $$PWD/executor_p.h \
- $$PWD/iddecorator.h \
- $$PWD/inconstructionstate_p.h \
- $$PWD/job.h \
- $$PWD/jobinterface.h \
- $$PWD/jobpointer.h \
- $$PWD/lambda.h \
- $$PWD/managedjobpointer.h \
- $$PWD/qobjectdecorator.h \
- $$PWD/queue.h \
- $$PWD/queueapi_p.h \
- $$PWD/queueing.h \
- $$PWD/queueinterface.h \
- $$PWD/queuepolicy.h \
- $$PWD/queuesignals.h \
- $$PWD/queuestream.h \
- $$PWD/resourcerestrictionpolicy.h \
- $$PWD/sequence.h \
- $$PWD/shuttingdownstate_p.h \
- $$PWD/state.h \
- $$PWD/suspendedstate_p.h \
- $$PWD/suspendingstate_p.h \
- $$PWD/thread.h \
- $$PWD/threadweaver.h \
- $$PWD/weaver_p.h \
- $$PWD/weaverimplstate_p.h \
- $$PWD/weaverinterface_p.h \
- $$PWD/workinghardstate_p.h
-
-SOURCES += \
- $$PWD/collection.cpp \
- $$PWD/debuggingaids.cpp \
- $$PWD/dependency.cpp \
- $$PWD/dependencypolicy.cpp \
- $$PWD/destructedstate.cpp \
- $$PWD/exception.cpp \
- $$PWD/executewrapper.cpp \
- $$PWD/executor.cpp \
- $$PWD/iddecorator.cpp \
- $$PWD/inconstructionstate.cpp \
- $$PWD/job.cpp \
- $$PWD/qobjectdecorator.cpp \
- $$PWD/queue.cpp \
- $$PWD/queueapi.cpp \
- $$PWD/queuesignals.cpp \
- $$PWD/queuestream.cpp \
- $$PWD/resourcerestrictionpolicy.cpp \
- $$PWD/sequence.cpp \
- $$PWD/shuttingdownstate.cpp \
- $$PWD/state.cpp \
- $$PWD/suspendedstate.cpp \
- $$PWD/suspendingstate.cpp \
- $$PWD/thread.cpp \
- $$PWD/threadweaver.cpp \
- $$PWD/weaver.cpp \
- $$PWD/weaverimplstate.cpp \
- $$PWD/workinghardstate.cpp
diff --git a/src/3rdparty/threadweaver/src/threadweaver_export.h b/src/3rdparty/threadweaver/src/threadweaver_export.h
deleted file mode 100644
index f9b29346b..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver_export.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef THREADWEAVER_EXPORT_H
-#define THREADWEAVER_EXPORT_H
-
-#define THREADWEAVER_EXPORT
-
-#endif // THREADWEAVER_EXPORT_H
diff --git a/src/3rdparty/threadweaver/src/weaver.cpp b/src/3rdparty/threadweaver/src/weaver.cpp
deleted file mode 100644
index 5f2df89fb..000000000
--- a/src/3rdparty/threadweaver/src/weaver.cpp
+++ /dev/null
@@ -1,643 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the WeaverImpl class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: WeaverImpl.cpp 30 2005-08-16 16:16:04Z mirko $
-
-*/
-
-#include "weaver_p.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QObject>
-#include <QtCore/QMutex>
-#include <QtCore/QDebug>
-
-#include "job.h"
-#include "managedjobpointer.h"
-#include "state.h"
-#include "thread.h"
-#include "threadweaver.h"
-#include "debuggingaids.h"
-#include "suspendedstate_p.h"
-#include "suspendingstate_p.h"
-#include "destructedstate_p.h"
-#include "workinghardstate_p.h"
-#include "shuttingdownstate_p.h"
-#include "inconstructionstate_p.h"
-#include "queuepolicy.h"
-
-using namespace ThreadWeaver;
-
-/** @brief Constructs a Weaver object. */
-Weaver::Weaver(QObject *parent)
- : QueueAPI(parent)
- , m_active(0)
- , m_inventoryMax(qMax(4, 2 * QThread::idealThreadCount()))
- , m_mutex(new QMutex(QMutex::NonRecursive))
-{
- qRegisterMetaType<ThreadWeaver::JobPointer>("ThreadWeaver::JobPointer");
-
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- // initialize state objects:
- m_states[InConstruction] = QSharedPointer<State>(new InConstructionState(this));
- setState_p(InConstruction);
- m_states[WorkingHard] = QSharedPointer<State>(new WorkingHardState(this));
- m_states[Suspending] = QSharedPointer<State>(new SuspendingState(this));
- m_states[Suspended] = QSharedPointer<State>(new SuspendedState(this));
- m_states[ShuttingDown] = QSharedPointer<State>(new ShuttingDownState(this));
- m_states[Destructed] = QSharedPointer<State>(new DestructedState(this));
- setState_p(WorkingHard);
-}
-
-/** @brief Destructs a Weaver object. */
-Weaver::~Weaver()
-{
- Q_ASSERT_X(state()->stateId() == Destructed, Q_FUNC_INFO, "shutDown() method was not called before Weaver destructor!");
- delete m_mutex;
-}
-
-/** @brief Enter Destructed state.
- *
- * Once this method returns, it is save to delete this object.
- */
-void Weaver::shutDown()
-{
- state()->shutDown();
-}
-
-void Weaver::shutDown_p()
-{
- // the constructor may only be called from the thread that owns this
- // object (everything else would be what we professionals call "insane")
-
- REQUIRE(QThread::currentThread() == thread());
- debug(3, "WeaverImpl::shutDown: destroying inventory.\n");
- m_semaphore.acquire(m_createdThreads.loadAcquire());
- finish();
- suspend();
- setState(ShuttingDown);
- reschedule();
- m_jobFinished.wakeAll();
-
- // problem: Some threads might not be asleep yet, just finding
- // out if a job is available. Those threads will suspend
- // waiting for their next job (a rare case, but not impossible).
- // Therefore, if we encounter a thread that has not exited, we
- // have to wake it again (which we do in the following for
- // loop).
-
- for (;;) {
- Thread *th = 0;
- {
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- if (m_inventory.isEmpty()) {
- break;
- }
- th = m_inventory.takeFirst();
- }
- if (!th->isFinished()) {
- for (;;) {
- Q_ASSERT(state()->stateId() == ShuttingDown);
- reschedule();
- if (th->wait(100)) {
- break;
- }
- debug(1, "WeaverImpl::shutDown: thread %i did not exit as expected, "
- "retrying.\n", th->id());
- }
- }
- emit(threadExited(th));
- delete th;
- }
- Q_ASSERT(m_inventory.isEmpty());
- debug(3, "WeaverImpl::shutDown: done\n");
- setState(Destructed); // Destructed ignores all calls into the queue API
-}
-
-/** @brief Set the Weaver state.
- * @see StateId
- * @see WeaverImplState
- * @see State
- */
-void Weaver::setState(StateId id)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- setState_p(id);
-}
-
-void Weaver::setState_p(StateId id)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- State *newState = m_states[id].data();
- State *previous = m_state.fetchAndStoreOrdered(newState);
- if (previous == 0 || previous->stateId() != id) {
- newState->activated();
- debug(2, "WeaverImpl::setState: state changed to \"%s\".\n", newState->stateName().toLatin1().constData());
- if (id == Suspended) {
- emit(suspended());
- }
- emit(stateChanged(newState));
- }
-}
-
-const State *Weaver::state() const
-{
- return m_state.loadAcquire();
-}
-
-State *Weaver::state()
-{
- return m_state.loadAcquire();
-}
-
-void Weaver::setMaximumNumberOfThreads(int cap)
-{
- //FIXME really? Why not 0?
- Q_ASSERT_X(cap > 0, "Weaver Impl", "Thread inventory size has to be larger than zero.");
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->setMaximumNumberOfThreads(cap);
-}
-
-void Weaver::setMaximumNumberOfThreads_p(int cap)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- m_inventoryMax = cap;
-}
-
-int Weaver::maximumNumberOfThreads() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->maximumNumberOfThreads();
-}
-
-int Weaver::maximumNumberOfThreads_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_inventoryMax;
-}
-
-int Weaver::currentNumberOfThreads() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->currentNumberOfThreads();
-}
-
-int Weaver::currentNumberOfThreads_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_inventory.count();
-}
-
-void Weaver::enqueue(const QVector<JobPointer> &jobs)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->enqueue(jobs);
-}
-
-void Weaver::enqueue_p(const QVector<JobPointer> &jobs)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- if (jobs.isEmpty()) {
- return;
- }
- Q_FOREACH (const JobPointer &job, jobs) {
- if (job) {
- Q_ASSERT(job->status() == Job::Status_New);
- adjustInventory(1);
- debug(3, "WeaverImpl::enqueue: queueing job %p.\n", (void *)job.data());
- job->aboutToBeQueued(this);
- // find position for insertion:
- int i = m_assignments.size();
- if (i > 0) {
- while (i > 0 && m_assignments.at(i - 1)->priority() < job->priority()) {
- --i;
- }
- m_assignments.insert(i, job);
- } else {
- m_assignments.append(job);
- }
- job->setStatus(Job::Status_Queued);
- reschedule();
- }
- }
-}
-
-bool Weaver::dequeue(const JobPointer &job)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->dequeue(job);
-}
-
-bool Weaver::dequeue_p(JobPointer job)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- int position = m_assignments.indexOf(job);
- if (position != -1) {
- job->aboutToBeDequeued(this);
- int newPosition = m_assignments.indexOf(job);
- JobPointer job = m_assignments.takeAt(newPosition);
- job->setStatus(Job::Status_New);
- Q_ASSERT(!m_assignments.contains(job));
- debug(3, "WeaverImpl::dequeue: job %p dequeued, %i jobs left.\n", (void *)job.data(), queueLength_p());
- // from the queues point of view, a job is just as finished if it gets dequeued:
- m_jobFinished.wakeAll();
- Q_ASSERT(!m_assignments.contains(job));
- return true;
- } else {
- debug(3, "WeaverImpl::dequeue: job %p not found in queue.\n", (void *)job.data());
- return false;
- }
-}
-
-void Weaver::dequeue()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->dequeue();
-}
-
-void Weaver::dequeue_p()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- debug(3, "WeaverImpl::dequeue: dequeueing all jobs.\n");
- for (int index = 0; index < m_assignments.size(); ++index) {
- m_assignments.at(index)->aboutToBeDequeued(this);
- }
- m_assignments.clear();
- ENSURE(m_assignments.isEmpty());
-}
-
-void Weaver::finish()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->finish();
-}
-
-void Weaver::finish_p()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
-#ifdef QT_NO_DEBUG
- const int MaxWaitMilliSeconds = 50;
-#else
- const int MaxWaitMilliSeconds = 500;
-#endif
- while (!isIdle_p()) {
- Q_ASSERT_X(state()->stateId() == WorkingHard, Q_FUNC_INFO, qPrintable(state()->stateName()));
- debug(2, "WeaverImpl::finish: not done, waiting.\n");
- if (m_jobFinished.wait(m_mutex, MaxWaitMilliSeconds) == false) {
- debug(2, "WeaverImpl::finish: wait timed out, %i jobs left, waking threads.\n", queueLength_p());
- reschedule();
- }
- }
- debug(2, "WeaverImpl::finish: done.\n\n\n");
-}
-
-void Weaver::suspend()
-{
- //FIXME?
- //QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->suspend();
-}
-
-void Weaver::suspend_p()
-{
- //FIXME ?
-}
-
-void Weaver::resume()
-{
- //FIXME?
- //QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->resume();
-}
-
-void Weaver::resume_p()
-{
- //FIXME ?
-}
-
-bool Weaver::isEmpty() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->isEmpty();
-}
-
-bool Weaver::isEmpty_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_assignments.isEmpty();
-}
-
-bool Weaver::isIdle() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->isIdle();
-}
-
-bool Weaver::isIdle_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return isEmpty_p() && m_active == 0;
-}
-
-int Weaver::queueLength() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->queueLength();
-}
-
-int Weaver::queueLength_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_assignments.count();
-}
-
-void Weaver::requestAbort()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->requestAbort();
-}
-
-void Weaver::reschedule()
-{
- m_jobAvailable.wakeAll();
-}
-
-void Weaver::requestAbort_p()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- for (int i = 0; i < m_inventory.size(); ++i) {
- m_inventory[i]->requestAbort();
- }
-}
-
-/** @brief Adjust the inventory size.
- *
- * Requires that the mutex is being held when called.
- *
- * This method creates threads on demand. Threads in the inventory
- * are not created upon construction of the WeaverImpl object, but
- * when jobs are queued. This avoids costly delays on the application
- * startup time. Threads are created when the inventory size is under
- * inventoryMin and new jobs are queued.
- */
-//TODO add code to raise inventory size over inventoryMin
-//TODO add code to quit unnecessary threads
-void Weaver::adjustInventory(int numberOfNewJobs)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- //number of threads that can be created:
- const int reserve = m_inventoryMax - m_inventory.count();
-
- if (reserve > 0) {
- for (int i = 0; i < qMin(reserve, numberOfNewJobs); ++i) {
- Thread *th = createThread();
- th->moveToThread(th); // be sane from the start
- m_inventory.append(th);
- connect(th, SIGNAL(jobStarted(ThreadWeaver::JobPointer,ThreadWeaver::Thread*)),
- SIGNAL(threadBusy(ThreadWeaver::JobPointer,ThreadWeaver::Thread*)));
- connect(th, SIGNAL(jobDone(ThreadWeaver::JobPointer)),
- SIGNAL(jobDone(ThreadWeaver::JobPointer)));
- th->start();
- m_createdThreads.ref();
- debug(2, "WeaverImpl::adjustInventory: thread created, "
- "%i threads in inventory.\n", currentNumberOfThreads_p());
- }
- }
-}
-
-/** @brief Check with the assigned queue policies if the job can be executed.
- *
- * If it returns true, it expects that the job is executed right after that. The done() methods of the
- * queue policies will be automatically called when the job is finished.
- *
- * If it returns false, all queue policy resources have been freed, and the method can be called again
- * at a later time.
- */
-bool Weaver::canBeExecuted(JobPointer job)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
-
- QList<QueuePolicy *> acquired;
-
- bool success = true;
-
- QList<QueuePolicy *> policies = job->queuePolicies();
- if (!policies.isEmpty()) {
- debug(4, "WeaverImpl::canBeExecuted: acquiring permission from %i queue %s.\n",
- policies.size(), policies.size() == 1 ? "policy" : "policies");
- for (int index = 0; index < policies.size(); ++index) {
- if (policies.at(index)->canRun(job)) {
- acquired.append(policies.at(index));
- } else {
- success = false;
- break;
- }
- }
-
- debug(4, "WeaverImpl::canBeExecuted: queue policies returned %s.\n", success ? "true" : "false");
-
- if (!success) {
- for (int index = 0; index < acquired.size(); ++index) {
- acquired.at(index)->release(job);
- }
- }
- } else {
- debug(4, "WeaverImpl::canBeExecuted: no queue policies, this job can be executed.\n");
- }
- return success;
-}
-
-/** @brief Factory method to create the threads.
- *
- * Overload in adapted Weaver implementations.
- */
-Thread *Weaver::createThread()
-{
- return new Thread(this);
-}
-
-/** @brief Increment the count of active threads. */
-void Weaver::incActiveThreadCount()
-{
- adjustActiveThreadCount(1);
-}
-
-/** brief Decrement the count of active threads. */
-void Weaver::decActiveThreadCount()
-{
- adjustActiveThreadCount(-1);
- // the done job could have freed another set of jobs, and we do not know how
- // many - therefore we need to wake all threads:
- m_jobFinished.wakeAll();
-}
-
-/** @brief Adjust active thread count.
- *
- * This is a helper function for incActiveThreadCount and decActiveThreadCount.
- */
-void Weaver::adjustActiveThreadCount(int diff)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- m_active += diff;
- debug(4, "WeaverImpl::adjustActiveThreadCount: %i active threads (%i jobs"
- " in queue).\n", m_active, queueLength_p());
-
- if (m_assignments.isEmpty() && m_active == 0) {
- P_ASSERT(diff < 0); // cannot reach zero otherwise
- emit(finished());
- }
-}
-
-/** @brief Returns the number of active threads.
- *
- * Threads are active if they process a job. Requires that the mutex is being held when called.
- */
-int Weaver::activeThreadCount()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_active;
-}
-
-/** @brief Called from a new thread when entering the run method. */
-void Weaver::threadEnteredRun(Thread *thread)
-{
- m_semaphore.release(1);
- emit threadStarted(thread);
-}
-
-/** @brief Take the first available job out of the queue and return it.
- *
- * The job will be removed from the queue (therefore, take). Only jobs that have no unresolved dependencies
- * are considered available. If only jobs that depened on other unfinished jobs are in the queue, this method
- * blocks on m_jobAvailable.
- *
- * This method will enter suspended state if the active thread count is now zero and
- * suspendIfAllThreadsInactive is true.
- * If justReturning is true, do not assign a new job, just process the completed previous one.
- */
-JobPointer Weaver::takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy,
- bool suspendIfInactive, bool justReturning)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- Q_ASSERT(threadWasBusy == false || (threadWasBusy == true && m_active > 0));
-
-#ifndef QT_NO_DEBUG
- debug(3, "WeaverImpl::takeFirstAvailableJobOrWait: trying to assign new job to thread %i (%s state).\n",
- th->id(), qPrintable(state()->stateName()));
- debug(5, "WeaverImpl::takeFirstAvailableJobOrWait: %i active threads, was busy: %s, suspend: %s, assign new job: %s.\n",
- activeThreadCount(), threadWasBusy ? "yes" : "no", suspendIfInactive ? "yes" : "no", !justReturning ? "yes" : "no");
-#endif
-
- if (threadWasBusy) {
- // cleanup and send events:
- decActiveThreadCount();
- }
- Q_ASSERT(m_active >= 0);
-
- if (suspendIfInactive && m_active == 0 && state()->stateId() == Suspending) {
- setState_p(Suspended);
- return JobPointer();
- }
-
- if (state()->stateId() != WorkingHard || justReturning) {
- return JobPointer();
- }
-
- JobPointer next;
- for (int index = 0; index < m_assignments.size(); ++index) {
- const JobPointer &candidate = m_assignments.at(index);
- if (canBeExecuted(candidate)) {
- next = candidate;
- m_assignments.removeAt(index);
- break;
- }
- }
- if (next) {
- incActiveThreadCount();
- debug(3, "WeaverImpl::takeFirstAvailableJobOrWait: job %p assigned to thread %i (%s state).\n",
- next.data(), th->id(), qPrintable(state()->stateName()));
- return next;
- }
-
- blockThreadUntilJobsAreBeingAssigned_locked(th);
- return JobPointer();
-}
-
-/** @brief Assign a job to the calling thread.
- *
- * This is supposed to be called from the Thread objects in the inventory. Do not call this method from
- * your code.
- * Returns 0 if the weaver is shutting down, telling the calling thread to finish and exit. If no jobs are
- * available and shut down is not in progress, the calling thread is suspended until either condition is met.
- * @param wasBusy True if the thread is returning from processing a job
- */
-JobPointer Weaver::applyForWork(Thread *th, bool wasBusy)
-{
- return state()->applyForWork(th, wasBusy);
-}
-
-/** @brief Wait for a job to become available. */
-void Weaver::waitForAvailableJob(Thread *th)
-{
- state()->waitForAvailableJob(th);
-}
-
-/** @brief Blocks the calling thread until jobs can be assigned. */
-void Weaver::blockThreadUntilJobsAreBeingAssigned(Thread *th)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- blockThreadUntilJobsAreBeingAssigned_locked(th);
-}
-
-/** @brief Blocks the calling thread until jobs can be assigned.
- *
- * The mutex must be held when calling this method.
- */
-void Weaver::blockThreadUntilJobsAreBeingAssigned_locked(Thread *th)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- debug(4, "WeaverImpl::blockThreadUntilJobsAreBeingAssigned_locked: thread %i blocked (%s state).\n",
- th->id(), qPrintable(state()->stateName()));
- emit threadSuspended(th);
- m_jobAvailable.wait(m_mutex);
- debug(4, "WeaverImpl::blockThreadUntilJobsAreBeingAssigned_locked: thread %i resumed (%s state).\n",
- th->id(), qPrintable(state()->stateName()));
-}
-
-/** @brief Dump the current jobs to the console.
- *
- * Use at your own risk.
- */
-void Weaver::dumpJobs()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- debug(0, "WeaverImpl::dumpJobs: current jobs:\n");
- for (int index = 0; index < m_assignments.size(); ++index) {
- debug(0, "--> %4i: %p (priority %i, can be executed: %s)\n", index, (void *)m_assignments.at(index).data(),
- m_assignments.at(index)->priority(),
- canBeExecuted(m_assignments.at(index)) ? "yes" : "no");
- }
-}
-
diff --git a/src/3rdparty/threadweaver/src/weaver_p.h b/src/3rdparty/threadweaver/src/weaver_p.h
deleted file mode 100644
index 7523633e7..000000000
--- a/src/3rdparty/threadweaver/src/weaver_p.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the public interfaces of the WeaverImpl class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: WeaverImpl.h 32 2005-08-17 08:38:01Z mirko $
-*/
-#ifndef WeaverImpl_H
-#define WeaverImpl_H
-
-#include <QtCore/QObject>
-#include <QtCore/QWaitCondition>
-#include <QSharedPointer>
-#include <QAtomicPointer>
-#include <QAtomicInt>
-#include <QSemaphore>
-#include <QVector>
-
-#include "state.h"
-#include "queueapi_p.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-class WeaverImplState;
-class SuspendingState;
-
-/** @brief A Weaver manages worker threads.
- *
- * It creates an inventory of Thread objects to which it assigns jobs from its queue.
- * It extends the API of Queue, hiding methods that need to be public to implement state handling, but
- * should not be exposed in general.
- */
-class THREADWEAVER_EXPORT Weaver : public QueueAPI
-{
- Q_OBJECT
-public:
- explicit Weaver(QObject *parent = 0);
- virtual ~Weaver();
- void shutDown() Q_DECL_OVERRIDE;
- void shutDown_p() Q_DECL_OVERRIDE;
-
- const State *state() const Q_DECL_OVERRIDE;
- State *state() Q_DECL_OVERRIDE;
-
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
-
- void setState(StateId);
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE;
- bool dequeue(const JobPointer &job) Q_DECL_OVERRIDE;
- void dequeue() Q_DECL_OVERRIDE;
- void finish() Q_DECL_OVERRIDE;
- void suspend() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
- bool isEmpty() const Q_DECL_OVERRIDE;
- bool isIdle() const Q_DECL_OVERRIDE;
- int queueLength() const Q_DECL_OVERRIDE;
- virtual JobPointer applyForWork(Thread *thread, bool wasBusy) Q_DECL_OVERRIDE;
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
- void blockThreadUntilJobsAreBeingAssigned(Thread *th);
- void blockThreadUntilJobsAreBeingAssigned_locked(Thread *th);
- void incActiveThreadCount();
- void decActiveThreadCount();
- int activeThreadCount();
-
- void threadEnteredRun(Thread *thread);
- JobPointer takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy,
- bool suspendIfAllThreadsInactive, bool justReturning);
- void requestAbort() Q_DECL_OVERRIDE;
- void reschedule() Q_DECL_OVERRIDE;
-
- void dumpJobs();
-
- //FIXME: rename _p to _locked:
- friend class WeaverImplState;
- friend class SuspendingState;
- void setState_p(StateId);
- void setMaximumNumberOfThreads_p(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads_p() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads_p() const Q_DECL_OVERRIDE;
- void enqueue_p(const QVector<JobPointer> &jobs);
- bool dequeue_p(JobPointer job) Q_DECL_OVERRIDE;
- void dequeue_p() Q_DECL_OVERRIDE;
- void finish_p() Q_DECL_OVERRIDE;
- void suspend_p() Q_DECL_OVERRIDE;
- void resume_p() Q_DECL_OVERRIDE;
- bool isEmpty_p() const Q_DECL_OVERRIDE;
- bool isIdle_p() const Q_DECL_OVERRIDE;
- int queueLength_p() const Q_DECL_OVERRIDE;
- void requestAbort_p() Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- /** @brief A Thread has been created. */
- void threadStarted(ThreadWeaver::Thread *);
- /** @brief A thread has exited. */
- void threadExited(ThreadWeaver::Thread *);
- /** @brief A thread has been suspended. */
- void threadSuspended(ThreadWeaver::Thread *);
- /** @brief The thread is busy executing job j. */
- void threadBusy(ThreadWeaver::JobPointer, ThreadWeaver::Thread *);
-
-protected:
- void adjustActiveThreadCount(int diff);
- virtual Thread *createThread();
- void adjustInventory(int noOfNewJobs);
-
-private:
- bool canBeExecuted(JobPointer);
- /** The thread inventory. */
- QList<Thread *> m_inventory;
- /** The job queue. */
- QList<JobPointer> m_assignments;
- /** The number of jobs that are assigned to the worker threads, but not finished. */
- int m_active;
- /** The maximum number of worker threads. */
- int m_inventoryMax;
- /** Wait condition all idle or done threads wait for. */
- QWaitCondition m_jobAvailable;
- /** Wait for a job to finish. */
- QWaitCondition m_jobFinished;
- /** Mutex to serialize operations. */
- QMutex *m_mutex;
- /** Semaphore to ensure thread startup is in sequence. */
- QSemaphore m_semaphore;
- /** Before shutdown can proceed to close the running threads, it needs to ensure that all of them
- * entered the run method. */
- QAtomicInt m_createdThreads;
- /** The state of the art.
- * @see StateId
- */
- QAtomicPointer<State> m_state;
- /** The state objects. */
- QSharedPointer<State> m_states[NoOfStates];
-};
-
-} // namespace ThreadWeaver
-
-#endif // WeaverImpl_H
diff --git a/src/3rdparty/threadweaver/src/weaverimplstate.cpp b/src/3rdparty/threadweaver/src/weaverimplstate.cpp
deleted file mode 100644
index b1ad4fcbb..000000000
--- a/src/3rdparty/threadweaver/src/weaverimplstate.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the StateImplementation class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: InConstructionState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "weaverimplstate_p.h"
-
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-WeaverImplState::WeaverImplState(QueueSignals *weaver)
- : State(weaver)
-{}
-
-const State *WeaverImplState::state() const
-{
- return this;
-}
-
-void WeaverImplState::shutDown()
-{
- weaver()->shutDown_p();
-}
-
-Weaver *WeaverImplState::weaver()
-{
- Q_ASSERT(dynamic_cast<Weaver *>(State::weaver()));
- return static_cast<Weaver *>(State::weaver());
-}
-
-const Weaver *WeaverImplState::weaver() const
-{
- Q_ASSERT(dynamic_cast<const Weaver *>(State::weaver()));
- return static_cast<const Weaver *>(State::weaver());
-}
-
-void WeaverImplState::setMaximumNumberOfThreads(int cap)
-{
- weaver()->setMaximumNumberOfThreads_p(cap);
-}
-
-int WeaverImplState::maximumNumberOfThreads() const
-{
- return weaver()->maximumNumberOfThreads_p();
-}
-
-int WeaverImplState::currentNumberOfThreads() const
-{
- return weaver()->currentNumberOfThreads_p();
-}
-
-void WeaverImplState::enqueue(const QVector<JobPointer> &jobs)
-{
- weaver()->enqueue_p(jobs);
-}
-
-bool WeaverImplState::dequeue(const JobPointer &job)
-{
- return weaver()->dequeue_p(job);
-}
-
-void WeaverImplState::dequeue()
-{
- weaver()->dequeue_p();
-}
-
-void WeaverImplState::finish()
-{
- weaver()->finish_p();
-}
-
-bool WeaverImplState::isEmpty() const
-{
- return weaver()->isEmpty_p();
-}
-
-bool WeaverImplState::isIdle() const
-{
- return weaver()->isIdle_p();
-}
-
-int WeaverImplState::queueLength() const
-{
- return weaver()->queueLength_p();
-}
-
-void WeaverImplState::requestAbort()
-{
- return weaver()->requestAbort_p();
-}
-
-void WeaverImplState::reschedule()
-{
- // Not implemented, performed directly in Weaver::reschedule().
-}
-
-void WeaverImplState::waitForAvailableJob(Thread *th)
-{
- weaver()->blockThreadUntilJobsAreBeingAssigned(th);
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/weaverimplstate_p.h b/src/3rdparty/threadweaver/src/weaverimplstate_p.h
deleted file mode 100644
index ff6eb74f5..000000000
--- a/src/3rdparty/threadweaver/src/weaverimplstate_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the StateIMplementation class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id$
-*/
-
-#ifndef STATEIMPLEMENTATION_H
-#define STATEIMPLEMENTATION_H
-
-#include "state.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-class QueueSignals;
-
-/** @brief Base class for all WeaverImpl states. */
-class WeaverImplState : public State
-{
-public:
- explicit WeaverImplState(QueueSignals *weaver);
-
- const State *state() const Q_DECL_OVERRIDE;
-
- /** Shut down the queue. */
- void shutDown() Q_DECL_OVERRIDE;
- /** Set the maximum number of threads this Weaver object may start. */
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- /** Get the maximum number of threads this Weaver may start. */
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- /** Returns the current number of threads in the inventory. */
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
- /** Enqueue a job. */
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE;
- /** Dequeue a job. */
- bool dequeue(const JobPointer &job) Q_DECL_OVERRIDE;
- /** Dequeue all jobs. */
- void dequeue() Q_DECL_OVERRIDE;
- /** Finish all queued jobs. */
- void finish() Q_DECL_OVERRIDE;
- /** Are no more jobs queued? */
- bool isEmpty() const Q_DECL_OVERRIDE;
- /** Are all threads waiting? */
- bool isIdle() const Q_DECL_OVERRIDE;
- /** How many jobs are currently queued? */
- int queueLength() const Q_DECL_OVERRIDE;
- /** Request abort for all queued and currently executed jobs. */
- void requestAbort() Q_DECL_OVERRIDE;
- /** Reschedule jobs to threads. */
- void reschedule() Q_DECL_OVERRIDE;
- /** Wait (by suspending the calling thread) until a job becomes available. */
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
-
-protected:
- /** Provide correct return type for WeaverImpl states. */
- Weaver *weaver() Q_DECL_OVERRIDE;
- const Weaver *weaver() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/weaverinterface_p.h b/src/3rdparty/threadweaver/src/weaverinterface_p.h
deleted file mode 100644
index 2ce28edc2..000000000
--- a/src/3rdparty/threadweaver/src/weaverinterface_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the WeaverInterface class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUEINTERFACE_H
-#define THREADWEAVER_QUEUEINTERFACE_H
-
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-class THREADWEAVER_EXPORT WeaverInterface
-{
-public:
- virtual ~WeaverInterface() {}
-
- /** @brief Assign a job to an idle thread.
- * @param th the thread to give a new Job to
- * @param wasBusy true if a job was previously assigned to the calling thread
- */
- virtual JobPointer applyForWork(Thread *th, bool wasBusy) = 0;
-
- /** @brief Wait (by suspending the calling thread) until a job becomes available. */
- virtual void waitForAvailableJob(Thread *th) = 0;
-};
-
-}
-
-#endif // THREADWEAVER_QUEUEINTERFACE_H
diff --git a/src/3rdparty/threadweaver/src/workinghardstate.cpp b/src/3rdparty/threadweaver/src/workinghardstate.cpp
deleted file mode 100644
index 0b1b9a79a..000000000
--- a/src/3rdparty/threadweaver/src/workinghardstate.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the WorkingHardState class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: WorkingHardState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "workinghardstate_p.h"
-
-#include <QtCore/QByteRef>
-
-#include "job.h"
-#include "thread.h"
-#include "weaver_p.h"
-#include "threadweaver.h"
-#include "debuggingaids.h"
-
-namespace ThreadWeaver
-{
-
-void WorkingHardState::activated()
-{
- weaver()->reschedule();
-}
-
-WorkingHardState::WorkingHardState(Weaver *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void WorkingHardState::suspend()
-{
- weaver()->setState(Suspending);
-}
-
-void WorkingHardState::resume()
-{
-}
-
-JobPointer WorkingHardState::applyForWork(Thread *th, bool wasBusy)
-{
- // beware: this code is executed in the applying thread!
- debug(2, "WorkingHardState::applyForWork: thread %i applies for work in %s state.\n", th->id(),
- qPrintable(weaver()->state()->stateName()));
- JobPointer next = weaver()->takeFirstAvailableJobOrSuspendOrWait(th, wasBusy, false, false);
- if (next) {
- return next;
- } else {
- // this is no infinite recursion: the state may have changed meanwhile, or jobs may have become available:
- debug(2, "WorkingHardState::applyForWork: repeating for thread %i in %s state.\n", th->id(),
- qPrintable(weaver()->state()->stateName()));
- return weaver()->applyForWork(th, false);
- }
-}
-
-StateId WorkingHardState::stateId() const
-{
- return WorkingHard;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/workinghardstate_p.h b/src/3rdparty/threadweaver/src/workinghardstate_p.h
deleted file mode 100644
index 30a33ee3e..000000000
--- a/src/3rdparty/threadweaver/src/workinghardstate_p.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the WorkingHardState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- 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 library 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 library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: WorkingHardState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef WorkingHardState_H
-#define WorkingHardState_H
-
-#include "weaverimplstate_p.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-/* WorkingHardState handles the state dependent calls in the state where
- * jobs are executed. */
-class WorkingHardState : public WeaverImplState
-{
-public:
- explicit WorkingHardState(Weaver *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** Overload. */
- void activated() Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // WorkingHardIState_H
diff --git a/src/3rdparty/threadweaver/threadweaver.yaml b/src/3rdparty/threadweaver/threadweaver.yaml
deleted file mode 100644
index c54f87b3f..000000000
--- a/src/3rdparty/threadweaver/threadweaver.yaml
+++ /dev/null
@@ -1 +0,0 @@
-tier: 1
diff --git a/src/bulletphysics/bulletphysics.pri b/src/bulletphysics/bulletphysics.pri
deleted file mode 100644
index 1b8a027c6..000000000
--- a/src/bulletphysics/bulletphysics.pri
+++ /dev/null
@@ -1,20 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/bulletphysicsaspect.h \
- $$PWD/qrigidbody.h \
- $$PWD/qrigidbody_p.h \
- $$PWD/qabstractcollider.h \
- $$PWD/qabstractcollider_p.h \
- $$PWD/qspherecollider.h \
- $$PWD/qspherecollider_p.h \
- $$PWD/qboxcollider.h \
- $$PWD/qboxcollider_p.h
-
-SOURCES += \
- $$PWD/bulletphysicsaspect.cpp \
- $$PWD/qrigidbody.cpp \
- $$PWD/qabstractcollider.cpp \
- $$PWD/qspherecollider.cpp \
- $$PWD/qboxcollider.cpp
-
diff --git a/src/bulletphysics/bulletphysics.pro b/src/bulletphysics/bulletphysics.pro
deleted file mode 100644
index bdae45d1c..000000000
--- a/src/bulletphysics/bulletphysics.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-TARGET = Qt3DBulletPhysics
-
-QT += core 3dcore core-private 3dcore-private
-
-LIBS += -lBulletDynamics -lBulletCollision -lLinearMath
-
-DEFINES += QT3DBULLETPHYSICS_LIBRARY
-
-MODULE = 3dbulletphysics
-
-load(qt_module)
-
-include(bulletphysics.pri)
-
-unix {
- CONFIG += link_pkgconfig
- PKGCONFIG += bullet
-}
-
-gcov {
- CONFIG += static
- QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
- QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
-}
-
-# otherwise mingw headers do not declare common functions like ::strcasecmp
-win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
-
-HEADERS += \
- qt3dbulletphysics_global.h
-
-!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
diff --git a/src/bulletphysics/qabstractcollider.cpp b/src/bulletphysics/qabstractcollider.cpp
deleted file mode 100644
index 96b3542cb..000000000
--- a/src/bulletphysics/qabstractcollider.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractcollider.h"
-#include "qabstractcollider_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-QAbstractColliderPrivate::QAbstractColliderPrivate(QAbstractCollider *qq)
- : Qt3D::QComponentPrivate(qq)
- , m_collisionBehavior(QAbstractCollider::NotifyOnly)
-{
-}
-
-void QAbstractCollider::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QAbstractCollider *other = static_cast<const QAbstractCollider *>(ref);
- d_func()->m_collisionBehavior = other->d_func()->m_collisionBehavior;
-}
-
-QAbstractCollider::QAbstractCollider(QNode *parent)
- : Qt3D::QComponent(*new QAbstractColliderPrivate(this), parent)
-{
-}
-
-QAbstractCollider::QAbstractCollider(QAbstractColliderPrivate &dd, Qt3D::QNode *parent)
- : Qt3D::QComponent(dd, parent)
-{
-}
-
-
-void QAbstractCollider::setCollisionBehavior(CollisionBehavior collisionBehavior)
-{
- Q_D(QAbstractCollider);
- if (d->m_collisionBehavior != collisionBehavior) {
- d->m_collisionBehavior = collisionBehavior;
- emit collisionBehaviorChanged();
- }
-}
-
-QAbstractCollider::CollisionBehavior QAbstractCollider::collisionBehavior() const
-{
- Q_D(const QAbstractCollider);
- return d->m_collisionBehavior;
-}
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/bulletphysics/qboxcollider.cpp b/src/bulletphysics/qboxcollider.cpp
deleted file mode 100644
index 9ae9d87a2..000000000
--- a/src/bulletphysics/qboxcollider.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qboxcollider.h"
-#include "qboxcollider_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-QBoxColliderPrivate::QBoxColliderPrivate(QBoxCollider *qq)
- : QAbstractColliderPrivate(qq)
- , m_center()
- , m_halfExtents()
-{
-}
-
-void QBoxCollider::copy(const QNode *ref)
-{
- QAbstractCollider::copy(ref);
- const QBoxCollider *other = static_cast<const QBoxCollider*>(ref);
- d_func()->m_center = other->d_func()->m_center;
- d_func()->m_halfExtents = other->d_func()->m_halfExtents;
-}
-
-QBoxCollider::QBoxCollider(Qt3D::QNode *parent)
- : QAbstractCollider(*new QBoxColliderPrivate(this), parent)
-{
-}
-
-QBoxCollider::QBoxCollider(QBoxColliderPrivate &dd, QNode *parent)
- : QAbstractCollider(dd, parent)
-{
-}
-
-void QBoxCollider::setCenter(const QVector3D &center)
-{
- Q_D(QBoxCollider);
- if (!qFuzzyCompare(d->m_center, center)) {
- setCenterX(center.x());
- setCenterY(center.y());
- setCenterZ(center.z());
- emit centerChanged();
- }
-}
-
-QVector3D QBoxCollider::center() const
-{
- Q_D(const QBoxCollider);
- return d->m_center;
-}
-
-void QBoxCollider::setHalfExtents(const QVector3D &halfExtents)
-{
- Q_D(QBoxCollider);
- if (d->m_halfExtents != halfExtents) {
- d->m_halfExtents = halfExtents;
- emit halfExtentsChanged();
- }
-}
-
-QVector3D QBoxCollider::halfExtents() const
-{
- Q_D(const QBoxCollider);
- return d->m_halfExtents;
-}
-
-void QBoxCollider::setCenterX(float x)
-{
- Q_D(QBoxCollider);
- if (!qFuzzyCompare(d->m_center.x(), x)) {
- d->m_center.setX(x);
- emit centerXChanged();
- }
-}
-
-float QBoxCollider::centerX() const
-{
- Q_D(const QBoxCollider);
- return d->m_center.x();
-}
-
-void QBoxCollider::setCenterY(float y)
-{
- Q_D(QBoxCollider);
- if (!qFuzzyCompare(d->m_center.y(), y)) {
- d->m_center.setY(y);
- emit centerYChanged();
- }
-}
-
-float QBoxCollider::centerY() const
-{
- Q_D(const QBoxCollider);
- return d->m_center.y();
-}
-
-void QBoxCollider::setCenterZ(float z)
-{
- Q_D(QBoxCollider);
- if (!qFuzzyCompare(d->m_center.z(), z)) {
- d->m_center.setZ(z);
- emit centerZChanged();
- }
-}
-
-float QBoxCollider::centerZ() const
-{
- Q_D(const QBoxCollider);
- return d->m_center.z();
-}
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/bulletphysics/qboxcollider.h b/src/bulletphysics/qboxcollider.h
deleted file mode 100644
index 9a890e5e0..000000000
--- a/src/bulletphysics/qboxcollider.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_BULLETPHYSICS_QBOXCOLLIDER_H
-#define QT3D_BULLETPHYSICS_QBOXCOLLIDER_H
-
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <Qt3DBulletPhysics/qabstractcollider.h>
-
-#include <QtGui/qvector3d.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-class QBoxColliderPrivate;
-
-class QBoxCollider : public Qt3D::BulletPhysics::QAbstractCollider
-{
- Q_OBJECT
-
- Q_PROPERTY(QVector3D center READ center WRITE setCenter NOTIFY centerChanged)
- Q_PROPERTY(float centerX READ centerX WRITE setCenterX NOTIFY centerXChanged)
- Q_PROPERTY(float centerY READ centerY WRITE setCenterY NOTIFY centerYChanged)
- Q_PROPERTY(float centerZ READ centerZ WRITE setCenterZ NOTIFY centerZChanged)
- Q_PROPERTY(QVector3D halfExtents READ halfExtents WRITE setHalfExtents NOTIFY halfExtentsChanged)
-
-public:
- explicit QBoxCollider(Qt3D::QNode *parent = 0);
-
- void setCenter(const QVector3D &center);
- QVector3D center() const;
-
- void setHalfExtents(const QVector3D &halfExtents);
- QVector3D halfExtents() const;
-
- void setCenterX(float x);
- float centerX() const;
-
- void setCenterY(float y);
- float centerY() const;
-
- void setCenterZ(float z);
- float centerZ() const;
-
-Q_SIGNALS:
- void centerXChanged();
- void centerYChanged();
- void centerZChanged();
- void centerChanged();
- void halfExtentsChanged();
-
-protected:
- QBoxCollider(QBoxColliderPrivate &dd, QNode *parent = 0);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QBoxCollider)
- QT3D_CLONEABLE(QBoxCollider)
-};
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3D_BULLETPHYSICS_QBOXCOLLIDER_H
diff --git a/src/bulletphysics/qboxcollider_p.h b/src/bulletphysics/qboxcollider_p.h
deleted file mode 100644
index e8da0b849..000000000
--- a/src/bulletphysics/qboxcollider_p.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_BULLETPHYSICS_QBOXCOLLIDER_P_H
-#define QT3D_BULLETPHYSICS_QBOXCOLLIDER_P_H
-
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <private/qabstractcollider_p.h>
-#include <Qt3DBulletPhysics/qboxcollider.h>
-
-#include <QtGui/qvector3d.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-class QBoxColliderPrivate : public QAbstractColliderPrivate
-{
-public:
- QBoxColliderPrivate(QBoxCollider *qq);
-
- Q_DECLARE_PUBLIC(QBoxCollider)
-
- QVector3D m_center;
- QVector3D m_halfExtents;
-};
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3D_BULLETPHYSICS_QBOXCOLLIDER_P_H
diff --git a/src/bulletphysics/qrigidbody.cpp b/src/bulletphysics/qrigidbody.cpp
deleted file mode 100644
index f09125aa7..000000000
--- a/src/bulletphysics/qrigidbody.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qrigidbody.h"
-#include "qrigidbody_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-QRigidBodyPrivate::QRigidBodyPrivate(QRigidBody *qq)
- : Qt3D::QComponentPrivate(qq)
- , m_mass(0.0f)
- , m_centerOfMass()
-{
-}
-
-
-QRigidBody::QRigidBody(Qt3D::QNode *parent)
- : Qt3D::QComponent(*new QRigidBodyPrivate(this), parent)
-{
-}
-
-QRigidBody::QRigidBody(QRigidBodyPrivate &dd, Qt3D::QNode *parent)
- : Qt3D::QComponent(dd, parent)
-{
-}
-
-void QRigidBody::copy(const QNode *ref)
-{
- QRigidBody::copy(ref);
- const QRigidBody *other = static_cast<const QRigidBody*>(ref);
- d_func()->m_mass = other->d_func()->m_mass;
- d_func()->m_centerOfMass = other->d_func()->m_centerOfMass;
-}
-
-void QRigidBody::setMass(float mass)
-{
- Q_D(QRigidBody);
- if (!qFuzzyCompare(d->m_mass, mass)) {
- d->m_mass = mass;
- emit massChanged();
- }
-}
-
-float QRigidBody::mass() const
-{
- Q_D(const QRigidBody);
- return d->m_mass;
-}
-
-void QRigidBody::setCenterOfMass(const QVector3D &centerOfMass)
-{
- Q_D(QRigidBody);
- if (!qFuzzyCompare(d->m_centerOfMass,centerOfMass)) {
- setCenterOfMassX(centerOfMass.x());
- setCenterOfMassY(centerOfMass.y());
- setCenterOfMassZ(centerOfMass.z());
- emit centerOfMassChanged();
- }
-}
-
-QVector3D QRigidBody::centerOfMass() const
-{
- Q_D(const QRigidBody);
- return d->m_centerOfMass;
-}
-
-void QRigidBody::setCenterOfMassX(float x)
-{
- Q_D(QRigidBody);
- if (!qFuzzyCompare(d->m_centerOfMass.x(), x)) {
- d->m_centerOfMass.setX(x);
- emit centerOfMassXChanged();
- }
-}
-
-float QRigidBody::centerOfMassX() const
-{
- Q_D(const QRigidBody);
- return d->m_centerOfMass.x();
-}
-
-void QRigidBody::setCenterOfMassY(float y)
-{
- Q_D(QRigidBody);
- if (!qFuzzyCompare(d->m_centerOfMass.y(), y)) {
- d->m_centerOfMass.setY(y);
- emit centerOfMassYChanged();
- }
-}
-
-float QRigidBody::centerOfMassY() const
-{
- Q_D(const QRigidBody);
- return d->m_centerOfMass.y();
-}
-
-void QRigidBody::setCenterOfMassZ(float z)
-{
- Q_D(QRigidBody);
- if (!qFuzzyCompare(d->m_centerOfMass.z(), z)) {
- d->m_centerOfMass.setZ(z);
- emit centerOfMassZChanged();
- }
-}
-
-float QRigidBody::centerOfMassZ() const
-{
- Q_D(const QRigidBody);
- return d->m_centerOfMass.z();
-}
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/bulletphysics/qrigidbody.h b/src/bulletphysics/qrigidbody.h
deleted file mode 100644
index 0d741ce97..000000000
--- a/src/bulletphysics/qrigidbody.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_BULLETPHYSICS_QRIGIDBODY_H
-#define QT3D_BULLETPHYSICS_QRIGIDBODY_H
-
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-
-#include <Qt3DCore/qcomponent.h>
-#include <QtGui/qvector3d.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-
-class QNode;
-
-namespace BulletPhysics {
-
-class QRigidBodyPrivate;
-
-class QT3DBULLETPHYSICSSHARED_EXPORT QRigidBody : public Qt3D::QComponent
-{
- Q_OBJECT
-
- Q_PROPERTY(float mass READ mass WRITE setMass NOTIFY massChanged)
- Q_PROPERTY(QVector3D centerOfMass READ centerOfMass WRITE setCenterOfMass NOTIFY centerOfMassChanged)
- Q_PROPERTY(float centerOfMassX READ centerOfMassX WRITE setCenterOfMassX NOTIFY centerOfMassXChanged)
- Q_PROPERTY(float centerOfMassY READ centerOfMassY WRITE setCenterOfMassY NOTIFY centerOfMassYChanged)
- Q_PROPERTY(float centerOfMassZ READ centerOfMassZ WRITE setCenterOfMassZ NOTIFY centerOfMassZChanged)
-
-public:
- explicit QRigidBody(Qt3D::QNode *parent = 0);
-
- void setMass(float mass);
- float mass() const;
-
- void setCenterOfMass(const QVector3D &centerOfMass);
- QVector3D centerOfMass() const;
-
- void setCenterOfMassX(float x);
- float centerOfMassX() const;
-
- void setCenterOfMassY(float y);
- float centerOfMassY() const;
-
- void setCenterOfMassZ(float z);
- float centerOfMassZ() const;
-
-Q_SIGNALS:
- void massChanged();
- void centerOfMassXChanged();
- void centerOfMassYChanged();
- void centerOfMassZChanged();
- void centerOfMassChanged();
-
-protected:
- QRigidBody(QRigidBodyPrivate &dd, Qt3D::QNode *parent = 0);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QRigidBody)
- QT3D_CLONEABLE(QRigidBody)
-};
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3D_BULLETPHYSICS_QRIGIDBODY_H
diff --git a/src/bulletphysics/qrigidbody_p.h b/src/bulletphysics/qrigidbody_p.h
deleted file mode 100644
index 53c1da3c3..000000000
--- a/src/bulletphysics/qrigidbody_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_BULLETPHYSICS_QRIGIDBODY_P_H
-#define QT3D_BULLETPHYSICS_QRIGIDBODY_P_H
-
-#include <QtGui/qvector3d.h>
-#include <Qt3DCore/private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-class QRigidBodyPrivate : public Qt3D::QComponentPrivate
-{
-public:
- explicit QRigidBodyPrivate(QRigidBody *qq);
-
- Q_DECLARE_PUBLIC(QRigidBody)
-
- float m_mass;
- QVector3D m_centerOfMass;
-};
-
-}
-}
-
-QT_END_NAMESPACE
-
-#endif // QT3D_BULLETPHYSICS_QRIGIDBODY_P_H
diff --git a/src/bulletphysics/qspherecollider.cpp b/src/bulletphysics/qspherecollider.cpp
deleted file mode 100644
index 2a052ba9d..000000000
--- a/src/bulletphysics/qspherecollider.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qspherecollider.h"
-#include "qspherecollider_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-QSphereColliderPrivate::QSphereColliderPrivate(QSphereCollider *qq)
- : QAbstractColliderPrivate(qq)
- , m_center()
- , m_radius(1.0f)
-{
-}
-
-
-QSphereCollider::QSphereCollider(Qt3D::QNode *parent)
- : QAbstractCollider(*new QSphereColliderPrivate(this), parent)
-{
-}
-
-QSphereCollider::QSphereCollider(QSphereColliderPrivate &dd, QNode *parent)
- : QAbstractCollider(dd, parent)
-{
-}
-
-void QSphereCollider::copy(const QNode *ref)
-{
- QAbstractCollider::copy(ref);
- const QSphereCollider *other = static_cast<const QSphereCollider*>(ref);
- d_func()->m_center = other->d_func()->m_center;
- d_func()->m_radius = other->d_func()->m_radius;
-}
-
-void QSphereCollider::setCenter(const QVector3D &center)
-{
- Q_D(QSphereCollider);
- if (!qFuzzyCompare(d->m_center, center)) {
- setCenterX(center.x());
- setCenterY(center.y());
- setCenterZ(center.z());
- emit centerChanged();
- }
-}
-
-QVector3D QSphereCollider::center() const
-{
- Q_D(const QSphereCollider);
- return d->m_center;
-}
-
-void QSphereCollider::setRadius(float radius)
-{
- Q_D(QSphereCollider);
- if (d->m_radius != radius) {
- d->m_radius = radius;
- emit radiusChanged();
- }
-}
-
-float QSphereCollider::radius() const
-{
- Q_D(const QSphereCollider);
- return d->m_radius;
-}
-
-void QSphereCollider::setCenterX(float x)
-{
- Q_D(QSphereCollider);
- if (!qFuzzyCompare(d->m_center.x(), x)) {
- d->m_center.setX(x);
- emit centerXChanged();
- }
-}
-
-float QSphereCollider::centerX() const
-{
- Q_D(const QSphereCollider);
- return d->m_center.x();
-}
-
-void QSphereCollider::setCenterY(float y)
-{
- Q_D(QSphereCollider);
- if (!qFuzzyCompare(d->m_center.y(), y)) {
- d->m_center.setY(y);
- emit centerYChanged();
- }
-}
-
-float QSphereCollider::centerY() const
-{
- Q_D(const QSphereCollider);
- return d->m_center.y();
-}
-
-void QSphereCollider::setCenterZ(float z)
-{
- Q_D(QSphereCollider);
- if (!qFuzzyCompare(d->m_center.z(), z)) {
- d->m_center.setZ(z);
- emit centerZChanged();
- }
-}
-
-float QSphereCollider::centerZ() const
-{
- Q_D(const QSphereCollider);
- return d->m_center.z();
-}
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/bulletphysics/qspherecollider.h b/src/bulletphysics/qspherecollider.h
deleted file mode 100644
index 1a4781ba6..000000000
--- a/src/bulletphysics/qspherecollider.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_BULLETPHYSICS_QSPHERECOLLIDER_H
-#define QT3D_BULLETPHYSICS_QSPHERECOLLIDER_H
-
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <Qt3DBulletPhysics/qabstractcollider.h>
-
-#include <QtGui/qvector3d.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3D {
-namespace BulletPhysics {
-
-class QSphereColliderPrivate;
-
-class QT3DBULLETPHYSICSSHARED_EXPORT QSphereCollider : public Qt3D::BulletPhysics::QAbstractCollider
-{
- Q_OBJECT
-
- Q_PROPERTY(QVector3D center READ center WRITE setCenter NOTIFY centerChanged)
- Q_PROPERTY(float centerX READ centerX WRITE setCenterX NOTIFY centerXChanged)
- Q_PROPERTY(float centerY READ centerY WRITE setCenterY NOTIFY centerYChanged)
- Q_PROPERTY(float centerZ READ centerZ WRITE setCenterZ NOTIFY centerZChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
-
-public:
- explicit QSphereCollider(Qt3D::QNode *parent = 0);
-
- void setCenter(const QVector3D &center);
- QVector3D center() const;
-
- void setRadius(float radius);
- float radius() const;
-
- void setCenterX(float x);
- float centerX() const;
-
- void setCenterY(float y);
- float centerY() const;
-
- void setCenterZ(float z);
- float centerZ() const;
-
-Q_SIGNALS:
- void centerXChanged();
- void centerYChanged();
- void centerZChanged();
- void centerChanged();
- void radiusChanged();
-
-protected:
- QSphereCollider(QSphereColliderPrivate &dd, QNode *parent = 0);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QSphereCollider)
- QT3D_CLONEABLE(QSphereCollider)
-};
-
-} // namespace BulletPhysics
-} // namespace Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3D_BULLETPHYSICS_QSPHERECOLLIDER_H
diff --git a/src/bulletphysics/qt3dbulletphysics_global.h b/src/bulletphysics/qt3dbulletphysics_global.h
deleted file mode 100644
index 6e992d8c5..000000000
--- a/src/bulletphysics/qt3dbulletphysics_global.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DBULLETPHYSICS_GLOBAL_H
-#define QT3DBULLETPHYSICS_GLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#if defined(QT_SHARED) || !defined(QT_STATIC)
-# if defined(QT3DBULLETPHYSICS_LIBRARY)
-# define QT3DBULLETPHYSICSSHARED_EXPORT Q_DECL_EXPORT
-# else
-# define QT3DBULLETPHYSICSSHARED_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define QT3DBULLETPHYSICSSHARED_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QT3DBULLETPHYSICS_GLOBAL_H
diff --git a/src/core/core.pro b/src/core/core.pro
index cb9437700..bd965516e 100644
--- a/src/core/core.pro
+++ b/src/core/core.pro
@@ -6,6 +6,11 @@ load(qt_module)
DEFINES += QT3DCORE_LIBRARY
+# TODO: Make tasking API configurable
+#use_thread_weaver {
+# DEFINES += THREAD_WEAVER
+#}
+
QMAKE_DOCS = $$PWD/doc/qt3dcore.qdocconf
gcov {
@@ -17,7 +22,6 @@ gcov {
# otherwise mingw headers do not declare common functions like ::strcasecmp
win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
-include(../3rdparty/threadweaver/src/threadweaver.pri)
include(core.pri)
!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
diff --git a/src/core/jobs/dependencyhandler.cpp b/src/core/jobs/dependencyhandler.cpp
new file mode 100644
index 000000000..9778ede58
--- /dev/null
+++ b/src/core/jobs/dependencyhandler.cpp
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <iterator>
+
+#include "dependencyhandler_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+namespace {
+ template <template <typename T> class Op>
+ struct ByDepender {
+ typedef bool result_type;
+
+ bool operator()(const QSharedPointer<TaskInterface> &lhs, const QSharedPointer<TaskInterface> &rhs) const Q_DECL_NOTHROW
+ { return Op<QSharedPointer<TaskInterface> >()(lhs, rhs); }
+
+ bool operator()(const QSharedPointer<TaskInterface> &lhs, const Dependency &rhs) const Q_DECL_NOTHROW
+ { return operator()(lhs, rhs.depender); }
+
+ bool operator()(const Dependency &lhs, const QSharedPointer<TaskInterface> &rhs) const Q_DECL_NOTHROW
+ { return operator()(lhs.depender, rhs); }
+
+ bool operator()(const Dependency &lhs, const Dependency &rhs) const Q_DECL_NOTHROW
+ { return operator()(lhs.depender, rhs.depender); }
+ };
+
+ struct DependeeEquals : std::unary_function<Dependency, bool>
+ {
+ QSharedPointer<TaskInterface> dependee;
+ explicit DependeeEquals(QSharedPointer<TaskInterface> dependee)
+ : dependee(qMove(dependee)) {}
+ bool operator()(const Dependency &candidate) const
+ {
+ return dependee == candidate.dependee;
+ }
+ };
+
+ struct ByDependerThenDependee : std::binary_function<Dependency, Dependency, bool>
+ {
+ // Defines a lexicographical order (depender first).
+ bool operator()(const Dependency &lhs, const Dependency &rhs)
+ {
+ if (lhs.depender < rhs.depender) return true;
+ if (rhs.depender < lhs.depender) return false;
+ return lhs.dependee < rhs.dependee;
+ }
+ };
+}
+
+DependencyHandler::DependencyHandler()
+{
+}
+
+void DependencyHandler::addDependencies(QVector<Dependency> dependencies)
+{
+ std::sort(dependencies.begin(), dependencies.end(), ByDependerThenDependee());
+
+ const QMutexLocker locker(&m_mutex);
+
+ QVector<Dependency> newDependencyMap;
+ newDependencyMap.reserve(dependencies.size() + m_dependencyMap.size());
+ std::set_union(m_dependencyMap.begin(), m_dependencyMap.end(),
+ dependencies.begin(), dependencies.end(),
+ std::back_inserter(newDependencyMap), ByDependerThenDependee());
+ m_dependencyMap.swap(newDependencyMap); // commit
+}
+
+bool DependencyHandler::hasDependency(const QSharedPointer<TaskInterface> &depender)
+{
+ const QMutexLocker locker(&m_mutex);
+
+ return std::binary_search(m_dependencyMap.begin(), m_dependencyMap.end(),
+ depender, ByDepender<std::less>());
+}
+
+/*
+ * Removes all the entries on the m_dependencyMap that have given task as a dependee,
+ * i.e. entries where the dependency is on the given task.
+ */
+void DependencyHandler::freeDependencies(const QSharedPointer<TaskInterface> &dependee)
+{
+ const QMutexLocker locker(&m_mutex);
+
+ m_dependencyMap.erase(std::remove_if(m_dependencyMap.begin(), m_dependencyMap.end(),
+ DependeeEquals(dependee)),
+ m_dependencyMap.end());
+}
+
+} // namespace Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/bulletphysics/qabstractcollider.h b/src/core/jobs/dependencyhandler_p.h
index 04fe6ca96..0d2aafaa6 100644
--- a/src/bulletphysics/qabstractcollider.h
+++ b/src/core/jobs/dependencyhandler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
@@ -34,51 +34,65 @@
**
****************************************************************************/
-#ifndef QT3D_BULLETPHYSICS_QABSTRACTCOLLIDER_H
-#define QT3D_BULLETPHYSICS_QABSTRACTCOLLIDER_H
+#ifndef QT3D_DEPENDENCYHANDLER_P_H
+#define QT3D_DEPENDENCYHANDLER_P_H
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <Qt3DCore/qcomponent.h>
+#include "task_p.h"
+
+#include <QtCore/QMutex>
+#include <QtCore/QVector>
QT_BEGIN_NAMESPACE
namespace Qt3D {
-namespace BulletPhysics {
-
-class QAbstractColliderPrivate;
-class QT3DBULLETPHYSICSSHARED_EXPORT QAbstractCollider : public Qt3D::QComponent
+struct Dependency
{
- Q_OBJECT
+ Dependency() {}
+ Dependency(QSharedPointer<TaskInterface> depender, QSharedPointer<TaskInterface> dependee)
+ : depender(qMove(depender)),
+ dependee(qMove(dependee)) {}
- Q_ENUMS(CollisionBehavior)
- Q_PROPERTY(CollisionBehavior collisionBehavior READ collisionBehavior WRITE setCollisionBehavior NOTIFY collisionBehaviorChanged)
+ QSharedPointer<TaskInterface> depender;
+ QSharedPointer<TaskInterface> dependee;
+};
-public:
- explicit QAbstractCollider(QNode *parent = 0);
+} // namespace Qt3D
+
+template <>
+class QTypeInfo<Qt3D::Dependency> : public QTypeInfoMerger<Qt3D::Dependency, QSharedPointer<Qt3D::TaskInterface> > {};
+
+namespace Qt3D {
- enum CollisionBehavior {
- NotifyOnly = 0,
- NotifyAndPreventIntersection
- };
+inline bool operator==(const Dependency &left, const Dependency &right)
+{
+ return left.depender == right.depender && left.dependee == right.dependee;
+}
- void setCollisionBehavior(CollisionBehavior collisionBehavior);
- CollisionBehavior collisionBehavior() const;
+inline bool operator!=(const Dependency &left, const Dependency &right)
+{
+ return !operator==(left, right);
+}
-Q_SIGNALS:
- void collisionBehaviorChanged();
+class DependencyHandler
+{
+public:
+ DependencyHandler();
-protected:
- QAbstractCollider(QAbstractColliderPrivate &dd, Qt3D::QNode *parent = 0);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
+ void addDependencies(QVector<Dependency> dependencies);
+ bool hasDependency(const QSharedPointer<TaskInterface> &depender);
+ void freeDependencies(const QSharedPointer<TaskInterface> &dependee);
private:
- Q_DECLARE_PRIVATE(QAbstractCollider)
+ Q_DISABLE_COPY(DependencyHandler)
+
+ QVector<Dependency> m_dependencyMap;
+ mutable QMutex m_mutex;
};
-} // namespace BulletPhysics
} // namespace Qt3D
QT_END_NAMESPACE
-#endif // QT3D_BULLETPHYSICS_QABSTRACTCOLLIDER_H
+#endif // QT3D_DEPENDENCYHANDLER_P_H
+
diff --git a/src/bulletphysics/qspherecollider_p.h b/src/core/jobs/jobrunner.cpp
index 165815d68..d1cfe234b 100644
--- a/src/bulletphysics/qspherecollider_p.h
+++ b/src/core/jobs/jobrunner.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
@@ -34,33 +34,59 @@
**
****************************************************************************/
-#ifndef QT3D_BULLETPHYSICS_QSPHERECOLLIDER_P_H
-#define QT3D_BULLETPHYSICS_QSPHERECOLLIDER_P_H
+#include "jobrunner_p.h"
+#include "qthreadpooler_p.h"
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <private/qabstractcollider_p.h>
-
-#include <QtGui/qvector3d.h>
+#include <QtCore/QThread>
+#include <QtCore/QMutexLocker>
+#include <QtCore/QAtomicInt>
QT_BEGIN_NAMESPACE
namespace Qt3D {
-namespace BulletPhysics {
-class QSphereColliderPrivate : public QAbstractColliderPrivate
+JobRunner::JobRunner(QThreadPooler *parent)
+ : QThread(parent),
+ m_abort(0),
+ m_pooler(parent),
+ m_jobAvailable(Q_NULLPTR),
+ m_mutex(Q_NULLPTR)
+{
+ QObject::connect(parent, SIGNAL(shuttingDown()), this, SLOT(shutDown()));
+}
+
+JobRunner::~JobRunner()
+{
+ shutDown();
+}
+
+void JobRunner::run()
{
-public:
- QSphereColliderPrivate(QSphereCollider *qq);
+ Q_ASSERT(m_jobAvailable != Q_NULLPTR);
- Q_DECLARE_PUBLIC(QSphereCollider)
+ while (!m_abort.load()) {
+ if (const QSharedPointer<TaskInterface> task = m_pooler->nextTask()) {
+ m_pooler->startRunning();
+ task->run(task, this);
+ m_pooler->stopRunning();
+ } else {
+ suspend();
+ }
+ }
+}
- QVector3D m_center;
- float m_radius;
-};
+void JobRunner::suspend()
+{
+ const QMutexLocker locker(m_mutex);
+
+ m_jobAvailable->wait(m_mutex);
+}
+
+void JobRunner::shutDown()
+{
+ m_abort.store(1);
+}
-} // namespace BulletPhysics
} // namespace Qt3D
QT_END_NAMESPACE
-
-#endif // QT3D_BULLETPHYSICS_QSPHERECOLLIDER_P_H
diff --git a/src/openal/openalaspect.h b/src/core/jobs/jobrunner_p.h
index 39574e554..14b5213e9 100644
--- a/src/openal/openalaspect.h
+++ b/src/core/jobs/jobrunner_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
@@ -34,38 +34,55 @@
**
****************************************************************************/
-#ifndef QT3D_OPENALASPECT_H
-#define QT3D_OPENALASPECT_H
+#ifndef QT3D_JOBRUNNER_P_H
+#define QT3D_JOBRUNNER_P_H
-#include <Qt3DOpenAL/qt3dopenal_global.h>
-#include <Qt3DCore/qabstractaspect.h>
+#include "qaspectjobmanager.h"
+#include "task_p.h"
+
+#include <QtCore/QThread>
+#include <QtCore/QWaitCondition>
+#include <QtCore/QAtomicInt>
QT_BEGIN_NAMESPACE
namespace Qt3D {
-class QT3DOPENALSHARED_EXPORT OpenALAspect : public QAbstractAspect
+class QThreadPooler;
+
+class JobRunner : public QThread
{
Q_OBJECT
+
public:
- explicit OpenALAspect(QObject *parent = 0);
+ explicit JobRunner(QThreadPooler *parent = 0);
+ ~JobRunner();
- void sceneNodeAdded(QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void sceneNodeRemoved(QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ void run() Q_DECL_OVERRIDE;
- // QJobProviderInterface interface
- QVector<QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
+ inline void setWaitConditions(QWaitCondition *jobAvailable)
+ {
+ m_jobAvailable = jobAvailable;
+ }
+ inline void setMutex(QMutex *mutex) { m_mutex = mutex; }
- // AbstractAspect interface
private:
- void setRootEntity(QEntity *rootObject) Q_DECL_OVERRIDE;
- void onInitialize(const QVariantMap &) Q_DECL_OVERRIDE;
- void onCleanup() Q_DECL_OVERRIDE;
+ void suspend();
+private:
+ QAtomicInt m_abort;
+ QThreadPooler *m_pooler;
+
+ QWaitCondition *m_jobAvailable;
+ QMutex *m_mutex; // For waiting next available job
+
+private Q_SLOTS:
+ void shutDown();
};
-} // Qt3D
+} // namespace Qt3D
QT_END_NAMESPACE
-#endif // QT3D_OPENALASPECT_H
+#endif // QT3D_JOBRUNNER_P_H
+
diff --git a/src/core/jobs/jobs.pri b/src/core/jobs/jobs.pri
index 8c286bfe3..b6def7aa8 100644
--- a/src/core/jobs/jobs.pri
+++ b/src/core/jobs/jobs.pri
@@ -1,18 +1,34 @@
SOURCES += \
- $$PWD/weaverjob.cpp \
$$PWD/qaspectjob.cpp \
$$PWD/qaspectjobmanager.cpp \
- $$PWD/qabstractaspectjobmanager.cpp
+ $$PWD/qabstractaspectjobmanager.cpp \
+ $$PWD/jobrunner.cpp \
+ $$PWD/qthreadpooler.cpp \
+ $$PWD/task.cpp \
+ $$PWD/dependencyhandler.cpp
+
+# TODO: Make tasking API configurable
+#use_thread_weaver {
+#SOURCES += \
+# $$PWD/weaverjob.cpp
+#
+#HEADERS += \
+# $$PWD/weaverjob_p.h \
+#}
HEADERS += \
- $$PWD/weaverjob_p.h \
$$PWD/qaspectjob.h \
$$PWD/qaspectjob_p.h \
$$PWD/qabstractaspectjobmanager.h \
$$PWD/qaspectjobproviderinterface.h \
$$PWD/qaspectjobmanager.h \
$$PWD/qaspectjobmanager_p.h \
- $$PWD/qabstractaspectjobmanager_p.h
+ $$PWD/qabstractaspectjobmanager_p.h \
+ $$PWD/dependencyhandler_p.h \
+ $$PWD/jobrunner_p.h \
+ $$PWD/task_p.h \
+ $$PWD/qthreadpooler_p_p.h \
+ $$PWD/qthreadpooler_p.h
INCLUDEPATH += $$PWD
diff --git a/src/core/jobs/qaspectjobmanager.cpp b/src/core/jobs/qaspectjobmanager.cpp
index cabe2a941..970c6458e 100644
--- a/src/core/jobs/qaspectjobmanager.cpp
+++ b/src/core/jobs/qaspectjobmanager.cpp
@@ -34,14 +34,18 @@
**
****************************************************************************/
+#ifdef THREAD_WEAVER
#include <threadweaver.h>
#include <dependencypolicy.h>
#include <thread.h>
-
-#include "qaspectjobmanager.h"
#include "job.h"
#include "weaverjob_p.h"
+#endif
+
+#include "qaspectjobmanager.h"
#include "qaspectjobmanager_p.h"
+#include "task_p.h"
+#include "dependencyhandler_p.h"
#include <QAtomicInt>
#include <QDebug>
@@ -52,6 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3D {
+#ifdef THREAD_WEAVER
namespace {
class SynchronizedJob : public ThreadWeaver::Job
@@ -92,11 +97,14 @@ void SynchronizedJob::run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *t
}
} // anonymous
+#endif
QAspectJobManagerPrivate::QAspectJobManagerPrivate(QAspectJobManager *qq)
: QAbstractAspectJobManagerPrivate()
, q_ptr(qq)
+#ifdef THREAD_WEAVER
, m_weaver(Q_NULLPTR)
+#endif
{
}
@@ -104,16 +112,31 @@ QAspectJobManager::QAspectJobManager(QObject *parent)
: QAbstractAspectJobManager(*new QAspectJobManagerPrivate(this), parent)
{
Q_D(QAspectJobManager);
+#ifdef THREAD_WEAVER
d->m_weaver = new ThreadWeaver::Queue(this);
d->m_weaver->setMaximumNumberOfThreads(QThread::idealThreadCount());
+#else
+ d->m_threadPooler = new QThreadPooler(this);
+ d->m_threadPooler->setMaxThreadCount(QThread::idealThreadCount());
+
+ d->m_dependencyHandler = new DependencyHandler();
+ d->m_threadPooler->setDependencyHandler(d->m_dependencyHandler);
+#endif
}
QAspectJobManager::QAspectJobManager(QAspectJobManagerPrivate &dd, QObject *parent)
: QAbstractAspectJobManager(dd, parent)
{
Q_D(QAspectJobManager);
+#ifdef THREAD_WEAVER
d->m_weaver = new ThreadWeaver::Queue(this);
d->m_weaver->setMaximumNumberOfThreads(QThread::idealThreadCount());
+#else
+ d->m_threadPooler = new QThreadPooler(this);
+ d->m_threadPooler->setMaxThreadCount(QThread::idealThreadCount());
+
+ d->m_dependencyHandler = new DependencyHandler();
+#endif
}
void QAspectJobManager::initialize()
@@ -123,6 +146,8 @@ void QAspectJobManager::initialize()
void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
{
Q_D(QAspectJobManager);
+
+#ifdef THREAD_WEAVER
// Convert QJobs to ThreadWeaver::Jobs
QHash<QAspectJob *, QSharedPointer<WeaverJob> > jobsMap;
Q_FOREACH (const QAspectJobPtr &job, jobQueue) {
@@ -150,17 +175,55 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
QSharedPointer<WeaverJob> weaverJob = jobsMap.value(job.data());
d->m_weaver->enqueue(weaverJob);
}
+#else
+ // Convert QJobs to Tasks
+ QHash<QAspectJob *, QSharedPointer<AspectTask>> tasksMap;
+ Q_FOREACH (const QAspectJobPtr &job, jobQueue) {
+ QSharedPointer<AspectTask> task = QSharedPointer<AspectTask>::create();
+ task->m_job = job;
+ tasksMap.insert(job.data(), task);
+ }
+
+ // Resolve dependencies
+ QVector<Dependency> dependencyList;
+
+ Q_FOREACH (const QAspectJobPtr &job, jobQueue) {
+ const QVector<QWeakPointer<QAspectJob> > &deps = job->dependencies();
+
+ Q_FOREACH (const QWeakPointer<QAspectJob> &dep, deps) {
+ QSharedPointer<AspectTask> taskDependee = tasksMap.value(dep.data());
+
+ if (taskDependee) {
+ QSharedPointer<AspectTask> taskDepender = tasksMap.value(job.data());
+ dependencyList.append(Dependency(taskDepender, taskDependee));
+ taskDependee->setDependencyHandler(d->m_dependencyHandler);
+ }
+ }
+ }
+ d->m_dependencyHandler->addDependencies(qMove(dependencyList));
+
+ Q_FOREACH (const QAspectJobPtr &job, jobQueue) {
+ QSharedPointer<AspectTask> task = tasksMap.value(job.data());
+ d->m_threadPooler->enqueueTask(task);
+ }
+#endif
}
void QAspectJobManager::waitForAllJobs()
{
Q_D(QAspectJobManager);
+#ifdef THREAD_WEAVER
d->m_weaver->finish();
+#else
+ d->m_threadPooler->flush();
+#endif
}
void QAspectJobManager::waitForPerThreadFunction(JobFunction func, void *arg)
{
Q_D(QAspectJobManager);
+
+#ifdef THREAD_WEAVER
const int threadCount = d->m_weaver->maximumNumberOfThreads();
QAtomicInt atomicCount(threadCount);
@@ -170,6 +233,17 @@ void QAspectJobManager::waitForPerThreadFunction(JobFunction func, void *arg)
}
d->m_weaver->finish();
+#else
+ const int threadCount = d->m_threadPooler->maxThreadCount();
+ QAtomicInt atomicCount(threadCount);
+
+ for (int i = 0; i < threadCount; ++i) {
+ QSharedPointer<SynchronizedTask> syncTask(new SynchronizedTask(func, arg, &atomicCount));
+ d->m_threadPooler->enqueueTask(syncTask);
+ }
+
+ d->m_threadPooler->flush();
+#endif
}
} // namespace Qt3D
diff --git a/src/core/jobs/qaspectjobmanager_p.h b/src/core/jobs/qaspectjobmanager_p.h
index 9db148558..5ea9cc54a 100644
--- a/src/core/jobs/qaspectjobmanager_p.h
+++ b/src/core/jobs/qaspectjobmanager_p.h
@@ -39,9 +39,14 @@
#include <private/qabstractaspectjobmanager_p.h>
+#include "qthreadpooler_p.h"
+#include "dependencyhandler_p.h"
+
+#ifdef THREAD_WEAVER
namespace ThreadWeaver {
class Queue;
}
+#endif
QT_BEGIN_NAMESPACE
@@ -57,8 +62,15 @@ public:
Q_DECLARE_PUBLIC(QAspectJobManager)
QAspectJobManager *q_ptr;
+#ifdef THREAD_WEAVER
// Owned by QAspectJobManager via QObject parent-child
ThreadWeaver::Queue *m_weaver;
+#endif
+
+ QThreadPooler *m_threadPooler;
+ DependencyHandler *m_dependencyHandler;
+ QMutex *m_syncMutex;
+ QWaitCondition m_syncFinished;
};
} // Qt3D
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
new file mode 100644
index 000000000..1620185b5
--- /dev/null
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qthreadpooler_p.h"
+#include "qthreadpooler_p_p.h"
+#include "jobrunner_p.h"
+#include "dependencyhandler_p.h"
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+QThreadPoolerPrivate::QThreadPoolerPrivate(QThreadPooler *qq)
+ : QObjectPrivate(),
+ m_mutex(new QMutex(QMutex::NonRecursive)),
+ m_runningThreads(0)
+{
+ q_ptr = qq;
+}
+
+QThreadPoolerPrivate::~QThreadPoolerPrivate()
+{
+ Q_FOREACH (QSharedPointer<TaskInterface> task, m_taskQueue)
+ task->setDependencyHandler(Q_NULLPTR);
+ delete m_dependencyHandler;
+
+ delete m_mutex;
+}
+
+void QThreadPoolerPrivate::shutdown()
+{
+ m_jobFinished.wakeAll();
+
+ // When shutting down a signal is send for jobrunners to exit run() loop
+ // on next round. Sometimes the jobrunner is busy doing still the clean up
+ // tasks and isn't waiting the release of WaitCondition. Repeat the waking
+ // process max tryOuts.
+ const int tryOuts = 2;
+
+ Q_FOREACH (JobRunner *jr, m_workers) {
+ if (!jr->isFinished()) {
+ for (int i = 0; i < tryOuts; i++) {
+ m_jobAvailable.wakeAll();
+ if (jr->wait(100))
+ break;
+ }
+ }
+ }
+}
+
+
+bool QThreadPoolerPrivate::isQueueEmpty()
+{
+ return m_taskQueue.isEmpty();
+}
+
+void QThreadPoolerPrivate::incRunningThreads()
+{
+ m_runningThreads += 1;
+}
+
+void QThreadPoolerPrivate::decRunningThreads()
+{
+ m_runningThreads -= 1;
+
+ // Sanity check
+ if (m_runningThreads < 0)
+ m_runningThreads = 0;
+}
+
+void QThreadPoolerPrivate::createRunners(int threadCount)
+{
+ Q_Q(QThreadPooler);
+
+ for (int i = 0; i < threadCount; i++) {
+ JobRunner *jr = new JobRunner(q);
+
+ jr->setMutex(m_mutex);
+ jr->setWaitConditions(&(m_jobAvailable));
+ jr->start();
+
+ m_workers.append(jr);
+ }
+}
+
+int QThreadPoolerPrivate::maxThreadCount() const
+{
+ return m_maxThreadCount;
+}
+
+void QThreadPoolerPrivate::setMaxThreadCount(int threadCount)
+{
+
+ m_maxThreadCount = threadCount;
+ createRunners(m_maxThreadCount);
+}
+
+/////////////////////////////////////////////////
+
+QThreadPooler::QThreadPooler(QObject *parent)
+ : QObject(*new QThreadPoolerPrivate(this), parent)
+{
+}
+
+QThreadPooler::~QThreadPooler()
+{
+ Q_D(QThreadPooler);
+
+ emit shuttingDown();
+ d->m_jobAvailable.wakeAll();
+
+ d->shutdown();
+}
+
+int QThreadPooler::maxThreadCount() const
+{
+ Q_D(const QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+ return d->maxThreadCount();
+}
+
+void QThreadPooler::setMaxThreadCount(int threadCount)
+{
+ Q_D(QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+ d->setMaxThreadCount(threadCount);
+}
+
+QSharedPointer<TaskInterface> QThreadPooler::nextTask()
+{
+ Q_D(QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+ QSharedPointer<TaskInterface> task;
+ int queueSize = d->m_taskQueue.size();
+ for (int i = 0; i < queueSize; i++) {
+ const QSharedPointer<TaskInterface> &candidate = d->m_taskQueue.at(i);
+ if (!hasDependencies(candidate)) {
+ task = candidate;
+ d->m_taskQueue.removeAt(i);
+
+ break;
+ }
+ }
+
+ return task;
+}
+
+bool QThreadPooler::hasDependencies(const QSharedPointer<TaskInterface> &task)
+{
+ DependencyHandler *handler = task->dependencyHandler();
+ if (handler)
+ return handler->hasDependency(task);
+
+ return false;
+}
+
+void QThreadPooler::enqueueTask(const QSharedPointer<TaskInterface> &task)
+{
+ Q_D(QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+ d->m_taskQueue.append(task);
+ d->m_jobAvailable.wakeAll();
+}
+
+void QThreadPooler::flush()
+{
+ Q_D(QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+#ifdef QT_NO_DEBUG
+ const int waitTime = 50;
+#else
+ const int waitTime = 500;
+#endif
+
+ while (!isIdling()) {
+ if (d->m_jobFinished.wait(d->m_mutex, waitTime) == false)
+ d->m_jobAvailable.wakeAll();
+ }
+}
+
+bool QThreadPooler::isIdling()
+{
+ Q_D(QThreadPooler);
+
+ return d->isQueueEmpty() && d->m_runningThreads == 0;
+}
+
+void QThreadPooler::startRunning()
+{
+ Q_D(QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+ d->incRunningThreads();
+}
+
+void QThreadPooler::stopRunning()
+{
+ Q_D(QThreadPooler);
+
+ const QMutexLocker locker(d->m_mutex);
+
+ d->decRunningThreads();
+ d->m_jobFinished.wakeAll();
+}
+
+void QThreadPooler::setDependencyHandler(DependencyHandler *handler)
+{
+ Q_D(QThreadPooler);
+
+ d->setDependencyHandler(handler);
+}
+
+} // namespace Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/bulletphysics/bulletphysicsaspect.h b/src/core/jobs/qthreadpooler_p.h
index 55c566718..6579e6283 100644
--- a/src/bulletphysics/bulletphysicsaspect.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
@@ -34,39 +34,53 @@
**
****************************************************************************/
-#ifndef QT3D_BULLETPHYSICSASPECT_H
-#define QT3D_BULLETPHYSICSASPECT_H
+#ifndef QT3D_QTHREADPOOLER_H
+#define QT3D_QTHREADPOOLER_H
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <Qt3DCore/qabstractaspect.h>
+#include "task_p.h"
+#include "dependencyhandler_p.h"
-QT_BEGIN_NAMESPACE
+#include <QtCore/QObject>
+#include <QtCore/QWaitCondition>
+#include <QtCore/QSharedPointer>
-class QSurface;
+QT_BEGIN_NAMESPACE
namespace Qt3D {
-class QT3DBULLETPHYSICSSHARED_EXPORT BulletPhysicsAspect : public QAbstractAspect
+class QThreadPoolerPrivate;
+
+class QThreadPooler : public QObject
{
Q_OBJECT
+
public:
- explicit BulletPhysicsAspect(QObject *parent = 0);
+ explicit QThreadPooler(QObject *parent = 0);
+ ~QThreadPooler();
+
+ int maxThreadCount() const;
+ void setMaxThreadCount(int threadCount);
+ QSharedPointer<TaskInterface> nextTask();
+ void enqueueTask(const QSharedPointer<TaskInterface> &task);
+ void flush();
+ void startRunning();
+ void stopRunning();
+ void setDependencyHandler(DependencyHandler *handler);
- void sceneNodeAdded(QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void sceneNodeRemoved(QSceneChangePtr &e) Q_DECL_OVERRIDE;
+signals:
+ void shuttingDown();
- // QJobProviderInterface interface
- QVector<QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
+private:
+ void manageThreads();
+ bool hasDependencies(const QSharedPointer<TaskInterface> &task);
+ bool isIdling();
- // AbstractAspect interface
private:
- void setRootEntity(QEntity *rootObject) Q_DECL_OVERRIDE;
- void onInitialize(const QVariantMap &data) Q_DECL_OVERRIDE;
- void onCleanup() Q_DECL_OVERRIDE;
+ Q_DECLARE_PRIVATE(QThreadPooler)
};
-} // Qt3D
+} // namespace Qt3D
QT_END_NAMESPACE
-#endif // QT3D_BULLETPHYSICSASPECT_H
+#endif // QT3D_QTHREADPOOLER_H
diff --git a/src/bulletphysics/qabstractcollider_p.h b/src/core/jobs/qthreadpooler_p_p.h
index 70486eb88..0057acc36 100644
--- a/src/bulletphysics/qabstractcollider_p.h
+++ b/src/core/jobs/qthreadpooler_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
@@ -34,32 +34,60 @@
**
****************************************************************************/
-#ifndef QT3D_BULLETPHYSICS_QABSTRACTCOLLIDER_P_H
-#define QT3D_BULLETPHYSICS_QABSTRACTCOLLIDER_P_H
+#ifndef QT3D_QTHREADPOOLER_P_H
+#define QT3D_QTHREADPOOLER_P_H
-#include <Qt3DBulletPhysics/qt3dbulletphysics_global.h>
-#include <Qt3DCore/private/qcomponent_p.h>
+#include "jobrunner_p.h"
+#include "dependencyhandler_p.h"
-#include "qabstractcollider.h"
+#include <QtCore/QtGlobal>
+#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3D {
-namespace BulletPhysics {
-class QAbstractColliderPrivate : public Qt3D::QComponentPrivate
+class QThreadPooler;
+
+class QThreadPoolerPrivate : public QObjectPrivate
{
public:
- QAbstractColliderPrivate(QAbstractCollider *qq);
+ QThreadPoolerPrivate(QThreadPooler *qq);
+ ~QThreadPoolerPrivate();
+
+ bool isQueueEmpty();
+
+ void incRunningThreads();
+ void decRunningThreads();
+
+ inline void setDependencyHandler(DependencyHandler *handler)
+ {
+ m_dependencyHandler = handler;
+ }
+
+ void createRunners(int threadCount);
+ void shutdown();
- Q_DECLARE_PUBLIC(QAbstractCollider)
+ int maxThreadCount() const;
+ void setMaxThreadCount(int threadCount);
- QAbstractCollider::CollisionBehavior m_collisionBehavior;
+ Q_DECLARE_PUBLIC(QThreadPooler)
+
+private:
+ QList<JobRunner *> m_workers;
+ QVector<QSharedPointer<TaskInterface> > m_taskQueue;
+
+ QWaitCondition m_jobAvailable;
+ QWaitCondition m_jobFinished;
+ QMutex *m_mutex;
+ int m_runningThreads;
+ int m_maxThreadCount;
+ DependencyHandler *m_dependencyHandler;
};
}
-}
QT_END_NAMESPACE
-#endif // QT3D_BULLETPHYSICS_QABSTRACTCOLLIDER_P_H
+#endif // QT3D_QTHREADPOOLER_P_H
+
diff --git a/src/core/jobs/task.cpp b/src/core/jobs/task.cpp
new file mode 100644
index 000000000..87ddd57a5
--- /dev/null
+++ b/src/core/jobs/task.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "task_p.h"
+#include "jobrunner_p.h"
+#include "dependencyhandler_p.h"
+
+#include <QMutexLocker>
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+
+TaskInterface::~TaskInterface()
+{
+}
+
+// Aspect task
+
+AspectTask::AspectTask()
+ : m_dependencyHandler(0)
+{
+}
+
+AspectTask::~AspectTask()
+{
+}
+
+void AspectTask::run(QSharedPointer<TaskInterface> self, JobRunner *jr)
+{
+ Q_UNUSED(self);
+ Q_UNUSED(jr);
+ if (m_job)
+ m_job->run();
+
+ // Cleanup stuff
+ // For now at least dependecies.
+ if (m_dependencyHandler)
+ m_dependencyHandler->freeDependencies(self);
+}
+
+void AspectTask::run()
+{
+}
+
+void AspectTask::setDependencyHandler(DependencyHandler *handler)
+{
+ m_dependencyHandler = handler;
+}
+
+DependencyHandler *AspectTask::dependencyHandler()
+{
+ return m_dependencyHandler;
+}
+
+// Synchronized task
+
+SynchronizedTask::SynchronizedTask(QAbstractAspectJobManager::JobFunction func,
+ void *arg, QAtomicInt *atomicCount)
+ : m_func(func),
+ m_arg(arg),
+ m_atomicCount(atomicCount)
+{
+}
+
+SynchronizedTask::~SynchronizedTask()
+{
+}
+
+void SynchronizedTask::run()
+{
+ m_func(m_arg);
+}
+
+void SynchronizedTask::run(QSharedPointer<TaskInterface> self, JobRunner *jr)
+{
+ Q_UNUSED(self);
+ Q_UNUSED(jr);
+ Q_ASSERT(m_func);
+ Q_ASSERT(jr);
+
+ // Call the function
+ m_func(m_arg);
+
+ // Decrement the atomic counter to let others know we've done our bit
+ m_atomicCount->deref();
+
+ // Wait for the other worker threads to be done
+ while (m_atomicCount->load() > 0)
+ jr->yieldCurrentThread();
+}
+
+void SynchronizedTask::setDependencyHandler(DependencyHandler *handler)
+{
+ Q_UNUSED(handler);
+}
+
+DependencyHandler *SynchronizedTask::dependencyHandler()
+{
+ return Q_NULLPTR;
+}
+
+
+} // namespace Qt3D {
+
+QT_END_NAMESPACE
diff --git a/src/core/jobs/task_p.h b/src/core/jobs/task_p.h
new file mode 100644
index 000000000..cde8f90eb
--- /dev/null
+++ b/src/core/jobs/task_p.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3D_TASK_P_H
+#define QT3D_TASK_P_H
+
+#include "qaspectjobmanager.h"
+
+#include <QtCore/QtGlobal>
+#include <QtCore/QThread>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QWaitCondition>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3D {
+
+class JobRunner;
+class DependencyHandler;
+
+class TaskInterface
+{
+public:
+ virtual ~TaskInterface();
+
+ virtual void run(QSharedPointer<TaskInterface> self, JobRunner *jr) = 0;
+ virtual void run() = 0;
+
+ virtual void setDependencyHandler(DependencyHandler *) = 0;
+ virtual DependencyHandler *dependencyHandler() = 0;
+
+ virtual int id() = 0;
+ virtual void setId(int id) = 0;
+};
+
+class AspectTask : public TaskInterface
+{
+public:
+ AspectTask();
+ ~AspectTask();
+
+ int id() Q_DECL_OVERRIDE { return m_id; }
+ void setId(int id) Q_DECL_OVERRIDE { m_id = id; }
+
+ void setDependencyHandler(DependencyHandler *handler) Q_DECL_OVERRIDE;
+ DependencyHandler *dependencyHandler() Q_DECL_OVERRIDE;
+
+public:
+ QSharedPointer<QAspectJob> m_job;
+
+protected:
+ void run(QSharedPointer<TaskInterface> self, JobRunner *jr) Q_DECL_OVERRIDE;
+ void run() Q_DECL_OVERRIDE;
+
+private:
+ DependencyHandler *m_dependencyHandler;
+ int m_id; // For testing purposes for now
+};
+
+class SynchronizedTask : public TaskInterface
+{
+public:
+ explicit SynchronizedTask(QAbstractAspectJobManager::JobFunction func, void *arg,
+ QAtomicInt *atomicCount);
+ ~SynchronizedTask();
+
+ int id() Q_DECL_OVERRIDE { return m_id; }
+ void setId(int id) Q_DECL_OVERRIDE { m_id = id; }
+
+ void setDependencyHandler(DependencyHandler *handler) Q_DECL_OVERRIDE;
+ DependencyHandler *dependencyHandler() Q_DECL_OVERRIDE;
+
+protected:
+ void run(QSharedPointer<TaskInterface> self, JobRunner *jr) Q_DECL_OVERRIDE;
+ void run() Q_DECL_OVERRIDE;
+
+private:
+ QAbstractAspectJobManager::JobFunction m_func;
+ void *m_arg;
+ QAtomicInt *m_atomicCount;
+
+ int m_id;
+};
+
+} // namespace Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3D_TASK_P_H
+
diff --git a/src/input/cameracontroller.cpp b/src/input/cameracontroller.cpp
index 379b2c41a..27f8988ae 100644
--- a/src/input/cameracontroller.cpp
+++ b/src/input/cameracontroller.cpp
@@ -161,6 +161,9 @@ void CameraController::update(double dt)
bool CameraController::keyPressEvent( QKeyEvent* e )
{
+ m_translateFast = e->modifiers().testFlag(Qt::AltModifier);
+ m_viewCenterFixed = e->modifiers().testFlag(Qt::ShiftModifier);
+
switch ( e->key() )
{
case Qt::Key_Right:
@@ -187,14 +190,6 @@ bool CameraController::keyPressEvent( QKeyEvent* e )
m_vy = -m_linearSpeed;
break;
- case Qt::Key_Shift:
- m_viewCenterFixed = true;
- break;
-
- case Qt::Key_Alt:
- m_translateFast = true;
- break;
-
case Qt::Key_A:
toggleMSAA();
break;
@@ -225,14 +220,6 @@ bool CameraController::keyReleaseEvent( QKeyEvent* e )
m_vy = 0.0;
break;
- case Qt::Key_Shift:
- m_viewCenterFixed = false;
- break;
-
- case Qt::Key_Alt:
- m_translateFast = false;
- break;
-
default:
return false;
}
diff --git a/src/openal/openal.pri b/src/openal/openal.pri
deleted file mode 100644
index 7c0536c4f..000000000
--- a/src/openal/openal.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/openalaspect.h
-
-SOURCES += \
- $$PWD/openalaspect.cpp
-
diff --git a/src/openal/openal.pro b/src/openal/openal.pro
deleted file mode 100644
index 995dfa073..000000000
--- a/src/openal/openal.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-TARGET = Qt3DOpenAL
-
-QT += core 3dcore
-
-DEFINES += QT3DOPENAL_LIBRARY
-
-MODULE = 3dopenal
-
-load(qt_module)
-
-include(openal.pri)
-
-gcov {
- CONFIG += static
- QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
- QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
-}
-
-# otherwise mingw headers do not declare common functions like ::strcasecmp
-win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
-
-HEADERS += \
- qt3dopenal_global.h
-
-!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
diff --git a/src/openal/qt3dopenal_global.h b/src/openal/qt3dopenal_global.h
deleted file mode 100644
index c1ca2b4c9..000000000
--- a/src/openal/qt3dopenal_global.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DOPENAL_GLOBAL_H
-#define QT3DOPENAL_GLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#if defined(QT_SHARED) || !defined(QT_STATIC)
-# if defined(QT3DOPENAL_LIBRARY)
-# define QT3DOPENALSHARED_EXPORT Q_DECL_EXPORT
-# else
-# define QT3DOPENALSHARED_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define QT3DOPENALSHARED_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QT3DOPENAL_GLOBAL_H
diff --git a/src/quick3d/imports/bulletphysics/importsbulletphysics.pro b/src/quick3d/imports/bulletphysics/importsbulletphysics.pro
deleted file mode 100644
index 0b8e2864a..000000000
--- a/src/quick3d/imports/bulletphysics/importsbulletphysics.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-CXX_MODULE = qml
-TARGET = quick3dbulletphysicsplugin
-TARGETPATH = Qt3D/BulletPhysics
-
-QT += core-private qml 3dcore 3dbulletphysics
-
-HEADERS += \
- qt3dquick3dbulletphysicsplugin.h
-
-SOURCES += \
- qt3dquick3dbulletphysicsplugin.cpp
-
-OTHER_FILES += qmldir
-
-load(qml_plugin)
diff --git a/src/quick3d/imports/bulletphysics/qmldir b/src/quick3d/imports/bulletphysics/qmldir
deleted file mode 100644
index 51cb48726..000000000
--- a/src/quick3d/imports/bulletphysics/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module Qt3D.BulletPhysics
-plugin quick3dbulletphysicsplugin
-classname Qt3DQuick3DBulletPhysicsPlugin
diff --git a/src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.cpp b/src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.cpp
deleted file mode 100644
index a9e0ce7a3..000000000
--- a/src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml>
-#include "qt3dquick3dbulletphysicsplugin.h"
-
-#include <Qt3DBulletPhysics/qabstractcollider.h>
-#include <Qt3DBulletPhysics/qspherecollider.h>
-#include <Qt3DBulletPhysics/qrigidbody.h>
-
-QT_BEGIN_NAMESPACE
-
-void Qt3DQuick3DBulletPhysicsPlugin::registerTypes(const char *uri)
-{
- qmlRegisterInterface<Qt3D::BulletPhysics::QAbstractCollider>("QAbstractCollider");
- qmlRegisterType<Qt3D::BulletPhysics::QSphereCollider>(uri, 2, 0, "SphereCollider");
- qmlRegisterType<Qt3D::BulletPhysics::QRigidBody>(uri, 2, 0, "RigidBody");
-}
-
-QT_END_NAMESPACE
-
-
diff --git a/src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.h b/src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.h
deleted file mode 100644
index f3d97bfb5..000000000
--- a/src/quick3d/imports/bulletphysics/qt3dquick3dbulletphysicsplugin.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DQUICK3DRENDERPLUGIN_H
-#define QT3DQUICK3DRENDERPLUGIN_H
-
-#include <QtQml/QQmlExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class Qt3DQuick3DBulletPhysicsPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
-public:
- void registerTypes(const char *uri) Q_DECL_OVERRIDE;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT3DQUICK3DRENDERPLUGIN_H
diff --git a/src/quick3d/imports/scene3d/importsscene3d.pro b/src/quick3d/imports/scene3d/importsscene3d.pro
index cd8402320..074f60810 100644
--- a/src/quick3d/imports/scene3d/importsscene3d.pro
+++ b/src/quick3d/imports/scene3d/importsscene3d.pro
@@ -2,7 +2,7 @@ CXX_MODULE = qml
TARGET = qtquickscene3dplugin
TARGETPATH = QtQuick/Scene3D
-QT += qml quick 3dcore 3drenderer
+QT += qml quick 3dcore 3drenderer 3dinput
HEADERS += \
qtquickscene3dplugin.h \
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index 26617b036..ce21e7283 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -38,12 +38,13 @@
#include <Qt3DCore/QAspectEngine>
#include <Qt3DRenderer/QRenderAspect>
+#include <Qt3DInput/QInputAspect>
#include <QOpenGLContext>
#include <QOpenGLFramebufferObject>
#include <QOpenGLFramebufferObjectFormat>
-
#include <QSurface>
+#include <QQuickWindow>
#include <QSGSimpleTextureNode>
@@ -102,6 +103,14 @@ public:
Q_UNUSED(saver)
m_renderAspect->renderSynchronous();
+
+ // We may have called doneCurrent() so restore the context.
+ saver.context()->makeCurrent(saver.surface());
+
+ // Reset the state used by the Qt Quick scenegraph to avoid any
+ // interference when rendering the rest of the UI.
+ m_item->window()->resetOpenGLState();
+
update();
}
@@ -164,6 +173,10 @@ void Scene3DItem::setAspects(const QStringList &aspects)
Q_FOREACH (const QString &aspect, m_aspects) {
if (aspect == QStringLiteral("render")) // This one is hardwired anyway
continue;
+ if (aspect == QStringLiteral("input")) {
+ m_aspectEngine->registerAspect(new Qt3D::QInputAspect);
+ continue;
+ }
m_aspectEngine->registerAspect(aspect);
}
diff --git a/src/quick3d/quick3dbulletphysics/items/items.pri b/src/quick3d/quick3dbulletphysics/items/items.pri
deleted file mode 100644
index e4d92bb8f..000000000
--- a/src/quick3d/quick3dbulletphysics/items/items.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-#HEADERS +=
-
-#SOURCES +=
-
-INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3dbulletphysics/quick3dbulletphysics.pro b/src/quick3d/quick3dbulletphysics/quick3dbulletphysics.pro
deleted file mode 100644
index f0a25d703..000000000
--- a/src/quick3d/quick3dbulletphysics/quick3dbulletphysics.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-TARGET = Qt3DQuickBulletPhysics
-
-QT += core core-private qml quick 3dcore 3dbulletphysics 3dquick
-
-DEFINES += QT3DQUICKBULLETPHYSICS_LIBRARY
-
-MODULE = 3dquickbulletphysics
-
-load(qt_module)
-
-gcov {
- CONFIG += static
- QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
- QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
-} else {
- CONFIG += dll
-}
-
-HEADERS += $$PRIVATE_HEADERS \
- qt3dquickbulletphysics_global.h
-
-!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
-
-# otherwise mingw headers do not declare common functions like ::strcasecmp
-win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
-
-include(./items/items.pri)
-
diff --git a/src/render/backend/qgraphicscontext.cpp b/src/render/backend/qgraphicscontext.cpp
index 7145d5451..3b0df7691 100644
--- a/src/render/backend/qgraphicscontext.cpp
+++ b/src/render/backend/qgraphicscontext.cpp
@@ -161,6 +161,8 @@ bool QGraphicsContext::beginDrawing(QSurface *surface, const QColor &clearColor)
if (m_activeShader)
m_activeShader = NULL;
+ m_activeTextures.fill(0);
+
return true;
}
diff --git a/src/render/backend/qgraphicshelperes2.cpp b/src/render/backend/qgraphicshelperes2.cpp
index 72190ea15..37cac786d 100644
--- a/src/render/backend/qgraphicshelperes2.cpp
+++ b/src/render/backend/qgraphicshelperes2.cpp
@@ -41,6 +41,23 @@
QT_BEGIN_NAMESPACE
+// ES 3.0+
+#ifndef GL_SAMPLER_3D
+#define GL_SAMPLER_3D 0x8B5F
+#endif
+#ifndef GL_SAMPLER_2D_SHADOW
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#endif
+#ifndef GL_SAMPLER_CUBE_SHADOW
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#endif
+#ifndef GL_SAMPLER_2D_ARRAY
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#endif
+#ifndef GL_SAMPLER_2D_ARRAY_SHADOW
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#endif
+
namespace Qt3D {
namespace Render {
@@ -59,6 +76,7 @@ void QGraphicsHelperES2::initializeHelper(QOpenGLContext *context,
Q_ASSERT(context);
m_funcs = context->functions();
Q_ASSERT(m_funcs);
+ m_isES3 = context->format().majorVersion() >= 3;
}
void QGraphicsHelperES2::drawElementsInstanced(GLenum primitiveType,
@@ -367,6 +385,21 @@ void QGraphicsHelperES2::bindUniform(const QVariant &v, const ShaderUniform &des
break;
}
+ // ES 3.0+
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ if (m_isES3) {
+ Q_ASSERT(description.m_size == 1);
+ m_funcs->glUniform1i(description.m_location, v.toInt());
+ } else {
+ qWarning() << Q_FUNC_INFO << "ES 3.0 uniform type" << description.m_type << "for"
+ << description.m_name << "is not supported in ES 2.0";
+ }
+ break;
+
default:
qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name;
break;
diff --git a/src/render/backend/qgraphicshelperes2_p.h b/src/render/backend/qgraphicshelperes2_p.h
index 7cd58a016..200242578 100644
--- a/src/render/backend/qgraphicshelperes2_p.h
+++ b/src/render/backend/qgraphicshelperes2_p.h
@@ -89,6 +89,7 @@ public:
private:
QOpenGLFunctions *m_funcs;
+ bool m_isES3;
};
} // Render
diff --git a/src/render/backend/qgraphicshelpergl3.cpp b/src/render/backend/qgraphicshelpergl3.cpp
index a2dbb0e4d..24c2d9d64 100644
--- a/src/render/backend/qgraphicshelpergl3.cpp
+++ b/src/render/backend/qgraphicshelpergl3.cpp
@@ -248,10 +248,8 @@ void QGraphicsHelperGL3::disableAlphaCoverage()
GLuint QGraphicsHelperGL3::createFrameBufferObject()
{
- qDebug() << Q_FUNC_INFO;
GLuint id;
m_funcs->glGenFramebuffers(1, &id);
- qDebug() << Q_FUNC_INFO << id;
return id;
}
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp
index 7ad3813ce..e512bda1b 100644
--- a/src/render/backend/renderer.cpp
+++ b/src/render/backend/renderer.cpp
@@ -593,8 +593,11 @@ void Renderer::submitRenderViews(int maxFrameCount)
continue;
// Bail out if we cannot make the OpenGL context current (e.g. if the window has been destroyed)
- if (!m_graphicsContext->beginDrawing(m_surface, renderViews.first()->clearColor()))
+ if (!m_graphicsContext->beginDrawing(m_surface, renderViews.first()->clearColor())) {
+ qDeleteAll(renderViews);
+ m_renderQueues->popFrameQueue();
break;
+ }
if (!defaultFboIdValid) {
defaultFboIdValid = true;
diff --git a/src/render/frontend/qcylindermesh.cpp b/src/render/frontend/qcylindermesh.cpp
index 166b56d72..5c93a8234 100644
--- a/src/render/frontend/qcylindermesh.cpp
+++ b/src/render/frontend/qcylindermesh.cpp
@@ -45,7 +45,7 @@
#include "qmeshdata.h"
#include <Qt3DRenderer/private/qabstractmesh_p.h>
-#include <cmath>
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -212,8 +212,8 @@ void createSides(float *&verticesPtr, quint16 *&indicesPtr,
for (int slice = 0; slice <= slices; slice++) {
const float theta = static_cast<float>(slice) * dTheta;
- const float ct = cos(theta);
- const float st = sin(theta);
+ const float ct = qCos(theta);
+ const float st = qSin(theta);
*verticesPtr++ = radius * ct;
*verticesPtr++ = y;
@@ -264,8 +264,8 @@ void createDisc(float *&verticesPtr, quint16 *&indicesPtr,
for (int slice = 0; slice <= slices; slice++) {
const float theta = static_cast<float>(slice) * dTheta;
- const float ct = cos(theta);
- const float st = sin(theta);
+ const float ct = qCos(theta);
+ const float st = qSin(theta);
*verticesPtr++ = radius * ct;
*verticesPtr++ = yPosition;
diff --git a/src/render/frontend/qopenglfilter.cpp b/src/render/frontend/qopenglfilter.cpp
index f690c96a8..b4b16981d 100644
--- a/src/render/frontend/qopenglfilter.cpp
+++ b/src/render/frontend/qopenglfilter.cpp
@@ -36,6 +36,7 @@
#include "qopenglfilter.h"
#include "private/qobject_p.h"
+#include <QOpenGLContext>
QT_BEGIN_NAMESPACE
@@ -47,8 +48,8 @@ public:
QOpenGLFilterPrivate(QOpenGLFilter *qq)
: QObjectPrivate()
- , m_api(QOpenGLFilter::Desktop)
- , m_profile(QOpenGLFilter::Compatibility)
+ , m_api(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL ? QOpenGLFilter::Desktop : QOpenGLFilter::ES)
+ , m_profile(QOpenGLFilter::None) // matches all (no profile, core, compat)
, m_minor(0)
, m_major(0)
{
diff --git a/src/render/frontend/qspheremesh.cpp b/src/render/frontend/qspheremesh.cpp
index 7f739fa68..0ede65d43 100644
--- a/src/render/frontend/qspheremesh.cpp
+++ b/src/render/frontend/qspheremesh.cpp
@@ -46,7 +46,7 @@
#include "qmeshdata.h"
#include <private/qabstractmesh_p.h>
-#include <cmath>
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -191,16 +191,16 @@ QMeshDataPtr createSphereMesh(double radius, int rings, int slices, bool hasTang
for ( int lat = 0; lat < rings + 1; ++lat )
{
const float phi = M_PI_2 - static_cast<float>( lat ) * dPhi;
- const float cosPhi = cosf( phi );
- const float sinPhi = sinf( phi );
+ const float cosPhi = qCos( phi );
+ const float sinPhi = qSin( phi );
const float v = 1.0f - static_cast<float>( lat ) * dv;
// Iterate over longitudes (slices)
for ( int lon = 0; lon < slices + 1; ++lon )
{
const float theta = static_cast<float>( lon ) * dTheta;
- const float cosTheta = cosf( theta );
- const float sinTheta = sinf( theta );
+ const float cosTheta = qCos( theta );
+ const float sinTheta = qSin( theta );
const float u = static_cast<float>( lon ) * du;
*fptr++ = radius * cosTheta * cosPhi;
diff --git a/src/render/frontend/qtorusmesh.cpp b/src/render/frontend/qtorusmesh.cpp
index b45c0958e..09b4e2a54 100644
--- a/src/render/frontend/qtorusmesh.cpp
+++ b/src/render/frontend/qtorusmesh.cpp
@@ -45,7 +45,7 @@
#include "qmeshdata.h"
#include <Qt3DRenderer/private/qabstractmesh_p.h>
-#include <cmath>
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -182,14 +182,14 @@ QMeshDataPtr createTorusMesh(double radius, double minorRadius,
for ( int ring = 0; ring <= rings; ring++ )
{
float u = ring * ringFactor;
- float cu = cos( u );
- float su = sin( u );
+ float cu = qCos( u );
+ float su = qSin( u );
for ( int side = 0; side < sides; side++ )
{
float v = side * sideFactor;
- float cv = cos( v );
- float sv = sin( v );
+ float cv = qCos( v );
+ float sv = qSin( v );
float r = ( radius + minorRadius * cv );
*fptr++ = r * cu;
diff --git a/src/src.pro b/src/src.pro
index e67902fd2..f92a99dba 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -7,14 +7,6 @@ src_render.subdir = $$PWD/render
src_render.target = sub-render
src_render.depends = src_core
-src_bulletphysics.subdir = $$PWD/bulletphysics
-src_bulletphysics.target = sub-bulletphysics
-src_bulletphysics.depends = src_core
-
-src_openal.subdir = $$PWD/openal
-src_openal.target = sub-openal
-src_openal.depends = src_core
-
src_input.subdir = $$PWD/input
src_input.target = sub-input
src_input.depends = src_render
@@ -42,10 +34,6 @@ src_quick3d_imports_scene3d.file = $$PWD/quick3d/imports/scene3d/importsscene3d.
src_quick3d_imports_scene3d.target = sub-quick3d-imports-scene3d
src_quick3d_imports_scene3d.depends = src_quick3d_render src_input
-src_quick3d_imports_bulletphysics.file = $$PWD/quick3d/imports/bulletphysics/importsbulletphysics.pro
-src_quick3d_imports_bulletphysics.target = sub-quick3d-imports-bulletphysics
-src_quick3d_imports_bulletphysics.depends = src_bulletphysics
-
src_quick3d_imports_input.file = $$PWD/quick3d/imports/input/importsinputs.pro
src_quick3d_imports_input.target = sub-quick3d-imports-input
src_quick3d_imports_input.depends = src_input
@@ -59,7 +47,6 @@ SUBDIRS += \
src_core \
src_render \
src_input \
- src_openal \
src_quick3d_core \
src_quick3d_core_imports \
src_quick3d_render \
@@ -68,10 +55,4 @@ SUBDIRS += \
src_quick3d_imports_input \
src_plugins_sceneparsers
-config_bullet {
- SUBDIRS += \
- src_bulletphysics \
- src_quick3d_imports_bulletphysics
-}
-
diff --git a/sync.profile b/sync.profile
index 9b41a074d..4d9163f2b 100644
--- a/sync.profile
+++ b/sync.profile
@@ -3,9 +3,6 @@
"Qt3DRenderer" => "$basedir/src/render",
"Qt3DQuick" => "$basedir/src/quick3d/quick3d",
"Qt3DQuickRenderer" => "$basedir/src/quick3d/quick3drenderer",
- "Qt3DOpenAL" => "$basedir/src/openal",
- "Qt3DBulletPhysics" => "$basedir/src/bulletphysics",
- "Qt3DQuickBulletPhysics" => "$basedir/src/quick3d/quick3dbulletphysics",
"Qt3DInput" => "$basedir/src/input",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
diff --git a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
index 55b0ace9a..99331e0c7 100644
--- a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
+++ b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
@@ -34,7 +34,7 @@
**
****************************************************************************/
-#include <QtTest/QtTest>
+#include <QtTest/QTest>
#include <Qt3DCore/private/qobserverinterface_p.h>
#include <Qt3DCore/private/qobservableinterface_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
@@ -43,15 +43,17 @@
#include <Qt3DCore/qbackendscenepropertychange.h>
#include <Qt3DCore/qscene.h>
#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qbackendnode.h>
#include <Qt3DCore/qsceneobserverinterface.h>
#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include <QThread>
+#include <QWaitCondition>
class tst_QChangeArbiter : public QObject
{
Q_OBJECT
-public:
-#if 0
private slots:
void registerObservers();
void registerSceneObserver();
@@ -59,10 +61,8 @@ private slots:
void unregisterSceneObservers();
void distributeFrontendChanges();
void distributeBackendChanges();
-#endif
};
-#if 0
class tst_Node : public Qt3D::QNode
{
public:
@@ -72,50 +72,43 @@ public:
void sendNodeAddedNotification()
{
Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::NodeAdded, this));
- e->setPropertyName(QByteArrayLiteral("NodeAdded"));
-// d_func()->notifyObservers(e);
+ e->setPropertyName("NodeAdded");
+ Qt3D::QNodePrivate::get(this)->notifyObservers(e);
}
void sendNodeRemovedNotification()
{
Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::NodeRemoved, this));
- e->setPropertyName(QByteArrayLiteral("NodeRemoved"));
-// d->notifyObservers(e);
+ e->setPropertyName("NodeRemoved");
+ Qt3D::QNodePrivate::get(this)->notifyObservers(e);
}
void sendNodeUpdatedNotification()
{
Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::NodeUpdated, this));
- e->setPropertyName(QByteArrayLiteral("NodeUpdated"));
-// d->notifyObservers(e);
+ e->setPropertyName("NodeUpdated");
+ Qt3D::QNodePrivate::get(this)->notifyObservers(e);
}
void sendComponentAddedNotification()
{
Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::ComponentAdded, this));
- e->setPropertyName(QByteArrayLiteral("ComponentAdded"));
-// d->notifyObservers(e);
+ e->setPropertyName("ComponentAdded");
+ Qt3D::QNodePrivate::get(this)->notifyObservers(e);
}
void sendComponentRemovedNotification()
{
Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::ComponentRemoved, this));
- e->setPropertyName(QByteArrayLiteral("ComponentRemoved"));
-// d->notifyObservers(e);
- }
-
- void sendComponentUpdatedNotification()
- {
- Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::ComponentUpdated, this));
- e->setPropertyName(QByteArrayLiteral("ComponentUpdated"));
-// d->notifyObservers(e);
+ e->setPropertyName("ComponentRemoved");
+ Qt3D::QNodePrivate::get(this)->notifyObservers(e);
}
void sendAllChangesNotification()
{
Qt3D::QScenePropertyChangePtr e(new Qt3D::QScenePropertyChange(Qt3D::AllChanges, this));
- e->setPropertyName(QByteArrayLiteral("AllChanges"));
-// d->notifyObservers(e);
+ e->setPropertyName("AllChanges");
+ Qt3D::QNodePrivate::get(this)->notifyObservers(e);
}
void sceneChangeEvent(const Qt3D::QSceneChangePtr &change) Q_DECL_OVERRIDE
@@ -176,11 +169,15 @@ private:
QList<Qt3D::QSceneChangePtr> m_lastChanges;
};
-class tst_ObserverObservable : public Qt3D::QObservableInterface, public Qt3D::QObserverInterface
+class tst_BackendObserverObservable : public Qt3D::QBackendNode
{
public:
- tst_ObserverObservable() : m_arbiter(Q_NULLPTR)
+ tst_BackendObserverObservable()
+ : Qt3D::QBackendNode(ReadWrite)
+ {}
+
+ void updateFromPeer(Qt3D::QNode *) Q_DECL_OVERRIDE
{}
// QObserverInterface interface
@@ -188,23 +185,18 @@ public:
{
QVERIFY(!e.isNull());
m_lastChanges << e;
- // Sends reply to frontend
- Qt3D::QBackendScenePropertyChangePtr change(new Qt3D::QBackendScenePropertyChange(Qt3D::NodeUpdated, this));
- change->setTargetNode(e->subject().m_node->id());
- change->setPropertyName(QByteArrayLiteral("Reply"));
- notifyObservers(change);
+ // Save reply to be sent to the frontend
+ m_reply.reset(new Qt3D::QBackendScenePropertyChange(Qt3D::NodeUpdated, this));
+ m_reply->setTargetNode(e->subject().m_node->id());
+ m_reply->setPropertyName("Reply");
}
- // QObservableInterface interface
- void registerObserver(Qt3D::QObserverInterface *observer) Q_DECL_OVERRIDE
+ // should be called in thread
+ void sendReply()
{
- m_arbiter = dynamic_cast<Qt3D::QChangeArbiter *>(observer);
- QVERIFY(m_arbiter != Q_NULLPTR);
- }
-
- void unregisterObserver(Qt3D::QObserverInterface *observer) Q_DECL_OVERRIDE
- {
- QVERIFY(m_arbiter == observer);
+ QVERIFY(!m_reply.isNull());
+ notifyObservers(m_reply);
+ qDebug() << Q_FUNC_INFO;
}
Qt3D::QSceneChangePtr lastChange() const
@@ -219,17 +211,40 @@ public:
return m_lastChanges;
}
-protected:
- void notifyObservers(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE
+private:
+ QList<Qt3D::QSceneChangePtr> m_lastChanges;
+ Qt3D::QBackendScenePropertyChangePtr m_reply;
+
+};
+
+QWaitCondition waitingForBackendReplyCondition;
+
+class ThreadedAnswer : public QThread
+{
+ Q_OBJECT
+public:
+ ThreadedAnswer(Qt3D::QChangeArbiter *arbiter, tst_BackendObserverObservable *backend)
+ : QThread()
+ , m_arbiter(arbiter)
+ , m_backendObs(backend)
+ {}
+
+ void run() Q_DECL_OVERRIDE
{
- QVERIFY(m_arbiter != Q_NULLPTR);
- m_arbiter->sceneChangeEventWithLock(e);
+ // create backend change queue on QChangeArbiter
+ Qt3D::QChangeArbiter::createThreadLocalChangeQueue(m_arbiter);
+ m_backendObs->sendReply();
+ // gives time for other threads to start waiting
+ QThread::currentThread()->sleep(1);
+ // wake waiting condition
+ waitingForBackendReplyCondition.wakeOne();
+ exec();
}
private:
Qt3D::QChangeArbiter *m_arbiter;
- QList<Qt3D::QSceneChangePtr> m_lastChanges;
-
+ tst_BackendObserverObservable *m_backendObs;
+ QWaitCondition m_waitingForReplyToBeSent;
};
class tst_PostManObserver : public Qt3D::QObserverInterface
@@ -251,12 +266,25 @@ public:
Qt3D::QBackendScenePropertyChangePtr change = qSharedPointerDynamicCast<Qt3D::QBackendScenePropertyChange>(e);
QVERIFY(!change.isNull());
Qt3D::QNode *targetNode = m_sceneInterface->lookupNode(change->targetNode());
-// if (targetNode != Q_NULLPTR)
-// targetNode->sceneChangeEvent(e);
+ QVERIFY(targetNode != Q_NULLPTR);
+ m_lastChanges << e;
+ }
+
+ Qt3D::QSceneChangePtr lastChange() const
+ {
+ if (m_lastChanges.isEmpty())
+ return Qt3D::QSceneChangePtr();
+ return m_lastChanges.last();
+ }
+
+ QList<Qt3D::QSceneChangePtr> lastChanges() const
+ {
+ return m_lastChanges;
}
private:
Qt3D::QSceneInterface *m_sceneInterface;
+ QList<Qt3D::QSceneChangePtr> m_lastChanges;
};
class tst_SceneObserver : public Qt3D::QSceneObserverInterface
@@ -298,12 +326,12 @@ void tst_QChangeArbiter::registerObservers()
arbiter->setPostman(new tst_PostManObserver());
arbiter->setScene(scene);
scene->setArbiter(arbiter);
- // Replace initialize as we have not JobManager in this case
+ // Replaces initialize as we have no JobManager in this case
Qt3D::QChangeArbiter::createThreadLocalChangeQueue(arbiter);
Qt3D::QNode *root = new tst_Node();
Qt3D::QNode *child = new tst_Node();
- root->setScene(scene);
+ Qt3D::QNodePrivate::get(root)->setScene(scene);
scene->addObservable(root);
QList<tst_SimpleObserver *> observers;
@@ -318,13 +346,14 @@ void tst_QChangeArbiter::registerObservers()
Q_FOREACH (tst_SimpleObserver *o, observers)
QVERIFY(o->lastChange().isNull());
- root->addChild(child);
-
+ child->setParent(root);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
QVERIFY(o->lastChange()->type() == Qt3D::NodeCreated);
}
+
+ Qt3D::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter);
}
void tst_QChangeArbiter::registerSceneObserver()
@@ -334,12 +363,12 @@ void tst_QChangeArbiter::registerSceneObserver()
arbiter->setPostman(new tst_PostManObserver());
arbiter->setScene(scene);
scene->setArbiter(arbiter);
- // Replace initialize as we have not JobManager in this case
+ // Replace initialize as we have no JobManager in this case
Qt3D::QChangeArbiter::createThreadLocalChangeQueue(arbiter);
tst_Node *root = new tst_Node();
Qt3D::QNode *child = new tst_Node();
- root->setScene(scene);
+ Qt3D::QNodePrivate::get(root)->setScene(scene);
scene->addObservable(root);
QList<tst_SimpleObserver *> observers;
@@ -363,7 +392,7 @@ void tst_QChangeArbiter::registerSceneObserver()
Q_FOREACH (tst_SceneObserver *s, sceneObservers)
QVERIFY(s->lastChange().isNull());
- root->addChild(child);
+ child->setParent(root);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
@@ -386,6 +415,8 @@ void tst_QChangeArbiter::registerSceneObserver()
QVERIFY(!s->lastChange().isNull());
QVERIFY(s->lastChange()->type() == Qt3D::NodeCreated);
}
+
+ Qt3D::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter);
}
void tst_QChangeArbiter::unregisterObservers()
@@ -395,12 +426,12 @@ void tst_QChangeArbiter::unregisterObservers()
arbiter->setPostman(new tst_PostManObserver());
arbiter->setScene(scene);
scene->setArbiter(arbiter);
- // Replace initialize as we have not JobManager in this case
+ // Replace initialize as we have no JobManager in this case
Qt3D::QChangeArbiter::createThreadLocalChangeQueue(arbiter);
tst_Node *root = new tst_Node();
Qt3D::QNode *child = new tst_Node();
- root->setScene(scene);
+ Qt3D::QNodePrivate::get(root)->setScene(scene);
scene->addObservable(root);
QList<tst_SimpleObserver *> observers;
@@ -415,7 +446,7 @@ void tst_QChangeArbiter::unregisterObservers()
Q_FOREACH (tst_SimpleObserver *o, observers)
QVERIFY(o->lastChange().isNull());
- root->addChild(child);
+ child->setParent(root);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
@@ -433,6 +464,8 @@ void tst_QChangeArbiter::unregisterObservers()
QVERIFY(!o->lastChange().isNull());
QVERIFY(o->lastChange()->type() == Qt3D::NodeCreated);
}
+
+ Qt3D::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter);
}
void tst_QChangeArbiter::unregisterSceneObservers()
@@ -442,12 +475,12 @@ void tst_QChangeArbiter::unregisterSceneObservers()
arbiter->setPostman(new tst_PostManObserver());
arbiter->setScene(scene);
scene->setArbiter(arbiter);
- // Replace initialize as we have not JobManager in this case
+ // Replace initialize as we have no JobManager in this case
Qt3D::QChangeArbiter::createThreadLocalChangeQueue(arbiter);
tst_Node *root = new tst_Node();
Qt3D::QNode *child = new tst_Node();
- root->setScene(scene);
+ Qt3D::QNodePrivate::get(root)->setScene(scene);
scene->addObservable(root);
QList<tst_SimpleObserver *> observers;
@@ -471,7 +504,7 @@ void tst_QChangeArbiter::unregisterSceneObservers()
Q_FOREACH (tst_SceneObserver *s, sceneObservers)
QVERIFY(s->lastChange().isNull());
- root->addChild(child);
+ child->setParent(root);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
@@ -495,7 +528,7 @@ void tst_QChangeArbiter::unregisterSceneObservers()
QVERIFY(s->lastChange()->type() == Qt3D::NodeCreated);
}
- root->removeAllChildren();
+ child->setParent(Q_NULLPTR);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
@@ -510,7 +543,7 @@ void tst_QChangeArbiter::unregisterSceneObservers()
Q_FOREACH (tst_SceneObserver *s, sceneObservers)
arbiter->unregisterSceneObserver(s);
- root->addChild(child);
+ child->setParent(root);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
@@ -521,6 +554,8 @@ void tst_QChangeArbiter::unregisterSceneObservers()
QVERIFY(!s->lastChange().isNull());
QVERIFY(s->lastChange()->type() == Qt3D::NodeAboutToBeDeleted);
}
+
+ Qt3D::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter);
}
void tst_QChangeArbiter::distributeFrontendChanges()
@@ -530,11 +565,11 @@ void tst_QChangeArbiter::distributeFrontendChanges()
arbiter->setPostman(new tst_PostManObserver());
arbiter->setScene(scene);
scene->setArbiter(arbiter);
- // Replace initialize as we have not JobManager in this case
+ // Replace initialize as we have no JobManager in this case
Qt3D::QChangeArbiter::createThreadLocalChangeQueue(arbiter);
tst_Node *root = new tst_Node();
- root->setScene(scene);
+ Qt3D::QNodePrivate::get(root)->setScene(scene);
scene->addObservable(root);
tst_SimpleObserver *backendAllChangedObserver = new tst_SimpleObserver();
@@ -542,7 +577,6 @@ void tst_QChangeArbiter::distributeFrontendChanges()
tst_SimpleObserver *backendNodeRemovedObserver = new tst_SimpleObserver();
tst_SimpleObserver *backendNodeUpdatedObserver = new tst_SimpleObserver();
tst_SimpleObserver *backendComponentAddedObserver = new tst_SimpleObserver();
- tst_SimpleObserver *backendComponentUpdatedObserver = new tst_SimpleObserver();
tst_SimpleObserver *backendComponentRemovedObserver = new tst_SimpleObserver();
arbiter->registerObserver(backendAllChangedObserver, root->id());
@@ -550,7 +584,6 @@ void tst_QChangeArbiter::distributeFrontendChanges()
arbiter->registerObserver(backendNodeUpdatedObserver, root->id(), Qt3D::NodeUpdated);
arbiter->registerObserver(backendNodeRemovedObserver, root->id(), Qt3D::NodeRemoved);
arbiter->registerObserver(backendComponentAddedObserver, root->id(), Qt3D::ComponentAdded);
- arbiter->registerObserver(backendComponentUpdatedObserver, root->id(), Qt3D::ComponentUpdated);
arbiter->registerObserver(backendComponentRemovedObserver, root->id(), Qt3D::ComponentRemoved);
arbiter->syncChanges();
@@ -560,7 +593,6 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QVERIFY(backendNodeUpdatedObserver->lastChange().isNull());
QVERIFY(backendNodeRemovedObserver->lastChange().isNull());
QVERIFY(backendComponentAddedObserver->lastChange().isNull());
- QVERIFY(backendComponentUpdatedObserver->lastChange().isNull());
QVERIFY(backendComponentRemovedObserver->lastChange().isNull());
root->sendNodeAddedNotification();
@@ -571,7 +603,6 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 0);
QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 0);
QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 0);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 0);
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
root->sendNodeUpdatedNotification();
@@ -582,7 +613,6 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1);
QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 0);
QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 0);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 0);
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
@@ -594,7 +624,6 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1);
QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1);
QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 0);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 0);
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
root->sendComponentAddedNotification();
@@ -605,41 +634,30 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1);
QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1);
QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 1);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 0);
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
- root->sendComponentUpdatedNotification();
- arbiter->syncChanges();
-
- QCOMPARE(backendAllChangedObserver->lastChanges().count(), 5);
- QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1);
- QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1);
- QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1);
- QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 1);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 1);
- QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
root->sendComponentRemovedNotification();
arbiter->syncChanges();
- QCOMPARE(backendAllChangedObserver->lastChanges().count(), 6);
+ QCOMPARE(backendAllChangedObserver->lastChanges().count(), 5);
QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1);
QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1);
QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1);
QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 1);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 1);
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 1);
root->sendAllChangesNotification();
arbiter->syncChanges();
- QCOMPARE(backendAllChangedObserver->lastChanges().count(), 7);
+ QCOMPARE(backendAllChangedObserver->lastChanges().count(), 6);
QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 2);
QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 2);
QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 2);
QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 2);
- QCOMPARE(backendComponentUpdatedObserver->lastChanges().count(), 2);
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 2);
+
+ Qt3D::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter);
}
void tst_QChangeArbiter::distributeBackendChanges()
@@ -647,44 +665,72 @@ void tst_QChangeArbiter::distributeBackendChanges()
Qt3D::QChangeArbiter *arbiter = new Qt3D::QChangeArbiter();
Qt3D::QScene *scene = new Qt3D::QScene();
tst_PostManObserver *postMan = new tst_PostManObserver();
+ // In order for backend -> frontend changes to work properly,
+ // the backend notification should only be sent
+ // from a worker thread which has a dedicated ChangeQueue in the
+ // ChangeArbiter different than the frontend ChangeQueue. In this
+ // test we will only check that the backend has received the frontend notification
arbiter->setPostman(postMan);
arbiter->setScene(scene);
scene->setArbiter(arbiter);
postMan->setScene(scene);
- // Replace initialize as we have not JobManager in this case
+ // Replace initialize as we have no JobManager in this case
Qt3D::QChangeArbiter::createThreadLocalChangeQueue(arbiter);
tst_Node *root = new tst_Node();
- root->setScene(scene);
+ Qt3D::QNodePrivate::get(root)->setScene(scene);
scene->addObservable(root);
- tst_ObserverObservable *backenObserverObservable = new tst_ObserverObservable();
- arbiter->registerObserver(backenObserverObservable, root->id());
- arbiter->scene()->addObservable(backenObserverObservable, root->id());
+ tst_BackendObserverObservable *backenObserverObservable = new tst_BackendObserverObservable();
+ arbiter->registerObserver(Qt3D::QBackendNodePrivate::get(backenObserverObservable), root->id());
+ arbiter->scene()->addObservable(Qt3D::QBackendNodePrivate::get(backenObserverObservable), root->id());
+ Qt3D::QBackendNodePrivate::get(backenObserverObservable)->setArbiter(arbiter);
arbiter->syncChanges();
QVERIFY(root->lastChange().isNull());
QVERIFY(backenObserverObservable->lastChange().isNull());
+ QCOMPARE(backenObserverObservable->lastChanges().count(), 0);
root->sendAllChangesNotification();
arbiter->syncChanges();
+ // backend observer receives event from frontend node "root"
QCOMPARE(root->lastChanges().count(), 0);
+ QCOMPARE(postMan->lastChanges().count(), 0);
QCOMPARE(backenObserverObservable->lastChanges().count(), 1);
- // To send backendObservableReply
+ // simulate a worker thread
+ QScopedPointer<ThreadedAnswer> answer(new ThreadedAnswer(arbiter, backenObserverObservable));
+
+ QMutex mutex;
+ // sends reply from another thread (simulates job thread)
+ answer->start();
+ mutex.lock();
+ waitingForBackendReplyCondition.wait(&mutex);
+ mutex.unlock();
+
+ // To verify that backendObserver sent a reply
arbiter->syncChanges();
- QCOMPARE(root->lastChanges().count(), 1);
+
+ // the repliers should receive it's reply
QCOMPARE(backenObserverObservable->lastChanges().count(), 2);
- Qt3D::QBackendScenePropertyChangePtr c = qSharedPointerDynamicCast<Qt3D::QBackendScenePropertyChange>(root->lastChange());
+ // verify that postMan has received the change
+ QCOMPARE(postMan->lastChanges().count(), 1);
+
+ // verify correctness of the reply
+ Qt3D::QBackendScenePropertyChangePtr c = qSharedPointerDynamicCast<Qt3D::QBackendScenePropertyChange>(postMan->lastChange());
QVERIFY(!c.isNull());
QVERIFY(c->targetNode() == root->id());
- QVERIFY(c->propertyName() == QByteArrayLiteral("Reply"));
+ qDebug() << c->propertyName();
+ QVERIFY(strcmp(c->propertyName(), "Reply") == 0);
QVERIFY(c->type() == Qt3D::NodeUpdated);
+
+ answer->exit();
+ answer->wait();
+ Qt3D::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter);
}
-#endif
-QTEST_APPLESS_MAIN(tst_QChangeArbiter)
+QTEST_GUILESS_MAIN(tst_QChangeArbiter)
#include "tst_qchangearbiter.moc"