From 51dd89fc3408c2790f47cf0125744d62efc7f240 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 10 Aug 2017 12:41:52 +0200 Subject: [PATCH] QmlProfiler: Remove connection timer The connection timer was traditionally used in cases where the application was started without being given a port on the commandline. These setups do not exist anymore or have been changed to provide a suitable port on the commandline. Change-Id: Ib4653e73943819762f0c8162cc13e4da789705a7 Reviewed-by: Ulf Hermann --- .../qmlprofiler/qmlprofilerruncontrol.cpp | 60 ------------------- .../qmlprofiler/qmlprofilerruncontrol.h | 3 - 2 files changed, 63 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index fff1a528006..263ed951b71 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -56,7 +56,6 @@ #include #include #include -#include using namespace Debugger; using namespace Core; @@ -75,7 +74,6 @@ class QmlProfilerRunner::QmlProfilerRunnerPrivate { public: QmlProfilerStateManager *m_profilerState = 0; - QTimer m_noDebugOutputTimer; }; // @@ -89,14 +87,6 @@ QmlProfilerRunner::QmlProfilerRunner(RunControl *runControl) setDisplayName("QmlProfilerRunner"); runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR); setSupportsReRunning(false); - - // Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect - // (application output might be redirected / blocked) - d->m_noDebugOutputTimer.setSingleShot(true); - d->m_noDebugOutputTimer.setInterval(4000); - connect(&d->m_noDebugOutputTimer, &QTimer::timeout, this, [this]() { - notifyRemoteSetupDone(Utils::Port()); - }); } QmlProfilerRunner::~QmlProfilerRunner() @@ -118,8 +108,6 @@ void QmlProfilerRunner::start() clientManager->setServerUrl(serverUrl); clientManager->connectToTcpServer(); } - else if (serverUrl.path().isEmpty()) - d->m_noDebugOutputTimer.start(); d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning); @@ -190,53 +178,6 @@ void QmlProfilerRunner::cancelProcess() runControl()->initiateStop(); } -void QmlProfilerRunner::notifyRemoteSetupFailed(const QString &errorMessage) -{ - QMessageBox *infoBox = new QMessageBox(ICore::mainWindow()); - infoBox->setIcon(QMessageBox::Critical); - infoBox->setWindowTitle(tr("Qt Creator")); - //: %1 is detailed error message - infoBox->setText(tr("Could not connect to the in-process QML debugger:\n%1") - .arg(errorMessage)); - infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help); - infoBox->setDefaultButton(QMessageBox::Ok); - infoBox->setModal(true); - - connect(infoBox, &QDialog::finished, - this, &QmlProfilerRunner::wrongSetupMessageBoxFinished); - - infoBox->show(); - - // KILL - d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); - d->m_noDebugOutputTimer.stop(); -} - -void QmlProfilerRunner::wrongSetupMessageBoxFinished(int button) -{ - if (button == QMessageBox::Help) { - HelpManager::handleHelpRequest(QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-debugging-qml.html" - "#setting-up-qml-debugging")); - } -} - -void QmlProfilerRunner::notifyRemoteSetupDone(Utils::Port port) -{ - d->m_noDebugOutputTimer.stop(); - - QUrl serverUrl = this->serverUrl(); - if (!port.isValid()) - port = Utils::Port(serverUrl.port()); - - if (port.isValid()) { - serverUrl.setPort(port.number()); - auto clientManager = Internal::QmlProfilerTool::clientManager(); - clientManager->setServerUrl(serverUrl); - clientManager->connectToTcpServer(); - reportStarted(); - } -} - void QmlProfilerRunner::registerProfilerStateManager( QmlProfilerStateManager *profilerState ) { // disconnect old @@ -256,7 +197,6 @@ void QmlProfilerRunner::profilerStateChanged() { switch (d->m_profilerState->currentState()) { case QmlProfilerStateManager::Idle: - d->m_noDebugOutputTimer.stop(); reportStopped(); break; default: diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index 5d782e2d14d..749d7a22411 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -50,8 +50,6 @@ public: void registerProfilerStateManager( QmlProfilerStateManager *profilerState ); - void notifyRemoteSetupDone(Utils::Port port); - void notifyRemoteSetupFailed(const QString &errorMessage); void cancelProcess(); void notifyRemoteFinished(); @@ -59,7 +57,6 @@ private: void start() override; void stop() override; - void wrongSetupMessageBoxFinished(int); void profilerStateChanged(); class QmlProfilerRunnerPrivate;