Commit e10bda6f authored by Roberto Raggi's avatar Roberto Raggi

Create nodes for the project files.

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