1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DCORE_QCHANGEARBITER_P_H |
5 | #define QT3DCORE_QCHANGEARBITER_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DCore/qnodeid.h> |
19 | #include <QtCore/QFlags> |
20 | #include <QtCore/QList> |
21 | #include <QtCore/QMutex> |
22 | #include <QtCore/QObject> |
23 | #include <QtCore/QPair> |
24 | #include <QtCore/QReadWriteLock> |
25 | #include <QtCore/QThreadStorage> |
26 | #include <QtCore/QVariant> |
27 | |
28 | #include <Qt3DCore/private/qt3dcore_global_p.h> |
29 | |
30 | QT_BEGIN_NAMESPACE |
31 | |
32 | namespace Qt3DCore { |
33 | |
34 | class QNode; |
35 | class QObservableInterface; |
36 | class QAbstractAspectJobManager; |
37 | class QSceneObserverInterface; |
38 | class QAbstractPostman; |
39 | class QScene; |
40 | class QEntity; |
41 | class QComponent; |
42 | |
43 | struct ComponentRelationshipChange |
44 | { |
45 | QNode *node; |
46 | QNode *subNode; |
47 | |
48 | enum RelationShip { |
49 | Added = 0, |
50 | Removed |
51 | }; |
52 | RelationShip change; |
53 | }; |
54 | |
55 | class Q_3DCORE_PRIVATE_EXPORT QChangeArbiter |
56 | : public QObject |
57 | { |
58 | Q_OBJECT |
59 | public: |
60 | explicit QChangeArbiter(QObject *parent = nullptr); |
61 | ~QChangeArbiter(); |
62 | |
63 | void addDirtyFrontEndNode(QNode *node); |
64 | void addDirtyEntityComponentNodes(QEntity *entity, QComponent *component, |
65 | ComponentRelationshipChange::RelationShip change); |
66 | |
67 | void removeDirtyFrontEndNode(QNode *node); |
68 | QList<QNode *> takeDirtyFrontEndNodes(); |
69 | QList<ComponentRelationshipChange> takeDirtyEntityComponentNodes(); |
70 | |
71 | void setScene(Qt3DCore::QScene *scene); |
72 | |
73 | QScene *scene() const; |
74 | |
75 | Q_SIGNALS: |
76 | void receivedChange(); |
77 | |
78 | protected: |
79 | QScene *m_scene; |
80 | QList<QNode *> m_dirtyFrontEndNodes; |
81 | QList<ComponentRelationshipChange> m_dirtyEntityComponentNodeChanges; |
82 | }; |
83 | |
84 | } // namespace Qt3DCore |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #endif // QT3DCORE_QCHANGEARBITER_P_H |
89 | |