diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2011-01-28 14:06:27 -0200 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2011-01-28 14:06:27 -0200 |
commit | b39c2ebb56a0e2f6d9128ac26d586fdf210649cc (patch) | |
tree | 9920bcaa0edb53b3070a50f4ef8ba1f914380e87 /TelepathyQt4Yell | |
parent | 9886a4b7964d3372a5f7b42208357b2de950171a (diff) |
Added ChannelFactory.
Inherits Tp::ChannelFactory and adds Call support.
Diffstat (limited to 'TelepathyQt4Yell')
-rw-r--r-- | TelepathyQt4Yell/CMakeLists.txt | 3 | ||||
-rw-r--r-- | TelepathyQt4Yell/ChannelFactory | 13 | ||||
-rw-r--r-- | TelepathyQt4Yell/channel-factory.cpp | 79 | ||||
-rw-r--r-- | TelepathyQt4Yell/channel-factory.h | 62 | ||||
-rw-r--r-- | TelepathyQt4Yell/types.h | 2 |
5 files changed, 159 insertions, 0 deletions
diff --git a/TelepathyQt4Yell/CMakeLists.txt b/TelepathyQt4Yell/CMakeLists.txt index 5751039..4944145 100644 --- a/TelepathyQt4Yell/CMakeLists.txt +++ b/TelepathyQt4Yell/CMakeLists.txt @@ -13,6 +13,7 @@ set(telepathy_qt4_yell_SRCS call-channel-internal.h channel.cpp channel-class-spec.cpp + channel-factory.cpp types.cpp) # Exported headers for Tp-Qt4 @@ -22,12 +23,14 @@ set(telepathy_qt4_yell_HEADERS CallStream Channel ChannelClassSpec + ChannelFactory Constants Global Types call-channel.h channel.h channel-class-spec.h + channel-factory.h constants.h global.h types.h) diff --git a/TelepathyQt4Yell/ChannelFactory b/TelepathyQt4Yell/ChannelFactory new file mode 100644 index 0000000..8cbb95d --- /dev/null +++ b/TelepathyQt4Yell/ChannelFactory @@ -0,0 +1,13 @@ +#ifndef _TelepathyQt4Yell_ChannelFactory_HEADER_GUARD_ +#define _TelepathyQt4Yell_ChannelFactory_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_HEADER +#define IN_TELEPATHY_QT4_YELL_HEADER +#endif + +#include <TelepathyQt4Yell/channel-factory.h> + +#undef IN_TELEPATHY_QT4_YELL_HEADER + +#endif +// vim:set ft=cpp: diff --git a/TelepathyQt4Yell/channel-factory.cpp b/TelepathyQt4Yell/channel-factory.cpp new file mode 100644 index 0000000..c3d41ff --- /dev/null +++ b/TelepathyQt4Yell/channel-factory.cpp @@ -0,0 +1,79 @@ +/* + * This file is part of TelepathyQt4 + * + * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <TelepathyQt4Yell/ChannelFactory> + +#include <TelepathyQt4Yell/CallChannel> +#include <TelepathyQt4Yell/ChannelClassSpec> + +namespace Tpy +{ + +/** + * \class ChannelFactory + * \ingroup clientchannel + * \headerfile TelepathyQt4Yell/channel-factory.h <TelepathyQt4Yell/ChannelFactory> + * + * \brief Constructs Channel objects + */ + +/** + * Create a new ChannelFactory object for the given \a bus. + * + * The returned factory will construct channel subclasses provided by TelepathyQt4Yell/TelepathyQt4 + * as appropriate for the channel immutable properties, but not make any features ready. + * + * \param bus The QDBusConnection the proxies constructed using this factory should use. + * \return An ChannelFactoryPtr pointing to the newly created factory. + */ +ChannelFactoryPtr ChannelFactory::create(const QDBusConnection &bus) +{ + return ChannelFactoryPtr(new ChannelFactory(bus)); +} + +/** + * Class constructor. + * + * The constructed factory will construct channel subclasses provided by + * TelepathyQt4Yell/TelepathyQt4 as appropriate for the channel immutable properties, + * but not make any features ready. + * + * \param bus The QDBusConnection the proxies constructed using this factory should use. + */ +ChannelFactory::ChannelFactory(const QDBusConnection &bus) + : Tp::ChannelFactory(bus) +{ + setSubclassForMediaCalls<CallChannel>(); +} + +/** + * Class destructor. + */ +ChannelFactory::~ChannelFactory() +{ +} + +void ChannelFactory::setConstructorForMediaCalls(const ConstructorConstPtr &ctor, + const QVariantMap &additionalProps) +{ + setConstructorFor(ChannelClassSpec::mediaCall(additionalProps), ctor); +} + +} // Tpy diff --git a/TelepathyQt4Yell/channel-factory.h b/TelepathyQt4Yell/channel-factory.h new file mode 100644 index 0000000..8bfc745 --- /dev/null +++ b/TelepathyQt4Yell/channel-factory.h @@ -0,0 +1,62 @@ +/* + * This file is part of TelepathyQt4 + * + * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TelepathyQt4Yell_channel_factory_h_HEADER_GUARD_ +#define _TelepathyQt4Yell_channel_factory_h_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_HEADER +#error IN_TELEPATHY_QT4_YELL_HEADER +#endif + +#include <TelepathyQt4Yell/Global> +#include <TelepathyQt4Yell/Types> + +#include <TelepathyQt4/ChannelFactory> + +class QDBusConnection; + +namespace Tpy +{ + +class TELEPATHY_QT4_YELL_EXPORT ChannelFactory : public Tp::ChannelFactory +{ + Q_DISABLE_COPY(ChannelFactory) + +public: + static ChannelFactoryPtr create(const QDBusConnection &bus); + + virtual ~ChannelFactory(); + + template<typename Subclass> + void setSubclassForMediaCalls(const QVariantMap &additionalProps = QVariantMap()) + { + setConstructorForMediaCalls(SubclassCtor<Subclass>::create(), additionalProps); + } + + void setConstructorForMediaCalls(const ConstructorConstPtr &ctor, + const QVariantMap &additionalProps = QVariantMap()); + +protected: + ChannelFactory(const QDBusConnection &bus); +}; + +} // Tpy + +#endif diff --git a/TelepathyQt4Yell/types.h b/TelepathyQt4Yell/types.h index 2d1c9f3..074f1b5 100644 --- a/TelepathyQt4Yell/types.h +++ b/TelepathyQt4Yell/types.h @@ -37,10 +37,12 @@ TELEPATHY_QT4_YELL_EXPORT void registerTypes(); class CallChannel; class CallContent; class CallStream; +class ChannelFactory; typedef Tp::SharedPtr<CallChannel> CallChannelPtr; typedef Tp::SharedPtr<CallContent> CallContentPtr; typedef Tp::SharedPtr<CallStream> CallStreamPtr; +typedef Tp::SharedPtr<ChannelFactory> ChannelFactoryPtr; } // Tpy |