From 5bc6bf03e156677599fc9efd5c73c1c571b97742 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 20 Oct 2015 13:04:44 +0200 Subject: 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 --- src/plugins/qmlprofiler/qmlprofilertool.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index f80768dd98..915d3fd84c 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -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); -- cgit v1.2.1