QmlProfiler: Use a Target for populateFileFinder()

The RunConfiguration we were using previously only served to retrieve a
target.

Change-Id: I30628197de3025511a03a53d3119083b980762c8
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-09-27 14:56:00 +02:00
parent c0b2ba829f
commit 38d00cc8b6
6 changed files with 11 additions and 16 deletions

View File

@@ -206,13 +206,9 @@ void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc)
}
}
void QmlProfilerDetailsRewriter::populateFileFinder(
const ProjectExplorer::RunConfiguration *runConfiguration)
void QmlProfilerDetailsRewriter::populateFileFinder(const ProjectExplorer::Target *target)
{
// Prefer the given runConfiguration's target if available
const ProjectExplorer::Target *target = runConfiguration ? runConfiguration->target() : nullptr;
// If runConfiguration given, then use the project associated with that ...
// If target given, then use the project associated with that ...
const ProjectExplorer::Project *startupProject = target ? target->project() : nullptr;
// ... else try the session manager's global startup project ...
@@ -239,7 +235,7 @@ void QmlProfilerDetailsRewriter::populateFileFinder(
sourceFiles.append(project->files(ProjectExplorer::Project::SourceFiles));
}
// If no runConfiguration was given, but we've found a startupProject, then try to deduct a
// If no target was given, but we've found a startupProject, then try to deduct a
// target from that.
if (!target && startupProject)
target = startupProject->activeTarget();

View File

@@ -46,7 +46,7 @@ public:
void requestDetailsForLocation(int typeId, const QmlEventLocation &location);
QString getLocalFile(const QString &remoteFile);
void reloadDocuments();
void populateFileFinder(const ProjectExplorer::RunConfiguration *runConfiguration);
void populateFileFinder(const ProjectExplorer::Target *target);
signals:
void rewriteDetailsString(int typeId, const QString &details);

View File

@@ -524,9 +524,9 @@ void QmlProfilerModelManager::processingDone()
setState(Done);
}
void QmlProfilerModelManager::populateFileFinder(const ProjectExplorer::RunConfiguration *runConfiguration)
void QmlProfilerModelManager::populateFileFinder(const ProjectExplorer::Target *target)
{
d->detailsRewriter->populateFileFinder(runConfiguration);
d->detailsRewriter->populateFileFinder(target);
}
QString QmlProfilerModelManager::findLocalFile(const QString &remoteFile)

View File

@@ -37,7 +37,7 @@
#include <QObject>
#include <functional>
namespace ProjectExplorer { class RunConfiguration; }
namespace ProjectExplorer { class Target; }
namespace QmlProfiler {
class QmlProfilerModelManager;
@@ -129,7 +129,7 @@ public:
void acquiringDone();
void processingDone();
void populateFileFinder(const ProjectExplorer::RunConfiguration *runConfiguration = nullptr);
void populateFileFinder(const ProjectExplorer::Target *target = nullptr);
QString findLocalFile(const QString &remoteFile);
static const char *featureName(ProfileFeature feature);

View File

@@ -393,7 +393,8 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
// Initialize m_projectFinder
//
d->m_profilerModelManager->populateFileFinder(runConfiguration);
d->m_profilerModelManager->populateFileFinder(runConfiguration ? runConfiguration->target()
: nullptr);
}
void QmlProfilerTool::recordingButtonChanged(bool recording)

View File

@@ -202,9 +202,7 @@ void QmlProfilerDetailsRewriterTest::seedRewriter()
ProjectExplorer::SessionManager::addProject(project);
ProjectExplorer::Target *target = project->createTarget(kit);
ProjectExplorer::CustomExecutableRunConfiguration *rc
= new ProjectExplorer::CustomExecutableRunConfiguration(target);
m_rewriter.populateFileFinder(rc);
m_rewriter.populateFileFinder(target);
ProjectExplorer::SessionManager::removeProject(project);
ProjectExplorer::KitManager::deleteKit(kit);
}