forked from qt-creator/qt-creator
QmlProfiler: Try to locate files in loaded projects first
Similar to the debugger, the qml profiler should take all loaded projects into account. Change-Id: I37ce855a95f6f415a5d7a8d1d362c15a1dd698db Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
@@ -59,6 +59,7 @@
|
|||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
@@ -103,7 +104,6 @@ public:
|
|||||||
QmlProfilerEventsView *m_calleeView;
|
QmlProfilerEventsView *m_calleeView;
|
||||||
QmlProfilerEventsView *m_callerView;
|
QmlProfilerEventsView *m_callerView;
|
||||||
QmlProfilerEventsView *m_v8profilerView;
|
QmlProfilerEventsView *m_v8profilerView;
|
||||||
Project *m_project;
|
|
||||||
Utils::FileInProjectFinder m_projectFinder;
|
Utils::FileInProjectFinder m_projectFinder;
|
||||||
RunConfiguration *m_runConfiguration;
|
RunConfiguration *m_runConfiguration;
|
||||||
bool m_isAttached;
|
bool m_isAttached;
|
||||||
@@ -130,7 +130,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
|||||||
d->m_client = 0;
|
d->m_client = 0;
|
||||||
d->m_connectionAttempts = 0;
|
d->m_connectionAttempts = 0;
|
||||||
d->m_traceWindow = 0;
|
d->m_traceWindow = 0;
|
||||||
d->m_project = 0;
|
|
||||||
d->m_runConfiguration = 0;
|
d->m_runConfiguration = 0;
|
||||||
d->m_isAttached = false;
|
d->m_isAttached = false;
|
||||||
d->m_recordingEnabled = true;
|
d->m_recordingEnabled = true;
|
||||||
@@ -244,17 +243,30 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
|
|||||||
|
|
||||||
d->m_runConfiguration = runConfiguration;
|
d->m_runConfiguration = runConfiguration;
|
||||||
|
|
||||||
if (runConfiguration)
|
//
|
||||||
d->m_project = runConfiguration->target()->project();
|
// Initialize m_projectFinder
|
||||||
else
|
//
|
||||||
d->m_project = ProjectExplorerPlugin::instance()->currentProject();
|
|
||||||
|
|
||||||
if (d->m_project) {
|
QString projectDirectory;
|
||||||
d->m_projectFinder.setProjectDirectory(d->m_project->projectDirectory());
|
if (d->m_runConfiguration) {
|
||||||
updateProjectFileList();
|
Project *project = d->m_runConfiguration->target()->project();
|
||||||
connect(d->m_project, SIGNAL(fileListChanged()), this, SLOT(updateProjectFileList()));
|
projectDirectory = project->projectDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get files from all the projects in the session
|
||||||
|
QStringList sourceFiles;
|
||||||
|
SessionManager *sessionManager = ProjectExplorerPlugin::instance()->session();
|
||||||
|
QList<Project *> projects = sessionManager->projects();
|
||||||
|
if (Project *startupProject = ProjectExplorerPlugin::instance()->startupProject()) {
|
||||||
|
// startup project first
|
||||||
|
projects.removeOne(ProjectExplorerPlugin::instance()->startupProject());
|
||||||
|
projects.insert(0, startupProject);
|
||||||
|
}
|
||||||
|
foreach (Project *project, projects)
|
||||||
|
sourceFiles << project->files(Project::ExcludeGeneratedFiles);
|
||||||
|
|
||||||
|
d->m_projectFinder.setProjectDirectory(projectDirectory);
|
||||||
|
d->m_projectFinder.setProjectFiles(sourceFiles);
|
||||||
d->m_projectFinder.setSysroot(sp.sysroot);
|
d->m_projectFinder.setSysroot(sp.sysroot);
|
||||||
|
|
||||||
connect(engine, SIGNAL(processRunning(int)), this, SLOT(connectClient(int)));
|
connect(engine, SIGNAL(processRunning(int)), this, SLOT(connectClient(int)));
|
||||||
@@ -485,12 +497,6 @@ void QmlProfilerTool::updateTimer(qreal elapsedSeconds)
|
|||||||
emit setTimeLabel(tr("Elapsed: %1 s").arg(timeString));
|
emit setTimeLabel(tr("Elapsed: %1 s").arg(timeString));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::updateProjectFileList()
|
|
||||||
{
|
|
||||||
d->m_projectFinder.setProjectFiles(
|
|
||||||
d->m_project->files(Project::ExcludeGeneratedFiles));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerTool::clearDisplay()
|
void QmlProfilerTool::clearDisplay()
|
||||||
{
|
{
|
||||||
d->m_traceWindow->clearDisplay();
|
d->m_traceWindow->clearDisplay();
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ signals:
|
|||||||
void cancelRun();
|
void cancelRun();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateProjectFileList();
|
|
||||||
void tryToConnect();
|
void tryToConnect();
|
||||||
void connectionStateChanged();
|
void connectionStateChanged();
|
||||||
void showSaveDialog();
|
void showSaveDialog();
|
||||||
|
|||||||
Reference in New Issue
Block a user