53 // We mean it. |
53 // We mean it. |
54 // |
54 // |
55 |
55 |
56 #include <qabstractvideosurface.h> |
56 #include <qabstractvideosurface.h> |
57 #include <qvideosurfaceformat.h> |
57 #include <qvideosurfaceformat.h> |
58 #include <QtCore/private/qobject_p.h> |
58 |
|
59 #include <QtCore/qobject.h> |
|
60 #include <QtCore/qpointer.h> |
|
61 #include <QtCore/qcoreevent.h> |
|
62 #include <QtCore/qlist.h> |
|
63 #include <QtCore/qvector.h> |
|
64 #include <QtCore/qreadwritelock.h> |
|
65 #include <QtCore/qvariant.h> |
59 |
66 |
60 QT_BEGIN_NAMESPACE |
67 QT_BEGIN_NAMESPACE |
|
68 |
|
69 #ifndef QOBJECT_P_H |
|
70 #if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) |
|
71 |
|
72 class QVariant; |
|
73 class QThreadData; |
|
74 class QObjectConnectionListVector; |
|
75 namespace QtSharedPointer { struct ExternalRefCountData; } |
|
76 |
|
77 enum { QObjectPrivateVersion = QT_VERSION }; |
|
78 |
|
79 class QAbstractDeclarativeData; |
|
80 |
|
81 class Q_CORE_EXPORT QObjectPrivate : public QObjectData |
|
82 { |
|
83 Q_DECLARE_PUBLIC(QObject) |
|
84 |
|
85 public: |
|
86 struct ExtraData; |
|
87 struct Connection; |
|
88 // ConnectionList is a singly-linked list |
|
89 struct ConnectionList; |
|
90 struct Sender; |
|
91 |
|
92 QObjectPrivate(int version = QObjectPrivateVersion); |
|
93 virtual ~QObjectPrivate(); |
|
94 void deleteChildren(); |
|
95 |
|
96 void setParent_helper(QObject *); |
|
97 void moveToThread_helper(); |
|
98 void setThreadData_helper(QThreadData *currentData, QThreadData *targetData); |
|
99 void _q_reregisterTimers(void *pointer); |
|
100 |
|
101 bool isSender(const QObject *receiver, const char *signal) const; |
|
102 QObjectList receiverList(const char *signal) const; |
|
103 QObjectList senderList() const; |
|
104 |
|
105 void addConnection(int signal, Connection *c); |
|
106 void cleanConnectionLists(); |
|
107 |
|
108 #ifdef QT3_SUPPORT |
|
109 void sendPendingChildInsertedEvents(); |
|
110 void removePendingChildInsertedEvents(QObject *child); |
|
111 #endif |
|
112 |
|
113 static inline Sender *setCurrentSender(QObject *receiver, |
|
114 Sender *sender); |
|
115 static inline void resetCurrentSender(QObject *receiver, |
|
116 Sender *currentSender, |
|
117 Sender *previousSender); |
|
118 static int *setDeleteWatch(QObjectPrivate *d, int *newWatch); |
|
119 static void resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch); |
|
120 static void clearGuards(QObject *); |
|
121 |
|
122 static QObjectPrivate *get(QObject *o) { |
|
123 return o->d_func(); |
|
124 } |
|
125 |
|
126 int signalIndex(const char *signalName) const; |
|
127 inline bool isSignalConnected(uint signalIdx) const; |
|
128 |
|
129 public: |
|
130 QString objectName; |
|
131 ExtraData *extraData; // extra data set by the user |
|
132 QThreadData *threadData; // id of the thread that owns the object |
|
133 |
|
134 QObjectConnectionListVector *connectionLists; |
|
135 |
|
136 Connection *senders; // linked list of connections connected to this object |
|
137 Sender *currentSender; // object currently activating the object |
|
138 mutable quint32 connectedSignals[2]; |
|
139 |
|
140 #ifdef QT3_SUPPORT |
|
141 QList<QObject *> pendingChildInsertedEvents; |
|
142 #else |
|
143 // preserve binary compatibility with code compiled without Qt 3 support |
|
144 // keeping the binary layout stable helps the Qt Creator debugger |
|
145 void *unused; |
|
146 #endif |
|
147 |
|
148 QList<QPointer<QObject> > eventFilters; |
|
149 union { |
|
150 QObject *currentChildBeingDeleted; |
|
151 QAbstractDeclarativeData *declarativeData; //extra data used by the declarative module |
|
152 }; |
|
153 |
|
154 // these objects are all used to indicate that a QObject was deleted |
|
155 // plus QPointer, which keeps a separate list |
|
156 QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount; |
|
157 int *deleteWatch; |
|
158 }; |
|
159 |
|
160 #elif (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)) |
|
161 |
|
162 class QVariant; |
|
163 class QThreadData; |
|
164 class QObjectConnectionListVector; |
|
165 namespace QtSharedPointer { struct ExternalRefCountData; } |
|
166 |
|
167 enum { QObjectPrivateVersion = QT_VERSION }; |
|
168 |
|
169 class QDeclarativeData; |
|
170 |
|
171 class Q_CORE_EXPORT QObjectPrivate : public QObjectData |
|
172 { |
|
173 Q_DECLARE_PUBLIC(QObject) |
|
174 |
|
175 public: |
|
176 struct ExtraData; |
|
177 |
|
178 struct Connection; |
|
179 // ConnectionList is a singly-linked list |
|
180 struct ConnectionList; |
|
181 struct Sender; |
|
182 |
|
183 |
|
184 QObjectPrivate(int version = QObjectPrivateVersion); |
|
185 virtual ~QObjectPrivate(); |
|
186 void deleteChildren(); |
|
187 |
|
188 void setParent_helper(QObject *); |
|
189 void moveToThread_helper(); |
|
190 void setThreadData_helper(QThreadData *currentData, QThreadData *targetData); |
|
191 void _q_reregisterTimers(void *pointer); |
|
192 |
|
193 bool isSender(const QObject *receiver, const char *signal) const; |
|
194 QObjectList receiverList(const char *signal) const; |
|
195 QObjectList senderList() const; |
|
196 |
|
197 void addConnection(int signal, Connection *c); |
|
198 void cleanConnectionLists(); |
|
199 |
|
200 #ifdef QT3_SUPPORT |
|
201 void sendPendingChildInsertedEvents(); |
|
202 void removePendingChildInsertedEvents(QObject *child); |
|
203 #endif |
|
204 |
|
205 static Sender *setCurrentSender(QObject *receiver, |
|
206 Sender *sender); |
|
207 static void resetCurrentSender(QObject *receiver, |
|
208 Sender *currentSender, |
|
209 Sender *previousSender); |
|
210 static int *setDeleteWatch(QObjectPrivate *d, int *newWatch); |
|
211 static void resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch); |
|
212 static void clearGuards(QObject *); |
|
213 |
|
214 static QObjectPrivate *get(QObject *o) { |
|
215 return o->d_func(); |
|
216 } |
|
217 |
|
218 int signalIndex(const char *signalName) const; |
|
219 inline bool isSignalConnected(uint signalIdx) const; |
|
220 |
|
221 public: |
|
222 QString objectName; |
|
223 ExtraData *extraData; // extra data set by the user |
|
224 QThreadData *threadData; // id of the thread that owns the object |
|
225 |
|
226 QObjectConnectionListVector *connectionLists; |
|
227 |
|
228 Connection *senders; // linked list of connections connected to this object |
|
229 Sender *currentSender; // object currently activating the object |
|
230 mutable quint32 connectedSignals[2]; |
|
231 |
|
232 #ifdef QT3_SUPPORT |
|
233 QList<QObject *> pendingChildInsertedEvents; |
|
234 #else |
|
235 // preserve binary compatibility with code compiled without Qt 3 support |
|
236 // ### why? |
|
237 QList<QObject *> unused; |
|
238 #endif |
|
239 |
|
240 QList<QPointer<QObject> > eventFilters; |
|
241 union { |
|
242 QObject *currentChildBeingDeleted; |
|
243 QDeclarativeData *declarativeData; //extra data used by the DeclarativeUI project. |
|
244 }; |
|
245 |
|
246 // these objects are all used to indicate that a QObject was deleted |
|
247 // plus QPointer, which keeps a separate list |
|
248 QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount; |
|
249 int *deleteWatch; |
|
250 }; |
|
251 |
|
252 #endif |
|
253 |
|
254 #endif |
61 |
255 |
62 class QAbstractVideoSurfacePrivate : public QObjectPrivate |
256 class QAbstractVideoSurfacePrivate : public QObjectPrivate |
63 { |
257 { |
64 public: |
258 public: |
65 QAbstractVideoSurfacePrivate() |
259 QAbstractVideoSurfacePrivate() |