ProjectExplorer: Handle project file list globally

Handle the generation of the list of files in a project globally, based
on the project tree.

Creator now has the concept of TreeManagers which can enrich the project
tree with additional data (e.g. the files found in a resource file), which
the project does not necessarily know about. So use that tree to find
the files that belong to a project instead of implementing similar features
in each project.

Change-Id: Ia375a914a1f2c0adaa427f9eda834eec2db07f68
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
Tobias Hunger
2017-03-27 12:12:38 +02:00
parent d1a5304564
commit fc5ce1e710
19 changed files with 43 additions and 200 deletions

View File

@@ -249,9 +249,6 @@ void GenericProject::parseProject(RefreshOptions options)
// TODO: Possibly load some configuration from the project file
//QSettings projectInfo(m_fileName, QSettings::IniFormat);
}
if (options & Files)
emit fileListChanged();
}
void GenericProject::refresh(RefreshOptions options)
@@ -261,7 +258,7 @@ void GenericProject::refresh(RefreshOptions options)
if (options & Files) {
auto newRoot = new GenericProjectNode(this);
for (const QString &f : files()) {
for (const QString &f : m_files) {
FileType fileType = FileType::Source; // ### FIXME
if (f.endsWith(".qrc"))
fileType = FileType::Resource;
@@ -364,7 +361,7 @@ void GenericProject::refreshCppCodeModel()
rpp.setQtVersion(activeQtVersion);
rpp.setIncludePaths(projectIncludePaths());
rpp.setConfigFileName(configFileName());
rpp.setFiles(files());
rpp.setFiles(m_files);
const CppTools::ProjectUpdateInfo projectInfoUpdate(this, cToolChain, cxxToolChain, k, {rpp});
m_cppCodeModelUpdater->update(projectInfoUpdate);
@@ -397,22 +394,11 @@ QStringList GenericProject::projectIncludePaths() const
return m_projectIncludePaths;
}
QStringList GenericProject::files() const
{
return m_files;
}
QString GenericProject::displayName() const
{
return projectFilePath().toFileInfo().completeBaseName();
}
QStringList GenericProject::files(FilesMode fileMode) const
{
Q_UNUSED(fileMode);
return m_files;
}
QStringList GenericProject::buildTargets() const
{
const QStringList targets = { "all", "clean" };