diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 6a7590626acc5dad409716c5daea742db0e96c49..58825e73b65c56d3b5d6f3409dedf21dd78d123a 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -64,7 +64,7 @@ contains(QT_CONFIG, declarative) { minQtVersion(4, 7, 1) { SUBDIRS += plugin_qmldesigner - !win32:SUBDIRS += plugin_qmlprofiler + SUBDIRS += plugin_qmlprofiler } else { warning() warning("QmlDesigner plugin has been disabled.") @@ -269,13 +269,13 @@ plugin_analyzerbase.depends += plugin_projectexplorer plugin_callgrind.depends = plugin_coreplugin plugin_callgrind.depends += plugin_analyzerbase plugin_callgrind.depends += plugin_valgrindtoolbase - - plugin_qmlprofiler.subdir = qmlprofiler - plugin_qmlprofiler.depends = plugin_coreplugin - plugin_qmlprofiler.depends += plugin_analyzerbase - plugin_qmlprofiler.depends += plugin_qmlprojectmanager } +plugin_qmlprofiler.subdir = qmlprofiler +plugin_qmlprofiler.depends = plugin_coreplugin +plugin_qmlprofiler.depends += plugin_analyzerbase +plugin_qmlprofiler.depends += plugin_qmlprojectmanager + plugin_qmljstools.subdir = qmljstools plugin_qmljstools.depends = plugin_projectexplorer plugin_qmljstools.depends += plugin_coreplugin diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro index ff399c98966f7c4edfdbf30c78fb0b19a90e38e2..92fe11f0de931962674dd61cf7ccc58604ff9969 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.pro +++ b/src/plugins/qmlprofiler/qmlprofiler.pro @@ -8,11 +8,9 @@ include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/analyzerbase/analyzerbase.pri) include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri) - QT += network script declarative include(canvas/canvas.pri) -#include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) SOURCES += \ qmlprofilerplugin.cpp \ diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 2862dd184f930ad68b04b2df94d609c15cb44d69..edcfb46823750c708e07a2be292ec9b085e56e5d 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -52,9 +52,6 @@ #include <QProcess> -#ifdef Q_OS_UNIX -#include <unistd.h> // sleep -#endif using namespace QmlProfiler::Internal; @@ -176,9 +173,6 @@ bool QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor() connect(m_process,SIGNAL(finished(int)),q,SLOT(spontaneousStop())); m_process->start(m_params.debuggee, arguments); - // give the process time to start - sleep(1); - if (!m_process->waitForStarted()) { if (QmlProfilerPlugin::debugOutput) qWarning("QmlProfiler: %s failed to start", qPrintable(m_params.displayName)); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 8e592e6a883a4285797720cc1e53bd7ac92cc719..cebc1fa4c4e0f44f43e0dc730c1cc67108c607cc 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -109,6 +109,8 @@ public: QmlProfilerTool *q; QDeclarativeDebugConnection *m_client; + QTimer m_connectionTimer; + int m_connectionAttempts; TraceWindow *m_traceWindow; QTabWidget *m_tabbed; QmlProfilerSummaryView *m_summary; @@ -128,6 +130,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate(this)) { d->m_client = 0; + d->m_connectionAttempts = 0; d->m_traceWindow = 0; d->m_outputPaneAdapter = 0; d->m_project = 0; @@ -135,6 +138,9 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) d->m_isAttached = false; d->m_attachAction = 0; d->m_recordingEnabled = true; + + d->m_connectionTimer.setInterval(200); + connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect())); } QmlProfilerTool::~QmlProfilerTool() @@ -190,7 +196,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp return engine; } -void QmlProfilerTool::initialize(ExtensionSystem::IPlugin */*plugin*/) +void QmlProfilerTool::initialize(ExtensionSystem::IPlugin * /*plugin*/) { qmlRegisterType<Canvas>("Monitor", 1, 0, "Canvas"); qmlRegisterType<TiledCanvas>("Monitor", 1, 0, "TiledCanvas"); @@ -286,6 +292,11 @@ QWidget *QmlProfilerTool::createTimeLineWidget() } void QmlProfilerTool::connectClient() +{ + d->m_connectionTimer.start(); +} + +void QmlProfilerTool::connectToClient() { QDeclarativeDebugConnection *newClient = new QDeclarativeDebugConnection; d->m_traceWindow->reset(newClient); @@ -419,3 +430,19 @@ void QmlProfilerTool::updateAttachAction() d->m_attachAction->setEnabled(Analyzer::AnalyzerManager::instance()->currentTool() == this); } +void QmlProfilerTool::tryToConnect() +{ + ++d->m_connectionAttempts; + + if (d->m_client->isConnected()) { + d->m_connectionTimer.stop(); + d->m_connectionAttempts = 0; + } else if (d->m_connectionAttempts == 50) { + d->m_connectionTimer.stop(); + d->m_connectionAttempts = 0; + // TODO: Warn user that connection failed + //emit connectionStartupFailed(); + } else { + connectToClient(); + } +} diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index a59361929e06eac58e2302e9976c1339aae7350b..58a6242b1a52bf385f1a8ccd57bb0e62e6b2a13a 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -85,8 +85,11 @@ private slots: void updateProjectFileList(); void attach(); void updateAttachAction(); + void tryToConnect(); private: + void connectToClient(); + class QmlProfilerToolPrivate; QmlProfilerToolPrivate *d; };