Commit a46fe36b authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Fix toggling of internal client recording state



We cannot just set it unconditionally on setRecording() because the
client recording state is supposed to reflect the user's intention.
Instead, if the recording button's state differs from the intention
and then spontaneously changes to match it (through a change in the
application), we toggle the client recording state twice to make sure
everything is properly synchronized.

Change-Id: I070d38364e63ab9cf0597fabed3d326ac3685589
Task-number: QTCREATORBUG-13322, QTCREATORBUG-13430
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 9411cd2d
......@@ -328,14 +328,21 @@ void QmlProfilerTool::populateFileFinder(QString projectDirectory, QString activ
void QmlProfilerTool::recordingButtonChanged(bool recording)
{
// clientRecording is our intention for new sessions. That may differ from the state of the
// current session, as indicated by the button. To synchronize it, toggle once.
if (recording && d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning) {
if (checkForUnsavedNotes()) {
clearData(); // clear right away, before the application starts
if (d->m_profilerState->clientRecording())
d->m_profilerState->setClientRecording(false);
d->m_profilerState->setClientRecording(true);
} else {
d->m_recordButton->setChecked(false);
}
} else {
if (d->m_profilerState->clientRecording() == recording)
d->m_profilerState->setClientRecording(!recording);
d->m_profilerState->setClientRecording(recording);
}
}
......@@ -348,7 +355,6 @@ void QmlProfilerTool::setRecording(bool recording)
QLatin1String(":/qmlprofiler/recordOff.png")));
d->m_recordButton->setChecked(recording);
d->m_profilerState->setClientRecording(recording);
// manage timer
if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning) {
......
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