Merge remote-tracking branch 'origin/3.6'

Change-Id: Iddfa0d2f3c0fb8ba65c0e5d479ad8e2f2cb95685
This commit is contained in:
Eike Ziller
2015-10-26 10:55:45 +01:00
285 changed files with 6092 additions and 2844 deletions

View File

@@ -394,9 +394,6 @@ void QmlProfilerTool::setRecording(bool recording)
} else {
d->m_recordingTimer.stop();
}
d->m_recordButton->menu()->setEnabled(!recording);
} else {
d->m_recordButton->menu()->setEnabled(true);
}
}
@@ -420,12 +417,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);
@@ -452,6 +457,14 @@ void QmlProfilerTool::clearDisplay()
updateTimeDisplay();
}
void QmlProfilerTool::setButtonsEnabled(bool enable)
{
d->m_clearButton->setEnabled(enable);
d->m_displayFeaturesButton->setEnabled(enable);
d->m_searchButton->setEnabled(enable);
d->m_recordFeaturesMenu->setEnabled(enable);
}
bool QmlProfilerTool::prepareTool()
{
if (d->m_recordButton->isChecked()) {
@@ -626,7 +639,8 @@ void QmlProfilerTool::restoreFeatureVisibility()
void QmlProfilerTool::clientsDisconnected()
{
// If the application stopped by itself, check if we have all the data
if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppDying) {
if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppDying ||
d->m_profilerState->currentState() == QmlProfilerStateManager::Idle) {
if (d->m_profilerModelManager->state() == QmlProfilerModelManager::AcquiringData) {
showNonmodalWarning(tr("Application finished before loading profiled data.\n"
"Please use the stop button instead."));
@@ -634,7 +648,8 @@ void QmlProfilerTool::clientsDisconnected()
}
// ... and return to the "base" state
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppDying)
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
}
// If the connection is closed while the app is still running, no special action is needed
}
@@ -688,13 +703,21 @@ void QmlProfilerTool::profilerDataModelStateChanged()
{
switch (d->m_profilerModelManager->state()) {
case QmlProfilerModelManager::Empty :
d->m_recordButton->setEnabled(true);
setButtonsEnabled(true);
break;
case QmlProfilerModelManager::ClearingData :
d->m_recordButton->setEnabled(false);
setButtonsEnabled(false);
clearDisplay();
break;
case QmlProfilerModelManager::AcquiringData :
d->m_recordButton->setEnabled(true); // Press recording button to stop recording
setButtonsEnabled(false); // Other buttons disabled
break;
case QmlProfilerModelManager::ProcessingData :
// nothing to be done for these two
d->m_recordButton->setEnabled(false);
setButtonsEnabled(false);
break;
case QmlProfilerModelManager::Done :
if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppStopRequested)
@@ -702,6 +725,8 @@ void QmlProfilerTool::profilerDataModelStateChanged()
showSaveOption();
updateTimeDisplay();
restoreFeatureVisibility();
d->m_recordButton->setEnabled(true);
setButtonsEnabled(true);
break;
default:
break;
@@ -750,6 +775,11 @@ void QmlProfilerTool::profilerStateChanged()
// when the app finishes, set recording display to client status
setRecording(d->m_profilerState->clientRecording());
break;
case QmlProfilerStateManager::AppStopRequested:
// Don't allow toggling the recording while data is loaded when application quits
if (d->m_profilerState->serverRecording())
d->m_recordButton->setEnabled(false);
break;
default:
// no special action needed for other states
break;
@@ -782,15 +812,14 @@ void QmlProfilerTool::serverRecordingChanged()
showSaveDialog();
setRecording(true);
d->m_clearButton->setEnabled(false);
clearData();
d->m_profilerModelManager->prepareForWriting();
} else {
setRecording(false);
d->m_clearButton->setEnabled(true);
// changes back once loading is finished, see profilerDataModelStateChanged()
d->m_recordButton->setEnabled(false);
}
} else {
d->m_clearButton->setEnabled(true);
}
}