QmlProfiler: Don't update the time display during state transitions

Previously, the display would show 0.0 while the profiler was waiting
for the application to send data. That is somewhat confusing.

Change-Id: I3ad85e5479c2cf3a65e6c4b411d959a5b15baae8
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-10-20 13:04:44 +02:00
parent 69377f0de4
commit 5bc6bf03e1

View File

@@ -416,12 +416,20 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
void QmlProfilerTool::updateTimeDisplay()
{
double seconds = 0;
if (d->m_profilerState->serverRecording() &&
d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning) {
switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppStopRequested:
case QmlProfilerStateManager::AppDying:
return; // Transitional state: don't update the display.
case QmlProfilerStateManager::AppRunning:
if (d->m_profilerState->serverRecording()) {
seconds = d->m_recordingElapsedTime.elapsed() / 1000.0;
} else if (d->m_profilerModelManager->state() != QmlProfilerModelManager::Empty &&
d->m_profilerModelManager->state() != QmlProfilerModelManager::ClearingData) {
seconds = d->m_profilerModelManager->traceTime()->duration() / 1.0e9;
break;
} // else fall through
case QmlProfilerStateManager::Idle:
if (d->m_profilerModelManager->state() != QmlProfilerModelManager::Empty &&
d->m_profilerModelManager->state() != QmlProfilerModelManager::ClearingData)
seconds = d->m_profilerModelManager->traceTime()->duration() / 1.0e9;
break;
}
QString timeString = QString::number(seconds,'f',1);
QString profilerTimeStr = QmlProfilerTool::tr("%1 s").arg(timeString, 6);