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

channel-factory.h

    00001
    00023 #ifndef _TelepathyQt_channel_factory_h_HEADER_GUARD_
    00024 #define _TelepathyQt_channel_factory_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TP_QT_HEADER
    00027 #error IN_TP_QT_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt/DBusProxyFactory>
    00031 #include <TelepathyQt/SharedPtr>
    00032 #include <TelepathyQt/Types>
    00033
    00034 // For Q_DISABLE_COPY
    00035 #include <QtGlobal>
    00036 #include <QString>
    00037 #include <QVariantMap>
    00038
    00039 class QDBusConnection;
    00040
    00041 namespace Tp
    00042 {
    00043
    00044 class ChannelClassSpec;
    00045
    00046 class TP_QT_EXPORT ChannelFactory : public DBusProxyFactory
    00047 {
    00048     Q_OBJECT
    00049     Q_DISABLE_COPY(ChannelFactory)
    00050
    00051 public:
    00052 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00053     struct TP_QT_EXPORT Constructor : public RefCounted
    00054     {
    00055         virtual ~Constructor() {}
    00056
    00057         virtual ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
    00058                 const QVariantMap &immutableProperties) const = 0;
    00059     };
    00060     typedef SharedPtr<Constructor> ConstructorPtr;
    00061     typedef SharedPtr<const Constructor> ConstructorConstPtr;
    00062 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00063
    00064     static ChannelFactoryPtr create(const QDBusConnection &bus);
    00065
    00066     virtual ~ChannelFactory();
    00067
    00068     Features featuresForTextChats(const QVariantMap &additionalProps = QVariantMap()) const;
    00069     void addFeaturesForTextChats(const Features &features,
    00070             const QVariantMap &additionalProps = QVariantMap());
    00071
    00072     ConstructorConstPtr constructorForTextChats(
    00073             const QVariantMap &additionalProps = QVariantMap()) const;
    00074
    00075     template<typename Subclass>
    00076     void setSubclassForTextChats(const QVariantMap &additionalProps = QVariantMap())
    00077     {
    00078         setConstructorForTextChats(SubclassCtor<Subclass>::create(), additionalProps);
    00079     }
    00080
    00081     void setConstructorForTextChats(const ConstructorConstPtr &ctor,
    00082             const QVariantMap &additionalProps = QVariantMap());
    00083
    00084     Features featuresForTextChatrooms(const QVariantMap &additionalProps = QVariantMap()) const;
    00085     void addFeaturesForTextChatrooms(const Features &features,
    00086             const QVariantMap &additionalProps = QVariantMap());
    00087
    00088     ConstructorConstPtr constructorForTextChatrooms(
    00089             const QVariantMap &additionalProps = QVariantMap()) const;
    00090
    00091     template<typename Subclass>
    00092     void setSubclassForTextChatrooms(const QVariantMap &additionalProps = QVariantMap())
    00093     {
    00094         setConstructorForTextChatrooms(SubclassCtor<Subclass>::create(), additionalProps);
    00095     }
    00096
    00097     void setConstructorForTextChatrooms(const ConstructorConstPtr &ctor,
    00098             const QVariantMap &additionalProps = QVariantMap());
    00099
    00100     Features featuresForCalls(const QVariantMap &additionalProps = QVariantMap()) const;
    00101     void addFeaturesForCalls(const Features &features,
    00102             const QVariantMap &additionalProps = QVariantMap());
    00103
    00104     template<typename Subclass>
    00105     void setSubclassForCalls(const QVariantMap &additionalProps = QVariantMap())
    00106     {
    00107         setConstructorForCalls(SubclassCtor<Subclass>::create(), additionalProps);
    00108     }
    00109
    00110     void setConstructorForCalls(const ConstructorConstPtr &ctor,
    00111             const QVariantMap &additionalProps = QVariantMap());
    00112
    00113     TP_QT_DEPRECATED Features featuresForStreamedMediaCalls(const QVariantMap &additionalProps = QVariantMap()) const;
    00114     TP_QT_DEPRECATED void addFeaturesForStreamedMediaCalls(const Features &features,
    00115             const QVariantMap &additionalProps = QVariantMap());
    00116
    00117     TP_QT_DEPRECATED ConstructorConstPtr constructorForStreamedMediaCalls(
    00118             const QVariantMap &additionalProps = QVariantMap()) const;
    00119
    00120     template<typename Subclass>
    00121     TP_QT_DEPRECATED void setSubclassForStreamedMediaCalls(const QVariantMap &additionalProps = QVariantMap())
    00122     {
    00123         setConstructorForStreamedMediaCalls(SubclassCtor<Subclass>::create(), additionalProps);
    00124     }
    00125
    00126     TP_QT_DEPRECATED void setConstructorForStreamedMediaCalls(const ConstructorConstPtr &ctor,
    00127             const QVariantMap &additionalProps = QVariantMap());
    00128
    00129     Features featuresForRoomLists(const QVariantMap &additionalProps = QVariantMap()) const;
    00130     void addFeaturesForRoomLists(const Features &features,
    00131             const QVariantMap &additionalProps = QVariantMap());
    00132
    00133     ConstructorConstPtr constructorForRoomLists(
    00134             const QVariantMap &additionalProps = QVariantMap()) const;
    00135
    00136     template<typename Subclass>
    00137     void setSubclassForRoomLists(const QVariantMap &additionalProps = QVariantMap())
    00138     {
    00139         setConstructorForRoomLists(SubclassCtor<Subclass>::create(), additionalProps);
    00140     }
    00141
    00142     void setConstructorForRoomLists(const ConstructorConstPtr &ctor,
    00143             const QVariantMap &additionalProps = QVariantMap());
    00144
    00145     Features featuresForOutgoingFileTransfers(const QVariantMap &additionalProps = QVariantMap()) const;
    00146     void addFeaturesForOutgoingFileTransfers(const Features &features,
    00147             const QVariantMap &additionalProps = QVariantMap());
    00148
    00149     ConstructorConstPtr constructorForOutgoingFileTransfers(
    00150             const QVariantMap &additionalProps = QVariantMap()) const;
    00151
    00152     template<typename Subclass>
    00153     void setSubclassForOutgoingFileTransfers(const QVariantMap &additionalProps = QVariantMap())
    00154     {
    00155         setConstructorForOutgoingFileTransfers(SubclassCtor<Subclass>::create(), additionalProps);
    00156     }
    00157
    00158     void setConstructorForOutgoingFileTransfers(const ConstructorConstPtr &ctor,
    00159             const QVariantMap &additionalProps = QVariantMap());
    00160
    00161     Features featuresForIncomingFileTransfers(const QVariantMap &additionalProps = QVariantMap()) const;
    00162     void addFeaturesForIncomingFileTransfers(const Features &features,
    00163             const QVariantMap &additionalProps = QVariantMap());
    00164
    00165     ConstructorConstPtr constructorForIncomingFileTransfers(
    00166             const QVariantMap &additionalProps = QVariantMap()) const;
    00167
    00168     template<typename Subclass>
    00169     void setSubclassForIncomingFileTransfers(const QVariantMap &additionalProps = QVariantMap())
    00170     {
    00171         setConstructorForIncomingFileTransfers(SubclassCtor<Subclass>::create(), additionalProps);
    00172     }
    00173
    00174     void setConstructorForIncomingFileTransfers(const ConstructorConstPtr &ctor,
    00175             const QVariantMap &additionalProps = QVariantMap());
    00176
    00177     Features featuresForOutgoingStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00178     void addFeaturesForOutgoingStreamTubes(const Features &features,
    00179             const QVariantMap &additionalProps = QVariantMap());
    00180
    00181     ConstructorConstPtr constructorForOutgoingStreamTubes(
    00182             const QVariantMap &additionalProps = QVariantMap()) const;
    00183
    00184     template<typename Subclass>
    00185     void setSubclassForOutgoingStreamTubes(const QVariantMap &additionalProps = QVariantMap())
    00186     {
    00187         setConstructorForOutgoingStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00188     }
    00189
    00190     void setConstructorForOutgoingStreamTubes(const ConstructorConstPtr &ctor,
    00191             const QVariantMap &additionalProps = QVariantMap());
    00192
    00193     Features featuresForIncomingStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00194     void addFeaturesForIncomingStreamTubes(const Features &features,
    00195             const QVariantMap &additionalProps = QVariantMap());
    00196
    00197     ConstructorConstPtr constructorForIncomingStreamTubes(
    00198             const QVariantMap &additionalProps = QVariantMap()) const;
    00199
    00200     template<typename Subclass>
    00201     void setSubclassForIncomingStreamTubes(const QVariantMap &additionalProps = QVariantMap())
    00202     {
    00203         setConstructorForIncomingStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00204     }
    00205
    00206     void setConstructorForIncomingStreamTubes(const ConstructorConstPtr &ctor,
    00207             const QVariantMap &additionalProps = QVariantMap());
    00208
    00209     Features featuresForOutgoingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00210     void addFeaturesForOutgoingRoomStreamTubes(const Features &features,
    00211             const QVariantMap &additionalProps = QVariantMap());
    00212
    00213     ConstructorConstPtr constructorForOutgoingRoomStreamTubes(
    00214             const QVariantMap &additionalProps = QVariantMap()) const;
    00215
    00216     template<typename Subclass>
    00217     void setSubclassForOutgoingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap())
    00218     {
    00219         setConstructorForOutgoingRoomStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00220     }
    00221
    00222     void setConstructorForOutgoingRoomStreamTubes(const ConstructorConstPtr &ctor,
    00223             const QVariantMap &additionalProps = QVariantMap());
    00224
    00225     Features featuresForIncomingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00226     void addFeaturesForIncomingRoomStreamTubes(const Features &features,
    00227             const QVariantMap &additionalProps = QVariantMap());
    00228
    00229     ConstructorConstPtr constructorForIncomingRoomStreamTubes(
    00230             const QVariantMap &additionalProps = QVariantMap()) const;
    00231
    00232     template<typename Subclass>
    00233     void setSubclassForIncomingRoomStreamTubes(const QVariantMap &additionalProps = QVariantMap())
    00234     {
    00235         setConstructorForIncomingRoomStreamTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00236     }
    00237
    00238     void setConstructorForIncomingRoomStreamTubes(const ConstructorConstPtr &ctor,
    00239             const QVariantMap &additionalProps = QVariantMap());
    00240
    00241     Features featuresForOutgoingDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00242     void addFeaturesForOutgoingDBusTubes(const Features &features,
    00243             const QVariantMap &additionalProps = QVariantMap());
    00244
    00245     ConstructorConstPtr constructorForOutgoingDBusTubes(
    00246             const QVariantMap &additionalProps = QVariantMap()) const;
    00247
    00248     template<typename Subclass>
    00249     void setSubclassForOutgoingDBusTubes(const QVariantMap &additionalProps = QVariantMap())
    00250     {
    00251         setConstructorForOutgoingDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00252     }
    00253
    00254     void setConstructorForOutgoingDBusTubes(const ConstructorConstPtr &ctor,
    00255             const QVariantMap &additionalProps = QVariantMap());
    00256
    00257     Features featuresForIncomingDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00258     void addFeaturesForIncomingDBusTubes(const Features &features,
    00259             const QVariantMap &additionalProps = QVariantMap());
    00260
    00261     ConstructorConstPtr constructorForIncomingDBusTubes(
    00262             const QVariantMap &additionalProps = QVariantMap()) const;
    00263
    00264     template<typename Subclass>
    00265     void setSubclassForIncomingDBusTubes(const QVariantMap &additionalProps = QVariantMap())
    00266     {
    00267         setConstructorForIncomingDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00268     }
    00269
    00270     void setConstructorForIncomingDBusTubes(const ConstructorConstPtr &ctor,
    00271             const QVariantMap &additionalProps = QVariantMap());
    00272
    00273     Features featuresForOutgoingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00274     void addFeaturesForOutgoingRoomDBusTubes(const Features &features,
    00275             const QVariantMap &additionalProps = QVariantMap());
    00276
    00277     ConstructorConstPtr constructorForOutgoingRoomDBusTubes(
    00278             const QVariantMap &additionalProps = QVariantMap()) const;
    00279
    00280     template<typename Subclass>
    00281     void setSubclassForOutgoingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap())
    00282     {
    00283         setConstructorForOutgoingRoomDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00284     }
    00285
    00286     void setConstructorForOutgoingRoomDBusTubes(const ConstructorConstPtr &ctor,
    00287             const QVariantMap &additionalProps = QVariantMap());
    00288
    00289     Features featuresForIncomingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap()) const;
    00290     void addFeaturesForIncomingRoomDBusTubes(const Features &features,
    00291             const QVariantMap &additionalProps = QVariantMap());
    00292
    00293     ConstructorConstPtr constructorForIncomingRoomDBusTubes(
    00294             const QVariantMap &additionalProps = QVariantMap()) const;
    00295
    00296     template<typename Subclass>
    00297     void setSubclassForIncomingRoomDBusTubes(const QVariantMap &additionalProps = QVariantMap())
    00298     {
    00299         setConstructorForIncomingRoomDBusTubes(SubclassCtor<Subclass>::create(), additionalProps);
    00300     }
    00301
    00302     void setConstructorForIncomingRoomDBusTubes(const ConstructorConstPtr &ctor,
    00303             const QVariantMap &additionalProps = QVariantMap());
    00304
    00305     Features featuresForContactSearches(const QVariantMap &additionalProps = QVariantMap()) const;
    00306     void addFeaturesForContactSearches(const Features &features,
    00307             const QVariantMap &additionalProps = QVariantMap());
    00308
    00309     ConstructorConstPtr constructorForContactSearches(
    00310             const QVariantMap &additionalProps = QVariantMap()) const;
    00311
    00312     template<typename Subclass>
    00313     void setSubclassForContactSearches(const QVariantMap &additionalProps = QVariantMap())
    00314     {
    00315         setConstructorForContactSearches(SubclassCtor<Subclass>::create(), additionalProps);
    00316     }
    00317
    00318     void setConstructorForContactSearches(const ConstructorConstPtr &ctor,
    00319             const QVariantMap &additionalProps = QVariantMap());
    00320
    00321     Features featuresForServerAuthentication(const QVariantMap &additionalProps = QVariantMap()) const;
    00322     void addFeaturesForServerAuthentication(const Features &features,
    00323             const QVariantMap &additionalProps = QVariantMap());
    00324
    00325     ConstructorConstPtr constructorForServerAuthentication(
    00326             const QVariantMap &additionalProps = QVariantMap()) const;
    00327
    00328     template<typename Subclass>
    00329     void setSubclassForServerAuthentication(const QVariantMap &additionalProps = QVariantMap())
    00330     {
    00331         setConstructorForServerAuthentication(SubclassCtor<Subclass>::create(), additionalProps);
    00332     }
    00333
    00334     void setConstructorForServerAuthentication(const ConstructorConstPtr &ctor,
    00335             const QVariantMap &additionalProps = QVariantMap());
    00336
    00337     Features commonFeatures() const;
    00338     void addCommonFeatures(const Features &features);
    00339
    00340     ConstructorConstPtr fallbackConstructor() const;
    00341
    00342     template <typename Subclass>
    00343     void setFallbackSubclass()
    00344     {
    00345         setFallbackConstructor(SubclassCtor<Subclass>::create());
    00346     }
    00347
    00348     void setFallbackConstructor(const ConstructorConstPtr &ctor);
    00349
    00350     Features featuresFor(const ChannelClassSpec &channelClass) const;
    00351     void addFeaturesFor(const ChannelClassSpec &channelClass, const Features &features);
    00352
    00353     template <typename Subclass>
    00354     void setSubclassFor(const ChannelClassSpec &channelClass)
    00355     {
    00356         setConstructorFor(channelClass, SubclassCtor<Subclass>::create());
    00357     }
    00358
    00359     ConstructorConstPtr constructorFor(const ChannelClassSpec &channelClass) const;
    00360     void setConstructorFor(const ChannelClassSpec &channelClass, const ConstructorConstPtr &ctor);
    00361
    00362     PendingReady *proxy(const ConnectionPtr &connection, const QString &channelPath,
    00363             const QVariantMap &immutableProperties) const;
    00364
    00365 protected:
    00366     ChannelFactory(const QDBusConnection &bus);
    00367
    00368 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00369     template <typename Subclass>
    00370     struct SubclassCtor : public Constructor
    00371     {
    00372         static ConstructorPtr create()
    00373         {
    00374             return ConstructorPtr(new SubclassCtor<Subclass>());
    00375         }
    00376
    00377         virtual ~SubclassCtor() {}
    00378
    00379         ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
    00380                 const QVariantMap &immutableProperties) const
    00381         {
    00382             return Subclass::create(conn, objectPath, immutableProperties);
    00383         }
    00384     };
    00385 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00386
    00387     virtual QString finalBusNameFrom(const QString &uniqueOrWellKnown) const;
    00388     // Nothing we'd like to prepare()
    00389     virtual Features featuresFor(const DBusProxyPtr &proxy) const;
    00390
    00391 private:
    00392     struct Private;
    00393     Private *mPriv;
    00394 };
    00395
    00396 } // Tp
    00397
    00398 #endif