1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #include <Qt3DCore/private/qpostman_p.h> |
30 | #include <Qt3DCore/private/qchangearbiter_p.h> |
31 | |
32 | QT_BEGIN_NAMESPACE |
33 | |
34 | namespace Qt3DCore { |
35 | class QNode; |
36 | } // Qt3D |
37 | |
38 | class TestArbiter; |
39 | |
40 | class TestPostman : public Qt3DCore::QAbstractPostman |
41 | { |
42 | public: |
43 | explicit TestPostman(TestArbiter *arbiter); |
44 | void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) final; |
45 | void setScene(Qt3DCore::QScene *) final; |
46 | void notifyBackend(const Qt3DCore::QSceneChangePtr &e) final; |
47 | bool shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &e) final; |
48 | |
49 | private: |
50 | TestArbiter *m_arbiter; |
51 | }; |
52 | |
53 | class TestArbiter : public Qt3DCore::QAbstractArbiter |
54 | { |
55 | public: |
56 | TestArbiter(); |
57 | ~TestArbiter(); |
58 | |
59 | void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) final; |
60 | |
61 | void sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) final; |
62 | |
63 | void sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) final; |
64 | |
65 | Qt3DCore::QAbstractPostman *postman() const final; |
66 | |
67 | QVector<Qt3DCore::QSceneChangePtr> events; |
68 | QVector<Qt3DCore::QNode *> dirtyNodes; |
69 | QVector<Qt3DCore::NodeRelationshipChange> dirtySubNodes; |
70 | |
71 | void setArbiterOnNode(Qt3DCore::QNode *node); |
72 | void addDirtyFrontEndNode(Qt3DCore::QNode *node) final; |
73 | QT_WARNING_PUSH |
74 | QT_WARNING_DISABLE_DEPRECATED |
75 | void addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) final; |
76 | QT_WARNING_POP |
77 | void removeDirtyFrontEndNode(Qt3DCore::QNode *node) final; |
78 | |
79 | private: |
80 | TestPostman *m_postman; |
81 | }; |
82 | |
83 | QT_END_NAMESPACE |
84 | |