Initial import

This commit is contained in:
con
2008-12-02 12:01:29 +01:00
commit 05c35356ab
1675 changed files with 229938 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-cmake">
<sub-class-of type="text/plain"/>
<comment>CMake Project file</comment>
<glob pattern="CMakeLists.txt"/>
</mime-type>
</mime-info>

View File

@@ -0,0 +1,14 @@
<plugin name="CMakeProjectManager" version="0.9.1" compatVersion="0.9.1">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2008 Nokia Corporation</copyright>
<license>### TODO</license>
<description>CMake support</description>
<url>http://www.trolltech.com/</url>
<dependencyList>
<dependency name="TextEditor" version="0.9.1"/>
<dependency name="ProjectExplorer" version="0.9.1"/>
<dependency name="CppTools" version="0.9.1"/>
<dependency name="CppEditor" version="0.9.1"/>
<dependency name="Help" version="0.9.1"/>
</dependencyList>
</plugin>

View File

@@ -0,0 +1,441 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
#include <extensionsystem/pluginmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtCore/QDebug>
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
{
//TODO
m_file = new CMakeFile(this, fileName);
QDir dir = QFileInfo(m_fileName).absoluteDir();
QString cbpFile = findCbpFile(dir);
if (cbpFile.isEmpty())
cbpFile = createCbpFile(dir);
QList<ProjectExplorer::FileNode *> fileList;
QStringList includeFiles;
if (parseCbpFile(cbpFile, fileList, includeFiles)) {
buildTree(m_rootNode, fileList);
foreach(ProjectExplorer::FileNode *fn, fileList)
m_files.append(fn->path());
m_files.sort();
includeFiles.sort();
includeFiles.removeDuplicates();
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
if (modelmanager) {
CppTools::CppModelManagerInterface::ProjectInfo *pinfo = modelmanager->projectInfo(this);
pinfo->includePaths = includeFiles;
pinfo->sourceFiles = m_files; // TODO we only want C++ files, not all other stuff that might be in the project
// TODO defines
}
} else {
// TODO report error
}
}
CMakeProject::~CMakeProject()
{
delete m_rootNode;
}
QString CMakeProject::findCbpFile(const QDir &directory)
{
// Find the cbp file
// TODO the cbp file is named like the project() command in the CMakeList.txt file
// so this method below could find the wrong cbp file, if the user changes the project()
// name
foreach(const QString &cbpFile , directory.entryList())
{
if (cbpFile.endsWith(".cbp")) {
return directory.path() + "/" + cbpFile;
}
}
return QString::null;
}
QString CMakeProject::createCbpFile(const QDir &)
{
// TODO create a cbp file.
// Issue: Where to create it? We want to do that in the build directory
// but at this stage we don't know the build directory yet
// So create it in a temp directory?
// Issue: We want to reuse whatever CMakeCache.txt that is alread there, which
// would indicate, creating it in the build directory
// Or we could use a temp directory and use -C builddirectory
return QString::null;
}
bool CMakeProject::parseCbpFile(const QString &fileName, QList<ProjectExplorer::FileNode *> &fileList, QStringList &includeFiles)
{
QFile fi(fileName);
if (fi.exists() && fi.open(QFile::ReadOnly)) {
QXmlStreamReader stream(&fi);
while(!stream.atEnd()) {
stream.readNext();
if (stream.name() == "CodeBlocks_project_file") {
parseCodeBlocks_project_file(stream, fileList, includeFiles);
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
fi.close();
return true;
}
return false;
}
void CMakeProject::parseCodeBlocks_project_file(QXmlStreamReader &stream, QList<ProjectExplorer::FileNode *> &fileList, QStringList &includeFiles)
{
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.name() == "Project") {
parseProject(stream, fileList, includeFiles);
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseProject(QXmlStreamReader &stream, QList<ProjectExplorer::FileNode *> &fileList, QStringList &includeFiles)
{
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.name() == "Unit") {
parseUnit(stream, fileList);
} else if (stream.name() == "Build") {
parseBuild(stream, includeFiles);
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseBuild(QXmlStreamReader &stream, QStringList &includeFiles)
{
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.name() == "Target") {
parseTarget(stream, includeFiles);
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseTarget(QXmlStreamReader &stream, QStringList &includeFiles)
{
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.name() == "Compiler") {
parseCompiler(stream, includeFiles);
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseCompiler(QXmlStreamReader &stream, QStringList &includeFiles)
{
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.name() == "Add") {
parseAdd(stream, includeFiles);
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseAdd(QXmlStreamReader &stream, QStringList &includeFiles)
{
includeFiles.append(stream.attributes().value("directory").toString());
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseUnit(QXmlStreamReader &stream, QList<ProjectExplorer::FileNode *> &fileList)
{
//qDebug()<<stream.attributes().value("filename");
QString fileName = stream.attributes().value("filename").toString();
if (!fileName.endsWith(".rule"))
fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false));
while(!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement()) {
return;
} else if (stream.isStartElement()) {
parseUnknownElement(stream);
}
}
}
void CMakeProject::parseUnknownElement(QXmlStreamReader &stream)
{
Q_ASSERT(stream.isStartElement());
while (!stream.atEnd()) {
stream.readNext();
if (stream.isEndElement())
break;
if (stream.isStartElement())
parseUnknownElement(stream);
}
}
void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list)
{
//m_rootNode->addFileNodes(fileList, m_rootNode);
qSort(list.begin(), list.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
foreach( ProjectExplorer::FileNode *fn, list) {
// Get relative path to rootNode
QString parentDir = QFileInfo(fn->path()).absolutePath();
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
rootNode->addFileNodes(QList<ProjectExplorer::FileNode *>()<< fn, folder);
}
//m_rootNode->addFileNodes(list, rootNode);
}
ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *rootNode, QString directory)
{
QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
QStringList parts = relativePath.split("/");
ProjectExplorer::FolderNode *parent = rootNode;
foreach(const QString &part, parts) {
// Find folder in subFolders
bool found = false;
foreach(ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
if (QFileInfo(folder->path()).fileName() == part) {
// yeah found something :)
parent = folder;
found = true;
break;
}
}
if (!found) {
// No FolderNode yet, so create it
ProjectExplorer::FolderNode *tmp = new ProjectExplorer::FolderNode(part);
rootNode->addFolderNodes(QList<ProjectExplorer::FolderNode *>() << tmp, parent);
parent = tmp;
}
}
return parent;
}
QString CMakeProject::name() const
{
// TODO
return "";
}
Core::IFile *CMakeProject::file() const
{
return m_file;
}
ProjectExplorer::IProjectManager *CMakeProject::projectManager() const
{
return m_manager;
}
QList<Core::IFile *> CMakeProject::dependencies()
{
return QList<Core::IFile *>();
}
QList<ProjectExplorer::Project *> CMakeProject::dependsOn()
{
return QList<Project *>();
}
bool CMakeProject::isApplication() const
{
return true;
}
ProjectExplorer::Environment CMakeProject::environment(const QString &buildConfiguration) const
{
Q_UNUSED(buildConfiguration)
//TODO
return ProjectExplorer::Environment::systemEnvironment();
}
QString CMakeProject::buildDirectory(const QString &buildConfiguration) const
{
Q_UNUSED(buildConfiguration)
//TODO
return "";
}
ProjectExplorer::BuildStepConfigWidget *CMakeProject::createConfigWidget()
{
return new CMakeBuildSettingsWidget;
}
QList<ProjectExplorer::BuildStepConfigWidget*> CMakeProject::subConfigWidgets()
{
return QList<ProjectExplorer::BuildStepConfigWidget*>();
}
// This method is called for new build configurations
// You should probably set some default values in this method
void CMakeProject::newBuildConfiguration(const QString &buildConfiguration)
{
Q_UNUSED(buildConfiguration);
//TODO
}
ProjectExplorer::ProjectNode *CMakeProject::rootProjectNode() const
{
return m_rootNode;
}
QStringList CMakeProject::files(FilesMode fileMode) const
{
Q_UNUSED(fileMode);
// TODO
return m_files;
}
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
{
// TODO
Q_UNUSED(writer)
}
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
{
// TODO
Q_UNUSED(reader)
}
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
: Core::IFile(parent), m_project(parent), m_fileName(fileName)
{
}
bool CMakeFile::save(const QString &fileName)
{
// TODO
// Once we have an texteditor open for this file, we probably do
// need to implement this, don't we.
Q_UNUSED(fileName);
return false;
}
QString CMakeFile::fileName() const
{
return m_fileName;
}
QString CMakeFile::defaultPath() const
{
return QString();
}
QString CMakeFile::suggestedFileName() const
{
return QString();
}
QString CMakeFile::mimeType() const
{
return Constants::CMAKEMIMETYPE;
}
bool CMakeFile::isModified() const
{
return false;
}
bool CMakeFile::isReadOnly() const
{
return true;
}
bool CMakeFile::isSaveAsAllowed() const
{
return false;
}
void CMakeFile::modified(ReloadBehavior *behavior)
{
Q_UNUSED(behavior);
}
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget()
{
}
QString CMakeBuildSettingsWidget::displayName() const
{
return "CMake";
}
void CMakeBuildSettingsWidget::init(const QString &buildConfiguration)
{
Q_UNUSED(buildConfiguration);
// TODO
}

View File

@@ -0,0 +1,158 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CMAKEPROJECT_H
#define CMAKEPROJECT_H
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/buildstep.h>
#include <coreplugin/ifile.h>
#include <QtCore/QXmlStreamReader>
#include "cmakeprojectmanager.h"
#include "cmakeprojectnodes.h"
namespace CMakeProjectManager {
namespace Internal{
class CMakeFile;
class CMakeProject : public ProjectExplorer::Project
{
Q_OBJECT
public:
CMakeProject(CMakeManager *manager, const QString &filename);
~CMakeProject();
virtual QString name() const;
virtual Core::IFile *file() const;
virtual ProjectExplorer::IProjectManager *projectManager() const;
virtual QList<Core::IFile *> dependencies(); //NBS TODO remove
virtual QList<ProjectExplorer::Project *> dependsOn(); //NBS TODO implement dependsOn
virtual bool isApplication() const;
virtual ProjectExplorer::Environment environment(const QString &buildConfiguration) const;
virtual QString buildDirectory(const QString &buildConfiguration) const;
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
virtual QList<ProjectExplorer::BuildStepConfigWidget*> subConfigWidgets();
// This method is called for new build configurations
// You should probably set some default values in this method
virtual void newBuildConfiguration(const QString &buildConfiguration);
// // Returns the list of different views (such as "File View" or "Project View") the project supports.
// virtual QStringList supportedModels() const = 0;
//
// // Returns the tree representing the requested view.
// virtual QModelIndex model(const QString &modelId) const = 0;
virtual ProjectExplorer::ProjectNode *rootProjectNode() const;
// // Conversion functions
// virtual QModelIndex indexForNode(const Node *node, const QString &modelId) const = 0;
// virtual Node *nodeForIndex(const QModelIndex &index) const = 0;
// virtual Node *nodeForFile(const QString &filePath) const = 0;
virtual QStringList files(FilesMode fileMode) const;
private:
QString findCbpFile(const QDir &);
QString createCbpFile(const QDir &);
bool parseCbpFile(const QString &fileName, QList<ProjectExplorer::FileNode *> &fileList, QStringList &includeFiles);
void parseCodeBlocks_project_file(QXmlStreamReader &stream, QList<ProjectExplorer::FileNode *> &fileList, QStringList &includeFiles);
void parseProject(QXmlStreamReader &stream, QList<ProjectExplorer::FileNode *> &fileList, QStringList &includeFiles);
void parseBuild(QXmlStreamReader &stream, QStringList &includeFiles);
void parseTarget(QXmlStreamReader &stream, QStringList &includeFiles);
void parseCompiler(QXmlStreamReader &stream, QStringList &includeFiles);
void parseAdd(QXmlStreamReader &stream, QStringList &includeFiles);
void parseUnit(QXmlStreamReader &stream, QList<ProjectExplorer::FileNode *> &fileList);
void parseUnknownElement(QXmlStreamReader &stream);
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory);
CMakeManager *m_manager;
QString m_fileName;
CMakeFile *m_file;
// TODO probably need a CMake specific node structure
CMakeProjectNode* m_rootNode;
QStringList m_files;
protected:
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
virtual void restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader);
};
class CMakeFile : public Core::IFile
{
Q_OBJECT
public:
CMakeFile(CMakeProject *parent, QString fileName);
bool save(const QString &fileName = QString());
QString fileName() const;
QString defaultPath() const;
QString suggestedFileName() const;
QString mimeType() const;
bool isModified() const;
bool isReadOnly() const;
bool isSaveAsAllowed() const;
void modified(ReloadBehavior *behavior);
private:
CMakeProject *m_project;
QString m_fileName;
};
class CMakeBuildSettingsWidget : public ProjectExplorer::BuildStepConfigWidget
{
public:
CMakeBuildSettingsWidget();
virtual QString displayName() const;
// This is called to set up the config widget before showing it
// buildConfiguration is QString::null for the non buildConfiguration specific page
virtual void init(const QString &buildConfiguration);
};
}
}
#endif // CMAKEPROJECT_H

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/cmakeproject" >
<file>CMakeProject.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,45 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CMAKEPROJECTCONSTANTS_H
#define CMAKEPROJECTCONSTANTS_H
namespace CMakeProjectManager {
namespace Constants {
const char * const PROJECTCONTEXT = "CMakeProject.ProjectContext";
const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is correct
}
}
#endif // CMAKEPROJECTCONSTANTS_H

View File

@@ -0,0 +1,72 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "cmakeprojectmanager.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
using namespace CMakeProjectManager::Internal;
CMakeManager::CMakeManager()
{
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
}
int CMakeManager::projectContext() const
{
return m_projectContext;
}
int CMakeManager::projectLanguage() const
{
return m_projectLanguage;
}
ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName)
{
// TODO check wheter this project is already opened
return new CMakeProject(this, fileName);
}
QString CMakeManager::mimeType() const
{
return Constants::CMAKEMIMETYPE;
}

View File

@@ -0,0 +1,60 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CMAKEPROJECTMANAGER_H
#define CMAKEPROJECTMANAGER_H
#include <projectexplorer/iprojectmanager.h>
namespace CMakeProjectManager {
namespace Internal {
class CMakeManager : public ProjectExplorer::IProjectManager
{
Q_OBJECT
public:
CMakeManager();
virtual int projectContext() const;
virtual int projectLanguage() const;
//virtual bool canOpenProject(const QString &fileName);
virtual ProjectExplorer::Project *openProject(const QString &fileName);
virtual QString mimeType() const;
//virtual QString fileFilter() const;
private:
int m_projectContext;
int m_projectLanguage;
};
}
}
#endif // CMAKEPROJECTMANAGER_H

View File

@@ -0,0 +1,14 @@
TEMPLATE = lib
TARGET = CMakeProjectManager
include(../../qworkbenchplugin.pri)
include(cmakeprojectmanager_dependencies.pri)
HEADERS = cmakeproject.h \
cmakeprojectplugin.h \
cmakeprojectmanager.h \
cmakeprojectconstants.h \
cmakeprojectnodes.h
SOURCES = cmakeproject.cpp \
cmakeprojectplugin.cpp \
cmakeprojectmanager.cpp \
cmakeprojectnodes.cpp
RESOURCES += cmakeproject.qrc

View File

@@ -0,0 +1,4 @@
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/cppeditor/cppeditor.pri)
include(../../plugins/texteditor/texteditor.pri)

