[Telepathy-commits] [telepathy-qt4/master] Moved ConnectionManager::Private code outside the class definition.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Mon Jan 5 08:56:30 PST 2009


---
 TelepathyQt4/cli-connection-manager.cpp |  153 +++++++++++++++++--------------
 1 files changed, 86 insertions(+), 67 deletions(-)

diff --git a/TelepathyQt4/cli-connection-manager.cpp b/TelepathyQt4/cli-connection-manager.cpp
index beb01eb..2f5f73a 100644
--- a/TelepathyQt4/cli-connection-manager.cpp
+++ b/TelepathyQt4/cli-connection-manager.cpp
@@ -156,86 +156,105 @@ struct ConnectionManager::Private
     QQueue<void (Private::*)()> introspectQueue;
     QQueue<QString> getParametersQueue;
     QQueue<QString> protocolQueue;
-
     QStringList interfaces;
     ProtocolInfoList protocols;;
 
-    ProtocolInfo *protocol(const QString &protocolName)
-    {
-        Q_FOREACH (ProtocolInfo *info, protocols) {
-            if (info->protocolName() == protocolName) {
-                return info;
-            }
-        }
-        return NULL;
-    }
+    Private(ConnectionManager& parent, QString name);
+    ~Private();
 
-    static inline QString makeBusName(const QString& name)
-    {
-        return QString::fromAscii(
-                TELEPATHY_CONNECTION_MANAGER_BUS_NAME_BASE).append(name);
-    }
+    static QString makeBusName(const QString& name);
+    static QString makeObjectPath(const QString& name);
+
+    ProtocolInfo *protocol(const QString &protocolName);
+
+    void callGetAll();
+    void callGetParameters();
+    void callListProtocols();
+};
+
+
+ConnectionManager::Private::Private(ConnectionManager& parent, QString name)
+    : parent(parent),
+      baseInterface(new ConnectionManagerInterface(parent.dbusConnection(),
+                  parent.busName(), parent.objectPath(), &parent)),
+      ready(false)
+{
+    debug() << "Creating new ConnectionManager:" << parent.busName();
 
-    static inline QString makeObjectPath(const QString& name)
-    {
-        return QString::fromAscii(
-                TELEPATHY_CONNECTION_MANAGER_OBJECT_PATH_BASE).append(name);
+    introspectQueue.enqueue(&Private::callGetAll);
+    introspectQueue.enqueue(&Private::callListProtocols);
+    QTimer::singleShot(0, &parent, SLOT(continueIntrospection()));
+}
+
+
+ConnectionManager::Private::~Private()
+{
+    Q_FOREACH (ProtocolInfo* info, protocols) {
+        delete info;
     }
+}
+
+
+QString ConnectionManager::Private::makeBusName(const QString& name)
+{
+    return QString::fromAscii(
+            TELEPATHY_CONNECTION_MANAGER_BUS_NAME_BASE).append(name);
+}
+
 
-    ~Private()
-    {
-        Q_FOREACH (ProtocolInfo* info, protocols) {
-            delete info;
+QString ConnectionManager::Private::makeObjectPath(const QString& name)
+{
+    return QString::fromAscii(
+            TELEPATHY_CONNECTION_MANAGER_OBJECT_PATH_BASE).append(name);
+}
+
+
+ProtocolInfo *ConnectionManager::Private::protocol(const QString &protocolName)
+{
+    Q_FOREACH (ProtocolInfo *info, protocols) {
+        if (info->protocolName() == protocolName) {
+            return info;
         }
     }
+    return NULL;
+}
 
-    void callGetAll()
-    {
-        debug() << "Calling Properties::GetAll(ConnectionManager)";
-        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
-                parent.propertiesInterface()->GetAll(
-                    TELEPATHY_INTERFACE_CONNECTION_MANAGER), &parent);
-        parent.connect(watcher,
-                SIGNAL(finished(QDBusPendingCallWatcher*)),
-                SLOT(onGetAllConnectionManagerReturn(QDBusPendingCallWatcher*)));
-    }
 
-    void callGetParameters()
-    {
-        QString protocol = getParametersQueue.dequeue();
-        protocolQueue.enqueue(protocol);
-        debug() << "Calling ConnectionManager::GetParameters(" <<
-            protocol << ")";
-        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
-                baseInterface->GetParameters(protocol), &parent);
-        parent.connect(watcher,
-                SIGNAL(finished(QDBusPendingCallWatcher*)),
-                SLOT(onGetParametersReturn(QDBusPendingCallWatcher*)));
-    }
+void ConnectionManager::Private::callGetAll()
+{
+    debug() << "Calling Properties::GetAll(ConnectionManager)";
+    QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
+            parent.propertiesInterface()->GetAll(
+                TELEPATHY_INTERFACE_CONNECTION_MANAGER), &parent);
+    parent.connect(watcher,
+            SIGNAL(finished(QDBusPendingCallWatcher*)),
+            SLOT(onGetAllConnectionManagerReturn(QDBusPendingCallWatcher*)));
+}
 
-    void callListProtocols()
-    {
-        debug() << "Calling ConnectionManager::ListProtocols";
-        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
-                baseInterface->ListProtocols(), &parent);
-        parent.connect(watcher,
-                SIGNAL(finished(QDBusPendingCallWatcher*)),
-                SLOT(onListProtocolsReturn(QDBusPendingCallWatcher*)));
-    }
 
-    Private(ConnectionManager& parent, QString name)
-        : parent(parent),
-          baseInterface(new ConnectionManagerInterface(parent.dbusConnection(),
-                      parent.busName(), parent.objectPath(), &parent)),
-          ready(false)
-    {
-        debug() << "Creating new ConnectionManager:" << parent.busName();
-
-        introspectQueue.enqueue(&Private::callGetAll);
-        introspectQueue.enqueue(&Private::callListProtocols);
-        QTimer::singleShot(0, &parent, SLOT(continueIntrospection()));
-    }
-};
+void ConnectionManager::Private::callGetParameters()
+{
+    QString protocol = getParametersQueue.dequeue();
+    protocolQueue.enqueue(protocol);
+    debug() << "Calling ConnectionManager::GetParameters(" <<
+        protocol << ")";
+    QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
+            baseInterface->GetParameters(protocol), &parent);
+    parent.connect(watcher,
+            SIGNAL(finished(QDBusPendingCallWatcher*)),
+            SLOT(onGetParametersReturn(QDBusPendingCallWatcher*)));
+}
+
+
+void ConnectionManager::Private::callListProtocols()
+{
+    debug() << "Calling ConnectionManager::ListProtocols";
+    QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(
+            baseInterface->ListProtocols(), &parent);
+    parent.connect(watcher,
+            SIGNAL(finished(QDBusPendingCallWatcher*)),
+            SLOT(onListProtocolsReturn(QDBusPendingCallWatcher*)));
+}
 
 
 ConnectionManager::ConnectionManager(const QString& name, QObject* parent)
-- 
1.5.6.5




More information about the Telepathy-commits mailing list