aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2016-01-22 17:08:50 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2016-01-22 17:26:17 +0000
commita1dd1e4c5bf4d3c5fe50f7b89a6f185ad4a622b0 (patch)
tree7af169437d46d48e05c1661fda7a38e98afe315a
parent0f4db8a32fc5665bdc4f40999b2741932f0b051b (diff)
Add runConfiguration to remote tool starters
Most of them need a run configuration. It's better to pass the right one than to use various hacky ways to work around it. Change-Id: Ic21b0ef33bdd79b526b1e1a1ead5ca87d9f32c4d Reviewed-by: hjk <hjk@theqtcompany.com>
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.cpp14
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.h2
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp4
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp37
-rw-r--r--src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h3
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.h2
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp8
9 files changed, 26 insertions, 52 deletions
diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp
index 359722807d..93c22d0e13 100644
--- a/src/plugins/analyzerbase/ianalyzertool.cpp
+++ b/src/plugins/analyzerbase/ianalyzertool.cpp
@@ -89,23 +89,25 @@ void AnalyzerAction::startTool()
if (m_toolPreparer && !m_toolPreparer())
return;
- // Custom start.
- if (m_customToolStarter) {
- m_customToolStarter();
- return;
- }
-
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
Project *pro = SessionManager::startupProject();
+ RunConfiguration *rc = 0;
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
if (pro) {
if (const Target *target = pro->activeTarget()) {
// Build configuration is 0 for QML projects.
if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration())
buildType = buildConfig->buildType();
+ rc = target->activeRunConfiguration();
}
}
+ // Custom start.
+ if (m_customToolStarter) {
+ m_customToolStarter(rc);
+ return;
+ }
+
// Check the project for whether the build config is in the correct mode
// if not, notify the user and urge him to use the correct mode.
if (!buildTypeAccepted(m_toolMode, buildType)) {
diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h
index 9c4a163aa3..c9e1168fe4 100644
--- a/src/plugins/analyzerbase/ianalyzertool.h
+++ b/src/plugins/analyzerbase/ianalyzertool.h
@@ -110,7 +110,7 @@ public:
void startTool();
/// This is only used for setups not using the startup project.
- typedef std::function<void()> ToolStarter;
+ typedef std::function<void(ProjectExplorer::RunConfiguration *runConfiguration)> ToolStarter;
void setCustomToolStarter(const ToolStarter &toolStarter) { m_customToolStarter = toolStarter; }
protected:
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp
index f854489b51..2822e0e6a1 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp
@@ -141,7 +141,9 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString
action->setActionId("ClangStaticAnalyzer");
action->setWidgetCreator(widgetCreator);
action->setRunControlCreator(runControlCreator);
- action->setCustomToolStarter([tool] { tool->startTool(); });
+ action->setCustomToolStarter([tool](ProjectExplorer::RunConfiguration *rc) {
+ tool->startTool(rc);
+ });
action->setText(tr("Clang Static Analyzer"));
action->setToolTip(toolTip);
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
index 9fe109d63d..b1a3a1e9fb 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
@@ -58,22 +58,6 @@ using namespace ProjectExplorer;
namespace ClangStaticAnalyzer {
namespace Internal {
-class DummyRunConfiguration : public RunConfiguration
-{
- Q_OBJECT
-
-public:
- DummyRunConfiguration(Target *parent)
- : RunConfiguration(parent, "ClangStaticAnalyzer.DummyRunConfig")
- {
- setDefaultDisplayName(tr("Clang Static Analyzer"));
- addExtraAspects();
- }
-
-private:
- QWidget *createConfigurationWidget() override { return 0; }
-};
-
ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent)
: QObject(parent)
, m_diagnosticModel(0)
@@ -225,7 +209,7 @@ static bool dontStartAfterHintForDebugMode(Project *project)
return false;
}
-void ClangStaticAnalyzerTool::startTool()
+void ClangStaticAnalyzerTool::startTool(ProjectExplorer::RunConfiguration *runConfiguration)
{
AnalyzerManager::showMode();
@@ -243,21 +227,8 @@ void ClangStaticAnalyzerTool::startTool()
m_running = true;
handleStateUpdate();
- Target * const target = project->activeTarget();
- QTC_ASSERT(target, return);
- DummyRunConfiguration *& rc = m_runConfigs[target];
- if (!rc) {
- rc = new DummyRunConfiguration(target);
- connect(project, &Project::aboutToRemoveTarget, this,
- [this](Target *t) { m_runConfigs.remove(t); });
- const auto onProjectRemoved = [this](Project *p) {
- foreach (Target * const t, p->targets())
- m_runConfigs.remove(t);
- };
- connect(SessionManager::instance(), &SessionManager::aboutToRemoveProject, this,
- onProjectRemoved, Qt::UniqueConnection);
- }
- ProjectExplorerPlugin::runRunConfiguration(rc, Constants::CLANGSTATICANALYZER_RUN_MODE);
+ ProjectExplorerPlugin::runRunConfiguration(runConfiguration,
+ Constants::CLANGSTATICANALYZER_RUN_MODE);
}
CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const
@@ -328,5 +299,3 @@ void ClangStaticAnalyzerTool::handleStateUpdate()
} // namespace Internal
} // namespace ClangStaticAnalyzer
-
-#include "clangstaticanalyzertool.moc"
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h
index e5a748d0cd..5c59281014 100644
--- a/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h
+++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h
@@ -61,7 +61,7 @@ public:
QWidget *createWidgets();
Analyzer::AnalyzerRunControl *createRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
Core::Id runMode);
- void startTool();
+ void startTool(ProjectExplorer::RunConfiguration *rc);
signals:
void finished(bool success); // For testing.
@@ -83,7 +83,6 @@ private:
QAction *m_goBack;
QAction *m_goNext;
- QHash<ProjectExplorer::Target *, DummyRunConfiguration *> m_runConfigs;
bool m_running;
};
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index 895895c338..f15d80249e 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -81,7 +81,9 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
action->setToolId(Constants::QmlProfilerToolId);
action->setWidgetCreator(widgetCreator);
action->setRunControlCreator(runControlCreator);
- action->setCustomToolStarter([tool] { tool->startRemoteTool(); });
+ action->setCustomToolStarter([tool](ProjectExplorer::RunConfiguration *rc) {
+ tool->startRemoteTool(rc);
+ });
action->setToolPreparer([tool] { return tool->prepareTool(); });
action->setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
action->setText(tr("QML Profiler (External)"));
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index aadb0635e6..faddbbe250 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -487,7 +487,7 @@ bool QmlProfilerTool::prepareTool()
return true;
}
-void QmlProfilerTool::startRemoteTool()
+void QmlProfilerTool::startRemoteTool(ProjectExplorer::RunConfiguration *rc)
{
AnalyzerManager::showMode();
@@ -525,7 +525,7 @@ void QmlProfilerTool::startRemoteTool()
}
connection.analyzerPort = port;
- auto runControl = qobject_cast<QmlProfilerRunControl *>(createRunControl(0));
+ auto runControl = qobject_cast<QmlProfilerRunControl *>(createRunControl(rc));
runControl->setConnection(connection);
ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h
index 71944aa65f..2e807f7fac 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.h
+++ b/src/plugins/qmlprofiler/qmlprofilertool.h
@@ -56,7 +56,7 @@ public:
QWidget *createWidgets();
bool prepareTool();
- void startRemoteTool();
+ void startRemoteTool(ProjectExplorer::RunConfiguration *rc);
static QList <QAction *> profilerContextMenuActions();
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index ef0e75e4b8..3d5f970100 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -187,11 +187,11 @@ void ValgrindPlugin::extensionsInitialized()
action->setActionId("Memcheck.Remote");
action->setToolId("Memcheck");
action->setWidgetCreator(mcWidgetCreator);
- action->setCustomToolStarter([mcTool] {
+ action->setCustomToolStarter([mcTool](ProjectExplorer::RunConfiguration *runConfig) {
StartRemoteDialog dlg;
if (dlg.exec() != QDialog::Accepted)
return;
- ValgrindRunControl *rc = mcTool->createRunControl(0, MEMCHECK_RUN_MODE);
+ ValgrindRunControl *rc = mcTool->createRunControl(runConfig, MEMCHECK_RUN_MODE);
QTC_ASSERT(rc, return);
AnalyzerRunnable runnable;
runnable.debuggee = dlg.executable();
@@ -214,11 +214,11 @@ void ValgrindPlugin::extensionsInitialized()
action->setActionId(CallgrindRemoteActionId);
action->setToolId(CallgrindToolId);
action->setWidgetCreator(cgWidgetCreator);
- action->setCustomToolStarter([cgTool] {
+ action->setCustomToolStarter([cgTool](ProjectExplorer::RunConfiguration *runConfig) {
StartRemoteDialog dlg;
if (dlg.exec() != QDialog::Accepted)
return;
- ValgrindRunControl *rc = cgTool->createRunControl(0);
+ ValgrindRunControl *rc = cgTool->createRunControl(runConfig);
QTC_ASSERT(rc, return);
AnalyzerRunnable runnable;
runnable.debuggee = dlg.executable();