forked from qt-creator/qt-creator
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:
@@ -101,12 +101,6 @@ QString AutotoolsProject::defaultBuildDirectory(const QString &projectPath)
|
||||
return QFileInfo(projectPath).absolutePath();
|
||||
}
|
||||
|
||||
QStringList AutotoolsProject::files(FilesMode fileMode) const
|
||||
{
|
||||
Q_UNUSED(fileMode);
|
||||
return m_files;
|
||||
}
|
||||
|
||||
// This function, is called at the very beginning, to
|
||||
// restore the settings if there are some stored.
|
||||
Project::RestoreResult AutotoolsProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
|
@@ -58,7 +58,6 @@ public:
|
||||
~AutotoolsProject() override;
|
||||
|
||||
QString displayName() const override;
|
||||
QStringList files(FilesMode fileMode) const override;
|
||||
static QString defaultBuildDirectory(const QString &projectPath);
|
||||
QStringList buildTargets() const;
|
||||
|
||||
|
@@ -306,21 +306,6 @@ QString CMakeProject::displayName() const
|
||||
return root ? root->displayName() : projectDirectory().fileName();
|
||||
}
|
||||
|
||||
QStringList CMakeProject::files(FilesMode fileMode) const
|
||||
{
|
||||
QStringList result;
|
||||
if (ProjectNode *rpn = rootProjectNode()) {
|
||||
rpn->forEachNode([&](const FileNode *fn) {
|
||||
const bool isGenerated = fn->isGenerated();
|
||||
if ((fileMode & Project::SourceFiles) && !isGenerated)
|
||||
result.append(fn->filePath().toString());
|
||||
if ((fileMode & Project::GeneratedFiles) && isGenerated)
|
||||
result.append(fn->filePath().toString());
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
{
|
||||
RestoreResult result = Project::fromMap(map, errorMessage);
|
||||
|
@@ -88,7 +88,6 @@ public:
|
||||
|
||||
QString displayName() const final;
|
||||
|
||||
QStringList files(FilesMode fileMode) const final;
|
||||
QStringList buildTargetTitles(bool runnable = false) const;
|
||||
bool hasBuildTarget(const QString &title) const;
|
||||
|
||||
|
@@ -45,8 +45,6 @@ public:
|
||||
|
||||
QString displayName() const override { return m_name; }
|
||||
|
||||
QStringList files(FilesMode fileMode) const override { Q_UNUSED(fileMode); return QStringList(); }
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
};
|
||||
|
@@ -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" };
|
||||
|
@@ -57,8 +57,6 @@ public:
|
||||
|
||||
QString displayName() const override;
|
||||
|
||||
QStringList files(FilesMode fileMode) const override;
|
||||
|
||||
QStringList buildTargets() const;
|
||||
|
||||
bool addFiles(const QStringList &filePaths);
|
||||
@@ -75,7 +73,6 @@ public:
|
||||
void refresh(RefreshOptions options);
|
||||
|
||||
QStringList projectIncludePaths() const;
|
||||
QStringList files() const;
|
||||
|
||||
protected:
|
||||
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
||||
|
@@ -87,7 +87,8 @@ void GenericProjectPlugin::editFiles()
|
||||
if (!genericProject)
|
||||
return;
|
||||
SelectableFilesDialogEditFiles sfd(genericProject->projectDirectory(),
|
||||
Utils::transform(genericProject->files(), [](const QString &f) { return Utils::FileName::fromString(f); }),
|
||||
Utils::transform(genericProject->files(Project::AllFiles),
|
||||
[](const QString &f) { return Utils::FileName::fromString(f); }),
|
||||
ICore::mainWindow());
|
||||
if (sfd.exec() == QDialog::Accepted)
|
||||
genericProject->setFiles(Utils::transform(sfd.selectedFiles(), &Utils::FileName::toString));
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
@@ -73,11 +74,6 @@ QString NimProject::displayName() const
|
||||
return projectFilePath().toFileInfo().completeBaseName();
|
||||
}
|
||||
|
||||
QStringList NimProject::files(FilesMode) const
|
||||
{
|
||||
return m_files;
|
||||
}
|
||||
|
||||
bool NimProject::needsConfiguration() const
|
||||
{
|
||||
return targets().empty();
|
||||
@@ -133,7 +129,7 @@ void NimProject::collectProjectFiles()
|
||||
|
||||
void NimProject::updateProject()
|
||||
{
|
||||
QStringList oldFiles = m_files;
|
||||
const QStringList oldFiles = m_files;
|
||||
m_files.clear();
|
||||
|
||||
QList<FileNode *> fileNodes = Utils::filtered(m_futureWatcher.future().result(),
|
||||
@@ -158,9 +154,6 @@ void NimProject::updateProject()
|
||||
newRoot->setDisplayName(displayName());
|
||||
newRoot->addNestedNodes(fileNodes);
|
||||
setRootProjectNode(newRoot);
|
||||
|
||||
emit fileListChanged();
|
||||
|
||||
emit parsingFinished();
|
||||
}
|
||||
|
||||
@@ -182,12 +175,10 @@ bool NimProject::supportsKit(Kit *k, QString *errorMessage) const
|
||||
|
||||
FileNameList NimProject::nimFiles() const
|
||||
{
|
||||
FileNameList result;
|
||||
rootProjectNode()->forEachNode([&](FileNode *file) {
|
||||
if (file->displayName().endsWith(QLatin1String(".nim")))
|
||||
result.append(file->filePath());
|
||||
const QStringList nim = files(AllFiles, [](const ProjectExplorer::FileNode *fn) {
|
||||
return fn->filePath().endsWith(".nim");
|
||||
});
|
||||
return result;
|
||||
return Utils::transform(nim, [](const QString &fp) { return Utils::FileName::fromString(fp); });
|
||||
}
|
||||
|
||||
QVariantMap NimProject::toMap() const
|
||||
@@ -203,4 +194,4 @@ Project::RestoreResult NimProject::fromMap(const QVariantMap &map, QString *erro
|
||||
return Project::fromMap(map, errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Nim
|
||||
|
@@ -42,7 +42,6 @@ public:
|
||||
explicit NimProject(const Utils::FileName &fileName);
|
||||
|
||||
QString displayName() const override;
|
||||
QStringList files(FilesMode) const override;
|
||||
bool needsConfiguration() const override;
|
||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
|
||||
Utils::FileNameList nimFiles() const;
|
||||
|
@@ -476,6 +476,7 @@ void Project::setRootProjectNode(ProjectNode *root)
|
||||
if (root)
|
||||
root->setParentFolderNode(&d->m_containerNode);
|
||||
ProjectTree::emitSubtreeChanged(root);
|
||||
emit fileListChanged();
|
||||
|
||||
delete oldNode;
|
||||
}
|
||||
@@ -524,6 +525,25 @@ Project::RestoreResult Project::restoreSettings(QString *errorMessage)
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList Project::files(Project::FilesMode fileMode,
|
||||
const std::function<bool (const FileNode *)> &filter) const
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
if (!rootProjectNode())
|
||||
return result;
|
||||
|
||||
rootProjectNode()->forEachNode([&](const FileNode *fn) {
|
||||
if (filter && !filter(fn))
|
||||
return;
|
||||
if ((fileMode == AllFiles)
|
||||
|| (fileMode == SourceFiles && !fn->isGenerated())
|
||||
|| (fileMode == GeneratedFiles && fn->isGenerated()))
|
||||
result.append(fn->filePath().toString());
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Serializes all data into a QVariantMap.
|
||||
|
@@ -36,6 +36,8 @@
|
||||
#include <QObject>
|
||||
#include <QFileSystemModel>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace Core {
|
||||
class IDocument;
|
||||
class Context;
|
||||
@@ -47,6 +49,7 @@ namespace ProjectExplorer {
|
||||
|
||||
class BuildInfo;
|
||||
class EditorConfiguration;
|
||||
class FileNode;
|
||||
class NamedWidget;
|
||||
class ProjectImporter;
|
||||
class ProjectNode;
|
||||
@@ -112,7 +115,8 @@ public:
|
||||
GeneratedFiles = 0x2,
|
||||
AllFiles = SourceFiles | GeneratedFiles
|
||||
};
|
||||
virtual QStringList files(FilesMode fileMode) const = 0;
|
||||
virtual QStringList files(FilesMode fileMode,
|
||||
const std::function<bool(const FileNode *)> &filter = {}) const;
|
||||
virtual QStringList filesGeneratedFrom(const QString &sourceFile) const;
|
||||
|
||||
static QString makeUnique(const QString &preferredName, const QStringList &usedNames);
|
||||
|
@@ -96,9 +96,6 @@ public:
|
||||
|
||||
QString displayName() const override;
|
||||
|
||||
QStringList files(FilesMode) const override { return m_files; }
|
||||
QStringList files() const { return m_files; }
|
||||
|
||||
bool addFiles(const QStringList &filePaths);
|
||||
bool removeFiles(const QStringList &filePaths);
|
||||
bool setFiles(const QStringList &filePaths);
|
||||
@@ -356,7 +353,7 @@ public:
|
||||
|
||||
PythonProject *project = static_cast<PythonProject *>(parent->project());
|
||||
QList<Core::Id> allIds;
|
||||
foreach (const QString &file, project->files())
|
||||
foreach (const QString &file, project->files(ProjectExplorer::Project::AllFiles))
|
||||
allIds.append(idFromScript(file));
|
||||
return allIds;
|
||||
}
|
||||
@@ -371,7 +368,7 @@ public:
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
PythonProject *project = static_cast<PythonProject *>(parent->project());
|
||||
return project->files().contains(scriptFromId(id));
|
||||
return project->files(ProjectExplorer::Project::AllFiles).contains(scriptFromId(id));
|
||||
}
|
||||
|
||||
bool canRestore(Target *parent, const QVariantMap &map) const override
|
||||
@@ -533,7 +530,6 @@ void PythonProject::parseProject()
|
||||
m_rawFileList = readLines(projectFilePath().toString());
|
||||
m_rawFileList << projectFilePath().fileName();
|
||||
m_files = processEntries(m_rawFileList, &m_rawListEntries);
|
||||
emit fileListChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -175,58 +175,6 @@ void QbsProject::projectLoaded()
|
||||
m_parsingDelay.start(0);
|
||||
}
|
||||
|
||||
static void collectFilesForProject(const qbs::ProjectData &project, Project::FilesMode mode,
|
||||
QSet<QString> &result)
|
||||
{
|
||||
if (mode & Project::SourceFiles)
|
||||
result.insert(project.location().filePath());
|
||||
|
||||
foreach (const qbs::ProductData &prd, project.products()) {
|
||||
if (mode & Project::SourceFiles) {
|
||||
foreach (const qbs::GroupData &grp, prd.groups()) {
|
||||
foreach (const QString &file, grp.allFilePaths())
|
||||
result.insert(file);
|
||||
result.insert(grp.location().filePath());
|
||||
}
|
||||
result.insert(prd.location().filePath());
|
||||
}
|
||||
if (mode & Project::GeneratedFiles) {
|
||||
foreach (const qbs::ProductData &prd, project.products()) {
|
||||
foreach (const qbs::ArtifactData &artifact, prd.generatedArtifacts()) {
|
||||
// A list of human-readable file types that we can reasonably expect
|
||||
// to get generated during a build. Extend as needed.
|
||||
static const QSet<QString> sourceTags = {
|
||||
QLatin1String("c"), QLatin1String("cpp"), QLatin1String("hpp"),
|
||||
QLatin1String("objc"), QLatin1String("objcpp"),
|
||||
QLatin1String("c_pch_src"), QLatin1String("cpp_pch_src"),
|
||||
QLatin1String("objc_pch_src"), QLatin1String("objcpp_pch_src"),
|
||||
QLatin1String("asm"), QLatin1String("asm_cpp"),
|
||||
QLatin1String("linkerscript"),
|
||||
QLatin1String("qrc"), QLatin1String("java.java")
|
||||
};
|
||||
if (artifact.fileTags().toSet().intersects(sourceTags))
|
||||
result.insert(artifact.filePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const qbs::ProjectData &subProject, project.subProjects())
|
||||
collectFilesForProject(subProject, mode, result);
|
||||
}
|
||||
|
||||
QStringList QbsProject::files(Project::FilesMode fileMode) const
|
||||
{
|
||||
qCDebug(qbsPmLog) << Q_FUNC_INFO << fileMode << m_qbsProject.isValid() << isParsing();
|
||||
if (!m_qbsProject.isValid() || isParsing())
|
||||
return QStringList();
|
||||
QSet<QString> result;
|
||||
collectFilesForProject(m_projectData, fileMode, result);
|
||||
result.unite(m_qbsProject.buildSystemFiles());
|
||||
qCDebug(qbsPmLog) << "file count:" << result.count();
|
||||
return result.toList();
|
||||
}
|
||||
|
||||
QStringList QbsProject::filesGeneratedFrom(const QString &sourceFile) const
|
||||
{
|
||||
QStringList generated;
|
||||
@@ -312,7 +260,6 @@ bool QbsProject::addFilesToProduct(const QStringList &filePaths,
|
||||
if (notAdded->count() != filePaths.count()) {
|
||||
m_projectData = m_qbsProject.projectData();
|
||||
setRootProjectNode(Internal::QbsNodeTreeBuilder::buildTree(this));
|
||||
emit fileListChanged();
|
||||
}
|
||||
return notAdded->isEmpty();
|
||||
}
|
||||
|
@@ -64,7 +64,6 @@ public:
|
||||
QString displayName() const override;
|
||||
QbsRootProjectNode *rootProjectNode() const override;
|
||||
|
||||
QStringList files(FilesMode fileMode) const override;
|
||||
QStringList filesGeneratedFrom(const QString &sourceFile) const override;
|
||||
|
||||
bool isProjectEditable() const;
|
||||
|
@@ -191,7 +191,6 @@ static QList<QmakeProject *> s_projects;
|
||||
*/
|
||||
|
||||
QmakeProject::QmakeProject(const FileName &fileName) :
|
||||
m_projectFiles(new QmakeProjectFiles),
|
||||
m_qmakeVfs(new QMakeVfs),
|
||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
@@ -230,7 +229,6 @@ QmakeProject::~QmakeProject()
|
||||
setRootProjectNode(nullptr);
|
||||
m_rootProFile.reset();
|
||||
|
||||
delete m_projectFiles;
|
||||
m_cancelEvaluate = true;
|
||||
Q_ASSERT(m_qmakeGlobalsRefCnt == 0);
|
||||
delete m_qmakeVfs;
|
||||
@@ -241,32 +239,6 @@ QmakeProFile *QmakeProject::rootProFile() const
|
||||
return m_rootProFile.get();
|
||||
}
|
||||
|
||||
void QmakeProject::updateFileList()
|
||||
{
|
||||
QmakeProjectFiles files;
|
||||
rootProjectNode()->forEachNode([&](FileNode *fileNode) {
|
||||
const int type = static_cast<int>(fileNode->fileType());
|
||||
QStringList &targetList = fileNode->isGenerated() ? files.generatedFiles[type] : files.files[type];
|
||||
targetList.push_back(fileNode->filePath().toString());
|
||||
}, [&](FolderNode *folderNode) {
|
||||
if (ProjectNode *projectNode = folderNode->asProjectNode())
|
||||
files.proFiles.append(projectNode->filePath().toString());
|
||||
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(folderNode))
|
||||
files.files[static_cast<int>(FileType::Resource)].push_back(folderNode->filePath().toString());
|
||||
});
|
||||
|
||||
for (QStringList &f : files.files)
|
||||
f.removeDuplicates();
|
||||
for (QStringList &f : files.generatedFiles)
|
||||
f.removeDuplicates();
|
||||
files.proFiles.removeDuplicates();
|
||||
|
||||
if (files != *m_projectFiles) {
|
||||
*m_projectFiles = files;
|
||||
emit fileListChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Project::RestoreResult QmakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
{
|
||||
RestoreResult result = Project::fromMap(map, errorMessage);
|
||||
@@ -576,7 +548,6 @@ void QmakeProject::decrementPendingEvaluateFutures()
|
||||
setAllBuildConfigurationsEnabled(true);
|
||||
|
||||
m_asyncUpdateState = Base;
|
||||
updateFileList();
|
||||
updateCodeModels();
|
||||
updateBuildSystemData();
|
||||
if (activeTarget())
|
||||
@@ -639,21 +610,6 @@ QString QmakeProject::displayName() const
|
||||
return projectFilePath().toFileInfo().completeBaseName();
|
||||
}
|
||||
|
||||
QStringList QmakeProject::files(FilesMode fileMode) const
|
||||
{
|
||||
QStringList files;
|
||||
for (int i = 0; i < static_cast<int>(FileType::FileTypeSize); ++i) {
|
||||
if (fileMode & SourceFiles)
|
||||
files += m_projectFiles->files[i];
|
||||
if (fileMode & GeneratedFiles)
|
||||
files += m_projectFiles->generatedFiles[i];
|
||||
}
|
||||
|
||||
files.removeDuplicates();
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// Find the folder that contains a file with a certain name (recurse down)
|
||||
static FolderNode *folderOf(FolderNode *in, const FileName &fileName)
|
||||
{
|
||||
@@ -1086,10 +1042,8 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
|
||||
m_recursiveWatchedFolders += tmp;
|
||||
}
|
||||
|
||||
if (newOrRemovedFiles) {
|
||||
m_project->updateFileList();
|
||||
if (newOrRemovedFiles)
|
||||
m_project->updateCodeModels();
|
||||
}
|
||||
}
|
||||
|
||||
bool QmakeProject::needsConfiguration() const
|
||||
|
@@ -73,7 +73,6 @@ public:
|
||||
bool validParse(const Utils::FileName &proFilePath) const;
|
||||
bool parseInProgress(const Utils::FileName &proFilePath) const;
|
||||
|
||||
virtual QStringList files(FilesMode fileMode) const final;
|
||||
virtual QStringList filesGeneratedFrom(const QString &file) const final;
|
||||
|
||||
enum Parsing {ExactParse, ExactAndCumulativeParse };
|
||||
@@ -109,8 +108,6 @@ public:
|
||||
/// \internal
|
||||
bool wasEvaluateCanceled();
|
||||
|
||||
// For QmakeProFileNode after a on disk change
|
||||
void updateFileList();
|
||||
void updateCodeModels();
|
||||
|
||||
void watchFolders(const QStringList &l, QmakePriFile *file);
|
||||
@@ -188,9 +185,6 @@ private:
|
||||
|
||||
std::unique_ptr<QmakeProFile> m_rootProFile;
|
||||
|
||||
// cached lists of all of files
|
||||
Internal::QmakeProjectFiles *m_projectFiles = nullptr;
|
||||
|
||||
QMakeVfs *m_qmakeVfs = nullptr;
|
||||
|
||||
// cached data during project rescan
|
||||
|
@@ -168,9 +168,6 @@ void QmlProject::parseProject(RefreshOptions options)
|
||||
if (options & Configuration) {
|
||||
// update configuration
|
||||
}
|
||||
|
||||
if (options & Files)
|
||||
emit fileListChanged();
|
||||
}
|
||||
|
||||
void QmlProject::refresh(RefreshOptions options)
|
||||
@@ -195,16 +192,6 @@ void QmlProject::refresh(RefreshOptions options)
|
||||
emit parsingFinished();
|
||||
}
|
||||
|
||||
QStringList QmlProject::files() const
|
||||
{
|
||||
QStringList files;
|
||||
if (m_projectItem)
|
||||
files = m_projectItem.data()->files();
|
||||
else
|
||||
files = m_files;
|
||||
return files;
|
||||
}
|
||||
|
||||
QString QmlProject::mainFile() const
|
||||
{
|
||||
if (m_projectItem)
|
||||
@@ -296,11 +283,6 @@ Internal::QmlProjectNode *QmlProject::rootProjectNode() const
|
||||
return static_cast<Internal::QmlProjectNode *>(Project::rootProjectNode());
|
||||
}
|
||||
|
||||
QStringList QmlProject::files(FilesMode) const
|
||||
{
|
||||
return files();
|
||||
}
|
||||
|
||||
Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
{
|
||||
RestoreResult result = Project::fromMap(map, errorMessage);
|
||||
@@ -371,9 +353,12 @@ Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *erro
|
||||
|
||||
void QmlProject::generateProjectTree()
|
||||
{
|
||||
if (!m_projectItem)
|
||||
return;
|
||||
|
||||
auto newRoot = new Internal::QmlProjectNode(this);
|
||||
|
||||
for (const QString &f : files()) {
|
||||
for (const QString &f : m_projectItem.data()->files()) {
|
||||
FileType fileType = FileType::Source; // ### FIXME
|
||||
if (f == projectFilePath().toString())
|
||||
fileType = FileType::Project;
|
||||
|
@@ -51,7 +51,6 @@ public:
|
||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
|
||||
|
||||
Internal::QmlProjectNode *rootProjectNode() const override;
|
||||
QStringList files(FilesMode fileMode) const override;
|
||||
|
||||
bool validProjectFile() const;
|
||||
|
||||
@@ -66,7 +65,6 @@ public:
|
||||
void refresh(RefreshOptions options);
|
||||
|
||||
QDir projectDir() const;
|
||||
QStringList files() const;
|
||||
QString mainFile() const;
|
||||
QStringList customImportPaths() const;
|
||||
|
||||
@@ -92,10 +90,7 @@ private:
|
||||
void parseProject(RefreshOptions options);
|
||||
|
||||
QmlImport m_defaultImport;
|
||||
ProjectExplorer::Target *m_activeTarget = 0;
|
||||
|
||||
// plain format
|
||||
QStringList m_files;
|
||||
ProjectExplorer::Target *m_activeTarget = nullptr;
|
||||
|
||||
QPointer<QmlProjectItem> m_projectItem;
|
||||
};
|
||||
|
Reference in New Issue
Block a user