| Home · All Classes · All Namespaces · Modules · Functions · Files

channel-factory.h
1
23 #ifndef _TelepathyQt_channel_factory_h_HEADER_GUARD_
24 #define _TelepathyQt_channel_factory_h_HEADER_GUARD_
25
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29
30 #include <TelepathyQt/DBusProxyFactory>
31 #include <TelepathyQt/SharedPtr>
32 #include <TelepathyQt/Types>
33
34 // For Q_DISABLE_COPY
35 #include <QtGlobal>
36 #include <QString>
37 #include <QVariantMap>
38
39 class QDBusConnection;
40
41 namespace Tp
42 {
43
44 class ChannelClassSpec;
45
46 class TP_QT_EXPORT ChannelFactory : public DBusProxyFactory
47 {
48 Q_OBJECT
49 Q_DISABLE_COPY(ChannelFactory)
50
51 public:
52 #ifndef DOXYGEN_SHOULD_SKIP_THIS
53 struct TP_QT_EXPORT Constructor : public RefCounted
54 {
55 virtual ~Constructor() {}
56
57 virtual ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
58 const QVariantMap &immutableProperties) const = 0;
59 };
60 typedef SharedPtr<Constructor> ConstructorPtr;
61 typedef SharedPtr<const Constructor> ConstructorConstPtr;
62 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
63
64 static ChannelFactoryPtr create(const QDBusConnection &bus);
65
66 virtual ~ChannelFactory();
67
68 Features featuresForTextChats(const QVariantMap &additionalProps = QVariantMap()) const;
69 void addFeaturesForTextChats(const Features &features,
70 const QVariantMap &additionalProps = QVariantMap());
71
72 ConstructorConstPtr constructorForTextChats(
73 const QVariantMap &additionalProps = QVariantMap()) const;
74
75 template<typename Subclass>
76 void setSubclassForTextChats(const QVariantMap &additionalProps = QVariantMap())
77 {
78 setConstructorForTextChats(SubclassCtor<Subclass>::create(), additionalProps);
79 }
80
81 void setConstructorForTextChats(const ConstructorConstPtr &ctor,
82 const QVariantMap &additionalProps = QVariantMap());
83
84 Features featuresForTextChatrooms(const QVariantMap &additionalProps = QVariantMap()) const;
85 void addFeaturesForTextChatrooms(const Features &features,
86 const QVariantMap &additionalProps = QVariantMap());
87
88 ConstructorConstPtr constructorForTextChatrooms(
89 const QVariantMap &additionalProps = QVariantMap()) const;
90
91 template<typename Subclass>
92 void setSubclassForTextChatrooms(const QVariantMap &additionalProps = QVariantMap())
93 {
94 setConstructorForTextChatrooms(SubclassCtor<Subclass>::create(), additionalProps);
95 }
96
97 void setConstructorForTextChatrooms(const ConstructorConstPtr &ctor,
98 const QVariantMap &additionalProps = QVariantMap());
99
100 Features featuresForCalls(const QVariantMap &additionalProps = QVariantMap()) const;
101 void addFeaturesForCalls(const Features &features,
102 const QVariantMap &additionalProps = QVariantMap());
103
104 template<typename Subclass>
105 void setSubclassForCalls(const QVariantMap &additionalProps = QVariantMap())
106 {
107 setConstructorForCalls(SubclassCtor<Subclass>::create(), additionalProps);
108 }
109
110 void setConstructorForCalls(const ConstructorConstPtr &ctor,
111 const QVariantMap &additionalProps = QVariantMap());
112
113 TP_QT_DEPRECATED Features featuresForStreamedMediaCalls(const QVariantMap &additionalProps = QVariantMap()) const;
114 TP_QT_DEPRECATED void addFeaturesForStreamedMediaCalls(const Features &features,
115 const QVariantMap &additionalProps = QVariantMap());
116
117 TP_QT_DEPRECATED ConstructorConstPtr constructorForStreamedMediaCalls(
118 const QVariantMap &additionalProps = QVariantMap()) const;
119
120 template<typename Subclass>
121 TP_QT_DEPRECATED void setSubclassForStreamedMediaCalls(const QVariantMap &additionalProps = QVariantMap())
122 {
123 setConstructorForStreamedMediaCalls(SubclassCtor<Subclass>::create(), additionalProps);
124 }
125
126 TP_QT_DEPRECATED void setConstructorForStreamedMediaCalls(const ConstructorConstPtr &ctor,
127 const QVariantMap &additionalProps = QVariantMap());
128
129 Features featuresForRoomLists(const QVariantMap &additionalProps = QVariantMap()) const;
130 void addFeaturesForRoomLists(const Features &features,
131 const QVariantMap &additionalProps = QVariantMap());
132
133 ConstructorConstPtr constructorForRoomLists(
134 const QVariantMap &additionalProps = QVariantMap()) const;
135
136 template<typename Subclass>
137 void setSubclassForRoomLists(const QVariantMap &additionalProps = QVariantMap())
138 {
139 setConstructorForRoomLists(SubclassCtor<Subclass>::create(), additionalProps);
140 }
141
142 void setConstructorForRoomLists(const ConstructorConstPtr &ctor,
143 const QVariantMap &additionalProps = QVariantMap());
144
145 Features featuresForOutgoingFileTransfers(const QVariantMap &additionalProps = QVariantMap()) const;
146 void addFeaturesForOutgoingFileTransfers(const Features &features,
147 const QVariantMap &additionalProps = QVariantMap());
148
149 ConstructorConstPtr constructorForOutgoingFileTransfers(
150 const QVariantMap &additionalProps = QVariantMap()) const;
151
152 template<typename Subclass>
153 void setSubclassForOutgoingFileTransfers(const QVariantMap &additionalProps = QVariantMap())
154 {
155 setConstructorForOutgoingFileTransfers(SubclassCtor<Subclass>::create(), additionalProps);
156 }
157
158 void setConstructorForOutgoingFileTransfers(const ConstructorConstPtr &ctor,
159 const QVariantMap &additionalProps = QVariantMap());
160
161 Features featuresForIncomingFileTransfers(const QVariantMap &additionalProps = QVariantMap()) const;
162 void addFeaturesForIncomingFileTransfers(const Features &features,
163 const QVariantMap &additionalProps = QVariantMap());
164
165 ConstructorConstPtr constructorForIncomingFileTransfers(
166 const QVariantMap &additionalProps = QVariantMap()) const;
167
168 template<typename Subclass>
169 void setSubclassForIncomingFileTransfers(const QVariantMap &additionalProps = QVariantMap())
170 {
171 setConstructorForIncomingFileTransfers(SubclassCtor<Subclass>::create(), additionalProps);
172 }
173
174 void setConstructorForIncomingFileTransfers(const ConstructorConstPtr &ctor,
175 const QVariantMap &additionalProps = QVariantMap());
176
177 Features featuresForOutgoingStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
178 void addFeaturesForOutgoingStreamTubes(const Features &features,
179 const QVariantMap &additionalProps = QVariantMap());
180
181 ConstructorConstPtr constructorForOutgoingStreamTubes(
182 const QVariantMap &additionalProps = QVariantMap()) const;
183
184 template<typename Subclass>
185 void setSubclassForOutgoingStreamTubes(const QVariantMap &additionalProps = QVariantMap())
186 {
187 setConstructorForOutgoingStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
188 }
189
190 void setConstructorForOutgoingStreamTubes(const ConstructorConstPtr &ctor,
191 const QVariantMap &additionalProps = QVariantMap());
192
193 Features featuresForIncomingStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
194 void addFeaturesForIncomingStreamTubes(const Features &features,
195 const QVariantMap &additionalProps = QVariantMap());
196
197 ConstructorConstPtr constructorForIncomingStreamTubes(
198 const QVariantMap &additionalProps = QVariantMap()) const;
199
200 template<typename Subclass>
201 void setSubclassForIncomingStreamTubes(const QVariantMap &additionalProps = QVariantMap())
202 {
203 setConstructorForIncomingStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
204 }
205
206 void setConstructorForIncomingStreamTubes(const ConstructorConstPtr &ctor,
207 const QVariantMap &additionalProps = QVariantMap());
208
209 Features featuresForOutgoingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
210 void addFeaturesForOutgoingRoomStreamTubes(const Features &features,
211 const QVariantMap &additionalProps = QVariantMap());
212
213 ConstructorConstPtr constructorForOutgoingRoomStreamTubes(
214 const QVariantMap &additionalProps = QVariantMap()) const;
215
216 template<typename Subclass>
217 void setSubclassForOutgoingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap())
218 {
219 setConstructorForOutgoingRoomStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
220 }
221
222 void setConstructorForOutgoingRoomStreamTubes(const ConstructorConstPtr &ctor,
223 const QVariantMap &additionalProps = QVariantMap());
224
225 Features featuresForIncomingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
226 void addFeaturesForIncomingRoomStreamTubes(const Features &features,
227 const QVariantMap &additionalProps = QVariantMap());
228
229 ConstructorConstPtr constructorForIncomingRoomStreamTubes(
230 const QVariantMap &additionalProps = QVariantMap()) const;
231
232 template<typename Subclass>
233 void setSubclassForIncomingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap())
234 {
235 setConstructorForIncomingRoomStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
236 }
237
238 void setConstructorForIncomingRoomStreamTubes(const ConstructorConstPtr &ctor,
239 const QVariantMap &additionalProps = QVariantMap());
240
241 Features featuresForOutgoingDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
242 void addFeaturesForOutgoingDBusTubes(const Features &features,
243 const QVariantMap &additionalProps = QVariantMap());
244
245 ConstructorConstPtr constructorForOutgoingDBusTubes(
246 const QVariantMap &additionalProps = QVariantMap()) const;
247
248 template<typename Subclass>
249 void setSubclassForOutgoingDBusTubes(const QVariantMap &additionalProps = QVariantMap())
250 {
251 setConstructorForOutgoingDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
252 }
253
254 void setConstructorForOutgoingDBusTubes(const ConstructorConstPtr &ctor,
255 const QVariantMap &additionalProps = QVariantMap());
256
257 Features featuresForIncomingDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
258 void addFeaturesForIncomingDBusTubes(const Features &features,
259 const QVariantMap &additionalProps = QVariantMap());
260
261 ConstructorConstPtr constructorForIncomingDBusTubes(
262 const QVariantMap &additionalProps = QVariantMap()) const;
263
264 template<typename Subclass>
265 void setSubclassForIncomingDBusTubes(const QVariantMap &additionalProps = QVariantMap())
266 {
267 setConstructorForIncomingDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
268 }
269
270 void setConstructorForIncomingDBusTubes(const ConstructorConstPtr &ctor,
271 const QVariantMap &additionalProps = QVariantMap());
272
273 Features featuresForOutgoingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
274 void addFeaturesForOutgoingRoomDBusTubes(const Features &features,
275 const QVariantMap &additionalProps = QVariantMap());
276
277 ConstructorConstPtr constructorForOutgoingRoomDBusTubes(
278 const QVariantMap &additionalProps = QVariantMap()) const;
279
280 template<typename Subclass>
281 void setSubclassForOutgoingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap())
282 {
283 setConstructorForOutgoingRoomDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
284 }
285
286 void setConstructorForOutgoingRoomDBusTubes(const ConstructorConstPtr &ctor,
287 const QVariantMap &additionalProps = QVariantMap());
288
289 Features featuresForIncomingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
290 void addFeaturesForIncomingRoomDBusTubes(const Features &features,
291 const QVariantMap &additionalProps = QVariantMap());
292
293 ConstructorConstPtr constructorForIncomingRoomDBusTubes(
294 const QVariantMap &additionalProps = QVariantMap()) const;
295
296 template<typename Subclass>
297 void setSubclassForIncomingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap())
298 {
299 setConstructorForIncomingRoomDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
300 }
301
302 void setConstructorForIncomingRoomDBusTubes(const ConstructorConstPtr &ctor,
303 const QVariantMap &additionalProps = QVariantMap());
304
305 Features featuresForContactSearches(const QVariantMap &additionalProps = QVariantMap()) const;
306 void addFeaturesForContactSearches(const Features &features,
307 const QVariantMap &additionalProps = QVariantMap());
308
309 ConstructorConstPtr constructorForContactSearches(
310 const QVariantMap &additionalProps = QVariantMap()) const;
311
312 template<typename Subclass>
313 void setSubclassForContactSearches(const QVariantMap &additionalProps = QVariantMap())
314 {
315 setConstructorForContactSearches(SubclassCtor<Subclass>::create(), additionalProps);
316 }
317
318 void setConstructorForContactSearches(const ConstructorConstPtr &ctor,
319 const QVariantMap &additionalProps = QVariantMap());
320
321 Features featuresForServerAuthentication(const QVariantMap &additionalProps = QVariantMap()) const;
322 void addFeaturesForServerAuthentication(const Features &features,
323 const QVariantMap &additionalProps = QVariantMap());
324
325 ConstructorConstPtr constructorForServerAuthentication(
326 const QVariantMap &additionalProps = QVariantMap()) const;
327
328 template<typename Subclass>
329 void setSubclassForServerAuthentication(const QVariantMap &additionalProps = QVariantMap())
330 {
331 setConstructorForServerAuthentication(SubclassCtor<Subclass>::create(), additionalProps);
332 }
333
334 void setConstructorForServerAuthentication(const ConstructorConstPtr &ctor,
335 const QVariantMap &additionalProps = QVariantMap());
336
337 Features commonFeatures() const;
338 void addCommonFeatures(const Features &features);
339
340 ConstructorConstPtr fallbackConstructor() const;
341
342 template <typename Subclass>
343 void setFallbackSubclass()
344 {
345 setFallbackConstructor(SubclassCtor<Subclass>::create());
346 }
347
348 void setFallbackConstructor(const ConstructorConstPtr &ctor);
349
350 Features featuresFor(const ChannelClassSpec &channelClass) const;
351 void addFeaturesFor(const ChannelClassSpec &channelClass, const Features &features);
352
353 template <typename Subclass>
354 void setSubclassFor(const ChannelClassSpec &channelClass)
355 {
356 setConstructorFor(channelClass, SubclassCtor<Subclass>::create());
357 }
358
359 ConstructorConstPtr constructorFor(const ChannelClassSpec &channelClass) const;
360 void setConstructorFor(const ChannelClassSpec &channelClass, const ConstructorConstPtr &ctor);
361
362 PendingReady *proxy(const ConnectionPtr &connection, const QString &channelPath,
363 const QVariantMap &immutableProperties) const;
364
365 protected:
366 ChannelFactory(const QDBusConnection &bus);
367
368 #ifndef DOXYGEN_SHOULD_SKIP_THIS
369 template <typename Subclass>
370 struct SubclassCtor : public Constructor
371 {
372 static ConstructorPtr create()
373 {
374 return ConstructorPtr(new SubclassCtor<Subclass>());
375 }
376
377 virtual ~SubclassCtor() {}
378
379 ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
380 const QVariantMap &immutableProperties) const
381 {
382 return Subclass::create(conn, objectPath, immutableProperties);
383 }
384 };
385 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
386
387 virtual QString finalBusNameFrom(const QString &uniqueOrWellKnown) const;
388 // Nothing we'd like to prepare()
389 virtual Features featuresFor(const DBusProxyPtr &proxy) const;
390
391 private:
392 struct Private;
393 Private *mPriv;
394 };
395
396 } // Tp
397
398 #endif
Tp::ChannelFactory::setSubclassForOutgoingFileTransfers
void setSubclassForOutgoingFileTransfers(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:153
Tp::ChannelFactory::setSubclassForContactSearches
void setSubclassForContactSearches(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:313
Tp::ChannelFactory::setSubclassForIncomingStreamTubes
void setSubclassForIncomingStreamTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:201
Tp::PendingReady
The PendingReady class represents the features requested and the reply to a request for an object to ...
Definition: pending-ready.h:40
Tp::ChannelFactory::setSubclassForIncomingFileTransfers
void setSubclassForIncomingFileTransfers(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:169
Tp::ChannelFactory
The ChannelFactory class is responsible for constructing Channel objects according to application-def...
Definition: channel-factory.h:46
Tp::ChannelFactory::setSubclassForRoomLists
void setSubclassForRoomLists(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:137
Tp::SharedPtr
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
Tp::ChannelFactory::setSubclassForCalls
void setSubclassForCalls(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:105
Tp::ChannelFactory::setSubclassForServerAuthentication
void setSubclassForServerAuthentication(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:329
Tp::ChannelClassSpec
The ChannelClassSpec class represents a Telepathy channel class.
Definition: channel-class-spec.h:42
Tp::ChannelFactory::setSubclassForOutgoingDBusTubes
void setSubclassForOutgoingDBusTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:249
Tp::ChannelFactory::setSubclassForIncomingRoomDBusTubes
void setSubclassForIncomingRoomDBusTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:297
Tp::ChannelFactory::setSubclassForTextChats
void setSubclassForTextChats(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:76
Tp::ChannelFactory::setSubclassForOutgoingRoomDBusTubes
void setSubclassForOutgoingRoomDBusTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:281
Tp::ChannelFactory::setSubclassFor
void setSubclassFor(const ChannelClassSpec &channelClass)
Definition: channel-factory.h:354
Tp::ChannelFactory::setSubclassForOutgoingRoomStreamTubes
void setSubclassForOutgoingRoomStreamTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:217
Tp::ChannelFactory::setSubclassForIncomingDBusTubes
void setSubclassForIncomingDBusTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:265
Tp::ChannelFactory::setFallbackSubclass
void setFallbackSubclass()
Definition: channel-factory.h:343
Tp::DBusProxyFactory
The DBusProxyFactory class is a base class for all D-Bus proxy factory classes. Handles proxy caching...
Definition: dbus-proxy-factory.h:48
Tp::ChannelFactory::setSubclassForTextChatrooms
void setSubclassForTextChatrooms(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:92
Tp::ChannelFactory::setSubclassForIncomingRoomStreamTubes
void setSubclassForIncomingRoomStreamTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:233
Tp::RefCounted
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
Tp::Features
The Features class represents a list of Feature.
Definition: feature.h:61
Tp::ChannelFactory::setSubclassForOutgoingStreamTubes
void setSubclassForOutgoingStreamTubes(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:185
Tp::ChannelFactory::setSubclassForStreamedMediaCalls
void setSubclassForStreamedMediaCalls(const QVariantMap &additionalProps=QVariantMap())
Definition: channel-factory.h:121