| 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     Features featuresForStreamedMediaCalls(const QVariantMap &additionalProps = QVariantMap()) const;
    00114     void addFeaturesForStreamedMediaCalls(const Features &features,
    00115             const QVariantMap &additionalProps = QVariantMap());
    00116
    00117     ConstructorConstPtr constructorForStreamedMediaCalls(
    00118             const QVariantMap &additionalProps = QVariantMap()) const;
    00119
    00120     template<typename Subclass>
    00121     void setSubclassForStreamedMediaCalls(const QVariantMap &additionalProps = QVariantMap())
    00122     {
    00123         setConstructorForStreamedMediaCalls(SubclassCtor<Subclass>::create(), additionalProps);
    00124     }
    00125
    00126     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 featuresForContactSearches(const QVariantMap &additionalProps = QVariantMap()) const;
    00242     void addFeaturesForContactSearches(const Features &features,
    00243             const QVariantMap &additionalProps = QVariantMap());
    00244
    00245     ConstructorConstPtr constructorForContactSearches(
    00246             const QVariantMap &additionalProps = QVariantMap()) const;
    00247
    00248     template<typename Subclass>
    00249     void setSubclassForContactSearches(const QVariantMap &additionalProps = QVariantMap())
    00250     {
    00251         setConstructorForContactSearches(SubclassCtor<Subclass>::create(), additionalProps);
    00252     }
    00253
    00254     void setConstructorForContactSearches(const ConstructorConstPtr &ctor,
    00255             const QVariantMap &additionalProps = QVariantMap());
    00256
    00257     Features featuresForServerAuthentication(const QVariantMap &additionalProps = QVariantMap()) const;
    00258     void addFeaturesForServerAuthentication(const Features &features,
    00259             const QVariantMap &additionalProps = QVariantMap());
    00260
    00261     ConstructorConstPtr constructorForServerAuthentication(
    00262             const QVariantMap &additionalProps = QVariantMap()) const;
    00263
    00264     template<typename Subclass>
    00265     void setSubclassForServerAuthentication(const QVariantMap &additionalProps = QVariantMap())
    00266     {
    00267         setConstructorForServerAuthentication(SubclassCtor<Subclass>::create(), additionalProps);
    00268     }
    00269
    00270     void setConstructorForServerAuthentication(const ConstructorConstPtr &ctor,
    00271             const QVariantMap &additionalProps = QVariantMap());
    00272
    00273     Features commonFeatures() const;
    00274     void addCommonFeatures(const Features &features);
    00275
    00276     ConstructorConstPtr fallbackConstructor() const;
    00277
    00278     template <typename Subclass>
    00279     void setFallbackSubclass()
    00280     {
    00281         setFallbackConstructor(SubclassCtor<Subclass>::create());
    00282     }
    00283
    00284     void setFallbackConstructor(const ConstructorConstPtr &ctor);
    00285
    00286     Features featuresFor(const ChannelClassSpec &channelClass) const;
    00287     void addFeaturesFor(const ChannelClassSpec &channelClass, const Features &features);
    00288
    00289     template <typename Subclass>
    00290     void setSubclassFor(const ChannelClassSpec &channelClass)
    00291     {
    00292         setConstructorFor(channelClass, SubclassCtor<Subclass>::create());
    00293     }
    00294
    00295     ConstructorConstPtr constructorFor(const ChannelClassSpec &channelClass) const;
    00296     void setConstructorFor(const ChannelClassSpec &channelClass, const ConstructorConstPtr &ctor);
    00297
    00298     PendingReady *proxy(const ConnectionPtr &connection, const QString &channelPath,
    00299             const QVariantMap &immutableProperties) const;
    00300
    00301 protected:
    00302     ChannelFactory(const QDBusConnection &bus);
    00303
    00304 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00305     template <typename Subclass>
    00306     struct SubclassCtor : public Constructor
    00307     {
    00308         static ConstructorPtr create()
    00309         {
    00310             return ConstructorPtr(new SubclassCtor<Subclass>());
    00311         }
    00312
    00313         virtual ~SubclassCtor() {}
    00314
    00315         ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
    00316                 const QVariantMap &immutableProperties) const
    00317         {
    00318             return Subclass::create(conn, objectPath, immutableProperties);
    00319         }
    00320     };
    00321 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00322
    00323     virtual QString finalBusNameFrom(const QString &uniqueOrWellKnown) const;
    00324     // Nothing we'd like to prepare()
    00325     virtual Features featuresFor(const DBusProxyPtr &proxy) const;
    00326
    00327 private:
    00328     struct Private;
    00329     Private *mPriv;
    00330 };
    00331
    00332 } // Tp
    00333
    00334 #endif