View File

@@ -0,0 +1,89 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "cmakeprojectnodes.h"
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
CMakeProjectNode::CMakeProjectNode(const QString &fileName)
: ProjectExplorer::ProjectNode(fileName)
{
}
bool CMakeProjectNode::hasTargets() const
{
// TODO
return true;
}
QList<ProjectExplorer::ProjectNode::ProjectAction> CMakeProjectNode::supportedActions() const
{
return QList<ProjectAction>();
}
bool CMakeProjectNode::addSubProjects(const QStringList &proFilePaths)
{
Q_UNUSED(proFilePaths);
return false;
}
bool CMakeProjectNode::removeSubProjects(const QStringList &proFilePaths)
{
Q_UNUSED(proFilePaths);
return false;
}
bool CMakeProjectNode::addFiles(const ProjectExplorer::FileType fileType, const QStringList &filePaths, QStringList *notAdded)
{
Q_UNUSED(fileType);
Q_UNUSED(filePaths);
Q_UNUSED(notAdded);
return false;
}
// TODO: Maybe remove fileType, can be detected by project
bool CMakeProjectNode::removeFiles(const ProjectExplorer::FileType fileType, const QStringList &filePaths, QStringList *notRemoved)
{
Q_UNUSED(fileType);
Q_UNUSED(filePaths);
Q_UNUSED(notRemoved);
return false;
}
bool CMakeProjectNode::renameFile(const ProjectExplorer::FileType fileType, const QString &filePath, const QString &newFilePath)
{
Q_UNUSED(fileType);
Q_UNUSED(filePath);
Q_UNUSED(newFilePath);
return false;
}

