OSDN Git Service

QmlProfiler: user defined host:port
authorChristiaan Janssen <christiaan.janssen@nokia.com>
Thu, 14 Apr 2011 13:44:43 +0000 (15:44 +0200)
committerChristiaan Janssen <christiaan.janssen@nokia.com>
Thu, 14 Apr 2011 13:44:43 +0000 (15:44 +0200)
Reviewed-by: Kai Koehne
src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
src/plugins/qmlprofiler/qmlprofilerengine.cpp
src/plugins/qmlprofiler/qmlprofilertool.cpp
src/plugins/qmlprofiler/qmlprofilertool.h
src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp

index e919c82..d698acd 100644 (file)
@@ -61,6 +61,8 @@ AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *
     sp.debuggee = rc->executable();
     sp.debuggeeArgs = rc->commandLineArguments();
     sp.displayName = rc->displayName();
+    sp.connParams.host = QLatin1String("localhost");
+    sp.connParams.port = rc->qmlDebugServerPort();
     return sp;
 }
 
index 06bb164..3489ed1 100644 (file)
@@ -147,7 +147,7 @@ bool QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor()
 
     m_process = new QProcess();
 
-    QStringList arguments("-qmljsdebugger=port:" + QString::number(QmlProfilerTool::port) + ",block");
+    QStringList arguments("-qmljsdebugger=port:" + QString::number(m_params.connParams.port) + ",block");
     arguments.append(m_params.debuggeeArgs.split(" "));
 
     if (QmlProfilerPlugin::debugOutput)
@@ -174,7 +174,7 @@ bool QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor()
     }
 
     if (QmlProfilerPlugin::debugOutput)
-        qWarning("QmlProfiler: Connecting to %s:%d", qPrintable(QmlProfilerTool::host), QmlProfilerTool::port);
+        qWarning("QmlProfiler: Connecting to %s:%d", qPrintable(m_params.connParams.host), m_params.connParams.port);
 
     return true;
 }
index 7f1c382..601a73c 100644 (file)
 using namespace Analyzer;
 using namespace QmlProfiler::Internal;
 
-QString QmlProfilerTool::host = QLatin1String("localhost");
-quint16 QmlProfilerTool::port = 33456;
-
-
 // Adapter for output pane.
 class QmlProfilerOutputPaneAdapter : public Analyzer::IAnalyzerOutputPaneAdapter
 {
@@ -124,6 +120,8 @@ public:
     QAction *m_attachAction;
     QToolButton *m_recordButton;
     bool m_recordingEnabled;
+    QString m_host;
+    quint64 m_port;
 };
 
 QmlProfilerTool::QmlProfilerTool(QObject *parent)
@@ -170,6 +168,9 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
 {
     QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration);
 
+    d->m_host = sp.connParams.host;
+    d->m_port = sp.connParams.port;
+
     d->m_runConfiguration = runConfiguration;
     d->m_project = runConfiguration->target()->project();
     if (d->m_project) {
@@ -291,7 +292,7 @@ void QmlProfilerTool::connectClient()
     delete d->m_client;
     d->m_client = newClient;
 
-    d->m_client->connectToHost(host, port);
+    d->m_client->connectToHost(d->m_host, d->m_port);
     d->m_client->waitForConnected();
 
     if (d->m_client->isConnected()) {
@@ -392,8 +393,8 @@ void QmlProfilerTool::attach()
         if (result == QDialog::Rejected)
             return;
 
-        port = dialog.port();
-        host = dialog.address();
+        d->m_port = dialog.port();
+        d->m_host = dialog.address();
 
         connectClient();
         AnalyzerManager::instance()->showMode();
index 5e7ec67..a593619 100644 (file)
@@ -81,11 +81,6 @@ signals:
     void fetchingData(bool);
     void connectionFailed();
 
-public:
-    // Todo: configurable parameters
-    static QString host;
-    static quint16 port;
-
 private slots:
     void updateProjectFileList();
     void attach();
index e310335..14e72bd 100644 (file)
@@ -57,6 +57,8 @@ AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *
     sp.debuggee = rc->observerPath();
     sp.debuggeeArgs = rc->viewerArguments();
     sp.displayName = rc->displayName();
+    sp.connParams.host = QLatin1String("localhost");
+    sp.connParams.port = rc->qmlDebugServerPort();
     return sp;
 }