Commit e10bda6f authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Create nodes for the project files.

parent d06aa363
...@@ -111,6 +111,14 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName) ...@@ -111,6 +111,14 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QFileInfo fileInfo(_fileName);
const QString projectBaseName = fileInfo.baseName();
QDir dir = fileInfo.dir();
_filesFileName = QFileInfo(dir, projectBaseName + QLatin1String(".files")).absoluteFilePath();
_includesFileName = QFileInfo(dir, projectBaseName + QLatin1String(".includes")).absoluteFilePath();
_configFileName = QFileInfo(dir, projectBaseName + QLatin1String(".config")).absoluteFilePath();
_file = new GenericProjectFile(this, fileName); _file = new GenericProjectFile(this, fileName);
_rootNode = new GenericProjectNode(this, _file); _rootNode = new GenericProjectNode(this, _file);
...@@ -127,6 +135,15 @@ GenericProject::~GenericProject() ...@@ -127,6 +135,15 @@ GenericProject::~GenericProject()
delete _toolChain; delete _toolChain;
} }
QString GenericProject::filesFileName() const
{ return _filesFileName; }
QString GenericProject::includesFileName() const
{ return _includesFileName; }
QString GenericProject::configFileName() const
{ return _configFileName; }
QStringList GenericProject::readLines(const QString &absoluteFileName) const QStringList GenericProject::readLines(const QString &absoluteFileName) const
{ {
QStringList lines; QStringList lines;
...@@ -155,20 +172,17 @@ QStringList GenericProject::readLines(const QString &absoluteFileName) const ...@@ -155,20 +172,17 @@ QStringList GenericProject::readLines(const QString &absoluteFileName) const
void GenericProject::parseProject() void GenericProject::parseProject()
{ {
const QFileInfo projectFileInfo(_fileName); const QFileInfo projectFileInfo(_fileName);
const QDir projectDir = projectFileInfo.dir();
const QString projectName = projectFileInfo.baseName();
const QFileInfo projectFiles(projectDir, projectName + QLatin1String(".files"));
const QFileInfo projectIncludes(projectDir, projectName + QLatin1String(".includes"));
const QFileInfo projectConfig(projectDir, projectName + QLatin1String(".config"));
QSettings projectInfo(_fileName, QSettings::IniFormat); QSettings projectInfo(_fileName, QSettings::IniFormat);
_files = convertToAbsoluteFiles(readLines(projectFiles.absoluteFilePath())); _files = convertToAbsoluteFiles(readLines(filesFileName()));
_projectIncludePaths = readLines(projectIncludes.absoluteFilePath()); _files.removeDuplicates();
_projectIncludePaths = readLines(includesFileName());
_projectIncludePaths.removeDuplicates();
_generated = convertToAbsoluteFiles(projectInfo.value(QLatin1String("generated")).toStringList()); _generated = convertToAbsoluteFiles(projectInfo.value(QLatin1String("generated")).toStringList());
_defines = projectInfo.value(QLatin1String("defines")).toStringList(); _defines = projectInfo.value(QLatin1String("defines")).toStringList();
_projectIncludePaths = projectInfo.value(QLatin1String("includePaths")).toStringList();
emit fileListChanged(); emit fileListChanged();
} }
......
...@@ -59,6 +59,10 @@ public: ...@@ -59,6 +59,10 @@ public:
GenericProject(Manager *manager, const QString &filename); GenericProject(Manager *manager, const QString &filename);
virtual ~GenericProject(); virtual ~GenericProject();
QString filesFileName() const;
QString includesFileName() const;
QString configFileName() const;
virtual QString name() const; virtual QString name() const;
virtual Core::IFile *file() const; virtual Core::IFile *file() const;
virtual ProjectExplorer::IProjectManager *projectManager() const; virtual ProjectExplorer::IProjectManager *projectManager() const;
...@@ -110,6 +114,9 @@ private: ...@@ -110,6 +114,9 @@ private:
Manager *_manager; Manager *_manager;
QString _fileName; QString _fileName;
QString _filesFileName;
QString _includesFileName;
QString _configFileName;
GenericProjectFile *_file; GenericProjectFile *_file;
QString _projectName; QString _projectName;
......
...@@ -65,10 +65,23 @@ void GenericProjectNode::refresh() ...@@ -65,10 +65,23 @@ void GenericProjectNode::refresh()
ProjectExplorerPlugin::instance()->setCurrentNode(0); // ### remove me ProjectExplorerPlugin::instance()->setCurrentNode(0); // ### remove me
FileNode *projectFileNode = new FileNode(projectFilePath(), ProjectFileType, FileNode *projectFilesNode = new FileNode(_project->filesFileName(),
/* generated = */ false); ProjectFileType,
/* generated = */ false);
addFileNodes(QList<FileNode *>() << projectFileNode, this);
FileNode *projectIncludesNode = new FileNode(_project->includesFileName(),
ProjectFileType,
/* generated = */ false);
FileNode *projectConfigNode = new FileNode(_project->configFileName(),
ProjectFileType,
/* generated = */ false);
addFileNodes(QList<FileNode *>()
<< projectFilesNode
<< projectIncludesNode
<< projectConfigNode,
this);
QStringList filePaths; QStringList filePaths;
QHash<QString, QStringList> filesInPath; QHash<QString, QStringList> filesInPath;
......
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