Commit 030acfdf authored by Ulf Hermann's avatar Ulf Hermann

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: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent d7f6dec9
......@@ -88,7 +88,7 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint
{
setRequestedFeatures(features);
connect(&d->engineControl, &QmlEngineControlClient::engineAboutToBeAdded,
this, &QmlProfilerTraceClient::sendRecordingStatus);
this, &QmlProfilerTraceClient::newEngine);
}
QmlProfilerTraceClient::~QmlProfilerTraceClient()
......@@ -116,14 +116,9 @@ void QmlProfilerTraceClient::clearData()
emit cleared();
}
void QmlProfilerTraceClient::sendRecordingStatus()
void QmlProfilerTraceClient::sendRecordingStatus(int engineId)
{
d->sendRecordingStatus(-1);
}
bool QmlProfilerTraceClient::isEnabled() const
{
return state() == Enabled;
d->sendRecordingStatus(engineId);
}
bool QmlProfilerTraceClient::isRecording() const
......@@ -190,9 +185,10 @@ bool QmlProfilerTraceClientPrivate::updateFeatures(ProfileFeature feature)
return true;
}
void QmlProfilerTraceClient::stateChanged(State /*status*/)
void QmlProfilerTraceClient::stateChanged(State status)
{
emit enabledChanged();
if (status == Enabled)
sendRecordingStatus(-1);
}
void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
......
......@@ -44,7 +44,6 @@ namespace QmlDebug {
class QMLDEBUG_EXPORT QmlProfilerTraceClient : public QmlDebug::QmlDebugClient
{
Q_OBJECT
Q_PROPERTY(bool enabled READ isEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool recording READ isRecording WRITE setRecording NOTIFY recordingChanged)
// don't hide by signal
......@@ -54,14 +53,13 @@ public:
QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features);
~QmlProfilerTraceClient();
bool isEnabled() const;
bool isRecording() const;
void setRecording(bool);
quint64 recordedFeatures() const;
public slots:
void clearData();
void sendRecordingStatus();
void sendRecordingStatus(int engineId = -1);
void setRequestedFeatures(quint64 features);
void setFlushInterval(quint32 flushInterval);
......@@ -77,8 +75,8 @@ signals:
const QmlDebug::QmlEventLocation &location);
void recordingChanged(bool arg);
void recordedFeaturesChanged(quint64 features);
void newEngine(int engineId);
void enabledChanged();
void cleared();
protected:
......
......@@ -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) {
......
......@@ -81,6 +81,7 @@ private slots:
void retryMessageBoxFinished(int result);
void qmlComplete(qint64 maximumTime);
void qmlNewEngine(int engineId);
void profilerStateChanged();
void clientRecordingChanged();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment