From ae633c19567d2c4c5b507f34d92e5fbd127faedf Mon Sep 17 00:00:00 2001 From: dt <qtc-committer@nokia.com> Date: Mon, 23 Nov 2009 12:11:48 +0100 Subject: [PATCH] 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. --- .../cmakebuildconfiguration.cpp | 42 +++++++++++++++ .../cmakebuildconfiguration.h | 42 +++++++++++++++ .../cmakeprojectmanager/cmakeproject.cpp | 13 ++++- .../cmakeprojectmanager/cmakeproject.h | 1 + .../cmakeprojectmanager.pro | 6 ++- .../genericbuildconfiguration.cpp | 46 +++++++++++++++++ .../genericbuildconfiguration.h | 48 +++++++++++++++++ .../genericprojectmanager/genericproject.cpp | 13 ++++- .../genericprojectmanager/genericproject.h | 1 + .../genericprojectmanager.pro | 7 +-- .../projectexplorer/buildconfiguration.h | 19 +++++-- .../buildsettingspropertiespage.cpp | 5 +- src/plugins/projectexplorer/project.cpp | 11 ---- src/plugins/projectexplorer/project.h | 2 +- src/plugins/projectexplorer/session.cpp | 1 - .../qt4buildconfiguration.cpp | 51 +++++++++++++++++++ .../qt4projectmanager/qt4buildconfiguration.h | 50 ++++++++++++++++++ src/plugins/qt4projectmanager/qt4project.cpp | 11 +++- src/plugins/qt4projectmanager/qt4project.h | 1 + .../qt4projectconfigwidget.cpp | 3 +- .../qt4projectmanager/qt4projectmanager.pro | 6 ++- 21 files changed, 348 insertions(+), 31 deletions(-) create mode 100644 src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp create mode 100644 src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h create mode 100644 src/plugins/genericprojectmanager/genericbuildconfiguration.cpp create mode 100644 src/plugins/genericprojectmanager/genericbuildconfiguration.h create mode 100644 src/plugins/qt4projectmanager/qt4buildconfiguration.cpp create mode 100644 src/plugins/qt4projectmanager/qt4buildconfiguration.h diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp new file mode 100644 index 00000000000..3ea888b3bd7 --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -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) +{ + +} diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h new file mode 100644 index 00000000000..be98eecda15 --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h @@ -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 diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 8363b7491b5..34262e966a4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -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()) diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index 126061c61be..38595b525cd 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -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; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro index fe516111f6e..fd898b76754 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro @@ -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 += diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp new file mode 100644 index 00000000000..04385f82121 --- /dev/null +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** 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 "genericbuildconfiguration.h" + +using namespace GenericProjectManager; +using namespace GenericProjectManager::Internal; +using ProjectExplorer::BuildConfiguration; + +GenericBuildConfiguration::GenericBuildConfiguration(const QString &name) + : BuildConfiguration(name) +{ + +} + +GenericBuildConfiguration::GenericBuildConfiguration(const QString &name, GenericBuildConfiguration *source) + : BuildConfiguration(name, source) +{ + +} diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h new file mode 100644 index 00000000000..58f05dc4478 --- /dev/null +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h @@ -0,0 +1,48 @@ +/************************************************************************** +** +** 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 GENERICBUILDCONFIGURATION_H +#define GENERICBUILDCONFIGURATION_H + +#include <projectexplorer/buildconfiguration.h> + +namespace GenericProjectManager { + namespace Internal { + + +class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration +{ +public: + GenericBuildConfiguration(const QString &name); + GenericBuildConfiguration(const QString &name, GenericBuildConfiguration *source); +}; + +} // namespace GenericProjectManager +} // namespace Internal +#endif // GENERICBUILDCONFIGURATION_H diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index 7775582cc4a..25e914a9fb8 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -30,6 +30,7 @@ #include "genericproject.h" #include "genericprojectconstants.h" #include "genericmakestep.h" +#include "genericbuildconfiguration.h" #include <projectexplorer/toolchain.h> #include <projectexplorer/projectexplorerconstants.h> @@ -145,7 +146,7 @@ bool GenericBuildConfigurationFactory::create(const QString &type) const &ok); if (!ok || buildConfigurationName.isEmpty()) return false; - BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName); + GenericBuildConfiguration *bc = new GenericBuildConfiguration(buildConfigurationName); m_project->addBuildConfiguration(bc); // also makes the name unique... GenericMakeStep *makeStep = new GenericMakeStep(m_project, bc); @@ -154,6 +155,14 @@ bool GenericBuildConfigurationFactory::create(const QString &type) const return true; } +bool GenericBuildConfigurationFactory::clone(const QString &name, BuildConfiguration *source) const +{ + // TODO + GenericBuildConfiguration *bc = new GenericBuildConfiguration(name, static_cast<GenericBuildConfiguration *>(source)); + m_project->addBuildConfiguration(bc); + return true; +} + //////////////////////////////////////////////////////////////////////////////////// // GenericProject //////////////////////////////////////////////////////////////////////////////////// @@ -518,7 +527,7 @@ bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead Project::restoreSettingsImpl(reader); if (buildConfigurations().isEmpty()) { - ProjectExplorer::BuildConfiguration *bc = new BuildConfiguration("all"); + GenericBuildConfiguration *bc = new GenericBuildConfiguration("all"); addBuildConfiguration(bc); GenericMakeStep *makeStep = new GenericMakeStep(this, bc); diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h index 784951aa23a..c0a3c042036 100644 --- a/src/plugins/genericprojectmanager/genericproject.h +++ b/src/plugins/genericprojectmanager/genericproject.h @@ -67,6 +67,7 @@ public: QString displayNameForType(const QString &type) const; bool create(const QString &type) const; + bool clone(const QString &name, ProjectExplorer::BuildConfiguration *source) const; private: GenericProject *m_project; diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.pro b/src/plugins/genericprojectmanager/genericprojectmanager.pro index a58404176a9..cc7f6164242 100644 --- a/src/plugins/genericprojectmanager/genericprojectmanager.pro +++ b/src/plugins/genericprojectmanager/genericprojectmanager.pro @@ -10,7 +10,8 @@ HEADERS = genericproject.h \ genericprojectwizard.h \ genericprojectfileseditor.h \ pkgconfigtool.h \ - genericmakestep.h + genericmakestep.h \ + genericbuildconfiguration.h SOURCES = genericproject.cpp \ genericprojectplugin.cpp \ genericprojectmanager.cpp \ @@ -18,8 +19,8 @@ SOURCES = genericproject.cpp \ genericprojectwizard.cpp \ genericprojectfileseditor.cpp \ pkgconfigtool.cpp \ - genericmakestep.cpp + genericmakestep.cpp \ + genericbuildconfiguration.cpp RESOURCES += genericproject.qrc FORMS += genericmakestep.ui - OTHER_FILES += GenericProjectManager.pluginspec diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h index 54ec4a69013..a6acb4c1c30 100644 --- a/src/plugins/projectexplorer/buildconfiguration.h +++ b/src/plugins/projectexplorer/buildconfiguration.h @@ -50,13 +50,14 @@ class PROJECTEXPLORER_EXPORT BuildConfiguration : public QObject Q_OBJECT public: - BuildConfiguration(const QString &name); - BuildConfiguration(const QString &name, BuildConfiguration *source); - ~BuildConfiguration(); + // ctors are protected + virtual ~BuildConfiguration(); + QString name() const; QString displayName() const; void setDisplayName(const QString &name); + // TODO remove those QVariant value(const QString &key) const; void setValue(const QString &key, QVariant value); @@ -73,6 +74,10 @@ public: void removeCleanStep(int position); void moveCleanStepUp(int position); +protected: + BuildConfiguration(const QString &name); + BuildConfiguration(const QString &name, BuildConfiguration *source); + private: void setName(const QString &name); @@ -101,6 +106,14 @@ public: // returns true if build configuration(s) actually have been added virtual bool create(const QString &type) const = 0; + // clones a given BuildConfiguration + virtual bool clone(const QString &name, BuildConfiguration *source) const = 0; + + // TODO All those methods make the internal name (and display name) unique, + // but in different ways + + //virtual bool restore(const QString &name); + // to come: // restore // clone diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index fac04077b61..bf2fcf13fd0 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -356,7 +356,10 @@ void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration) newBuildConfiguration = Project::makeUnique(newBuildConfiguration, buildConfigurationNames); - m_project->copyBuildConfiguration(sourceConfiguration, newBuildConfiguration); + BuildConfiguration *sourceBc = m_project->buildConfiguration(sourceConfiguration); + + m_project->buildConfigurationFactory()->clone(newBuildConfiguration, sourceBc); + m_project->setDisplayNameFor(m_project->buildConfiguration(newBuildConfiguration), newDisplayName); m_buildConfiguration = newBuildConfiguration; diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index e8c0b31c844..37bd4d3fa0c 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -109,17 +109,6 @@ void Project::removeBuildConfiguration(BuildConfiguration *configuration) delete configuration; } -void Project::copyBuildConfiguration(const QString &source, const QString &dest) -{ - BuildConfiguration *sourceConfiguration = buildConfiguration(source); - if (!sourceConfiguration) - return; - - m_buildConfigurationValues.push_back(new BuildConfiguration(dest, sourceConfiguration)); - - emit addedBuildConfiguration(this, dest); -} - QList<BuildConfiguration *> Project::buildConfigurations() const { return m_buildConfigurationValues; diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 6ad90351f4f..2e7e43a6972 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -86,7 +86,7 @@ public: // Build configuration void addBuildConfiguration(BuildConfiguration *configuration); void removeBuildConfiguration(BuildConfiguration *configuration); - void copyBuildConfiguration(const QString &source, const QString &dest); + BuildConfiguration *buildConfiguration(const QString & name) const; QList<BuildConfiguration *> buildConfigurations() const; // remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 8dcb7c238d2..8fb3b897d51 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -853,7 +853,6 @@ Project *SessionManager::projectForFile(const QString &fileName) const foreach (Project *p, projectList) if (p != currentProject && projectContainsFile(p, fileName)) return p; - return 0; } diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp new file mode 100644 index 00000000000..cc62dbe4484 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -0,0 +1,51 @@ +/************************************************************************** +** +** 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 "qt4buildconfiguration.h" + +using namespace Qt4ProjectManager; +using namespace Qt4ProjectManager::Internal; +using ProjectExplorer::BuildConfiguration; + +Qt4BuildConfiguration::Qt4BuildConfiguration(const QString &name) + : BuildConfiguration(name) +{ + +} + +Qt4BuildConfiguration::Qt4BuildConfiguration(const QString &name, Qt4BuildConfiguration *source) + : BuildConfiguration(name, source) +{ + +} + +Qt4BuildConfiguration::~Qt4BuildConfiguration() +{ + +} diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.h b/src/plugins/qt4projectmanager/qt4buildconfiguration.h new file mode 100644 index 00000000000..d359a7810ae --- /dev/null +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.h @@ -0,0 +1,50 @@ +/************************************************************************** +** +** 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 QT4BUILDCONFIGURATION_H +#define QT4BUILDCONFIGURATION_H + +#include <projectexplorer/buildconfiguration.h> + +namespace Qt4ProjectManager { +namespace Internal { + +class Qt4BuildConfiguration : public ProjectExplorer::BuildConfiguration +{ +public: + Qt4BuildConfiguration(const QString &name); + // copy ctor + Qt4BuildConfiguration(const QString &name, Qt4BuildConfiguration *source); + ~Qt4BuildConfiguration(); +}; + +} // namespace Qt4ProjectManager +} // namespace Internal + +#endif // QT4BUILDCONFIGURATION_H diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 4f23d4bbbab..7c127bba263 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -41,6 +41,7 @@ #include "qt4projectmanagerconstants.h" #include "projectloadwizard.h" #include "qtversionmanager.h" +#include "qt4buildconfiguration.h" #ifdef QTCREATOR_WITH_S60 #include "qt-s60/gccetoolchain.h" @@ -295,6 +296,14 @@ bool Qt4BuildConfigurationFactory::create(const QString &type) const return true; } +bool Qt4BuildConfigurationFactory::clone(const QString &name, BuildConfiguration *source) const +{ + Qt4BuildConfiguration *oldbc = static_cast<Qt4BuildConfiguration *>(source); + Qt4BuildConfiguration *newbc = new Qt4BuildConfiguration(name, oldbc); + m_project->addBuildConfiguration(newbc); + return true; +} + /*! \class Qt4Project @@ -443,7 +452,7 @@ void Qt4Project::addQt4BuildConfiguration(QString buildConfigurationName, QtVers bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild; // Add the buildconfiguration - ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName); + Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(buildConfigurationName); addBuildConfiguration(bc); QMakeStep *qmakeStep = new QMakeStep(this, bc); diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index d5529125b76..84ae43db613 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -131,6 +131,7 @@ public: QString displayNameForType(const QString &type) const; bool create(const QString &type) const; + bool clone(const QString &name, ProjectExplorer::BuildConfiguration *source) const; void update(); diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index a309cc7e628..fdafc76416f 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -165,8 +165,7 @@ void Qt4ProjectConfigWidget::init(const QString &buildConfiguration) void Qt4ProjectConfigWidget::changeConfigName(const QString &newName) { - m_pro->setDisplayNameFor( - m_pro->buildConfiguration(m_buildConfiguration), newName); + m_pro->setDisplayNameFor(m_pro->buildConfiguration(m_buildConfiguration), newName); } void Qt4ProjectConfigWidget::setupQtVersionsComboBox() diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index b30e3fe8c05..556deeb6a14 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -39,7 +39,8 @@ HEADERS += qt4projectmanagerplugin.h \ qtuicodemodelsupport.h \ externaleditors.h \ gettingstartedwelcomepagewidget.h \ - gettingstartedwelcomepage.h + gettingstartedwelcomepage.h \ + qt4buildconfiguration.h SOURCES += qt4projectmanagerplugin.cpp \ qt4projectmanager.cpp \ qt4project.cpp \ @@ -74,7 +75,8 @@ SOURCES += qt4projectmanagerplugin.cpp \ qtuicodemodelsupport.cpp \ externaleditors.cpp \ gettingstartedwelcomepagewidget.cpp \ - gettingstartedwelcomepage.cpp + gettingstartedwelcomepage.cpp \ + qt4buildconfiguration.cpp FORMS += makestep.ui \ qmakestep.ui \ qt4projectconfigwidget.ui \ -- GitLab