View File

@@ -0,0 +1,66 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CMAKEPROJECTNODE_H
#define CMAKEPROJECTNODE_H
#include <projectexplorer/projectnodes.h>
namespace CMakeProjectManager {
namespace Internal {
class CMakeProjectNode : public ProjectExplorer::ProjectNode
{
public:
CMakeProjectNode(const QString &fileName);
virtual bool hasTargets() const;
virtual QList<ProjectExplorer::ProjectNode::ProjectAction> supportedActions() const;
virtual bool addSubProjects(const QStringList &proFilePaths);
virtual bool removeSubProjects(const QStringList &proFilePaths);
virtual bool addFiles(const ProjectExplorer::FileType fileType,
const QStringList &filePaths,
QStringList *notAdded = 0);
virtual bool removeFiles(const ProjectExplorer::FileType fileType,
const QStringList &filePaths,
QStringList *notRemoved = 0);
virtual bool renameFile(const ProjectExplorer::FileType fileType,
const QString &filePath,
const QString &newFilePath);
// TODO is protected in base class, and that's correct
using ProjectNode::addFileNodes;
using ProjectNode::addFolderNodes;
};
}
}
#endif // CMAKEPROJECTNODE_H

View File

@@ -0,0 +1,65 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "cmakeprojectplugin.h"
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
#include <QtCore/qplugin.h>
#include <QtCore/QDebug>
#include "cmakeprojectmanager.h"
using namespace CMakeProjectManager::Internal;
CMakeProjectPlugin::CMakeProjectPlugin()
{
}
CMakeProjectPlugin::~CMakeProjectPlugin()
{
}
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
QString errorMessage;
core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), &errorMessage);
addAutoReleasedObject(new CMakeManager());
return true;
}
void CMakeProjectPlugin::extensionsInitialized()
{
}
Q_EXPORT_PLUGIN(CMakeProjectPlugin)

View File

@@ -0,0 +1,63 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception version
** 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CMAKEPROJECTPLUGIN_H
#define CMAKEPROJECTPLUGIN_H
#include <extensionsystem/iplugin.h>
#include <QtCore/QObject>
namespace CMakeProjectManager {
namespace Internal {
class CMakeProjectPlugin
: public ExtensionSystem::IPlugin
{
Q_OBJECT
public:
CMakeProjectPlugin();
~CMakeProjectPlugin();
bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized();
private:
};
} // namespace Internal
} // namespace CMakeProject
#endif // CMAKEPROJECTPLUGIN_H