forked from qt-creator/qt-creator
PerfProfiler: Simplify logic around PerfProfilerTool::populateFileFinder
It doesn't need a RunConfiguration, only uses a Target. Change-Id: I96bac9ab26f7e261f1a170dec8bfbad8e4d63a72 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -439,7 +439,7 @@ void PerfProfilerTool::onReaderStarted()
|
|||||||
|
|
||||||
void PerfProfilerTool::onWorkerCreation(RunControl *runControl)
|
void PerfProfilerTool::onWorkerCreation(RunControl *runControl)
|
||||||
{
|
{
|
||||||
populateFileFinder(runControl->runConfiguration());
|
populateFileFinder(runControl->project(), runControl->kit());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfProfilerTool::updateRunActions()
|
void PerfProfilerTool::updateRunActions()
|
||||||
@@ -617,7 +617,12 @@ void PerfProfilerTool::showLoadTraceDialog()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
startLoading();
|
startLoading();
|
||||||
populateFileFinder();
|
|
||||||
|
const Project *currentProject = SessionManager::startupProject();
|
||||||
|
const Target *target = currentProject ? currentProject->activeTarget() : nullptr;
|
||||||
|
const Kit *kit = target ? target->kit() : nullptr;
|
||||||
|
populateFileFinder(currentProject, kit);
|
||||||
|
|
||||||
m_traceManager->loadFromTraceFile(filename);
|
m_traceManager->loadFromTraceFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,24 +678,12 @@ void PerfProfilerTool::updateTime(qint64 duration, qint64 delay)
|
|||||||
m_delayLabel->clear();
|
m_delayLabel->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfProfilerTool::populateFileFinder(const RunConfiguration *rc)
|
void PerfProfilerTool::populateFileFinder(const Project *project, const Kit *kit)
|
||||||
{
|
{
|
||||||
const Project *currentProject = nullptr;
|
m_fileFinder.setProjectFiles(sourceFiles(project));
|
||||||
const Kit *kit = nullptr;
|
|
||||||
if (rc) {
|
|
||||||
if (const Target *target = rc->target()) {
|
|
||||||
kit = target->kit();
|
|
||||||
currentProject = target->project();
|
|
||||||
}
|
|
||||||
} else if ((currentProject = SessionManager::startupProject())) {
|
|
||||||
if (const Target *target = currentProject->activeTarget())
|
|
||||||
kit = target->kit();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_fileFinder.setProjectFiles(sourceFiles(currentProject));
|
if (project)
|
||||||
|
m_fileFinder.setProjectDirectory(project->projectDirectory());
|
||||||
if (currentProject)
|
|
||||||
m_fileFinder.setProjectDirectory(currentProject->projectDirectory());
|
|
||||||
|
|
||||||
if (kit) {
|
if (kit) {
|
||||||
m_fileFinder.setAdditionalSearchDirectories(collectQtIncludePaths(kit));
|
m_fileFinder.setAdditionalSearchDirectories(collectQtIncludePaths(kit));
|
||||||
|
@@ -88,7 +88,8 @@ private:
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
friend class PerfProfilerRunner;
|
friend class PerfProfilerRunner;
|
||||||
void populateFileFinder(const ProjectExplorer::RunConfiguration *rc = nullptr);
|
void populateFileFinder(const ProjectExplorer::Project *project,
|
||||||
|
const ProjectExplorer::Kit *kit);
|
||||||
void updateFilterMenu();
|
void updateFilterMenu();
|
||||||
void updateRunActions();
|
void updateRunActions();
|
||||||
void addLoadSaveActionsToMenu(QMenu *menu);
|
void addLoadSaveActionsToMenu(QMenu *menu);
|
||||||
|
Reference in New Issue
Block a user