summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@digia.com>2013-05-03 12:41:58 +0200
committerhjk <hjk121@nokiamail.com>2013-05-06 13:27:50 +0200
commit24af63ec4b9b32afeff4e5ab07186cf35e178f34 (patch)
tree349c87435ca4a85506d378cd8bc580d1879fead9 /src/plugins
parentc9d1c5b3540971c2551e58e39d8715366b3c4d2a (diff)
downloadqt-creator-24af63ec4b9b32afeff4e5ab07186cf35e178f34.tar.gz
Android: Add QML profiling
Change-Id: Ie06c0b49707f8ec549f180f41c565fd223240186 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/analyzerbase/analyzerconstants.h3
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrol.cpp8
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrol.h3
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrolfactory.cpp1
-rw-r--r--src/plugins/analyzerbase/ianalyzerengine.h5
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.cpp1
-rw-r--r--src/plugins/android/android.pro8
-rw-r--r--src/plugins/android/android.qbs4
-rw-r--r--src/plugins/android/android_dependencies.pri3
-rw-r--r--src/plugins/android/androidanalyzesupport.cpp121
-rw-r--r--src/plugins/android/androidanalyzesupport.h72
-rw-r--r--src/plugins/android/androiddebugsupport.cpp66
-rw-r--r--src/plugins/android/androiddebugsupport.h13
-rw-r--r--src/plugins/android/androidruncontrol.cpp2
-rw-r--r--src/plugins/android/androidrunfactories.cpp18
-rw-r--r--src/plugins/android/androidrunner.cpp13
-rw-r--r--src/plugins/android/androidrunner.h7
-rw-r--r--src/plugins/android/androidrunsupport.cpp79
-rw-r--r--src/plugins/android/androidrunsupport.h63
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.cpp18
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.h3
21 files changed, 452 insertions, 59 deletions
diff --git a/src/plugins/analyzerbase/analyzerconstants.h b/src/plugins/analyzerbase/analyzerconstants.h
index 2c1162cc24..1b1826443c 100644
--- a/src/plugins/analyzerbase/analyzerconstants.h
+++ b/src/plugins/analyzerbase/analyzerconstants.h
@@ -44,7 +44,8 @@ enum StartMode
{
StartLocal = -1,
StartRemote = -2,
- StartQml = -3
+ StartQml = -3,
+ StartQmlAndroid = -4 // TODO: remove this enum and make it generic
};
namespace Constants {
diff --git a/src/plugins/analyzerbase/analyzerruncontrol.cpp b/src/plugins/analyzerbase/analyzerruncontrol.cpp
index c13e06e7a7..f7197126a7 100644
--- a/src/plugins/analyzerbase/analyzerruncontrol.cpp
+++ b/src/plugins/analyzerbase/analyzerruncontrol.cpp
@@ -38,6 +38,7 @@
#include <projectexplorer/taskhub.h>
#include <QDebug>
+#include <QAction>
using namespace ProjectExplorer;
@@ -85,6 +86,8 @@ AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool,
SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int)));
connect(d->m_engine, SIGNAL(finished()),
SLOT(engineFinished()));
+
+ connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), SLOT(stopIt()));
}
AnalyzerRunControl::~AnalyzerRunControl()
@@ -159,6 +162,11 @@ QIcon AnalyzerRunControl::icon() const
return QIcon(QLatin1String(":/images/analyzer_start_small.png"));
}
+IAnalyzerEngine *AnalyzerRunControl::engine() const
+{
+ return d->m_engine;
+}
+
void AnalyzerRunControl::receiveOutput(const QString &text, Utils::OutputFormat format)
{
appendMessage(text, format);
diff --git a/src/plugins/analyzerbase/analyzerruncontrol.h b/src/plugins/analyzerbase/analyzerruncontrol.h
index 6ad4464ab6..bf5a27e4d9 100644
--- a/src/plugins/analyzerbase/analyzerruncontrol.h
+++ b/src/plugins/analyzerbase/analyzerruncontrol.h
@@ -40,6 +40,7 @@ namespace Analyzer {
class AnalyzerStartParameters;
class IAnalyzerTool;
+class IAnalyzerEngine;
class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
{
@@ -57,6 +58,8 @@ public:
QString displayName() const;
QIcon icon() const;
+ IAnalyzerEngine *engine() const;
+
private slots:
void stopIt();
void receiveOutput(const QString &, Utils::OutputFormat format);
diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp b/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
index 38dcbc6703..9367ccacc7 100644
--- a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
+++ b/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
@@ -71,7 +71,6 @@ RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration
sp.toolId = tool->id();
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
- QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
return rc;
}
diff --git a/src/plugins/analyzerbase/ianalyzerengine.h b/src/plugins/analyzerbase/ianalyzerengine.h
index 50c1e400df..233564120a 100644
--- a/src/plugins/analyzerbase/ianalyzerengine.h
+++ b/src/plugins/analyzerbase/ianalyzerengine.h
@@ -83,6 +83,11 @@ public:
IAnalyzerTool *tool() const { return m_tool; }
StartMode mode() const { return m_sp.startMode; }
+ virtual void notifyRemoteSetupDone(quint16) {}
+
+public slots:
+ virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
+
signals:
/// Should be emitted when the debuggee outputted something.
void outputReceived(const QString &, Utils::OutputFormat format);
diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp
index 3f6c8b60ea..fc22394e29 100644
--- a/src/plugins/analyzerbase/ianalyzertool.cpp
+++ b/src/plugins/analyzerbase/ianalyzertool.cpp
@@ -54,6 +54,7 @@ Id IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
case StartRemote:
return id.withSuffix(".Remote");
case StartQml:
+ case StartQmlAndroid:
return id.withSuffix(".Qml");
}
return Id();
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro
index c4e6534bd4..38266056ba 100644
--- a/src/plugins/android/android.pro
+++ b/src/plugins/android/android.pro
@@ -34,7 +34,9 @@ HEADERS += \
androidplugin.h \
androiddevicefactory.h \
androiddevice.h \
- androidgdbserverkitinformation.h
+ androidgdbserverkitinformation.h \
+ androidanalyzesupport.h \
+ androidrunsupport.h
SOURCES += \
androidconfigurations.cpp \
@@ -63,7 +65,9 @@ SOURCES += \
androidplugin.cpp \
androiddevicefactory.cpp \
androiddevice.cpp \
- androidgdbserverkitinformation.cpp
+ androidgdbserverkitinformation.cpp \
+ androidanalyzesupport.cpp \
+ androidrunsupport.cpp
FORMS += \
androidsettingswidget.ui \
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index f531e2c0db..0c8ff2a0ca 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -20,6 +20,8 @@ QtcPlugin {
files: [
"addnewavddialog.ui",
"android.qrc",
+ "androidanalyzesupport.cpp",
+ "androidanalyzesupport.h",
"androidconfigurations.cpp",
"androidconfigurations.h",
"androidconstants.h",
@@ -71,6 +73,8 @@ QtcPlugin {
"androidrunfactories.h",
"androidrunner.cpp",
"androidrunner.h",
+ "androidrunsupport.cpp",
+ "androidrunsupport.h",
"androidsettingspage.cpp",
"androidsettingspage.h",
"androidsettingswidget.cpp",
diff --git a/src/plugins/android/android_dependencies.pri b/src/plugins/android/android_dependencies.pri
index c5604f5bba..4258eb781b 100644
--- a/src/plugins/android/android_dependencies.pri
+++ b/src/plugins/android/android_dependencies.pri
@@ -3,4 +3,5 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
- qt4projectmanager
+ qt4projectmanager \
+ analyzerbase
diff --git a/src/plugins/android/androidanalyzesupport.cpp b/src/plugins/android/androidanalyzesupport.cpp
new file mode 100644
index 0000000000..13c31f4039
--- /dev/null
+++ b/src/plugins/android/androidanalyzesupport.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "androidanalyzesupport.h"
+
+#include "androidrunner.h"
+#include "androidmanager.h"
+
+#include "analyzerbase/ianalyzertool.h"
+#include "analyzerbase/ianalyzerengine.h"
+#include "analyzerbase/analyzermanager.h"
+#include "analyzerbase/analyzerruncontrol.h"
+#include "analyzerbase/analyzerstartparameters.h"
+
+#include <projectexplorer/target.h>
+#include <projectexplorer/project.h>
+#include <qtsupport/qtkitinformation.h>
+
+#include <QDir>
+#include <QTcpServer>
+
+using namespace Analyzer;
+using namespace ProjectExplorer;
+
+namespace Android {
+namespace Internal {
+
+RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfiguration *runConfig,
+ RunMode runMode, QString *errorMessage)
+{
+ IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(runMode);
+ if (!tool) {
+ if (errorMessage)
+ *errorMessage = tr("No analyzer tool selected");
+ return 0;
+ }
+
+ AnalyzerStartParameters params;
+ params.toolId = tool->id();
+ params.startMode = StartQmlAndroid;
+ Target *target = runConfig->target();
+ params.displayName = AndroidManager::packageName(target);
+ params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
+ // TODO: Not sure if these are the right paths.
+ params.workingDirectory = target->project()->projectDirectory();
+ if (runMode == ProjectExplorer::QmlProfilerRunMode) {
+ QTcpServer server;
+ QTC_ASSERT(server.listen(QHostAddress::LocalHost)
+ || server.listen(QHostAddress::LocalHostIPv6), return 0);
+ params.analyzerHost = server.serverAddress().toString();
+ }
+
+ AnalyzerRunControl * const analyzerRunControl = new AnalyzerRunControl(tool, params, runConfig);
+ new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
+ return analyzerRunControl;
+}
+
+AndroidAnalyzeSupport::AndroidAnalyzeSupport(AndroidRunConfiguration *runConfig,
+ AnalyzerRunControl *runControl)
+ : AndroidRunSupport(runConfig, runControl),
+ m_engine(0)
+{
+ if (runControl) {
+ m_engine = runControl->engine();
+ if (m_engine) {
+ connect(m_engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
+ m_runner, SLOT(start()));
+ }
+ }
+}
+
+void AndroidAnalyzeSupport::handleRemoteProcessStarted(int qmlPort)
+{
+ if (m_engine)
+ m_engine->notifyRemoteSetupDone(qmlPort);
+}
+
+void AndroidAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
+{
+ if (m_engine)
+ m_engine->logApplicationMessage(QString::fromUtf8(output), Utils::StdOutFormatSameLine);
+ else
+ AndroidRunSupport::handleRemoteOutput(output);
+}
+
+void AndroidAnalyzeSupport::handleRemoteErrorOutput(const QByteArray &output)
+{
+ if (m_engine)
+ m_engine->logApplicationMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine);
+ else
+ AndroidRunSupport::handleRemoteErrorOutput(output);
+}
+
+} // namespace Internal
+} // namespace Android
diff --git a/src/plugins/android/androidanalyzesupport.h b/src/plugins/android/androidanalyzesupport.h
new file mode 100644
index 0000000000..8aad0f43c9
--- /dev/null
+++ b/src/plugins/android/androidanalyzesupport.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROIDANALYZESUPPORT_H
+#define ANDROIDANALYZESUPPORT_H
+
+#include "androidrunsupport.h"
+
+namespace Analyzer {
+class IAnalyzerEngine;
+class AnalyzerRunControl;
+}
+namespace ProjectExplorer { class RunControl; }
+
+namespace Android {
+namespace Internal {
+
+class AndroidRunConfiguration;
+class AndroidRunner;
+
+class AndroidAnalyzeSupport : public AndroidRunSupport
+{
+ Q_OBJECT
+
+public:
+ static ProjectExplorer::RunControl *createAnalyzeRunControl(AndroidRunConfiguration *runConfig,
+ ProjectExplorer::RunMode runMode,
+ QString *errorMessage);
+
+ AndroidAnalyzeSupport(AndroidRunConfiguration *runConfig,
+ Analyzer::AnalyzerRunControl *runControl);
+
+private slots:
+ void handleRemoteProcessStarted(int qmlPort);
+
+ void handleRemoteOutput(const QByteArray &output);
+ void handleRemoteErrorOutput(const QByteArray &output);
+
+private:
+ Analyzer::IAnalyzerEngine *m_engine;
+};
+
+} // namespace Internal
+} // namespace Android
+
+#endif // ANDROIDANALYZESUPPORT_H
diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp
index 96c9c4c80d..c8e50f5d36 100644
--- a/src/plugins/android/androiddebugsupport.cpp
+++ b/src/plugins/android/androiddebugsupport.cpp
@@ -133,68 +133,70 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
DebuggerRunControl *runControl)
- : QObject(runControl), m_runControl(runControl),
- m_runner(new AndroidRunner(this, runConfig, true))
+ : AndroidRunSupport(runConfig, runControl),
+ m_engine(0)
{
Debugger::DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
Q_ASSERT(aspect->useCppDebugger() || aspect->useQmlDebugger());
- connect(m_runControl->engine(), SIGNAL(requestRemoteSetup()),
- m_runner, SLOT(start()));
- connect(m_runControl, SIGNAL(finished()),
- m_runner, SLOT(stop()));
- connect(m_runControl->engine(), SIGNAL(aboutToNotifyInferiorSetupOk()),
- m_runner, SLOT(handleRemoteDebuggerRunning()));
-
- connect(m_runner, SIGNAL(remoteServerRunning(QByteArray,int)),
- SLOT(handleRemoteServerRunning(QByteArray,int)));
- connect(m_runner, SIGNAL(remoteProcessStarted(int,int)),
- SLOT(handleRemoteProcessStarted(int,int)));
- connect(m_runner, SIGNAL(remoteProcessFinished(QString)),
- SLOT(handleRemoteProcessFinished(QString)));
-
- connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)),
- SLOT(handleRemoteErrorOutput(QByteArray)));
- connect(m_runner, SIGNAL(remoteOutput(QByteArray)),
- SLOT(handleRemoteOutput(QByteArray)));
+ if (runControl)
+ m_engine = runControl->engine();
+
+ if (m_engine) {
+ connect(m_engine, SIGNAL(requestRemoteSetup()),
+ m_runner, SLOT(start()));
+ connect(m_engine, SIGNAL(aboutToNotifyInferiorSetupOk()),
+ m_runner, SLOT(handleRemoteDebuggerRunning()));
+ }
}
void AndroidDebugSupport::handleRemoteServerRunning(const QByteArray &serverChannel, int pid)
{
- m_runControl->engine()->notifyEngineRemoteServerRunning(serverChannel, pid);
+ if (m_engine)
+ m_engine->notifyEngineRemoteServerRunning(serverChannel, pid);
}
void AndroidDebugSupport::handleRemoteProcessStarted(int gdbServerPort, int qmlPort)
{
disconnect(m_runner, SIGNAL(remoteProcessStarted(int,int)),
this, SLOT(handleRemoteProcessStarted(int,int)));
- m_runControl->engine()->notifyEngineRemoteSetupDone(gdbServerPort, qmlPort);
+ if (m_engine)
+ m_engine->notifyEngineRemoteSetupDone(gdbServerPort, qmlPort);
}
void AndroidDebugSupport::handleRemoteProcessFinished(const QString &errorMsg)
{
- if (m_runControl)
- m_runControl->showMessage(errorMsg, AppStuff);
+ DebuggerRunControl *runControl = qobject_cast<DebuggerRunControl *>(m_runControl);
+ if (runControl)
+ runControl->showMessage(errorMsg, AppStuff);
+ else
+ AndroidRunSupport::handleRemoteProcessFinished(errorMsg);
}
void AndroidDebugSupport::handleRemoteOutput(const QByteArray &output)
{
- if (m_runControl) {
- if (m_runControl->engine())
- m_runControl->engine()->showMessage(QString::fromUtf8(output), AppOutput);
+ if (m_engine) {
+ m_engine->showMessage(QString::fromUtf8(output), AppOutput);
+ } else {
+ DebuggerRunControl *runControl = qobject_cast<DebuggerRunControl *>(m_runControl);
+ if (runControl)
+ runControl->showMessage(QString::fromUtf8(output), AppOutput);
else
- m_runControl->showMessage(QString::fromUtf8(output), AppOutput);
+ AndroidRunSupport::handleRemoteOutput(output);
}
}
void AndroidDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
{
- if (m_runControl) {
- if (m_runControl->engine())
- m_runControl->engine()->showMessage(QString::fromUtf8(output), AppError);
+ if (m_engine) {
+ m_engine->showMessage(QString::fromUtf8(output), AppError);
+ } else {
+ DebuggerRunControl *runControl = qobject_cast<DebuggerRunControl *>(m_runControl);
+ if (runControl)
+ runControl->showMessage(QString::fromUtf8(output), AppError);
else
- m_runControl->showMessage(QString::fromUtf8(output), AppError);
+ AndroidRunSupport::handleRemoteErrorOutput(output);
}
}
diff --git a/src/plugins/android/androiddebugsupport.h b/src/plugins/android/androiddebugsupport.h
index 41a524b581..21baecf33f 100644
--- a/src/plugins/android/androiddebugsupport.h
+++ b/src/plugins/android/androiddebugsupport.h
@@ -30,9 +30,12 @@
#ifndef ANDROIDDEBUGSUPPORT_H
#define ANDROIDDEBUGSUPPORT_H
-#include "androidrunconfiguration.h"
+#include "androidrunsupport.h"
-namespace Debugger { class DebuggerRunControl; }
+namespace Debugger {
+class DebuggerEngine;
+class DebuggerRunControl;
+}
namespace ProjectExplorer { class RunControl; }
namespace Android {
@@ -41,7 +44,7 @@ namespace Internal {
class AndroidRunConfiguration;
class AndroidRunner;
-class AndroidDebugSupport : public QObject
+class AndroidDebugSupport : public AndroidRunSupport
{
Q_OBJECT
@@ -61,9 +64,7 @@ private slots:
void handleRemoteErrorOutput(const QByteArray &output);
private:
- Debugger::DebuggerRunControl* m_runControl;
- AndroidRunner * const m_runner;
- const QString m_dumperLib;
+ Debugger::DebuggerEngine *m_engine;
};
} // namespace Internal
diff --git a/src/plugins/android/androidruncontrol.cpp b/src/plugins/android/androidruncontrol.cpp
index e14e9a70d4..50e54135dc 100644
--- a/src/plugins/android/androidruncontrol.cpp
+++ b/src/plugins/android/androidruncontrol.cpp
@@ -45,7 +45,7 @@ namespace Internal {
AndroidRunControl::AndroidRunControl(AndroidRunConfiguration *rc)
: RunControl(rc, NormalRunMode)
- , m_runner(new AndroidRunner(this, rc, false))
+ , m_runner(new AndroidRunner(this, rc, NormalRunMode))
, m_running(false)
{
}
diff --git a/src/plugins/android/androidrunfactories.cpp b/src/plugins/android/androidrunfactories.cpp
index 2dd93bc6b4..65c6237739 100644
--- a/src/plugins/android/androidrunfactories.cpp
+++ b/src/plugins/android/androidrunfactories.cpp
@@ -31,6 +31,7 @@
#include "androidconstants.h"
#include "androiddebugsupport.h"
+#include "androidanalyzesupport.h"
#include "androidrunconfiguration.h"
#include "androidruncontrol.h"
#include "androidmanager.h"
@@ -150,7 +151,7 @@ AndroidRunControlFactory::AndroidRunControlFactory(QObject *parent)
bool AndroidRunControlFactory::canRun(RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const
{
- if (mode != NormalRunMode && mode != DebugRunMode)
+ if (mode != NormalRunMode && mode != DebugRunMode && mode != QmlProfilerRunMode)
return false;
return qobject_cast<AndroidRunConfiguration *>(runConfiguration);
}
@@ -161,10 +162,21 @@ RunControl *AndroidRunControlFactory::create(RunConfiguration *runConfig,
Q_ASSERT(canRun(runConfig, mode));
AndroidRunConfiguration *rc = qobject_cast<AndroidRunConfiguration *>(runConfig);
Q_ASSERT(rc);
- if (mode == NormalRunMode)
+ switch (mode) {
+ case NormalRunMode:
return new AndroidRunControl(rc);
- else
+ case DebugRunMode:
return AndroidDebugSupport::createDebugRunControl(rc, errorMessage);
+ case QmlProfilerRunMode:
+ return AndroidAnalyzeSupport::createAnalyzeRunControl(rc, mode, errorMessage);
+ case NoRunMode:
+ case DebugRunModeWithBreakOnMain:
+ case CallgrindRunMode:
+ case MemcheckRunMode:
+ default:
+ QTC_CHECK(false); // The other run modes are not supported
+ }
+ return 0;
}
} // namespace Internal
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index a6f42fe0ac..471c380f3b 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -49,19 +49,23 @@ namespace Internal {
typedef QLatin1String _;
-AndroidRunner::AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig, bool debuggingMode)
+AndroidRunner::AndroidRunner(QObject *parent,
+ AndroidRunConfiguration *runConfig,
+ ProjectExplorer::RunMode runMode)
: QThread(parent)
{
m_wasStarted = false;
Debugger::DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
+ const bool debuggingMode = runMode == ProjectExplorer::DebugRunMode;
m_useCppDebugger = debuggingMode && aspect->useCppDebugger();
m_useQmlDebugger = debuggingMode && aspect->useQmlDebugger();
QString channel = runConfig->remoteChannel();
QTC_CHECK(channel.startsWith(QLatin1Char(':')));
m_localGdbServerPort = channel.mid(1).toUShort();
QTC_CHECK(m_localGdbServerPort);
- if (m_useQmlDebugger) {
+ m_useQmlProfiler = runMode == ProjectExplorer::QmlProfilerRunMode;
+ if (m_useQmlDebugger || m_useQmlProfiler) {
QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6),
@@ -220,7 +224,8 @@ void AndroidRunner::asyncStart()
args << _("-e") << _("gdbserver_command") << m_gdbserverCommand;
args << _("-e") << _("gdbserver_socket") << m_gdbserverSocket;
}
- if (m_useQmlDebugger) {
+
+ if (m_useQmlDebugger || m_useQmlProfiler) {
// currently forward to same port on device and host
const QString port = QString::fromLatin1("tcp:%1").arg(m_qmlPort);
QProcess adb;
@@ -304,6 +309,8 @@ void AndroidRunner::asyncStart()
// gdb. Afterwards this ends up in handleRemoteDebuggerRunning() below.
QByteArray serverChannel = QByteArray::number(m_qmlPort);
emit remoteServerRunning(serverChannel, m_processPID);
+ } else if (m_useQmlProfiler) {
+ emit remoteProcessStarted(m_qmlPort);
} else {
// Start without debugging.
emit remoteProcessStarted(-1, -1);
diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h
index f44fcb98e8..6568e33ce7 100644
--- a/src/plugins/android/androidrunner.h
+++ b/src/plugins/android/androidrunner.h
@@ -32,6 +32,8 @@
#include "androidconfigurations.h"
+#include <projectexplorer/projectexplorerconstants.h>
+
#include <QObject>
#include <QTimer>
#include <QThread>
@@ -48,7 +50,8 @@ class AndroidRunner : public QThread
Q_OBJECT
public:
- AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig, bool debuggingMode);
+ AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig,
+ ProjectExplorer::RunMode runMode);
~AndroidRunner();
QString displayName() const;
@@ -61,6 +64,7 @@ public slots:
signals:
void remoteServerRunning(const QByteArray &serverChannel, int pid);
void remoteProcessStarted(int gdbServerPort, int qmlPort);
+ void remoteProcessStarted(int qmlPort);
void remoteProcessFinished(const QString &errString = QString());
void remoteOutput(const QByteArray &output);
@@ -92,6 +96,7 @@ private:
qint64 m_processPID;
bool m_useCppDebugger;
bool m_useQmlDebugger;
+ bool m_useQmlProfiler;
ushort m_localGdbServerPort; // Local end of forwarded debug socket.
quint16 m_qmlPort;
bool m_useLocalQtLibs;
diff --git a/src/plugins/android/androidrunsupport.cpp b/src/plugins/android/androidrunsupport.cpp
new file mode 100644
index 0000000000..b4028108d8
--- /dev/null
+++ b/src/plugins/android/androidrunsupport.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "androidrunsupport.h"
+#include "androidrunner.h"
+
+using namespace ProjectExplorer;
+
+namespace Android {
+namespace Internal {
+
+AndroidRunSupport::AndroidRunSupport(AndroidRunConfiguration *runConfig,
+ RunControl *runControl)
+ : QObject(runControl),
+ m_runControl(runControl),
+ m_runner(new AndroidRunner(this, runConfig, runControl->runMode()))
+{
+ connect(m_runControl, SIGNAL(finished()),
+ m_runner, SLOT(stop()));
+
+ connect(m_runner, SIGNAL(remoteServerRunning(QByteArray,int)),
+ SLOT(handleRemoteServerRunning(QByteArray,int)));
+ connect(m_runner, SIGNAL(remoteProcessStarted(int,int)),
+ SLOT(handleRemoteProcessStarted(int,int)));
+ connect(m_runner, SIGNAL(remoteProcessFinished(QString)),
+ SLOT(handleRemoteProcessFinished(QString)));
+
+ connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)),
+ SLOT(handleRemoteErrorOutput(QByteArray)));
+ connect(m_runner, SIGNAL(remoteOutput(QByteArray)),
+ SLOT(handleRemoteOutput(QByteArray)));
+}
+
+void AndroidRunSupport::handleRemoteProcessFinished(const QString &errorMsg)
+{
+ if (m_runControl)
+ m_runControl->appendMessage(errorMsg, Utils::NormalMessageFormat);
+}
+
+void AndroidRunSupport::handleRemoteOutput(const QByteArray &output)
+{
+ if (m_runControl)
+ m_runControl->appendMessage(QString::fromUtf8(output), Utils::StdOutFormatSameLine);
+}
+
+void AndroidRunSupport::handleRemoteErrorOutput(const QByteArray &output)
+{
+ if (m_runControl)
+ m_runControl->appendMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine);
+}
+
+} // namespace Internal
+} // namespace Android
diff --git a/src/plugins/android/androidrunsupport.h b/src/plugins/android/androidrunsupport.h
new file mode 100644
index 0000000000..cb699b9bec
--- /dev/null
+++ b/src/plugins/android/androidrunsupport.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef ANDROIDRUNSUPPORT_H
+#define ANDROIDRUNSUPPORT_H
+
+#include "androidrunconfiguration.h"
+
+namespace ProjectExplorer { class RunControl; }
+
+namespace Android {
+namespace Internal {
+
+class AndroidRunner;
+
+class AndroidRunSupport : public QObject
+{
+ Q_OBJECT
+public:
+ AndroidRunSupport(AndroidRunConfiguration *runConfig,
+ ProjectExplorer::RunControl *runControl);
+
+protected slots:
+ virtual void handleRemoteProcessFinished(const QString &errorMsg);
+
+ virtual void handleRemoteOutput(const QByteArray &output);
+ virtual void handleRemoteErrorOutput(const QByteArray &output);
+
+protected:
+ ProjectExplorer::RunControl* m_runControl;
+ AndroidRunner * const m_runner;
+};
+
+} // namespace Internal
+} // namespace Android
+
+#endif // ANDROIDRUNSUPPORT_H
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
index 8ec52e2e8b..1bb6f46cb0 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -197,6 +197,8 @@ bool QmlProfilerEngine::start()
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
d->m_runner->start();
d->m_noDebugOutputTimer.start();
+ } else if (d->sp.startMode == StartQmlAndroid) {
+ d->m_noDebugOutputTimer.start();
} else {
emit processRunning(startParameters().analyzerPort);
}
@@ -332,18 +334,19 @@ void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
noExecWarning->show();
}
-void QmlProfilerEngine::processIsRunning(quint16 port)
+void QmlProfilerEngine::notifyRemoteSetupDone(quint16 port)
{
d->m_noDebugOutputTimer.stop();
+ emit processRunning(port);
+}
- QTC_ASSERT(port == 0
- || port == d->m_runner->debugPort(),
- qWarning() << "Port " << port << "from application output does not match"
- << startParameters().connParams.port << "from start parameters.");
+void QmlProfilerEngine::processIsRunning(quint16 port)
+{
+ d->m_noDebugOutputTimer.stop();
if (port > 0)
emit processRunning(port);
- else
+ else if (d->m_runner)
emit processRunning(d->m_runner->debugPort());
}
@@ -366,8 +369,7 @@ void QmlProfilerEngine::profilerStateChanged()
{
switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppReadyToStop : {
- if (d->m_runner)
- cancelProcess();
+ cancelProcess();
break;
}
case QmlProfilerStateManager::Idle : {
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h
index 5b75562919..fe8cc47313 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.h
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.h
@@ -50,6 +50,9 @@ public:
void registerProfilerStateManager( QmlProfilerStateManager *profilerState );
static void showNonmodalWarning(const QString &warningMsg);
+
+ void notifyRemoteSetupDone(quint16 port);
+
signals:
void processRunning(quint16 port);
void timeUpdate();