forked from qt-creator/qt-creator
QmlProfiler: instantiate FileInProjectFinder only once
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
@@ -103,6 +104,8 @@ public:
|
|||||||
QDeclarativeDebugConnection *m_client;
|
QDeclarativeDebugConnection *m_client;
|
||||||
TraceWindow *m_traceWindow;
|
TraceWindow *m_traceWindow;
|
||||||
QmlProfilerOutputPaneAdapter *m_outputPaneAdapter;
|
QmlProfilerOutputPaneAdapter *m_outputPaneAdapter;
|
||||||
|
ProjectExplorer::Project *m_project;
|
||||||
|
Utils::FileInProjectFinder m_projectFinder;
|
||||||
};
|
};
|
||||||
|
|
||||||
QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
||||||
@@ -111,6 +114,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
|||||||
d->m_client = 0;
|
d->m_client = 0;
|
||||||
d->m_traceWindow = 0;
|
d->m_traceWindow = 0;
|
||||||
d->m_outputPaneAdapter = 0;
|
d->m_outputPaneAdapter = 0;
|
||||||
|
d->m_project = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerTool::~QmlProfilerTool()
|
QmlProfilerTool::~QmlProfilerTool()
|
||||||
@@ -142,6 +146,13 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(ProjectExplorer::RunConfiguration
|
|||||||
{
|
{
|
||||||
QmlProfilerEngine *engine = new QmlProfilerEngine(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(processRunning()), this, SLOT(connectClient()));
|
||||||
connect(engine, SIGNAL(processTerminated()), this, SLOT(disconnectClient()));
|
connect(engine, SIGNAL(processTerminated()), this, SLOT(disconnectClient()));
|
||||||
connect(engine, SIGNAL(stopRecording()), this, SLOT(stopRecording()));
|
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)));
|
connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal)));
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::initialize(ExtensionSystem::IPlugin */*plugin*/)
|
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()))
|
if (lineNumber < 0 || !QFile::exists(QUrl(fileName).toLocalFile()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Utils::FileInProjectFinder m_projectFinder;
|
QString projectFileName = d->m_projectFinder.findFile(fileName);
|
||||||
ProjectExplorer::Project *m_debugProject;
|
|
||||||
m_debugProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
|
|
||||||
m_projectFinder.setProjectDirectory(m_debugProject->projectDirectory());
|
|
||||||
|
|
||||||
QString projectFileName = m_projectFinder.findFile(fileName);
|
|
||||||
|
|
||||||
|
|
||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||||
Core::IEditor *editor = editorManager->openEditor(projectFileName);
|
Core::IEditor *editor = editorManager->openEditor(projectFileName);
|
||||||
@@ -262,3 +266,9 @@ void QmlProfilerTool::updateTimer(qreal elapsedSeconds)
|
|||||||
timeString = QString(" ").left(6-timeString.length()) + timeString;
|
timeString = QString(" ").left(6-timeString.length()) + timeString;
|
||||||
emit setTimeLabel(tr("elapsed: ")+timeString+QLatin1String(" s"));
|
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 QString host;
|
||||||
static quint16 port;
|
static quint16 port;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateProjectFileList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class QmlProfilerToolPrivate;
|
class QmlProfilerToolPrivate;
|
||||||
QmlProfilerToolPrivate *d;
|
QmlProfilerToolPrivate *d;
|
||||||
|
|||||||
Reference in New Issue
Block a user