Merge commit 'fred/cmake-project-name'

This commit is contained in:
dt
2009-01-15 16:02:14 +01:00
2 changed files with 21 additions and 2 deletions

View File

@@ -87,6 +87,7 @@ void CMakeProject::parseCMakeLists(const QDir &directory)
CMakeCbpParser cbpparser; CMakeCbpParser cbpparser;
qDebug()<<"Parsing file "<<cbpFile; qDebug()<<"Parsing file "<<cbpFile;
if (cbpparser.parseCbpFile(cbpFile)) { if (cbpparser.parseCbpFile(cbpFile)) {
m_projectName = cbpparser.projectName();
qDebug()<<"Building Tree"; qDebug()<<"Building Tree";
// TODO do a intelligent updating of the tree // TODO do a intelligent updating of the tree
buildTree(m_rootNode, cbpparser.fileList()); buildTree(m_rootNode, cbpparser.fileList());
@@ -200,8 +201,7 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
QString CMakeProject::name() const QString CMakeProject::name() const
{ {
// TODO return m_projectName;
return "";
} }
Core::IFile *CMakeProject::file() const Core::IFile *CMakeProject::file() const
@@ -469,6 +469,8 @@ void CMakeCbpParser::parseProject()
readNext(); readNext();
if (isEndElement()) { if (isEndElement()) {
return; return;
} else if (name() == "Option") {
parseOption();
} else if (name() == "Unit") { } else if (name() == "Unit") {
parseUnit(); parseUnit();
} else if (name() == "Build") { } else if (name() == "Build") {
@@ -537,6 +539,19 @@ void CMakeCbpParser::parseTargetOption()
} }
} }
QString CMakeCbpParser::projectName() const
{
return m_projectName;
}
void CMakeCbpParser::parseOption()
{
if (attributes().hasAttribute("title"))
m_projectName = attributes().value("title").toString();
if(isStartElement())
parseUnknownElement();
}
void CMakeCbpParser::parseMakeCommand() void CMakeCbpParser::parseMakeCommand()
{ {
while (!atEnd()) { while (!atEnd()) {

View File

@@ -118,6 +118,7 @@ private:
CMakeManager *m_manager; CMakeManager *m_manager;
QString m_fileName; QString m_fileName;
CMakeFile *m_file; CMakeFile *m_file;
QString m_projectName;
// TODO probably need a CMake specific node structure // TODO probably need a CMake specific node structure
CMakeProjectNode* m_rootNode; CMakeProjectNode* m_rootNode;
@@ -137,10 +138,12 @@ public:
QList<ProjectExplorer::FileNode *> fileList(); QList<ProjectExplorer::FileNode *> fileList();
QStringList includeFiles(); QStringList includeFiles();
QList<CMakeTarget> targets(); QList<CMakeTarget> targets();
QString projectName() const;
private: private:
void parseCodeBlocks_project_file(); void parseCodeBlocks_project_file();
void parseProject(); void parseProject();
void parseBuild(); void parseBuild();
void parseOption();
void parseTarget(); void parseTarget();
void parseTargetOption(); void parseTargetOption();
void parseMakeCommand(); void parseMakeCommand();
@@ -157,6 +160,7 @@ private:
CMakeTarget m_target; CMakeTarget m_target;
bool m_targetType; bool m_targetType;
QList<CMakeTarget> m_targets; QList<CMakeTarget> m_targets;
QString m_projectName;
}; };
class CMakeFile : public Core::IFile class CMakeFile : public Core::IFile