QmlProfiler: Send the client recording state to new engines

Otherwise some engine can stop recording by sending a "Complete" event
and that will be the state we send to any new engines, although the
recording button was checked when the recording started.

Also, don't redirect state changes and the associated recording state
sending through a signal and slot. This allows us to remove the
"enabled" property of QmlProfilerTraceClient and adapt the signature
of sendRecordingStatus() to facilitate the redirection of newEngine()
through the client manager.

Task-number: QTCREATORBUG-13317
Change-Id: Ie9dc6785eb761514bc96aaf5724f7b23d3c2932e
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-18 15:18:58 +01:00
parent d7f6dec98e
commit 030acfdf73
4 changed files with 21 additions and 18 deletions

View File

@@ -185,6 +185,8 @@ void QmlProfilerClientManager::connectClientSignals()
if (d->qmlclientplugin) {
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::complete,
this, &QmlProfilerClientManager::qmlComplete);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::newEngine,
this, &QmlProfilerClientManager::qmlNewEngine);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::rangedEvent,
d->modelManager, &QmlProfilerModelManager::addQmlEvent);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::debugMessage,
@@ -193,8 +195,6 @@ void QmlProfilerClientManager::connectClientSignals()
d->modelManager->traceTime(), &QmlProfilerTraceTime::increaseEndTime);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceStarted,
d->modelManager->traceTime(), &QmlProfilerTraceTime::decreaseStartTime);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::enabledChanged,
d->qmlclientplugin.data(), &QmlProfilerTraceClient::sendRecordingStatus);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged,
d->profilerState, &QmlProfilerStateManager::setServerRecording);
connect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
@@ -209,6 +209,8 @@ void QmlProfilerClientManager::disconnectClientSignals()
if (d->qmlclientplugin) {
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::complete,
this, &QmlProfilerClientManager::qmlComplete);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::newEngine,
this, &QmlProfilerClientManager::qmlNewEngine);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::rangedEvent,
d->modelManager, &QmlProfilerModelManager::addQmlEvent);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::debugMessage,
@@ -217,8 +219,6 @@ void QmlProfilerClientManager::disconnectClientSignals()
d->modelManager->traceTime(), &QmlProfilerTraceTime::increaseEndTime);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceStarted,
d->modelManager->traceTime(), &QmlProfilerTraceTime::decreaseStartTime);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::enabledChanged,
d->qmlclientplugin.data(), &QmlProfilerTraceClient::sendRecordingStatus);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged,
d->profilerState, &QmlProfilerStateManager::setServerRecording);
disconnect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
@@ -353,6 +353,14 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime)
d->modelManager->acquiringDone();
}
void QmlProfilerClientManager::qmlNewEngine(int engineId)
{
if (d->qmlclientplugin->isRecording() != d->profilerState->clientRecording())
d->qmlclientplugin->setRecording(d->profilerState->clientRecording());
else
d->qmlclientplugin->sendRecordingStatus(engineId);
}
void QmlProfilerClientManager::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
{
if (d->profilerState) {