Add BuildConfiguration classes

Each project has it's own BuildConfiguarion * classes, they'll get a
decent type safe interface and the setValue/value stuff will be removed.
This commit is contained in:
dt
2009-11-23 12:11:48 +01:00
parent 4ef64b8dc6
commit ae633c1956
21 changed files with 348 additions and 31 deletions

View File

@@ -0,0 +1,42 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** 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.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "cmakebuildconfiguration.h"
CMakeBuildConfiguration::CMakeBuildConfiguration(const QString &name)
: BuildConfiguration(name)
{
}
CMakeBuildConfiguration::CMakeBuildConfiguration(const QString &name, BuildConfiguration *source)
: BuildConfiguration(name, source)
{
}

View File

@@ -0,0 +1,42 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** 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.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef CMAKEBUILDCONFIGURATION_H
#define CMAKEBUILDCONFIGURATION_H
#include <projectexplorer/buildconfiguration.h>
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
{
public:
CMakeBuildConfiguration(const QString &name);
CMakeBuildConfiguration(const QString &name, BuildConfiguration *source);
};
#endif // CMAKEBUILDCONFIGURATION_H

View File

@@ -34,6 +34,7 @@
#include "makestep.h"
#include "cmakeopenprojectwizard.h"
#include "cmakebuildenvironmentwidget.h"
#include "cmakebuildconfiguration.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
@@ -103,7 +104,7 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
&ok);
if (!ok || buildConfigurationName.isEmpty())
return false;
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
BuildConfiguration *bc = new CMakeBuildConfiguration(buildConfigurationName);
MakeStep *makeStep = new MakeStep(m_project, bc);
bc->insertBuildStep(0, makeStep);
@@ -132,6 +133,14 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
return true;
}
bool CMakeBuildConfigurationFactory::clone(const QString &name, ProjectExplorer::BuildConfiguration *source) const
{
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(name, old);
m_project->addBuildConfiguration(bc);
return true;
}
/*!
\class CMakeProject
*/
@@ -649,7 +658,7 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
if (copw.exec() != QDialog::Accepted)
return false;
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration("all");
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration("all");
addBuildConfiguration(bc);
bc->setValue("msvcVersion", copw.msvcVersion());
if (!copw.buildDirectory().isEmpty())

View File

@@ -74,6 +74,7 @@ public:
QString displayNameForType(const QString &type) const;
bool create(const QString &type) const;
bool clone(const QString &name, ProjectExplorer::BuildConfiguration *source) const;
private:
CMakeProject *m_project;

View File

@@ -10,7 +10,8 @@ HEADERS = cmakeproject.h \
makestep.h \
cmakerunconfiguration.h \
cmakeopenprojectwizard.h \
cmakebuildenvironmentwidget.h
cmakebuildenvironmentwidget.h \
cmakebuildconfiguration.h
SOURCES = cmakeproject.cpp \
cmakeprojectplugin.cpp \
cmakeprojectmanager.cpp \
@@ -18,7 +19,8 @@ SOURCES = cmakeproject.cpp \
makestep.cpp \
cmakerunconfiguration.cpp \
cmakeopenprojectwizard.cpp \
cmakebuildenvironmentwidget.cpp
cmakebuildenvironmentwidget.cpp \
cmakebuildconfiguration.cpp
RESOURCES += cmakeproject.qrc
FORMS +=