QmlProfiler: When retrying to connect, double the timeout

If you are retrying, then probably you want it to be more patient this
time. Also, tell the user how long we have waited and how long we are
going to wait when retrying.

In turn, reduce the number of "internal" retries. Retrying 10 times
should be enough to determine if the given timeout is too short. This
will give us an initial waiting time of 2s, and make the second try 4s.

Change-Id: Ibdfe02d041550eb16cadc59cec1b78ce97289b30
Task-number: QTCREATORBUG-20529
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2018-05-31 12:52:24 +02:00
parent d3204ed5d4
commit 27907bc417
4 changed files with 28 additions and 16 deletions

View File

@@ -348,15 +348,23 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
infoBox->setText(QmlProfilerTool::tr("Could not connect to the in-process QML profiler.\n"
"Do you want to retry?"));
const int interval = d->m_profilerConnections->retryInterval();
const int retries = d->m_profilerConnections->maximumRetries();
infoBox->setText(QmlProfilerTool::tr("Could not connect to the in-process QML profiler "
"within %1 s.\n"
"Do you want to retry and wait %2 s?")
.arg(interval * retries / 1000.0)
.arg(interval * 2 * retries / 1000.0));
infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help);
infoBox->setDefaultButton(QMessageBox::Retry);
infoBox->setModal(true);
connect(infoBox, &QDialog::finished, runWorker, [this, runWorker](int result) {
connect(infoBox, &QDialog::finished, runWorker, [this, runWorker, interval](int result) {
switch (result) {
case QMessageBox::Retry:
d->m_profilerConnections->setRetryInterval(interval * 2);
d->m_profilerConnections->retryConnect();
break;
case QMessageBox::Help: