Commit eb4d2739 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlProfiler: instantiate FileInProjectFinder only once

parent d3c4e601
......@@ -52,6 +52,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <texteditor/itexteditor.h>
#include <coreplugin/editormanager/editormanager.h>
......@@ -103,6 +104,8 @@ public:
QDeclarativeDebugConnection *m_client;
TraceWindow *m_traceWindow;
QmlProfilerOutputPaneAdapter *m_outputPaneAdapter;
ProjectExplorer::Project *m_project;
Utils::FileInProjectFinder m_projectFinder;
};
QmlProfilerTool::QmlProfilerTool(QObject *parent)
......@@ -111,6 +114,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
d->m_client = 0;
d->m_traceWindow = 0;
d->m_outputPaneAdapter = 0;
d->m_project = 0;
}
QmlProfilerTool::~QmlProfilerTool()
......@@ -142,6 +146,13 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(ProjectExplorer::RunConfiguration
{
QmlProfilerEngine *engine = new QmlProfilerEngine(runConfiguration);
d->m_project = runConfiguration->target()->project();
if (d->m_project) {
d->m_projectFinder.setProjectDirectory(d->m_project->projectDirectory());
updateProjectFileList();
connect(d->m_project, SIGNAL(fileListChanged()), this, SLOT(updateProjectFileList()));
}
connect(engine, SIGNAL(processRunning()), this, SLOT(connectClient()));
connect(engine, SIGNAL(processTerminated()), this, SLOT(disconnectClient()));
connect(engine, SIGNAL(stopRecording()), this, SLOT(stopRecording()));
......@@ -150,7 +161,6 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(ProjectExplorer::RunConfiguration
connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal)));
return engine;
}
void QmlProfilerTool::initialize(ExtensionSystem::IPlugin */*plugin*/)
......@@ -237,13 +247,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileName, int lineNumber
if (lineNumber < 0 || !QFile::exists(QUrl(fileName).toLocalFile()))
return;
Utils::FileInProjectFinder m_projectFinder;
ProjectExplorer::Project *m_debugProject;
m_debugProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
m_projectFinder.setProjectDirectory(m_debugProject->projectDirectory());
QString projectFileName = m_projectFinder.findFile(fileName);
QString projectFileName = d->m_projectFinder.findFile(fileName);
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *editor = editorManager->openEditor(projectFileName);
......@@ -262,3 +266,9 @@ void QmlProfilerTool::updateTimer(qreal elapsedSeconds)
timeString = QString(" ").left(6-timeString.length()) + timeString;
emit setTimeLabel(tr("elapsed: ")+timeString+QLatin1String(" s"));
}
void QmlProfilerTool::updateProjectFileList()
{
d->m_projectFinder.setProjectFiles(
d->m_project->files(ProjectExplorer::Project::ExcludeGeneratedFiles));
}
......@@ -76,6 +76,9 @@ public:
static QString host;
static quint16 port;
private slots:
void updateProjectFileList();
private:
class QmlProfilerToolPrivate;
QmlProfilerToolPrivate *d;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment