[Telepathy-commits] [telepathy-qt4/master] Channel and subclasses: take immutable properties in constructor
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Feb 10 02:21:10 PST 2009
---
TelepathyQt4/Client/channel.cpp | 7 +++++++
TelepathyQt4/Client/channel.h | 1 +
TelepathyQt4/Client/file-transfer.cpp | 6 +++++-
TelepathyQt4/Client/file-transfer.h | 2 +-
TelepathyQt4/Client/pending-channel.cpp | 14 +++++++++-----
TelepathyQt4/Client/room-list.cpp | 6 +++++-
TelepathyQt4/Client/room-list.h | 2 +-
TelepathyQt4/Client/streamed-media-channel.cpp | 6 +++++-
TelepathyQt4/Client/streamed-media-channel.h | 2 +-
TelepathyQt4/Client/text-channel.cpp | 3 ++-
TelepathyQt4/Client/text-channel.h | 2 +-
11 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/TelepathyQt4/Client/channel.cpp b/TelepathyQt4/Client/channel.cpp
index d6c9744..7364123 100644
--- a/TelepathyQt4/Client/channel.cpp
+++ b/TelepathyQt4/Client/channel.cpp
@@ -517,16 +517,23 @@ void Channel::Private::changeReadiness(Readiness newReadiness)
* \param connection Connection owning this Channel, and specifying the
* service.
* \param objectPath Path to the object on the service.
+ * \param immutableProperties The immutable properties of the channel, as
+ * signalled by NewChannels or returned by
+ * CreateChannel or EnsureChannel
* \param parent Passed to the parent class constructor.
*/
Channel::Channel(Connection *connection,
const QString &objectPath,
+ const QVariantMap &immutableProperties,
QObject *parent)
: StatefulDBusProxy(connection->dbusConnection(), connection->busName(),
objectPath, parent),
OptionalInterfaceFactory<Channel>(this),
mPriv(new Private(this, connection))
{
+ // FIXME: remember the immutableProperties, and use them to reduce the
+ // number of D-Bus calls we need to make (but we should make at least
+ // one, to check that the channel does in fact exist)
mPriv->introspectQueue.enqueue(&Private::introspectMain);
QTimer::singleShot(0, this, SLOT(continueIntrospection()));
}
diff --git a/TelepathyQt4/Client/channel.h b/TelepathyQt4/Client/channel.h
index 9341272..30d15ab 100644
--- a/TelepathyQt4/Client/channel.h
+++ b/TelepathyQt4/Client/channel.h
@@ -61,6 +61,7 @@ public:
Channel(Connection *connection,
const QString &objectPath,
+ const QVariantMap &immutableProperties,
QObject *parent = 0);
~Channel();
diff --git a/TelepathyQt4/Client/file-transfer.cpp b/TelepathyQt4/Client/file-transfer.cpp
index ad569d0..cf14eb6 100644
--- a/TelepathyQt4/Client/file-transfer.cpp
+++ b/TelepathyQt4/Client/file-transfer.cpp
@@ -62,12 +62,16 @@ FileTransfer::Private::~Private()
* \param connection Connection owning this FileTransfer, and specifying the
* service.
* \param objectPath Path to the object on the service.
+ * \param immutableProperties The immutable properties of the channel, as
+ * signalled by NewChannels or returned by
+ * CreateChannel or EnsureChannel
* \param parent Passed to the parent class constructor.
*/
FileTransfer::FileTransfer(Connection *connection,
const QString &objectPath,
+ const QVariantMap &immutableProperties,
QObject *parent)
- : Channel(connection, objectPath, parent),
+ : Channel(connection, objectPath, immutableProperties, parent),
mPriv(new Private())
{
}
diff --git a/TelepathyQt4/Client/file-transfer.h b/TelepathyQt4/Client/file-transfer.h
index 6d585d3..f493173 100644
--- a/TelepathyQt4/Client/file-transfer.h
+++ b/TelepathyQt4/Client/file-transfer.h
@@ -39,7 +39,7 @@ class FileTransfer : public Channel
public:
FileTransfer(Connection *connection, const QString &objectPath,
- QObject *parent = 0);
+ const QVariantMap &immutableProperties, QObject *parent = 0);
~FileTransfer();
private:
diff --git a/TelepathyQt4/Client/pending-channel.cpp b/TelepathyQt4/Client/pending-channel.cpp
index 468e7ac..82d6080 100644
--- a/TelepathyQt4/Client/pending-channel.cpp
+++ b/TelepathyQt4/Client/pending-channel.cpp
@@ -56,6 +56,7 @@ struct PendingChannel::Private
uint handleType;
uint handle;
QDBusObjectPath objectPath;
+ QVariantMap immutableProperties;
};
/**
@@ -216,23 +217,24 @@ Channel *PendingChannel::channel(QObject *parent) const
if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT) {
channel = new TextChannel(connection(), mPriv->objectPath.path(),
- parent);
+ mPriv->immutableProperties, parent);
}
else if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA) {
channel = new StreamedMediaChannel(connection(),
- mPriv->objectPath.path(), parent);
+ mPriv->objectPath.path(), mPriv->immutableProperties, parent);
}
else if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_ROOM_LIST) {
channel = new RoomList(connection(), mPriv->objectPath.path(),
- parent);
+ mPriv->immutableProperties, parent);
}
else if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_FILE_TRANSFER) {
channel = new FileTransfer(connection(), mPriv->objectPath.path(),
- parent);
+ mPriv->immutableProperties, parent);
}
else {
// ContactList, old-style Tubes, or a future channel type
- channel = new Channel(connection(), mPriv->objectPath.path(), parent);
+ channel = new Channel(connection(), mPriv->objectPath.path(),
+ mPriv->immutableProperties, parent);
}
return channel;
}
@@ -247,6 +249,7 @@ void PendingChannel::onCallCreateChannelFinished(QDBusPendingCallWatcher *watche
mPriv->objectPath.path();
QVariantMap map = reply.argumentAt<1>();
+ mPriv->immutableProperties = map;
mPriv->channelType = map.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType")).toString();
mPriv->handleType = map.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType")).toUInt();
mPriv->handle = map.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle")).toUInt();
@@ -273,6 +276,7 @@ void PendingChannel::onCallEnsureChannelFinished(QDBusPendingCallWatcher *watche
mPriv->objectPath.path();
QVariantMap map = reply.argumentAt<2>();
+ mPriv->immutableProperties = map;
mPriv->channelType = map.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType")).toString();
mPriv->handleType = map.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType")).toUInt();
mPriv->handle = map.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle")).toUInt();
diff --git a/TelepathyQt4/Client/room-list.cpp b/TelepathyQt4/Client/room-list.cpp
index fe0ae7d..2d96c3a 100644
--- a/TelepathyQt4/Client/room-list.cpp
+++ b/TelepathyQt4/Client/room-list.cpp
@@ -61,12 +61,16 @@ RoomList::Private::~Private()
* \param connection Connection owning this RoomList, and specifying the
* service.
* \param objectPath Path to the object on the service.
+ * \param immutableProperties The immutable properties of the channel, as
+ * signalled by NewChannels or returned by
+ * CreateChannel or EnsureChannel
* \param parent Passed to the parent class constructor.
*/
RoomList::RoomList(Connection *connection,
const QString &objectPath,
+ const QVariantMap &immutableProperties,
QObject *parent)
- : Channel(connection, objectPath, parent),
+ : Channel(connection, objectPath, immutableProperties, parent),
mPriv(new Private())
{
}
diff --git a/TelepathyQt4/Client/room-list.h b/TelepathyQt4/Client/room-list.h
index 057288c..be1d8dd 100644
--- a/TelepathyQt4/Client/room-list.h
+++ b/TelepathyQt4/Client/room-list.h
@@ -39,7 +39,7 @@ class RoomList : public Channel
public:
RoomList(Connection *connection, const QString &objectPath,
- QObject *parent = 0);
+ const QVariantMap &immutableProperties, QObject *parent = 0);
~RoomList();
private:
diff --git a/TelepathyQt4/Client/streamed-media-channel.cpp b/TelepathyQt4/Client/streamed-media-channel.cpp
index 2edc782..38c8c1d 100644
--- a/TelepathyQt4/Client/streamed-media-channel.cpp
+++ b/TelepathyQt4/Client/streamed-media-channel.cpp
@@ -61,12 +61,16 @@ StreamedMediaChannel::Private::~Private()
* \param connection Connection owning this StreamedMediaChannel, and
* specifying the service.
* \param objectPath Path to the object on the service.
+ * \param immutableProperties The immutable properties of the channel, as
+ * signalled by NewChannels or returned by
+ * CreateChannel or EnsureChannel
* \param parent Passed to the parent class constructor.
*/
StreamedMediaChannel::StreamedMediaChannel(Connection *connection,
const QString &objectPath,
+ const QVariantMap &immutableProperties,
QObject *parent)
- : Channel(connection, objectPath, parent),
+ : Channel(connection, objectPath, immutableProperties, parent),
mPriv(new Private())
{
}
diff --git a/TelepathyQt4/Client/streamed-media-channel.h b/TelepathyQt4/Client/streamed-media-channel.h
index 0f1b5c8..55c5361 100644
--- a/TelepathyQt4/Client/streamed-media-channel.h
+++ b/TelepathyQt4/Client/streamed-media-channel.h
@@ -39,7 +39,7 @@ class StreamedMediaChannel : public Channel
public:
StreamedMediaChannel(Connection *connection, const QString &objectPath,
- QObject *parent = 0);
+ const QVariantMap &immutableProperties, QObject *parent = 0);
~StreamedMediaChannel();
private:
diff --git a/TelepathyQt4/Client/text-channel.cpp b/TelepathyQt4/Client/text-channel.cpp
index fe68781..402cd1e 100644
--- a/TelepathyQt4/Client/text-channel.cpp
+++ b/TelepathyQt4/Client/text-channel.cpp
@@ -65,8 +65,9 @@ TextChannel::Private::~Private()
*/
TextChannel::TextChannel(Connection *connection,
const QString &objectPath,
+ const QVariantMap &immutableProperties,
QObject *parent)
- : Channel(connection, objectPath, parent),
+ : Channel(connection, objectPath, immutableProperties, parent),
mPriv(new Private())
{
}
diff --git a/TelepathyQt4/Client/text-channel.h b/TelepathyQt4/Client/text-channel.h
index cf27eb2..c3caa34 100644
--- a/TelepathyQt4/Client/text-channel.h
+++ b/TelepathyQt4/Client/text-channel.h
@@ -39,7 +39,7 @@ class TextChannel : public Channel
public:
TextChannel(Connection *connection, const QString &objectPath,
- QObject *parent = 0);
+ const QVariantMap &immutableProperties, QObject *parent = 0);
~TextChannel();
private:
--
1.5.6.5
More information about the telepathy-commits
mailing list