From b723c98d18c4fdec1654ea283e5bfd9ea44dc701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6fman?= Date: Fri, 26 Nov 2010 15:26:32 +0200 Subject: Added connectedToManager() signal --- libresourceqt/include/qt4/policy/resource-set.h | 5 +++++ libresourceqt/src/resource-set.cpp | 1 + resourceqt-client/client.cpp | 14 ++++++++++++++ resourceqt-client/client.h | 1 + 4 files changed, 21 insertions(+) diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h index 03c9d95..538f9ae 100644 --- a/libresourceqt/include/qt4/policy/resource-set.h +++ b/libresourceqt/include/qt4/policy/resource-set.h @@ -298,6 +298,11 @@ signals: */ void errorCallback(quint32, const char*); + /** + * This signals that we have connected to the Resource Manager. + */ + void connectedToManager(); + private: bool initialize(); diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp index b6885a5..8f26a13 100644 --- a/libresourceqt/src/resource-set.cpp +++ b/libresourceqt/src/resource-set.cpp @@ -322,6 +322,7 @@ void ResourceSet::connectedHandler() qDebug("**************** ResourceSet::%s().... %d", __FUNCTION__, __LINE__); if (resourceEngine->isConnectedToManager()) { qDebug("ResourceSet::%s() Connected to manager!", __FUNCTION__); + emit connectedToManager(); if (pendingAudioProperties) { registerAudioProperties(); diff --git a/resourceqt-client/client.cpp b/resourceqt-client/client.cpp index 804ac56..fe15586 100644 --- a/resourceqt-client/client.cpp +++ b/resourceqt-client/client.cpp @@ -129,11 +129,15 @@ bool Client::initialize(const CommandLineParser &parser) if (!connect(&stdInNotifier, SIGNAL(activated(int)), this, SLOT(readLine(int)))) { return false; } + if (!connect(resourceSet , SIGNAL(connectedToManager()), this, SLOT(stopConnectTimerHandler()))) { + return false; + } if (!connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(doExit()))) { return false; } + start_timer(); resourceSet->initAndConnect(); output << "connecting...accepting input" << endl; showPrompt(); @@ -146,6 +150,7 @@ void Client::doExit() resourceSet->release(); } + const char * resourceTypeToString(ResourceType type) { switch (type) { @@ -201,6 +206,15 @@ void Client::showResources(const QList &resList) } } +void Client::stopConnectTimerHandler() +{ + long int ms = stop_timer(); + if (ms > 0) { + outputln << "Register took " << ms << "ms" << endl; + } + +} + void Client::resourceAcquiredHandler(const QList&) { long int ms = stop_timer(); diff --git a/resourceqt-client/client.h b/resourceqt-client/client.h index c22475d..342f5f9 100644 --- a/resourceqt-client/client.h +++ b/resourceqt-client/client.h @@ -62,6 +62,7 @@ private slots: void resourcesBecameAvailableHandler(const QList &availableResources); void readLine(int); void doExit(); + void stopConnectTimerHandler(); private: QTextStream standardInput; -- cgit v1.2.3