2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "cmakeproject.h"
|
|
|
|
#include "cmakeprojectconstants.h"
|
|
|
|
#include "cmakeprojectnodes.h"
|
2008-12-09 15:25:01 +01:00
|
|
|
#include "cmakerunconfiguration.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "cmaketarget.h"
|
2008-12-05 16:30:26 +01:00
|
|
|
#include "makestep.h"
|
2009-03-09 18:13:19 +01:00
|
|
|
#include "cmakeopenprojectwizard.h"
|
2009-11-23 12:11:48 +01:00
|
|
|
#include "cmakebuildconfiguration.h"
|
2010-09-24 13:17:43 +02:00
|
|
|
#include "cmakeuicodemodelsupport.h"
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2009-02-16 13:12:12 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2010-09-24 13:17:43 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2010-03-11 17:47:09 +01:00
|
|
|
#include <projectexplorer/buildenvironmentwidget.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2010-09-24 13:17:43 +02:00
|
|
|
#include <projectexplorer/buildmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <cpptools/cppmodelmanagerinterface.h>
|
2009-01-23 16:57:38 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2010-09-24 13:17:43 +02:00
|
|
|
#include <designer/formwindoweditor.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2009-01-23 16:57:38 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2010-09-24 13:17:43 +02:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2009-03-16 17:33:05 +01:00
|
|
|
#include <QtCore/QMap>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtCore/QDebug>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <QtCore/QDir>
|
2009-03-16 17:33:05 +01:00
|
|
|
#include <QtCore/QDateTime>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <QtCore/QProcess>
|
2009-01-12 15:10:33 +01:00
|
|
|
#include <QtGui/QFormLayout>
|
2009-01-23 16:57:38 +01:00
|
|
|
#include <QtGui/QMainWindow>
|
2009-09-24 16:02:02 +02:00
|
|
|
#include <QtGui/QInputDialog>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
using namespace CMakeProjectManager;
|
|
|
|
using namespace CMakeProjectManager::Internal;
|
2009-09-24 16:02:02 +02:00
|
|
|
using namespace ProjectExplorer;
|
2008-12-12 17:22:02 +01:00
|
|
|
|
|
|
|
// QtCreator CMake Generator wishlist:
|
|
|
|
// Which make targets we need to build to get all executables
|
|
|
|
// What is the make we need to call
|
|
|
|
// What is the actual compiler executable
|
|
|
|
// DEFINES
|
|
|
|
|
|
|
|
// Open Questions
|
|
|
|
// Who sets up the environment for cl.exe ? INCLUDEPATH and so on
|
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
/*!
|
|
|
|
\class CMakeProject
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
2009-02-11 12:14:51 +01:00
|
|
|
: m_manager(manager),
|
|
|
|
m_fileName(fileName),
|
|
|
|
m_rootNode(new CMakeProjectNode(m_fileName)),
|
2009-12-03 19:45:09 +01:00
|
|
|
m_insideFileChanged(false),
|
2010-09-24 13:17:43 +02:00
|
|
|
m_targetFactory(new CMakeTargetFactory(this)),
|
|
|
|
m_lastEditor(0)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
m_file = new CMakeFile(this, fileName);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)),
|
|
|
|
SLOT(targetAdded(ProjectExplorer::Target*)));
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CMakeProject::~CMakeProject()
|
|
|
|
{
|
2010-09-24 13:17:43 +02:00
|
|
|
// Remove CodeModel support
|
|
|
|
CppTools::CppModelManagerInterface *modelManager
|
|
|
|
= ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
|
|
|
QMap<QString, CMakeUiCodeModelSupport *>::const_iterator it, end;
|
|
|
|
it = m_uiCodeModelSupport.constBegin();
|
|
|
|
end = m_uiCodeModelSupport.constEnd();
|
|
|
|
for (; it!=end; ++it) {
|
|
|
|
modelManager->removeEditorSupport(it.value());
|
|
|
|
delete it.value();
|
|
|
|
}
|
|
|
|
|
2010-04-22 18:57:43 +02:00
|
|
|
m_codeModelFuture.cancel();
|
2009-01-12 15:10:33 +01:00
|
|
|
delete m_rootNode;
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
void CMakeProject::fileChanged(const QString &fileName)
|
2009-11-26 14:43:27 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
Q_UNUSED(fileName)
|
|
|
|
if (!activeTarget() ||
|
|
|
|
!activeTarget()->activeBuildConfiguration())
|
|
|
|
return;
|
2009-11-26 14:43:27 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
if (m_insideFileChanged)
|
|
|
|
return;
|
|
|
|
m_insideFileChanged = true;
|
|
|
|
changeActiveBuildConfiguration(activeTarget()->activeBuildConfiguration());
|
|
|
|
m_insideFileChanged = false;
|
2009-09-24 16:02:02 +02:00
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
|
2009-05-18 18:07:52 +02:00
|
|
|
{
|
2010-03-02 11:55:56 +01:00
|
|
|
if (!bc || bc->target() != activeTarget())
|
2010-02-08 15:50:06 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
CMakeBuildConfiguration * cmakebc(qobject_cast<CMakeBuildConfiguration *>(bc));
|
|
|
|
if (!cmakebc)
|
|
|
|
return;
|
2009-12-03 19:45:09 +01:00
|
|
|
|
2009-05-18 18:07:52 +02:00
|
|
|
// Pop up a dialog asking the user to rerun cmake
|
|
|
|
QFileInfo sourceFileInfo(m_fileName);
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QString cbpFile = CMakeManager::findCbpFile(QDir(bc->buildDirectory()));
|
2009-05-18 18:07:52 +02:00
|
|
|
QFileInfo cbpFileFi(cbpFile);
|
2009-09-14 16:09:17 +02:00
|
|
|
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
|
|
|
if (!cbpFileFi.exists()) {
|
2009-05-26 15:50:27 +02:00
|
|
|
mode = CMakeOpenProjectWizard::NeedToCreate;
|
2009-09-14 16:09:17 +02:00
|
|
|
} else {
|
|
|
|
foreach(const QString &file, m_watchedFiles) {
|
2009-09-23 15:28:12 +02:00
|
|
|
if (QFileInfo(file).lastModified() > cbpFileFi.lastModified()) {
|
2009-09-14 16:09:17 +02:00
|
|
|
mode = CMakeOpenProjectWizard::NeedToUpdate;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-18 18:07:52 +02:00
|
|
|
|
2009-05-26 15:50:27 +02:00
|
|
|
if (mode != CMakeOpenProjectWizard::Nothing) {
|
2009-05-26 16:10:13 +02:00
|
|
|
CMakeOpenProjectWizard copw(m_manager,
|
|
|
|
sourceFileInfo.absolutePath(),
|
2010-02-08 15:50:06 +01:00
|
|
|
cmakebc->buildDirectory(),
|
2009-05-26 16:10:13 +02:00
|
|
|
mode,
|
2010-02-08 15:50:06 +01:00
|
|
|
cmakebc->environment());
|
2009-05-18 18:07:52 +02:00
|
|
|
copw.exec();
|
2010-02-08 15:50:06 +01:00
|
|
|
cmakebc->setMsvcVersion(copw.msvcVersion());
|
2009-05-18 18:07:52 +02:00
|
|
|
}
|
|
|
|
// reparse
|
|
|
|
parseCMakeLists();
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
void CMakeProject::targetAdded(ProjectExplorer::Target *t)
|
2009-03-26 17:36:58 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!t)
|
2009-03-26 17:36:58 +01:00
|
|
|
return;
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
|
|
|
SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
2009-03-26 17:36:58 +01:00
|
|
|
}
|
|
|
|
|
2009-12-03 19:45:09 +01:00
|
|
|
void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory)
|
2009-04-20 14:35:25 +02:00
|
|
|
{
|
2009-12-03 19:45:09 +01:00
|
|
|
bc->setBuildDirectory(newBuildDirectory);
|
2009-04-20 14:35:25 +02:00
|
|
|
parseCMakeLists();
|
|
|
|
}
|
|
|
|
|
2010-03-25 11:55:49 +01:00
|
|
|
QString CMakeProject::defaultBuildDirectory() const
|
|
|
|
{
|
|
|
|
return projectDirectory() + QLatin1String("/qtcreator-build");
|
|
|
|
}
|
|
|
|
|
2009-07-03 16:46:01 +02:00
|
|
|
bool CMakeProject::parseCMakeLists()
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!activeTarget() ||
|
|
|
|
!activeTarget()->activeBuildConfiguration())
|
|
|
|
return false;
|
|
|
|
|
2009-03-26 17:36:58 +01:00
|
|
|
// Find cbp file
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
|
2009-11-26 14:43:27 +01:00
|
|
|
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
|
2009-03-26 17:36:58 +01:00
|
|
|
|
|
|
|
// setFolderName
|
2010-02-24 15:03:54 +01:00
|
|
|
m_rootNode->setDisplayName(QFileInfo(cbpFile).completeBaseName());
|
2008-12-02 17:56:21 +01:00
|
|
|
CMakeCbpParser cbpparser;
|
2009-03-26 17:36:58 +01:00
|
|
|
// Parsing
|
|
|
|
//qDebug()<<"Parsing file "<<cbpFile;
|
2010-02-02 12:03:50 +01:00
|
|
|
if (!cbpparser.parseCbpFile(cbpFile)) {
|
|
|
|
// TODO report error
|
|
|
|
qDebug()<<"Parsing failed";
|
|
|
|
// activeBC->updateToolChain(QString::null);
|
|
|
|
emit buildTargetsChanged();
|
|
|
|
return false;
|
|
|
|
}
|
2009-02-11 12:14:51 +01:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
// ToolChain
|
|
|
|
// activeBC->updateToolChain(cbpparser.compilerName());
|
|
|
|
m_projectName = cbpparser.projectName();
|
2010-02-24 15:03:54 +01:00
|
|
|
m_rootNode->setDisplayName(cbpparser.projectName());
|
2009-03-03 17:56:03 +01:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
//qDebug()<<"Building Tree";
|
|
|
|
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
|
|
|
|
QSet<QString> projectFiles;
|
|
|
|
if (cbpparser.hasCMakeFiles()) {
|
|
|
|
fileList.append(cbpparser.cmakeFileList());
|
|
|
|
foreach(const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList())
|
|
|
|
projectFiles.insert(node->path());
|
|
|
|
} else {
|
|
|
|
// Manually add the CMakeLists.txt file
|
2010-03-25 13:19:27 +01:00
|
|
|
QString cmakeListTxt = projectDirectory() + "/CMakeLists.txt";
|
2010-09-07 17:48:37 +02:00
|
|
|
bool generated = false;
|
|
|
|
fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated));
|
2010-02-02 12:03:50 +01:00
|
|
|
projectFiles.insert(cmakeListTxt);
|
|
|
|
}
|
2009-03-13 13:55:59 +01:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
QSet<QString> added = projectFiles;
|
|
|
|
added.subtract(m_watchedFiles);
|
|
|
|
foreach(const QString &add, added)
|
|
|
|
m_watcher->addFile(add);
|
|
|
|
foreach(const QString &remove, m_watchedFiles.subtract(projectFiles))
|
|
|
|
m_watcher->removeFile(remove);
|
|
|
|
m_watchedFiles = projectFiles;
|
2009-09-14 16:09:17 +02:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
m_files.clear();
|
|
|
|
foreach (ProjectExplorer::FileNode *fn, fileList)
|
|
|
|
m_files.append(fn->path());
|
|
|
|
m_files.sort();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
buildTree(m_rootNode, fileList);
|
2009-03-26 17:36:58 +01:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
//qDebug()<<"Adding Targets";
|
|
|
|
m_buildTargets = cbpparser.buildTargets();
|
2009-03-16 17:33:05 +01:00
|
|
|
// qDebug()<<"Printing targets";
|
2010-04-23 16:24:55 +02:00
|
|
|
// foreach(CMakeBuildTarget ct, m_buildTargets) {
|
2009-03-16 17:33:05 +01:00
|
|
|
// qDebug()<<ct.title<<" with executable:"<<ct.executable;
|
|
|
|
// qDebug()<<"WD:"<<ct.workingDirectory;
|
|
|
|
// qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
|
|
|
|
// qDebug()<<"";
|
|
|
|
// }
|
2008-12-09 14:13:29 +01:00
|
|
|
|
2010-09-24 13:17:43 +02:00
|
|
|
|
|
|
|
// TOOD this code ain't very pretty ...
|
|
|
|
m_uicCommand.clear();
|
|
|
|
QFile cmakeCache(activeBC->buildDirectory() + "/CMakeCache.txt");
|
|
|
|
cmakeCache.open(QIODevice::ReadOnly);
|
|
|
|
while (!cmakeCache.atEnd()) {
|
|
|
|
QString line = cmakeCache.readLine();
|
|
|
|
if (line.startsWith("QT_UIC_EXECUTABLE")) {
|
|
|
|
if (int pos = line.indexOf('=')) {
|
|
|
|
m_uicCommand = line.mid(pos + 1).trimmed();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmakeCache.close();
|
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
//qDebug()<<"Updating CodeModel";
|
2010-09-24 13:17:43 +02:00
|
|
|
createUiCodeModelSupport();
|
2009-02-11 12:14:51 +01:00
|
|
|
|
2010-02-02 12:03:50 +01:00
|
|
|
QStringList allIncludePaths;
|
|
|
|
QStringList allFrameworkPaths;
|
|
|
|
QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
|
|
|
foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) {
|
|
|
|
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
|
|
|
allFrameworkPaths.append(headerPath.path());
|
|
|
|
else
|
|
|
|
allIncludePaths.append(headerPath.path());
|
|
|
|
}
|
|
|
|
// This explicitly adds -I. to the include paths
|
2010-03-25 13:19:27 +01:00
|
|
|
allIncludePaths.append(projectDirectory());
|
2010-02-02 12:03:50 +01:00
|
|
|
|
|
|
|
allIncludePaths.append(cbpparser.includeFiles());
|
|
|
|
CppTools::CppModelManagerInterface *modelmanager =
|
|
|
|
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
|
|
|
if (modelmanager) {
|
|
|
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
|
|
|
if (pinfo.includePaths != allIncludePaths
|
|
|
|
|| pinfo.sourceFiles != m_files
|
|
|
|
|| pinfo.defines != activeBC->toolChain()->predefinedMacros()
|
|
|
|
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
|
|
|
pinfo.includePaths = allIncludePaths;
|
|
|
|
// TODO we only want C++ files, not all other stuff that might be in the project
|
|
|
|
pinfo.sourceFiles = m_files;
|
|
|
|
pinfo.defines = activeBC->toolChain()->predefinedMacros(); // TODO this is to simplistic
|
|
|
|
pinfo.frameworkPaths = allFrameworkPaths;
|
|
|
|
modelmanager->updateProjectInfo(pinfo);
|
2010-04-22 18:57:43 +02:00
|
|
|
m_codeModelFuture.cancel();
|
|
|
|
m_codeModelFuture = modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2010-02-02 12:03:50 +01:00
|
|
|
}
|
2009-03-16 17:33:05 +01:00
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
emit buildTargetsChanged();
|
2010-09-27 20:34:22 +01:00
|
|
|
emit fileListChanged();
|
2009-07-03 16:46:01 +02:00
|
|
|
return true;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QList<CMakeBuildTarget> CMakeProject::buildTargets() const
|
|
|
|
{
|
|
|
|
return m_buildTargets;
|
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
QStringList CMakeProject::buildTargetTitles() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-01-12 15:10:33 +01:00
|
|
|
QStringList results;
|
2010-02-02 12:01:11 +01:00
|
|
|
foreach (const CMakeBuildTarget &ct, m_buildTargets) {
|
2009-04-06 17:01:26 +02:00
|
|
|
if (ct.executable.isEmpty())
|
|
|
|
continue;
|
2010-02-01 12:43:56 +01:00
|
|
|
if (ct.title.endsWith(QLatin1String("/fast")))
|
2009-04-06 17:01:26 +02:00
|
|
|
continue;
|
2009-01-12 15:10:33 +01:00
|
|
|
results << ct.title;
|
2009-04-06 17:01:26 +02:00
|
|
|
}
|
2009-01-12 15:10:33 +01:00
|
|
|
return results;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
bool CMakeProject::hasBuildTarget(const QString &title) const
|
2010-01-14 15:38:31 +01:00
|
|
|
{
|
2010-02-02 12:01:11 +01:00
|
|
|
foreach (const CMakeBuildTarget &ct, m_buildTargets) {
|
2010-01-14 15:38:31 +01:00
|
|
|
if (ct.executable.isEmpty())
|
|
|
|
continue;
|
2010-02-01 12:43:56 +01:00
|
|
|
if (ct.title.endsWith(QLatin1String("/fast")))
|
2010-01-14 15:38:31 +01:00
|
|
|
continue;
|
|
|
|
if (ct.title == title)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-03-26 17:36:58 +01:00
|
|
|
void CMakeProject::gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-03-26 17:36:58 +01:00
|
|
|
foreach(ProjectExplorer::FolderNode *folder, parent->subFolderNodes())
|
|
|
|
gatherFileNodes(folder, list);
|
|
|
|
foreach(ProjectExplorer::FileNode *file, parent->fileNodes())
|
|
|
|
list.append(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> newList)
|
|
|
|
{
|
|
|
|
// Gather old list
|
|
|
|
QList<ProjectExplorer::FileNode *> oldList;
|
|
|
|
gatherFileNodes(rootNode, oldList);
|
|
|
|
qSort(oldList.begin(), oldList.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
|
|
|
|
qSort(newList.begin(), newList.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
|
|
|
|
|
|
|
|
// generate added and deleted list
|
|
|
|
QList<ProjectExplorer::FileNode *>::const_iterator oldIt = oldList.constBegin();
|
|
|
|
QList<ProjectExplorer::FileNode *>::const_iterator oldEnd = oldList.constEnd();
|
|
|
|
QList<ProjectExplorer::FileNode *>::const_iterator newIt = newList.constBegin();
|
|
|
|
QList<ProjectExplorer::FileNode *>::const_iterator newEnd = newList.constEnd();
|
|
|
|
|
|
|
|
QList<ProjectExplorer::FileNode *> added;
|
|
|
|
QList<ProjectExplorer::FileNode *> deleted;
|
|
|
|
|
|
|
|
|
|
|
|
while(oldIt != oldEnd && newIt != newEnd) {
|
|
|
|
if ( (*oldIt)->path() == (*newIt)->path()) {
|
|
|
|
delete *newIt;
|
|
|
|
++oldIt;
|
|
|
|
++newIt;
|
|
|
|
} else if ((*oldIt)->path() < (*newIt)->path()) {
|
|
|
|
deleted.append(*oldIt);
|
|
|
|
++oldIt;
|
|
|
|
} else {
|
|
|
|
added.append(*newIt);
|
|
|
|
++newIt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (oldIt != oldEnd) {
|
|
|
|
deleted.append(*oldIt);
|
|
|
|
++oldIt;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (newIt != newEnd) {
|
|
|
|
added.append(*newIt);
|
|
|
|
++newIt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// add added nodes
|
|
|
|
foreach (ProjectExplorer::FileNode *fn, added) {
|
|
|
|
// qDebug()<<"added"<<fn->path();
|
2008-12-02 12:01:29 +01:00
|
|
|
// Get relative path to rootNode
|
|
|
|
QString parentDir = QFileInfo(fn->path()).absolutePath();
|
|
|
|
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
|
|
|
|
rootNode->addFileNodes(QList<ProjectExplorer::FileNode *>()<< fn, folder);
|
|
|
|
}
|
2009-03-26 17:36:58 +01:00
|
|
|
|
2010-01-11 10:22:55 +01:00
|
|
|
// remove old file nodes and check whether folder nodes can be removed
|
2009-03-26 17:36:58 +01:00
|
|
|
foreach (ProjectExplorer::FileNode *fn, deleted) {
|
|
|
|
ProjectExplorer::FolderNode *parent = fn->parentFolderNode();
|
|
|
|
// qDebug()<<"removed"<<fn->path();
|
|
|
|
rootNode->removeFileNodes(QList<ProjectExplorer::FileNode *>() << fn, parent);
|
|
|
|
// Check for empty parent
|
|
|
|
while (parent->subFolderNodes().isEmpty() && parent->fileNodes().isEmpty()) {
|
|
|
|
ProjectExplorer::FolderNode *grandparent = parent->parentFolderNode();
|
|
|
|
rootNode->removeFolderNodes(QList<ProjectExplorer::FolderNode *>() << parent, grandparent);
|
|
|
|
parent = grandparent;
|
|
|
|
if (parent == rootNode)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *rootNode, QString directory)
|
|
|
|
{
|
|
|
|
QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
|
2010-02-01 12:43:56 +01:00
|
|
|
QStringList parts = relativePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
|
2008-12-02 12:01:29 +01:00
|
|
|
ProjectExplorer::FolderNode *parent = rootNode;
|
2009-10-27 17:27:37 +01:00
|
|
|
QString path = QFileInfo(rootNode->path()).path();
|
2008-12-09 11:07:24 +01:00
|
|
|
foreach (const QString &part, parts) {
|
2010-02-01 12:43:56 +01:00
|
|
|
path += QLatin1Char('/');
|
|
|
|
path += part;
|
2008-12-02 12:01:29 +01:00
|
|
|
// Find folder in subFolders
|
|
|
|
bool found = false;
|
2008-12-09 11:07:24 +01:00
|
|
|
foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
|
2009-10-27 17:27:37 +01:00
|
|
|
if (folder->path() == path) {
|
2008-12-02 12:01:29 +01:00
|
|
|
// yeah found something :)
|
|
|
|
parent = folder;
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
// No FolderNode yet, so create it
|
2009-10-27 17:27:37 +01:00
|
|
|
ProjectExplorer::FolderNode *tmp = new ProjectExplorer::FolderNode(path);
|
2010-02-24 15:03:54 +01:00
|
|
|
tmp->setDisplayName(part);
|
2008-12-02 12:01:29 +01:00
|
|
|
rootNode->addFolderNodes(QList<ProjectExplorer::FolderNode *>() << tmp, parent);
|
|
|
|
parent = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString CMakeProject::displayName() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-01-15 14:48:28 +00:00
|
|
|
return m_projectName;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-01-22 15:59:44 +01:00
|
|
|
QString CMakeProject::id() const
|
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return QLatin1String(Constants::CMAKEPROJECT_ID);
|
2010-01-22 15:59:44 +01:00
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
Core::IFile *CMakeProject::file() const
|
|
|
|
{
|
|
|
|
return m_file;
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeTargetFactory *CMakeProject::targetFactory() const
|
|
|
|
{
|
|
|
|
return m_targetFactory;
|
|
|
|
}
|
|
|
|
|
2009-04-20 14:35:25 +02:00
|
|
|
CMakeManager *CMakeProject::projectManager() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
return m_manager;
|
|
|
|
}
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeTarget *CMakeProject::activeTarget() const
|
|
|
|
{
|
|
|
|
return static_cast<CMakeTarget *>(Project::activeTarget());
|
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QList<ProjectExplorer::Project *> CMakeProject::dependsOn()
|
|
|
|
{
|
|
|
|
return QList<Project *>();
|
|
|
|
}
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-01-12 15:10:33 +01:00
|
|
|
return new CMakeBuildSettingsWidget(this);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-08-06 15:31:32 +02:00
|
|
|
QList<ProjectExplorer::BuildConfigWidget*> list;
|
2010-03-11 17:47:09 +01:00
|
|
|
list << new BuildEnvironmentWidget;
|
2009-05-26 15:22:11 +02:00
|
|
|
return list;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ProjectExplorer::ProjectNode *CMakeProject::rootProjectNode() const
|
|
|
|
{
|
|
|
|
return m_rootNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QStringList CMakeProject::files(FilesMode fileMode) const
|
|
|
|
{
|
2009-07-13 17:35:17 +02:00
|
|
|
Q_UNUSED(fileMode)
|
2008-12-02 12:01:29 +01:00
|
|
|
return m_files;
|
|
|
|
}
|
|
|
|
|
2010-01-19 16:33:44 +01:00
|
|
|
bool CMakeProject::fromMap(const QVariantMap &map)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-19 16:33:44 +01:00
|
|
|
if (!Project::fromMap(map))
|
|
|
|
return false;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-22 11:34:47 +01:00
|
|
|
bool hasUserFile = activeTarget();
|
2009-01-23 16:57:38 +01:00
|
|
|
if (!hasUserFile) {
|
2010-02-22 11:34:47 +01:00
|
|
|
CMakeTarget *t = targetFactory()->create(this, QLatin1String(DEFAULT_CMAKE_TARGET_ID));
|
|
|
|
Q_ASSERT(t);
|
|
|
|
Q_ASSERT(t->activeBuildConfiguration());
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2009-01-23 16:57:38 +01:00
|
|
|
// Ask the user for where he wants to build it
|
|
|
|
// and the cmake command line
|
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
CMakeOpenProjectWizard copw(m_manager, projectDirectory(), Utils::Environment::systemEnvironment());
|
2009-11-03 14:37:23 +01:00
|
|
|
if (copw.exec() != QDialog::Accepted)
|
|
|
|
return false;
|
2009-01-23 16:57:38 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeBuildConfiguration *bc =
|
|
|
|
static_cast<CMakeBuildConfiguration *>(t->buildConfigurations().at(0));
|
2009-12-07 15:55:00 +01:00
|
|
|
bc->setMsvcVersion(copw.msvcVersion());
|
2009-03-09 18:13:19 +01:00
|
|
|
if (!copw.buildDirectory().isEmpty())
|
2009-12-07 15:55:00 +01:00
|
|
|
bc->setBuildDirectory(copw.buildDirectory());
|
2009-04-07 15:00:16 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
addTarget(t);
|
2009-03-09 18:13:19 +01:00
|
|
|
} else {
|
|
|
|
// We have a user file, but we could still be missing the cbp file
|
|
|
|
// or simply run createXml with the saved settings
|
2009-03-16 17:33:05 +01:00
|
|
|
QFileInfo sourceFileInfo(m_fileName);
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
|
2009-11-25 18:50:20 +01:00
|
|
|
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
2009-05-18 18:07:52 +02:00
|
|
|
QFileInfo cbpFileFi(cbpFile);
|
2009-05-26 15:50:27 +02:00
|
|
|
|
|
|
|
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
2009-05-18 18:07:52 +02:00
|
|
|
if (!cbpFileFi.exists())
|
2009-05-26 15:50:27 +02:00
|
|
|
mode = CMakeOpenProjectWizard::NeedToCreate;
|
2009-05-18 18:07:52 +02:00
|
|
|
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
2009-05-26 15:50:27 +02:00
|
|
|
mode = CMakeOpenProjectWizard::NeedToUpdate;
|
2009-05-18 18:07:52 +02:00
|
|
|
|
2009-05-26 15:50:27 +02:00
|
|
|
if (mode != CMakeOpenProjectWizard::Nothing) {
|
2009-05-26 16:10:13 +02:00
|
|
|
CMakeOpenProjectWizard copw(m_manager,
|
|
|
|
sourceFileInfo.absolutePath(),
|
2009-11-25 18:50:20 +01:00
|
|
|
activeBC->buildDirectory(),
|
2009-05-26 16:10:13 +02:00
|
|
|
mode,
|
2009-11-25 18:50:20 +01:00
|
|
|
activeBC->environment());
|
2009-11-03 14:37:23 +01:00
|
|
|
if (copw.exec() != QDialog::Accepted)
|
|
|
|
return false;
|
2009-12-07 15:55:00 +01:00
|
|
|
activeBC->setMsvcVersion(copw.msvcVersion());
|
2009-03-16 17:33:05 +01:00
|
|
|
}
|
2009-01-23 16:57:38 +01:00
|
|
|
}
|
2009-06-17 11:56:49 +02:00
|
|
|
|
|
|
|
m_watcher = new ProjectExplorer::FileWatcher(this);
|
|
|
|
connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)));
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
if (!parseCMakeLists()) // Gets the directory from the active buildconfiguration
|
2009-09-14 16:09:17 +02:00
|
|
|
return false;
|
2009-06-17 11:56:49 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!hasUserFile && hasBuildTarget("all")) {
|
2010-03-16 14:36:59 +01:00
|
|
|
MakeStep *makeStep = qobject_cast<MakeStep *>(
|
2010-07-16 14:00:41 +02:00
|
|
|
activeTarget()->activeBuildConfiguration()->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(0));
|
2010-02-08 15:50:06 +01:00
|
|
|
Q_ASSERT(makeStep);
|
2009-10-27 14:16:28 +01:00
|
|
|
makeStep->setBuildTarget("all", true);
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
2009-10-27 14:16:28 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
foreach (Target *t, targets()) {
|
|
|
|
connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
|
|
|
this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
|
|
|
connect(t, SIGNAL(environmentChanged()),
|
|
|
|
this, SLOT(changeEnvironment()));
|
|
|
|
}
|
2010-09-24 13:17:43 +02:00
|
|
|
|
|
|
|
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
|
|
|
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
|
|
|
|
|
|
|
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
|
|
|
this, SLOT(editorChanged(Core::IEditor*)));
|
|
|
|
|
|
|
|
connect(ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager(), SIGNAL(buildStateChanged(ProjectExplorer::Project*)),
|
|
|
|
this, SLOT(buildStateChanged(ProjectExplorer::Project*)));
|
|
|
|
|
2009-07-03 16:46:01 +02:00
|
|
|
return true;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
CMakeBuildTarget CMakeProject::buildTargetForTitle(const QString &title)
|
2009-04-06 17:01:26 +02:00
|
|
|
{
|
2010-02-02 12:01:11 +01:00
|
|
|
foreach(const CMakeBuildTarget &ct, m_buildTargets)
|
2009-04-06 17:01:26 +02:00
|
|
|
if (ct.title == title)
|
|
|
|
return ct;
|
2010-02-02 12:01:11 +01:00
|
|
|
return CMakeBuildTarget();
|
2009-04-06 17:01:26 +02:00
|
|
|
}
|
|
|
|
|
2010-09-24 13:17:43 +02:00
|
|
|
QString CMakeProject::uicCommand() const
|
|
|
|
{
|
|
|
|
return m_uicCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString CMakeProject::uiHeaderFile(const QString &uiFile)
|
|
|
|
{
|
|
|
|
QDir srcDirRoot = QDir(projectDirectory());
|
|
|
|
QString relativePath = srcDirRoot.relativeFilePath(uiFile);
|
|
|
|
QDir buildDir = QDir(activeTarget()->activeBuildConfiguration()->buildDirectory());
|
|
|
|
QString uiHeaderFilePath = buildDir.absoluteFilePath(relativePath);
|
|
|
|
|
|
|
|
QFileInfo fi(uiHeaderFilePath);
|
|
|
|
uiHeaderFilePath = fi.absolutePath();
|
|
|
|
uiHeaderFilePath += QLatin1String("/ui_");
|
|
|
|
uiHeaderFilePath += fi.completeBaseName();
|
|
|
|
uiHeaderFilePath += QLatin1String(".h");
|
|
|
|
return QDir::cleanPath(uiHeaderFilePath);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::createUiCodeModelSupport()
|
|
|
|
{
|
|
|
|
// qDebug()<<"creatUiCodeModelSupport()";
|
|
|
|
CppTools::CppModelManagerInterface *modelManager
|
|
|
|
= ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
|
|
|
|
|
|
|
// First move all to
|
|
|
|
QMap<QString, CMakeUiCodeModelSupport *> oldCodeModelSupport;
|
|
|
|
oldCodeModelSupport = m_uiCodeModelSupport;
|
|
|
|
m_uiCodeModelSupport.clear();
|
|
|
|
|
|
|
|
// Find all ui files
|
|
|
|
foreach (const QString &uiFile, m_files) {
|
|
|
|
if (uiFile.endsWith(".ui")) {
|
|
|
|
// UI file, not convert to
|
|
|
|
QString uiHeaderFilePath = uiHeaderFile(uiFile);
|
|
|
|
QMap<QString, CMakeUiCodeModelSupport *>::iterator it
|
|
|
|
= oldCodeModelSupport.find(uiFile);
|
|
|
|
if (it != oldCodeModelSupport.end()) {
|
|
|
|
// qDebug()<<"updated old codemodelsupport";
|
|
|
|
CMakeUiCodeModelSupport *cms = it.value();
|
|
|
|
cms->setFileName(uiHeaderFilePath);
|
|
|
|
m_uiCodeModelSupport.insert(it.key(), cms);
|
|
|
|
oldCodeModelSupport.erase(it);
|
|
|
|
} else {
|
|
|
|
// qDebug()<<"adding new codemodelsupport";
|
|
|
|
CMakeUiCodeModelSupport *cms = new CMakeUiCodeModelSupport(modelManager, this, uiFile, uiHeaderFilePath);
|
|
|
|
m_uiCodeModelSupport.insert(uiFile, cms);
|
|
|
|
modelManager->addEditorSupport(cms);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove old
|
|
|
|
QMap<QString, CMakeUiCodeModelSupport *>::const_iterator it, end;
|
|
|
|
end = oldCodeModelSupport.constEnd();
|
|
|
|
for (it = oldCodeModelSupport.constBegin(); it!=end; ++it) {
|
|
|
|
modelManager->removeEditorSupport(it.value());
|
|
|
|
delete it.value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::updateCodeModelSupportFromEditor(const QString &uiFileName,
|
|
|
|
const QString &contents)
|
|
|
|
{
|
|
|
|
const QMap<QString, CMakeUiCodeModelSupport *>::const_iterator it =
|
|
|
|
m_uiCodeModelSupport.constFind(uiFileName);
|
|
|
|
if (it != m_uiCodeModelSupport.constEnd())
|
|
|
|
it.value()->updateFromEditor(contents);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::editorChanged(Core::IEditor *editor)
|
|
|
|
{
|
|
|
|
// Handle old editor
|
|
|
|
Designer::FormWindowEditor *lastFormEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor);
|
|
|
|
if (lastFormEditor) {
|
|
|
|
disconnect(lastFormEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
|
|
|
|
|
|
|
if (m_dirtyUic) {
|
|
|
|
const QString contents = lastFormEditor->contents();
|
|
|
|
updateCodeModelSupportFromEditor(lastFormEditor->file()->fileName(), contents);
|
|
|
|
m_dirtyUic = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_lastEditor = editor;
|
|
|
|
|
|
|
|
// Handle new editor
|
|
|
|
if (Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(editor))
|
|
|
|
connect(fw, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::editorAboutToClose(Core::IEditor *editor)
|
|
|
|
{
|
|
|
|
if (m_lastEditor == editor) {
|
|
|
|
// Oh no our editor is going to be closed
|
|
|
|
// get the content first
|
|
|
|
Designer::FormWindowEditor *lastEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor);
|
|
|
|
if (lastEditor) {
|
|
|
|
disconnect(lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
|
|
|
if (m_dirtyUic) {
|
|
|
|
const QString contents = lastEditor->contents();
|
|
|
|
updateCodeModelSupportFromEditor(lastEditor->file()->fileName(), contents);
|
|
|
|
m_dirtyUic = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_lastEditor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::uiEditorContentsChanged()
|
|
|
|
{
|
|
|
|
// cast sender, get filename
|
|
|
|
if (m_dirtyUic)
|
|
|
|
return;
|
|
|
|
Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(sender());
|
|
|
|
if (!fw)
|
|
|
|
return;
|
|
|
|
m_dirtyUic = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeProject::buildStateChanged(ProjectExplorer::Project *project)
|
|
|
|
{
|
|
|
|
if (project == this) {
|
|
|
|
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager()->isBuilding(this)) {
|
|
|
|
QMap<QString, CMakeUiCodeModelSupport *>::const_iterator it, end;
|
|
|
|
end = m_uiCodeModelSupport.constEnd();
|
|
|
|
for (it = m_uiCodeModelSupport.constBegin(); it != end; ++it) {
|
|
|
|
it.value()->updateFromBuild();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-17 17:56:40 +02:00
|
|
|
// CMakeFile
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
|
|
|
: Core::IFile(parent), m_project(parent), m_fileName(fileName)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CMakeFile::save(const QString &fileName)
|
|
|
|
{
|
|
|
|
// Once we have an texteditor open for this file, we probably do
|
|
|
|
// need to implement this, don't we.
|
2009-07-13 17:35:17 +02:00
|
|
|
Q_UNUSED(fileName)
|
2008-12-02 12:01:29 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-05-11 14:13:38 +02:00
|
|
|
void CMakeFile::rename(const QString &newName)
|
|
|
|
{
|
|
|
|
Q_ASSERT(false);
|
|
|
|
Q_UNUSED(newName);
|
|
|
|
// Can't happen....
|
|
|
|
}
|
|
|
|
|
2010-03-19 10:28:05 +01:00
|
|
|
Core::IFile::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-03-19 10:28:05 +01:00
|
|
|
Q_UNUSED(state)
|
|
|
|
Q_UNUSED(type)
|
|
|
|
return BehaviorSilent;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeFile::reload(ReloadFlag flag, ChangeType type)
|
|
|
|
{
|
|
|
|
Q_UNUSED(flag)
|
|
|
|
Q_UNUSED(type)
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-01-12 15:10:33 +01:00
|
|
|
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
2009-11-24 15:36:31 +01:00
|
|
|
: m_project(project), m_buildConfiguration(0)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-01-12 15:10:33 +01:00
|
|
|
QFormLayout *fl = new QFormLayout(this);
|
2009-08-06 17:26:38 +02:00
|
|
|
fl->setContentsMargins(20, -1, 0, -1);
|
2009-07-23 17:00:38 +02:00
|
|
|
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
2009-01-12 15:10:33 +01:00
|
|
|
setLayout(fl);
|
2010-09-02 13:57:14 +02:00
|
|
|
|
|
|
|
// TODO add action to Build menu?
|
|
|
|
QPushButton *runCmakeButton = new QPushButton("Run cmake");
|
|
|
|
connect(runCmakeButton, SIGNAL(clicked()),
|
|
|
|
this, SLOT(runCMake()));
|
|
|
|
fl->addRow(tr("Reconfigure project:"), runCmakeButton);
|
|
|
|
|
2009-04-20 14:35:25 +02:00
|
|
|
m_pathLineEdit = new QLineEdit(this);
|
|
|
|
m_pathLineEdit->setReadOnly(true);
|
|
|
|
|
|
|
|
QHBoxLayout *hbox = new QHBoxLayout();
|
|
|
|
hbox->addWidget(m_pathLineEdit);
|
|
|
|
|
|
|
|
m_changeButton = new QPushButton(this);
|
|
|
|
m_changeButton->setText(tr("&Change"));
|
|
|
|
connect(m_changeButton, SIGNAL(clicked()), this, SLOT(openChangeBuildDirectoryDialog()));
|
|
|
|
hbox->addWidget(m_changeButton);
|
|
|
|
|
|
|
|
fl->addRow("Build directory:", hbox);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString CMakeBuildSettingsWidget::displayName() const
|
|
|
|
{
|
|
|
|
return "CMake";
|
|
|
|
}
|
|
|
|
|
2009-11-24 15:36:31 +01:00
|
|
|
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
|
|
|
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
2010-03-25 13:19:27 +01:00
|
|
|
if (m_buildConfiguration->buildDirectory() == m_project->projectDirectory())
|
2009-04-20 14:35:25 +02:00
|
|
|
m_changeButton->setEnabled(false);
|
|
|
|
else
|
2009-05-18 18:07:52 +02:00
|
|
|
m_changeButton->setEnabled(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2008-12-02 17:56:21 +01:00
|
|
|
|
2009-04-20 14:35:25 +02:00
|
|
|
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-05-26 16:10:13 +02:00
|
|
|
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
2010-03-25 13:19:27 +01:00
|
|
|
m_project->projectDirectory(),
|
2009-11-25 18:50:20 +01:00
|
|
|
m_buildConfiguration->buildDirectory(),
|
|
|
|
m_buildConfiguration->environment());
|
2009-04-20 14:35:25 +02:00
|
|
|
if (copw.exec() == QDialog::Accepted) {
|
2009-11-24 15:36:31 +01:00
|
|
|
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
|
2009-11-25 18:50:20 +01:00
|
|
|
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
2009-04-20 14:35:25 +02:00
|
|
|
}
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
2010-09-02 13:57:14 +02:00
|
|
|
void CMakeBuildSettingsWidget::runCMake()
|
|
|
|
{
|
|
|
|
// TODO skip build directory
|
|
|
|
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
|
|
|
m_project->projectDirectory(),
|
|
|
|
m_buildConfiguration->buildDirectory(),
|
|
|
|
CMakeOpenProjectWizard::WantToUpdate,
|
|
|
|
m_buildConfiguration->environment());
|
|
|
|
if (copw.exec() == QDialog::Accepted) {
|
|
|
|
m_project->parseCMakeLists();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-12 15:10:33 +01:00
|
|
|
/////
|
|
|
|
// CMakeCbpParser
|
|
|
|
////
|
|
|
|
|
2008-12-02 17:56:21 +01:00
|
|
|
bool CMakeCbpParser::parseCbpFile(const QString &fileName)
|
|
|
|
{
|
|
|
|
QFile fi(fileName);
|
|
|
|
if (fi.exists() && fi.open(QFile::ReadOnly)) {
|
|
|
|
setDevice(&fi);
|
|
|
|
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (name() == "CodeBlocks_project_file") {
|
|
|
|
parseCodeBlocks_project_file();
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fi.close();
|
|
|
|
m_includeFiles.sort();
|
|
|
|
m_includeFiles.removeDuplicates();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseCodeBlocks_project_file()
|
|
|
|
{
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (name() == "Project") {
|
|
|
|
parseProject();
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseProject()
|
|
|
|
{
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
2009-01-15 14:48:28 +00:00
|
|
|
} else if (name() == "Option") {
|
|
|
|
parseOption();
|
2008-12-02 17:56:21 +01:00
|
|
|
} else if (name() == "Unit") {
|
|
|
|
parseUnit();
|
|
|
|
} else if (name() == "Build") {
|
|
|
|
parseBuild();
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseBuild()
|
|
|
|
{
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (name() == "Target") {
|
2010-02-02 12:01:11 +01:00
|
|
|
parseBuildTarget();
|
2008-12-02 17:56:21 +01:00
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void CMakeCbpParser::parseBuildTarget()
|
2008-12-02 17:56:21 +01:00
|
|
|
{
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTargetType = false;
|
|
|
|
m_buildTarget.clear();
|
2008-12-09 14:13:29 +01:00
|
|
|
|
|
|
|
if (attributes().hasAttribute("title"))
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTarget.title = attributes().value("title").toString();
|
2008-12-09 14:33:09 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
2010-02-02 12:01:11 +01:00
|
|
|
if (m_buildTargetType || m_buildTarget.title == "all" || m_buildTarget.title == "install") {
|
|
|
|
m_buildTargets.append(m_buildTarget);
|
2008-12-08 12:24:31 +01:00
|
|
|
}
|
2008-12-02 17:56:21 +01:00
|
|
|
return;
|
|
|
|
} else if (name() == "Compiler") {
|
|
|
|
parseCompiler();
|
2008-12-08 12:24:31 +01:00
|
|
|
} else if (name() == "Option") {
|
2010-02-02 12:01:11 +01:00
|
|
|
parseBuildTargetOption();
|
2008-12-08 12:24:31 +01:00
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void CMakeCbpParser::parseBuildTargetOption()
|
2008-12-08 12:24:31 +01:00
|
|
|
{
|
2010-04-23 16:24:55 +02:00
|
|
|
if (attributes().hasAttribute("output")) {
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTarget.executable = attributes().value("output").toString();
|
2010-04-23 16:24:55 +02:00
|
|
|
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "1" || attributes().value("type") == "0")) {
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTargetType = true;
|
2010-04-23 16:24:55 +02:00
|
|
|
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "3" || attributes().value("type") == "2")) {
|
|
|
|
m_buildTargetType = true;
|
|
|
|
m_buildTarget.library = true;
|
|
|
|
} else if (attributes().hasAttribute("working_dir")) {
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTarget.workingDirectory = attributes().value("working_dir").toString();
|
2010-04-23 16:24:55 +02:00
|
|
|
}
|
2008-12-09 14:33:09 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-09 14:13:29 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (name() == "MakeCommand") {
|
|
|
|
parseMakeCommand();
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-15 14:48:28 +00:00
|
|
|
QString CMakeCbpParser::projectName() const
|
|
|
|
{
|
|
|
|
return m_projectName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseOption()
|
|
|
|
{
|
|
|
|
if (attributes().hasAttribute("title"))
|
|
|
|
m_projectName = attributes().value("title").toString();
|
2009-01-15 16:06:37 +01:00
|
|
|
|
2009-02-11 12:14:51 +01:00
|
|
|
if (attributes().hasAttribute("compiler"))
|
|
|
|
m_compiler = attributes().value("compiler").toString();
|
|
|
|
|
2009-01-15 16:06:37 +01:00
|
|
|
while (!atEnd()) {
|
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if(isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
2009-01-15 14:48:28 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 14:13:29 +01:00
|
|
|
void CMakeCbpParser::parseMakeCommand()
|
|
|
|
{
|
2008-12-09 14:33:09 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-09 14:13:29 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (name() == "Build") {
|
2010-02-02 12:01:11 +01:00
|
|
|
parseBuildTargetBuild();
|
2008-12-09 14:13:29 +01:00
|
|
|
} else if (name() == "Clean") {
|
2010-02-02 12:01:11 +01:00
|
|
|
parseBuildTargetClean();
|
2008-12-09 14:13:29 +01:00
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void CMakeCbpParser::parseBuildTargetBuild()
|
2008-12-09 14:13:29 +01:00
|
|
|
{
|
|
|
|
if (attributes().hasAttribute("command"))
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTarget.makeCommand = attributes().value("command").toString();
|
2008-12-09 14:33:09 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-09 14:13:29 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void CMakeCbpParser::parseBuildTargetClean()
|
2008-12-09 14:13:29 +01:00
|
|
|
{
|
|
|
|
if (attributes().hasAttribute("command"))
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTarget.makeCleanCommand = attributes().value("command").toString();
|
2008-12-09 14:33:09 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-08 12:24:31 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
2008-12-02 17:56:21 +01:00
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseCompiler()
|
|
|
|
{
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (name() == "Add") {
|
|
|
|
parseAdd();
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseAdd()
|
|
|
|
{
|
|
|
|
m_includeFiles.append(attributes().value("directory").toString());
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
|
|
|
return;
|
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeCbpParser::parseUnit()
|
|
|
|
{
|
|
|
|
//qDebug()<<stream.attributes().value("filename");
|
|
|
|
QString fileName = attributes().value("filename").toString();
|
2009-06-30 17:38:27 +02:00
|
|
|
m_parsingCmakeUnit = false;
|
2008-12-09 11:07:24 +01:00
|
|
|
while (!atEnd()) {
|
2008-12-02 17:56:21 +01:00
|
|
|
readNext();
|
|
|
|
if (isEndElement()) {
|
2010-02-01 12:43:56 +01:00
|
|
|
if (!fileName.endsWith(QLatin1String(".rule")) && !m_processedUnits.contains(fileName)) {
|
2009-06-30 17:38:27 +02:00
|
|
|
// Now check whether we found a virtual element beneath
|
2009-07-27 12:20:16 +02:00
|
|
|
if (m_parsingCmakeUnit) {
|
2009-06-30 17:38:27 +02:00
|
|
|
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
|
2009-07-27 12:20:16 +02:00
|
|
|
} else {
|
2010-09-07 17:48:37 +02:00
|
|
|
bool generated = false;
|
|
|
|
QString onlyFileName = QFileInfo(fileName).fileName();
|
|
|
|
if ( (onlyFileName.startsWith("moc_") && onlyFileName.endsWith(".cxx"))
|
|
|
|
|| (onlyFileName.startsWith("ui_") && onlyFileName.endsWith(".h"))
|
|
|
|
|| (onlyFileName.startsWith("qrc_") && onlyFileName.endsWith(".cxx")))
|
|
|
|
generated = true;
|
|
|
|
|
2010-02-01 12:43:56 +01:00
|
|
|
if (fileName.endsWith(QLatin1String(".qrc")))
|
2010-09-07 17:48:37 +02:00
|
|
|
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ResourceType, generated));
|
2009-07-27 12:20:16 +02:00
|
|
|
else
|
2010-09-07 17:48:37 +02:00
|
|
|
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, generated));
|
2009-07-27 12:20:16 +02:00
|
|
|
}
|
2009-06-30 17:38:27 +02:00
|
|
|
m_processedUnits.insert(fileName);
|
|
|
|
}
|
2008-12-02 17:56:21 +01:00
|
|
|
return;
|
2009-06-30 17:38:27 +02:00
|
|
|
} else if (name() == "Option") {
|
|
|
|
parseUnitOption();
|
2008-12-02 17:56:21 +01:00
|
|
|
} else if (isStartElement()) {
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-30 17:38:27 +02:00
|
|
|
void CMakeCbpParser::parseUnitOption()
|
|
|
|
{
|
|
|
|
if (attributes().hasAttribute("virtualFolder"))
|
|
|
|
m_parsingCmakeUnit = true;
|
|
|
|
|
|
|
|
while (!atEnd()) {
|
|
|
|
readNext();
|
|
|
|
|
|
|
|
if (isEndElement())
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (isStartElement())
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-02 17:56:21 +01:00
|
|
|
void CMakeCbpParser::parseUnknownElement()
|
|
|
|
{
|
2008-12-17 15:51:48 +01:00
|
|
|
Q_ASSERT(isStartElement());
|
2008-12-02 17:56:21 +01:00
|
|
|
|
|
|
|
while (!atEnd()) {
|
|
|
|
readNext();
|
|
|
|
|
|
|
|
if (isEndElement())
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (isStartElement())
|
|
|
|
parseUnknownElement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<ProjectExplorer::FileNode *> CMakeCbpParser::fileList()
|
|
|
|
{
|
|
|
|
return m_fileList;
|
|
|
|
}
|
|
|
|
|
2009-06-30 17:38:27 +02:00
|
|
|
QList<ProjectExplorer::FileNode *> CMakeCbpParser::cmakeFileList()
|
|
|
|
{
|
|
|
|
return m_cmakeFileList;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CMakeCbpParser::hasCMakeFiles()
|
|
|
|
{
|
|
|
|
return !m_cmakeFileList.isEmpty();
|
|
|
|
}
|
|
|
|
|
2008-12-02 17:56:21 +01:00
|
|
|
QStringList CMakeCbpParser::includeFiles()
|
|
|
|
{
|
|
|
|
return m_includeFiles;
|
|
|
|
}
|
2008-12-09 14:13:29 +01:00
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
QList<CMakeBuildTarget> CMakeCbpParser::buildTargets()
|
2008-12-09 14:13:29 +01:00
|
|
|
{
|
2010-02-02 12:01:11 +01:00
|
|
|
return m_buildTargets;
|
2008-12-09 14:13:29 +01:00
|
|
|
}
|
|
|
|
|
2009-02-11 12:14:51 +01:00
|
|
|
QString CMakeCbpParser::compilerName() const
|
|
|
|
{
|
|
|
|
return m_compiler;
|
|
|
|
}
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void CMakeBuildTarget::clear()
|
2008-12-09 14:13:29 +01:00
|
|
|
{
|
2010-02-02 17:09:41 +01:00
|
|
|
executable.clear();
|
|
|
|
makeCommand.clear();
|
|
|
|
makeCleanCommand.clear();
|
|
|
|
workingDirectory.clear();
|
|
|
|
title.clear();
|
2010-04-23 16:24:55 +02:00
|
|
|
library = false;
|
2008-12-09 14:13:29 +01:00
|
|
|
}
|
|
|
|
|