summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@nokia.com>2011-04-13 10:39:47 +0200
committerChristiaan Janssen <christiaan.janssen@nokia.com>2011-04-14 09:57:08 +0200
commitcbfaea1ed342102cdfa848698d96cb7c010dae48 (patch)
tree8a35a308f294fcfdf467a4b9d8cb19adcf39164a /src
parent1df460426b2e409cccdb38254261f75fa686e924 (diff)
downloadqt-creator-cbfaea1ed342102cdfa848698d96cb7c010dae48.tar.gz
QmlProfiler: qmlproject support
Reviewed-by: Kai Koehne
Diffstat (limited to 'src')
-rw-r--r--src/plugins/analyzerbase/analyzermanager.cpp12
-rw-r--r--src/plugins/analyzerbase/analyzermanager.h2
-rw-r--r--src/plugins/analyzerbase/analyzerrunconfigwidget.cpp1
-rw-r--r--src/plugins/analyzerbase/analyzerrunconfigwidget.h6
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.pro7
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.cpp31
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp5
-rw-r--r--src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp123
-rw-r--r--src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h69
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp2
11 files changed, 226 insertions, 35 deletions
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp
index 00453b5b07..7d1d89fe7b 100644
--- a/src/plugins/analyzerbase/analyzermanager.cpp
+++ b/src/plugins/analyzerbase/analyzermanager.cpp
@@ -255,9 +255,8 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
{
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
m_runControlFactory = new AnalyzerRunControlFactory();
- AnalyzerPlugin::instance()->addAutoReleasedObject(m_runControlFactory);
- connect(m_runControlFactory, SIGNAL(runControlCreated(Analyzer::AnalyzerRunControl *)),
- q, SLOT(runControlCreated(Analyzer::AnalyzerRunControl *)));
+
+ q->registerRunControlFactory(m_runControlFactory);
connect(m_toolBox, SIGNAL(currentIndexChanged(int)),
q, SLOT(toolSelected(int)));
@@ -275,6 +274,13 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
}
}
+void AnalyzerManager::registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory)
+{
+ AnalyzerPlugin::instance()->addAutoReleasedObject(factory);
+ connect(factory, SIGNAL(runControlCreated(Analyzer::AnalyzerRunControl *)),
+ this, SLOT(runControlCreated(Analyzer::AnalyzerRunControl *)));
+}
+
void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
{
Core::ICore *core = Core::ICore::instance();
diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h
index 2506d63ead..728a38e116 100644
--- a/src/plugins/analyzerbase/analyzermanager.h
+++ b/src/plugins/analyzerbase/analyzermanager.h
@@ -37,6 +37,7 @@
#define ANALYZERMANAGER_H
#include "analyzerbase_global.h"
+#include "projectexplorer/runconfiguration.h"
#include <QtCore/QObject>
@@ -75,6 +76,7 @@ public:
~AnalyzerManager();
static AnalyzerManager *instance();
+ void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory);
bool isInitialized() const;
void shutdown();
diff --git a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
index 1097e1324a..69c18aef6a 100644
--- a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
+++ b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
@@ -45,7 +45,6 @@
#include <QtGui/QVBoxLayout>
using namespace Analyzer;
-using namespace Analyzer::Internal;
AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
: m_detailsWidget(new Utils::DetailsWidget(this))
diff --git a/src/plugins/analyzerbase/analyzerrunconfigwidget.h b/src/plugins/analyzerbase/analyzerrunconfigwidget.h
index e99b40e0c3..bc305fac96 100644
--- a/src/plugins/analyzerbase/analyzerrunconfigwidget.h
+++ b/src/plugins/analyzerbase/analyzerrunconfigwidget.h
@@ -38,6 +38,7 @@
#define ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
#include <projectexplorer/runconfiguration.h>
+#include <analyzerbase/analyzerbase_global.h>
QT_BEGIN_NAMESPACE
class QStandardItemModel;
@@ -51,9 +52,7 @@ namespace Analyzer {
class AnalyzerSettings;
-namespace Internal {
-
-class AnalyzerRunConfigWidget : public ProjectExplorer::RunConfigWidget
+class ANALYZER_EXPORT AnalyzerRunConfigWidget : public ProjectExplorer::RunConfigWidget
{
Q_OBJECT
@@ -69,6 +68,5 @@ private:
};
}
-}
#endif // ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index d6ead74e1c..6a7590626a 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -272,7 +272,8 @@ plugin_analyzerbase.depends += plugin_projectexplorer
plugin_qmlprofiler.subdir = qmlprofiler
plugin_qmlprofiler.depends = plugin_coreplugin
- plugin_qmlprofiler.depends = plugin_analyzerbase
+ plugin_qmlprofiler.depends += plugin_analyzerbase
+ plugin_qmlprofiler.depends += plugin_qmlprojectmanager
}
plugin_qmljstools.subdir = qmljstools
diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro
index acde7d9b03..ff399c9896 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.pro
+++ b/src/plugins/qmlprofiler/qmlprofiler.pro
@@ -6,6 +6,7 @@ DEFINES += PROFILER_LIBRARY
include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/analyzerbase/analyzerbase.pri)
+include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri)
QT += network script declarative
@@ -20,7 +21,8 @@ SOURCES += \
tracewindow.cpp \
timelineview.cpp \
qmlprofilerattachdialog.cpp \
- qmlprofilersummaryview.cpp
+ qmlprofilersummaryview.cpp \
+ qmlprojectanalyzerruncontrolfactory.cpp
HEADERS += \
qmlprofilerconstants.h \
@@ -31,7 +33,8 @@ HEADERS += \
tracewindow.h \
timelineview.h \
qmlprofilerattachdialog.h \
- qmlprofilersummaryview.h
+ qmlprofilersummaryview.h \
+ qmlprojectanalyzerruncontrolfactory.h
RESOURCES += \
qml/qml.qrc
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
index 5ddeee44dd..5314867488 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -39,8 +39,6 @@
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerconstants.h>
-#include <projectexplorer/applicationrunconfiguration.h>
-
#include <private/qdeclarativedebugclient_p.h>
#include "timelineview.h"
@@ -52,9 +50,7 @@
#include "canvas/qdeclarativecontext2d_p.h"
#include "canvas/qdeclarativetiledcanvas_p.h"
-#include <utils/environment.h>
#include <QProcess>
-#include "tracewindow.h"
#ifdef Q_OS_UNIX
#include <unistd.h> // sleep
@@ -73,11 +69,7 @@ public:
QmlProfilerEngine *q;
- QString m_workingDirectory;
- QString m_executable;
- QString m_commandLineArguments;
- Utils::Environment m_environment;
-
+ Analyzer::AnalyzerStartParameters m_params;
QProcess *m_process;
bool m_running;
bool m_fetchingData;
@@ -87,16 +79,7 @@ QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp
: IAnalyzerEngine(sp, runConfiguration)
, d(new QmlProfilerEnginePrivate(this))
{
- ProjectExplorer::LocalApplicationRunConfiguration *localAppConfig =
- qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration);
-
- if (!localAppConfig)
- return;
-
- d->m_workingDirectory = localAppConfig->workingDirectory();
- d->m_executable = localAppConfig->executable();
- d->m_commandLineArguments = localAppConfig->commandLineArguments();
- d->m_environment = localAppConfig->environment();
+ d->m_params = sp;
d->m_process = 0;
d->m_running = false;
d->m_fetchingData = false;
@@ -165,8 +148,10 @@ bool QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor()
m_process = new QProcess();
QStringList arguments("-qmljsdebugger=port:" + QString::number(QmlProfilerTool::port) + ",block");
+ arguments.append(m_params.debuggeeArgs.split(" "));
+
if (QmlProfilerPlugin::debugOutput)
- qWarning("QmlProfiler: Launching %s", qPrintable(m_executable));
+ qWarning("QmlProfiler: Launching %s", qPrintable(m_params.displayName));
if (qtquick1) {
QProcessEnvironment env;
@@ -175,16 +160,16 @@ bool QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor()
}
m_process->setProcessChannelMode(QProcess::ForwardedChannels);
- m_process->setWorkingDirectory(m_workingDirectory);
+ m_process->setWorkingDirectory(m_params.workingDirectory);
connect(m_process,SIGNAL(finished(int)),q,SLOT(spontaneousStop()));
- m_process->start(m_executable, arguments);
+ 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_executable));
+ qWarning("QmlProfiler: %s failed to start", qPrintable(m_params.displayName));
return false;
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index 27c1170073..6b3b5d6e02 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -33,6 +33,7 @@
#include "qmlprofilerplugin.h"
#include "qmlprofilerconstants.h"
+#include "qmlprojectanalyzerruncontrolfactory.h"
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
@@ -68,6 +69,7 @@ public:
void initialize(const QStringList &arguments, QString *errorString);
+ QmlProjectAnalyzerRunControlFactory *m_runControlFactory;
QmlProfilerPlugin *q;
};
@@ -76,7 +78,8 @@ void QmlProfilerPlugin::QmlProfilerPluginPrivate::initialize(const QStringList &
Q_UNUSED(arguments)
Q_UNUSED(errorString)
-// AnalyzerManager::instance()->addTool(new MemcheckTool(this));
+ m_runControlFactory = new QmlProjectAnalyzerRunControlFactory();
+ Analyzer::AnalyzerManager::instance()->registerRunControlFactory(m_runControlFactory);
}
diff --git a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp
new file mode 100644
index 0000000000..e310335ed5
--- /dev/null
+++ b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp
@@ -0,0 +1,123 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qmlprojectanalyzerruncontrolfactory.h"
+#include "qmlprojectmanager/qmlprojectrunconfiguration.h"
+#include <analyzerbase/analyzerstartparameters.h>
+#include <analyzerbase/analyzersettings.h>
+#include <analyzerbase/analyzerrunconfigwidget.h>
+
+#include <utils/qtcassert.h>
+
+using namespace Analyzer;
+using namespace ProjectExplorer;
+using namespace QmlProfiler::Internal;
+
+AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
+{
+ AnalyzerStartParameters sp;
+ QTC_ASSERT(runConfiguration, return sp);
+ QmlProjectManager::QmlProjectRunConfiguration *rc =
+ qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
+ QTC_ASSERT(rc, return sp);
+
+ sp.startMode = StartLocal;
+ sp.environment = rc->environment();
+ sp.workingDirectory = rc->workingDirectory();
+ sp.debuggee = rc->observerPath();
+ sp.debuggeeArgs = rc->viewerArguments();
+ sp.displayName = rc->displayName();
+ return sp;
+}
+
+QmlProjectAnalyzerRunControlFactory::QmlProjectAnalyzerRunControlFactory(QObject *parent)
+ : IRunControlFactory(parent)
+{
+
+}
+
+QmlProjectAnalyzerRunControlFactory::~QmlProjectAnalyzerRunControlFactory()
+{
+
+}
+
+bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
+{
+ if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration))
+ return false;
+ return mode == Constants::MODE_ANALYZE;
+}
+
+RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
+{
+ if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration) ||
+ mode != Constants::MODE_ANALYZE) {
+ return 0;
+ }
+ const AnalyzerStartParameters sp = localStartParameters(runConfiguration);
+ return create(sp, runConfiguration);
+}
+
+AnalyzerRunControl *QmlProjectAnalyzerRunControlFactory::create(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
+{
+ AnalyzerRunControl *rc = new AnalyzerRunControl(sp, runConfiguration);
+ emit runControlCreated(rc);
+ return rc;
+}
+
+QString QmlProjectAnalyzerRunControlFactory::displayName() const
+{
+ return tr("QmlAnalyzer");
+}
+
+IRunConfigurationAspect *QmlProjectAnalyzerRunControlFactory::createRunConfigurationAspect()
+{
+ return new AnalyzerProjectSettings;
+}
+
+RunConfigWidget *QmlProjectAnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
+{
+ QmlProjectManager::QmlProjectRunConfiguration *localRc =
+ qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
+ if (!localRc)
+ return 0;
+
+ AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ if (!settings)
+ return 0;
+
+ Analyzer::AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget;
+ ret->setRunConfiguration(runConfiguration);
+ return ret;
+// return 0;
+}
diff --git a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h
new file mode 100644
index 0000000000..1d2de80d0c
--- /dev/null
+++ b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h
@@ -0,0 +1,69 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef QMLPROJECTANALYZERRUNCONTROLFACTORY_H
+#define QMLPROJECTANALYZERRUNCONTROLFACTORY_H
+
+#include <analyzerbase/analyzerruncontrol.h>
+//#include <analyzerbase/analyzerruncontrolfactory.h>
+#include <projectexplorer/runconfiguration.h>
+
+namespace QmlProfiler {
+namespace Internal {
+
+class QmlProjectAnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory
+{
+ Q_OBJECT
+public:
+ typedef ProjectExplorer::RunConfiguration RunConfiguration;
+
+ QmlProjectAnalyzerRunControlFactory(QObject *parent = 0);
+ ~QmlProjectAnalyzerRunControlFactory();
+
+ // virtuals from IRunControlFactory
+ bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
+ ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
+ Analyzer::AnalyzerRunControl *create(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration = 0);
+ QString displayName() const;
+
+ ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
+ ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
+
+signals:
+ void runControlCreated(Analyzer::AnalyzerRunControl *);
+};
+
+}
+}
+
+#endif // QMLPROJECTANALYZERRUNCONTROLFACTORY_H
diff --git a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
index 5269a0292b..6a3945e402 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
@@ -152,6 +152,8 @@ bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration,
qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
if (mode == ProjectExplorer::Constants::RUNMODE)
return config != 0 && !config->viewerPath().isEmpty();
+ else if (mode != Debugger::Constants::DEBUGMODE)
+ return false;
bool qmlDebugSupportInstalled =
Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage);